public interface DBConnection
Modifier and Type | Method and Description |
---|---|
void |
abortConnection()
Abort the connection to the database and roll back the transaction.
|
void |
closeConnection()
Close the connection to the database and commit the transaction.
|
void |
commitConnection()
Commit the transaction running over the connection.
|
java.util.ArrayList<XMLDBModel> |
executeAttributeSearchTask(AttributeSearchTask task)
Search models that contain the given attributes in the database.
|
XMLDBAttribute |
executeCreateAttributeTask(CreateAttributeTask task)
Execute the necessary commands to create a new attribute in the database
according to the attribute specification given in the task parameter.
|
java.lang.String |
executeCreateModelTask(CreateModelTask task)
Execute the necessary commands to create a new model in the database according
to the model specification given in the task parameter.
|
void |
executeDeleteAttributeTask(DeleteAttributeTask task)
Execute the necessary commands to delete an attribute from the database
according to the attribute specification given in the task parameter.
|
java.util.ArrayList<XMLDBModel> |
executeFetchHierarchyTask(FetchHierarchyTask task)
Fetch the parent model hierarchies for the given models.
|
java.util.List<XMLDBAttribute> |
executeGetAttributesTask(GetAttributesTask task)
Get the attributes defined from the database.
|
XMLDBModel |
executeGetCompleteModelTask(GetModelTask task)
Execute the necessary commands to retrieve a model from the database
and resolve all the references in it if any.
|
java.util.List<XMLDBModel> |
executeGetFirstLevelParents(GetFirstLevelParentsTask task)
Execute the given task to fetch the first level parents for the given model.
|
java.util.List<XMLDBModel> |
executeGetListOfAllModels()
Retrieve and return the list of all models in the database.
|
XMLDBModel |
executeGetModelTask(GetModelTask task)
Execute the necessary commands to retrieve a model from the database.
|
java.lang.String |
executeGetReferenceStringTask(GetReferenceStringTask task)
Get the model reference string for the given model name.
|
java.util.ArrayList<XMLDBModel> |
executeGraphSearchTask(GraphSearchTask task)
Search models that contain given graphical pattern in the database.
|
java.util.ArrayList<XMLDBModel> |
executeModelNameSearchTask(ModelNameSearchTask modelNameSearchTask)
Execute the model name search task.
|
void |
executeRemoveModelsTask(RemoveModelsTask task)
Execute remove models task to delete a list of models from the database.
|
void |
executeRenameModelTask(RenameModelTask task)
Execute rename model task which will change the name of the model in
the database and reflect the change in the reference file.
|
java.lang.String |
executeSaveModelTask(SaveModelTask task)
Execute the necessary commands to save/update a model in the database
according to the model specification given in the task parameter.
|
void |
executeUpdateAttributeTask(UpdateAttributeTask task)
Execute the necessary commands to update an attribute in the database
according to the attribute specification given in the task parameter.
|
void |
executeUpdateModelInCache(XMLDBModel xmlDBModel)
Execute the necessary commands to update the cache with the given model.
|
void |
executeUpdateParentsToNewVersion(UpdateParentsToNewVersionTask task)
Execute the given task to update the referenced version for the given
parents from the old model to the new model.
|
void abortConnection() throws DBConnectionException
DBConnectionException
void closeConnection() throws DBConnectionException
DBConnectionException
void commitConnection() throws DBConnectionException
DBConnectionException
- - When there is a problem while committing
transaction in the database.XMLDBAttribute executeCreateAttributeTask(CreateAttributeTask task) throws DBExecutionException
task
- The task to be completed. In this case, CreateAttributeTask.
This will tell the DB layer to create a new attribute in the database.DBExecutionException
- Thrown if the operation fails.java.lang.String executeCreateModelTask(CreateModelTask task) throws DBExecutionException, ModelAlreadyExistException, CircularDependencyException
task
- The task to be completed. In this case, CreateModelTask.
This will tell the DB layer to create a new model in the database.DBExecutionException
ModelAlreadyExistException
- Thrown if the model being created
already exists.CircularDependencyException
- If thrown while creating reference
string.void executeDeleteAttributeTask(DeleteAttributeTask task) throws DBExecutionException
task
- The task to be completed. In this case, DeleteAttributeTask.
This will tell the DB layer to delete an attribute from the database.DBExecutionException
- Thrown if the operation fails.java.util.ArrayList<XMLDBModel> executeFetchHierarchyTask(FetchHierarchyTask task) throws DBExecutionException
task
- - Task that contains the list of models.DBExecutionException
- - When the database encounters
error while searching.java.util.List<XMLDBModel> executeGetListOfAllModels() throws DBExecutionException
DBExecutionException
- thrown if there is an error while reading
the model list from the database.java.util.ArrayList<XMLDBModel> executeAttributeSearchTask(AttributeSearchTask task) throws DBExecutionException
task
- Task that contains a list of attributes that
need to be searched in the database.DBExecutionException
- - When the database encounters error while searching.java.util.List<XMLDBAttribute> executeGetAttributesTask(GetAttributesTask task) throws DBExecutionException
task
- The criteria to get the attribute.DBExecutionException
- Thrown if the operation fails.java.util.List<XMLDBModel> executeGetFirstLevelParents(GetFirstLevelParentsTask task) throws DBExecutionException
task
- Task that contains the model for which the first level
parents list needs to be fetched.DBExecutionException
- If thrown while fetching the parents list from the
database.XMLDBModel executeGetModelTask(GetModelTask task) throws DBExecutionException
task
- The task to be completed. In this case, GetModelTask.
This will tell the DB layer to return the specified model.DBExecutionException
- Thrown if the operations fails.java.lang.String executeGetReferenceStringTask(GetReferenceStringTask task) throws DBExecutionException
task
- Task that contains the model name.DBExecutionException
- If thrown while fetching the reference
string.XMLDBModel executeGetCompleteModelTask(GetModelTask task) throws DBExecutionException
task
- The task to be completed. In this case, GetModelTask.
This will tell the DB layer to return the specified model.DBExecutionException
- Thrown if the operations fails.java.util.ArrayList<XMLDBModel> executeGraphSearchTask(GraphSearchTask task) throws DBExecutionException
task
- - Task that contains the graph search criteria.DBExecutionException
- - When the database encounters
error while searching.java.util.ArrayList<XMLDBModel> executeModelNameSearchTask(ModelNameSearchTask modelNameSearchTask) throws DBExecutionException
modelNameSearchTask
- Task that contains the model name to be searched for.DBExecutionException
- If thrown while searching the database.java.lang.String executeSaveModelTask(SaveModelTask task) throws DBExecutionException, CircularDependencyException
task
- The task to be completed. In this case, SaveModelTask.
This will tell the DB layer to save/update a model already
existing in the database.DBExecutionException
- Thrown when there is a problem in
executing the task.CircularDependencyException
- If thrown while creating reference
string.void executeRemoveModelsTask(RemoveModelsTask task) throws DBExecutionException
task
- Contains a list of models to be deleted from the database.DBExecutionException
- Thrown if the operation fails.void executeRenameModelTask(RenameModelTask task) throws DBConnectionException, DBExecutionException, ModelAlreadyExistException, DBModelNotFoundException
task
- RenameModelTask object that contains the XMLDBModel
object and the new name.DBConnectionException
- Thrown if there was a problem with the connection.DBExecutionException
- Thrown if there is a problem in executing the task.DBModelNotFoundException
- Thrown if the model with the name to be changed does not exist.ModelAlreadyExistException
- Thrown if the new name is a name of a model that is already in the database.void executeUpdateAttributeTask(UpdateAttributeTask task) throws DBExecutionException
task
- The task to be completed. In this case, UpdateAttributeTask.
This will tell the DB layer to update an attribute in the database.DBExecutionException
- Thrown if the operation fails.void executeUpdateModelInCache(XMLDBModel xmlDBModel) throws DBExecutionException
If the model exists, replace it with the new model.
If the model does not exist, save it in the cache.
xmlDBModel
- The model object that needs to be added to the cache.DBExecutionException
- Thrown if the operation fails.
already exists.void executeUpdateParentsToNewVersion(UpdateParentsToNewVersionTask task) throws DBExecutionException
task
- Task that contains the list of parents, the old model and the
new model.DBExecutionException
- If thrown while updating the parents in the
database.