@Component @Singleton public class JasDBMetadataStore extends Object implements MetadataStore
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_INSTANCE |
Constructor and Description |
---|
JasDBMetadataStore() |
Modifier and Type | Method and Description |
---|---|
void |
addBag(Bag bag)
Adds a new bag to the storage
|
void |
addBagIndex(String instanceId,
String bagName,
IndexDefinition indexDefinition)
Adds an index to an existing bag in a certain instance
|
void |
addInstance(Instance instance)
Adds an instance using the specified instance metadata
|
long |
addMetadataEntity(SimpleEntity entity)
Generic operation to add a metadata entity to the metadata store
|
void |
closeStore()
Close the store
|
boolean |
containsBag(String instanceId,
String bag)
Checks if a bag in an instance exists in the metadata store
|
boolean |
containsIndex(String instanceId,
String bagName,
IndexDefinition indexDefinition)
Checks if the index is already present in the metadata store
|
boolean |
containsInstance(String instanceId)
Checks if the instance alredy exists
|
void |
deleteMetadataEntity(long recordPointer)
Deletes a generic metadata entity
|
Bag |
getBag(String instanceId,
String name)
Gets the a specific bag in an instance
|
List<Bag> |
getBags(String instanceId)
Gets the bags for the given instanceId
|
Instance |
getInstance(String instanceId)
Gets a specific instance identified by the instanceId
|
List<Instance> |
getInstances()
Gets the registered instances
|
<T extends MetadataProvider> |
getMetadataProvider(String type)
Gets a metadata provider that can handle non standard metadata stored in the metadata store
|
boolean |
isLastShutdownClean()
Checks whether the last shutdown was done cleanly
|
void |
removeBag(String instanceId,
String name)
Remove a bag from the metadata store
|
void |
removeBagIndex(String instanceId,
String bagName,
IndexDefinition indexDefinition) |
void |
removeInstance(String instanceId)
Removes an instance from the metadata list
|
void |
updateInstance(Instance instance)
Updates the instance metadata
|
long |
updateMetadataEntity(SimpleEntity entity,
long previousRecord)
Generic operation to update a metadata entity in the metadata store
|
public static final String DEFAULT_INSTANCE
public JasDBMetadataStore() throws JasDBStorageException
JasDBStorageException
public boolean isLastShutdownClean() throws JasDBStorageException
MetadataStore
isLastShutdownClean
in interface MetadataStore
JasDBStorageException
- If unable to determine if last shutdown is clean@PreDestroy public void closeStore() throws JasDBStorageException
MetadataStore
closeStore
in interface MetadataStore
JasDBStorageException
- If unable to close the store cleanlypublic long addMetadataEntity(SimpleEntity entity) throws JasDBStorageException
MetadataStore
addMetadataEntity
in interface MetadataStore
entity
- The metadata entity to addJasDBStorageException
- If unable to add the metadata entitypublic long updateMetadataEntity(SimpleEntity entity, long previousRecord) throws JasDBStorageException
MetadataStore
updateMetadataEntity
in interface MetadataStore
entity
- The updated entitypreviousRecord
- The previous record pointerJasDBStorageException
- If unable to update the entitypublic void deleteMetadataEntity(long recordPointer) throws JasDBStorageException
MetadataStore
deleteMetadataEntity
in interface MetadataStore
recordPointer
- The record pointerJasDBStorageException
- If unable to delete the entitypublic List<Bag> getBags(String instanceId) throws JasDBStorageException
MetadataStore
getBags
in interface MetadataStore
instanceId
- The instanceIdJasDBStorageException
- If unable to load the bagspublic Bag getBag(String instanceId, String name) throws JasDBStorageException
MetadataStore
getBag
in interface MetadataStore
instanceId
- The instanceIdname
- The name of the bagJasDBStorageException
- If unable to load the bagpublic boolean containsBag(String instanceId, String bag) throws JasDBStorageException
MetadataStore
containsBag
in interface MetadataStore
instanceId
- The instance in which the bag should existbag
- The bag that should existJasDBStorageException
- If unable to check if the bag exists in the instancepublic void addBag(Bag bag) throws JasDBStorageException
MetadataStore
addBag
in interface MetadataStore
bag
- The bag to addJasDBStorageException
- If unable to add the bagpublic void removeBag(String instanceId, String name) throws JasDBStorageException
MetadataStore
removeBag
in interface MetadataStore
instanceId
- The name of the instance holding the bagname
- The name of the bagJasDBStorageException
- If unable to remove the bagpublic void addBagIndex(String instanceId, String bagName, IndexDefinition indexDefinition) throws JasDBStorageException
MetadataStore
addBagIndex
in interface MetadataStore
instanceId
- The instance that contains the bagbagName
- The bag to add the index toindexDefinition
- The index definitionJasDBStorageException
- If unable to add the indexpublic void removeBagIndex(String instanceId, String bagName, IndexDefinition indexDefinition) throws JasDBStorageException
removeBagIndex
in interface MetadataStore
instanceId
- The instance that contains the bagbagName
- The bag to remove the index fromindexDefinition
- The index definitionJasDBStorageException
- If unable to remove the indexpublic boolean containsIndex(String instanceId, String bagName, IndexDefinition indexDefinition) throws JasDBStorageException
MetadataStore
containsIndex
in interface MetadataStore
instanceId
- The instance that contains the bagbagName
- The bag to check the index presence onindexDefinition
- The index definitionJasDBStorageException
- If unable to check if the index is presentpublic List<Instance> getInstances() throws JasDBStorageException
MetadataStore
getInstances
in interface MetadataStore
JasDBStorageException
- If unable to get the list of instancespublic Instance getInstance(String instanceId) throws JasDBStorageException
MetadataStore
getInstance
in interface MetadataStore
instanceId
- The instanceIdJasDBStorageException
- If unable to get the instancepublic boolean containsInstance(String instanceId) throws JasDBStorageException
MetadataStore
containsInstance
in interface MetadataStore
instanceId
- The instanceIdJasDBStorageException
- If unable to check if the instance existspublic void addInstance(Instance instance) throws JasDBStorageException
MetadataStore
addInstance
in interface MetadataStore
instance
- The instanceJasDBStorageException
- If unable to add the instancepublic void removeInstance(String instanceId) throws JasDBStorageException
MetadataStore
removeInstance
in interface MetadataStore
instanceId
- The instance to removeJasDBStorageException
- If unable to remove the instancepublic void updateInstance(Instance instance) throws JasDBStorageException
MetadataStore
updateInstance
in interface MetadataStore
instance
- The instanceJasDBStorageException
- If unable to update the instancepublic <T extends MetadataProvider> T getMetadataProvider(String type)
MetadataStore
getMetadataProvider
in interface MetadataStore
T
- The subtype of the metadata providertype
- The type of metadata provider requestedCopyright © 2015. All rights reserved.