public class SQLMetadataStorageActionHandler<EntryType,StatusType,LogType,LockType> extends Object implements MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
Constructor and Description |
---|
SQLMetadataStorageActionHandler(SQLMetadataConnector connector,
com.fasterxml.jackson.databind.ObjectMapper jsonMapper,
MetadataStorageActionHandlerTypes<EntryType,StatusType,LogType,LockType> types,
String entryTypeName,
String entryTable,
String logTable,
String lockTable) |
Modifier and Type | Method and Description |
---|---|
boolean |
addLock(String entryId,
LockType lock)
Add a lock to the given entry
|
boolean |
addLog(String entryId,
LogType log)
Add a log to the entry with the given id.
|
List<com.metamx.common.Pair<EntryType,StatusType>> |
getActiveEntriesWithStatus()
Return all active entries with their respective status
|
com.google.common.base.Optional<EntryType> |
getEntry(String entryId)
Retrieves the entry with the given id.
|
List<StatusType> |
getInactiveStatusesSince(org.joda.time.DateTime timestamp)
Return all statuses for inactive entries created on or later than the given timestamp
|
Map<Long,LockType> |
getLocks(String entryId)
Returns the locks for the given entry
|
List<LogType> |
getLogs(String entryId)
Returns the logs for the entry with the given id.
|
com.google.common.base.Optional<StatusType> |
getStatus(String entryId)
Retrieve the status for the entry with the given id.
|
void |
insert(String id,
org.joda.time.DateTime timestamp,
String dataSource,
EntryType entry,
boolean active,
StatusType status)
Creates a new entry.
|
boolean |
removeLock(long lockId)
Remove the lock with the given lock id.
|
boolean |
setStatus(String entryId,
boolean active,
StatusType status)
Sets or updates the status for any active entry with the given id.
|
protected boolean |
shouldRetryException(Throwable e) |
public SQLMetadataStorageActionHandler(SQLMetadataConnector connector, com.fasterxml.jackson.databind.ObjectMapper jsonMapper, MetadataStorageActionHandlerTypes<EntryType,StatusType,LogType,LockType> types, String entryTypeName, String entryTable, String logTable, String lockTable)
public void insert(String id, org.joda.time.DateTime timestamp, String dataSource, EntryType entry, boolean active, StatusType status) throws EntryExistsException
MetadataStorageActionHandler
insert
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
id
- entry idtimestamp
- timestamp this entry was createddataSource
- datasource associated with this entryentry
- object representing this entryactive
- active or inactive flagstatus
- status object associated wit this object, can be nullEntryExistsException
public boolean setStatus(String entryId, boolean active, StatusType status)
MetadataStorageActionHandler
setStatus
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idactive
- activestatus
- statuspublic com.google.common.base.Optional<EntryType> getEntry(String entryId)
MetadataStorageActionHandler
getEntry
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idpublic com.google.common.base.Optional<StatusType> getStatus(String entryId)
MetadataStorageActionHandler
getStatus
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idpublic List<com.metamx.common.Pair<EntryType,StatusType>> getActiveEntriesWithStatus()
MetadataStorageActionHandler
getActiveEntriesWithStatus
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
public List<StatusType> getInactiveStatusesSince(org.joda.time.DateTime timestamp)
MetadataStorageActionHandler
getInactiveStatusesSince
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
timestamp
- timestamppublic boolean addLock(String entryId, LockType lock)
MetadataStorageActionHandler
addLock
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idlock
- lock to addpublic boolean removeLock(long lockId)
MetadataStorageActionHandler
removeLock
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
lockId
- lock idpublic boolean addLog(String entryId, LogType log)
MetadataStorageActionHandler
addLog
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idlog
- log to addpublic List<LogType> getLogs(String entryId)
MetadataStorageActionHandler
getLogs
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idpublic Map<Long,LockType> getLocks(String entryId)
MetadataStorageActionHandler
getLocks
in interface MetadataStorageActionHandler<EntryType,StatusType,LogType,LockType>
entryId
- entry idprotected boolean shouldRetryException(Throwable e)
Copyright © 2011–2015. All rights reserved.