| Constructor and Description |
|---|
LocalDBSession()
Creates a local DB session to the default instance
|
LocalDBSession(Credentials credentials)
Creates a local DB session with credentials
|
LocalDBSession(String instanceId)
Creates a local DB session bound to a specific instance
|
LocalDBSession(String instanceId,
Credentials credentials)
Creates a local DB session bound to a specific instance with given credentials
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAndSwitchInstance(String instanceId,
String path)
Adds a new instance with the given path to the DB.
|
void |
addInstance(String instanceId,
String path)
Adds a new instance with the given path to the DB.
|
void |
closeSession()
Closes the session and removes used resources
|
EntityBag |
createOrGetBag(String bagName)
Creates a bag or gets an existing one if it already existed for the connected instance.
|
EntityBag |
createOrGetBag(String instanceId,
String bagName)
Creates a bag or gets an existing one if it already existed for the specified instance.
|
Instance |
deleteInstance(String instanceId)
This deletes an instance all its related bags and entities permanently.
|
EntityBag |
getBag(String bagName)
Retrieves an existing bag if this exists on the connected instance, in case the bag does not
exist the method will return null
|
EntityBag |
getBag(String instanceId,
String bagName)
Retrieves an existing bag if this exists on the specified instance, in case the bag does not
exist the method will return null
|
List<EntityBag> |
getBags()
Gets a list of all existing bags in the default database instance
|
List<EntityBag> |
getBags(String instanceId)
Gets a list of all existing bags in the specified database instance
|
EntityManager |
getEntityManager()
Gets the entity manager that can be used for entity persistence
|
DBInstance |
getInstance(String instanceId)
Gets the metadata of a specific instance
|
String |
getInstanceId()
Gets the instance id of the currently connected instance
|
List<Instance> |
getInstances()
Gets a list of all available instances
|
UserAdministration |
getUserAdministration() |
void |
removeBag(String bagName)
Removes a bag from the current instance if it exists and is not in use
|
void |
removeBag(String instanceId,
String bagName)
Removes a bag from the specified instance if it exists and is not in use
|
void |
switchInstance(String instanceId)
Switches the current session to a new instance
|
public LocalDBSession()
throws JasDBStorageException
JasDBStorageException - If unable to request the sessionpublic LocalDBSession(Credentials credentials) throws JasDBStorageException
credentials - The credentialsJasDBStorageException - If unable to request the sessionpublic LocalDBSession(String instanceId) throws JasDBStorageException
instanceId - The instanceJasDBStorageException - If unable to request the sessionpublic LocalDBSession(String instanceId, Credentials credentials) throws JasDBStorageException
instanceId - The instancecredentials - The credentialsJasDBStorageException - If unable to request the sessionpublic UserAdministration getUserAdministration() throws JasDBStorageException
getUserAdministration in interface DBSessionJasDBStorageExceptionpublic EntityManager getEntityManager()
DBSessiongetEntityManager in interface DBSessionpublic List<Instance> getInstances() throws JasDBStorageException
DBSessiongetInstances in interface DBSessionJasDBStorageException - If unable to load the list of available instancespublic void addInstance(String instanceId, String path) throws JasDBStorageException
DBSessionaddInstance in interface DBSessioninstanceId - The id of the instance, should not exist alreadypath - The path where to store the instance and bag dataJasDBStorageException - If unable to to add an instancepublic void addAndSwitchInstance(String instanceId, String path) throws JasDBStorageException
DBSessionaddAndSwitchInstance in interface DBSessioninstanceId - The id of the instance, should not exist alreadypath - The path where to store the instance and bag dataJasDBStorageException - If unable to to add an instancepublic void switchInstance(String instanceId) throws JasDBStorageException
DBSessionswitchInstance in interface DBSessioninstanceId - The id of the instanceJasDBStorageException - If unable to switch to instancepublic Instance deleteInstance(String instanceId) throws JasDBStorageException
DBSessiondeleteInstance in interface DBSessioninstanceId - The instanceId of the instance and related resources (bags, entities) to deleteJasDBStorageException - If unable to delete the instance and related resources (bags, entities)public String getInstanceId() throws JasDBStorageException
DBSessiongetInstanceId in interface DBSessionJasDBStorageException - If unable to get the id of the current connected instancepublic EntityBag createOrGetBag(String bagName) throws JasDBStorageException
DBSessioncreateOrGetBag in interface DBSessionbagName - The name of the bagJasDBStorageException - If unable to create or get the bagpublic EntityBag createOrGetBag(String instanceId, String bagName) throws JasDBStorageException
DBSessioncreateOrGetBag in interface DBSessioninstanceId - The id of the instancebagName - The name of the bagJasDBStorageException - If unable to create or get the bagpublic EntityBag getBag(String bagName) throws JasDBStorageException
DBSessiongetBag in interface DBSessionbagName - The name of the bagJasDBStorageException - If unable to retrieve the bagpublic EntityBag getBag(String instanceId, String bagName) throws JasDBStorageException
DBSessiongetBag in interface DBSessioninstanceId - The id of the instancebagName - The name of the bagJasDBStorageException - If unable to retrieve the bagpublic DBInstance getInstance(String instanceId) throws JasDBStorageException
DBSessiongetInstance in interface DBSessionJasDBStorageException - If unable to load the metadata of the instancepublic List<EntityBag> getBags() throws JasDBStorageException
DBSessiongetBags in interface DBSessionJasDBStorageException - If unable to retrieve the list of entity bagspublic List<EntityBag> getBags(String instanceId) throws JasDBStorageException
DBSessiongetBags in interface DBSessioninstanceId - The id of the instanceJasDBStorageException - If unable to retrieve the list of entity bagspublic void removeBag(String bagName) throws JasDBStorageException
DBSessionremoveBag in interface DBSessionbagName - The name of the bagJasDBStorageException - If unable to remove the bag when it does not exist or the bag is in usepublic void removeBag(String instanceId, String bagName) throws JasDBStorageException
DBSessionremoveBag in interface DBSessioninstanceId - The id of the instancebagName - The name of the bagJasDBStorageException - If unable to remove the bag when it does not exist or the bag is in usepublic void closeSession()
throws JasDBStorageException
DBSessioncloseSession in interface DBSessionJasDBStorageException - if unable to cleanly close the sessionCopyright © 2015. All rights reserved.