SMILA (incubation) API documentation

org.eclipse.smila.jobmanager.persistence.objectstore
Class DefinitionStorageObjectstore

java.lang.Object
  extended by org.eclipse.smila.jobmanager.persistence.objectstore.DefinitionStorageObjectstore
All Implemented Interfaces:
DefinitionStorage

public class DefinitionStorageObjectstore
extends java.lang.Object
implements DefinitionStorage

Component for handling persistent jobmanager data by using objectstore.


Constructor Summary
DefinitionStorageObjectstore()
           
 
Method Summary
protected  void activate(ComponentContext context)
          OSGi Declarative Services service activation method.
 void addBucket(BucketDefinition bucket)
          Write bucket definition to storage.
 void addJob(JobDefinition job)
          Write job definition to storage.
 void addWorkflow(WorkflowDefinition workflow)
          Write workflow definition to storage.
 boolean containsJobRun(java.lang.String jobName, java.lang.String jobRunId)
          
protected  void deactivate(ComponentContext context)
          OSGi Declarative Services service deactivation method.
 void deleteJobRunData(java.lang.String jobName, java.lang.String jobRunId)
          Deletes the stored data for the given job run.
 BucketDefinition getBucket(java.lang.String name)
          get bucket definition from storage.
 java.util.Collection<java.lang.String> getBuckets()
          Get bucket names defined in storage.
 JobDefinition getJob(java.lang.String name)
          get job definition from storage.
 AnyMap getJobRunData(java.lang.String jobName, java.lang.String jobRunId)
          
 java.util.Collection<java.lang.String> getJobRunIds(java.lang.String jobName)
          
 java.util.Collection<java.lang.String> getJobs()
          Get job names defined in storage.
 WorkflowDefinition getWorkflow(java.lang.String name)
          get workflow definition from storage.
 java.util.Collection<java.lang.String> getWorkflows()
          Get workflow names defined in storage.
 boolean hasJob(java.lang.String name)
          
 void removeBucket(java.lang.String name)
          Remove bucket definition from storage.
 void removeJob(java.lang.String name)
          Remove job definition from storage.
 void removeWorkflow(java.lang.String name)
          Remove workflow definition from storage.
 void setClusterConfigService(ClusterConfigService ccs)
          set new ClusterConfigService.
 void setObjectStoreService(ObjectStoreService objectStoreService)
          method for DS to set a service reference.
 void storeJobRun(java.lang.String jobName, java.lang.String jobRunId, AnyMap jobRunData)
          Stores the job run data for the given job run.
 void unsetClusterConfigService(ClusterConfigService ccs)
          remove an ClusterConfigService.
 void unsetObjectStoreService(ObjectStoreService objectStoreService)
          method for DS to unset a service reference.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefinitionStorageObjectstore

public DefinitionStorageObjectstore()
Method Detail

activate

protected void activate(ComponentContext context)
                 throws ObjectStoreException
OSGi Declarative Services service activation method.

Parameters:
context - OSGi service component context.
Throws:
ObjectStoreException - could not prepare store.

deactivate

protected void deactivate(ComponentContext context)
OSGi Declarative Services service deactivation method.

Parameters:
context - OSGi service component context.

setObjectStoreService

public void setObjectStoreService(ObjectStoreService objectStoreService)
method for DS to set a service reference.

Parameters:
objectStoreService - ObjectStoreService reference.

unsetObjectStoreService

public void unsetObjectStoreService(ObjectStoreService objectStoreService)
method for DS to unset a service reference.

Parameters:
objectStoreService - ObjectStoreService reference.

addBucket

public void addBucket(BucketDefinition bucket)
               throws PersistenceException
Write bucket definition to storage.

Specified by:
addBucket in interface DefinitionStorage
Parameters:
bucket - bucket definition
Throws:
PersistenceException - error writing.

getBucket

public BucketDefinition getBucket(java.lang.String name)
                           throws PersistenceException
get bucket definition from storage.

Specified by:
getBucket in interface DefinitionStorage
Parameters:
name - bucket name
Returns:
bucket definition or null if bucket doesn't exist.
Throws:
PersistenceException - error reading bucket definition

removeBucket

public void removeBucket(java.lang.String name)
                  throws PersistenceException
Remove bucket definition from storage. Removing a non-existing bucket will be ignored.

Specified by:
removeBucket in interface DefinitionStorage
Parameters:
name - bucket name
Throws:
PersistenceException - error deleting.

getBuckets

public java.util.Collection<java.lang.String> getBuckets()
                                                  throws PersistenceException
Get bucket names defined in storage.

Specified by:
getBuckets in interface DefinitionStorage
Returns:
bucket names.
Throws:
PersistenceException - error reading.

addJob

public void addJob(JobDefinition job)
            throws PersistenceException
Write job definition to storage.

Specified by:
addJob in interface DefinitionStorage
Parameters:
job - job definition
Throws:
PersistenceException - error writing.

getJob

public JobDefinition getJob(java.lang.String name)
                     throws PersistenceException
get job definition from storage.

Specified by:
getJob in interface DefinitionStorage
Parameters:
name - job name
Returns:
job definition or null if job doesn't exist.
Throws:
PersistenceException - error reading job definition

hasJob

public boolean hasJob(java.lang.String name)
               throws PersistenceException

Specified by:
hasJob in interface DefinitionStorage
Parameters:
name - job name
Returns:
true if a job with this name is defined
Throws:
PersistenceException - error checking existence.

removeJob

public void removeJob(java.lang.String name)
               throws PersistenceException
Remove job definition from storage. Removing a non-existing job will be ignored.

Specified by:
removeJob in interface DefinitionStorage
Parameters:
name - job name
Throws:
PersistenceException - error deleting.

getJobs

public java.util.Collection<java.lang.String> getJobs()
                                               throws PersistenceException
Get job names defined in storage.

Specified by:
getJobs in interface DefinitionStorage
Returns:
job names.
Throws:
PersistenceException - error reading.

addWorkflow

public void addWorkflow(WorkflowDefinition workflow)
                 throws PersistenceException
Write workflow definition to storage.

Specified by:
addWorkflow in interface DefinitionStorage
Parameters:
workflow - workflow definition
Throws:
PersistenceException - error writing.

getWorkflow

public WorkflowDefinition getWorkflow(java.lang.String name)
                               throws PersistenceException
get workflow definition from storage.

Specified by:
getWorkflow in interface DefinitionStorage
Parameters:
name - workflow name
Returns:
workflow definition or null if workflow doesn't exist.
Throws:
PersistenceException - error reading workflow definition

getWorkflows

public java.util.Collection<java.lang.String> getWorkflows()
                                                    throws PersistenceException
Get workflow names defined in storage.

Specified by:
getWorkflows in interface DefinitionStorage
Returns:
workflow names.
Throws:
PersistenceException - error reading.

removeWorkflow

public void removeWorkflow(java.lang.String name)
                    throws PersistenceException
Remove workflow definition from storage. Removing a non-existing workflow will be ignored.

Specified by:
removeWorkflow in interface DefinitionStorage
Parameters:
name - workflow name
Throws:
PersistenceException - error deleting.

getJobRunIds

public java.util.Collection<java.lang.String> getJobRunIds(java.lang.String jobName)
                                                    throws PersistenceException

Specified by:
getJobRunIds in interface DefinitionStorage
Parameters:
jobName - the job for which to return the job run ids
Returns:
the ids of the stored job runs for the given job. If no entries are found an empty list is returned
Throws:
PersistenceException - error accessing store

storeJobRun

public void storeJobRun(java.lang.String jobName,
                        java.lang.String jobRunId,
                        AnyMap jobRunData)
Stores the job run data for the given job run. If writing to the storage fails for whatever reason, the data is logged, but no exception is thrown.

Specified by:
storeJobRun in interface DefinitionStorage
Parameters:
jobName - the job
jobRunId - the job run for which to store the data
jobRunData - the job run data

containsJobRun

public boolean containsJobRun(java.lang.String jobName,
                              java.lang.String jobRunId)
                       throws PersistenceException

Specified by:
containsJobRun in interface DefinitionStorage
Parameters:
jobName - the job
jobRunId - the job run for which to check if it's contained in the store
Returns:
'true' if an entry exists for the given job run, otherwise 'false'.
Throws:
PersistenceException - error accessing store

getJobRunData

public AnyMap getJobRunData(java.lang.String jobName,
                            java.lang.String jobRunId)
                     throws PersistenceException

Specified by:
getJobRunData in interface DefinitionStorage
Parameters:
jobName - the job
jobRunId - the job run id
Returns:
the job run data for the given job run id. If the job run doesn't exist 'null' is returned
Throws:
PersistenceException - error accessing store

deleteJobRunData

public void deleteJobRunData(java.lang.String jobName,
                             java.lang.String jobRunId)
                      throws PersistenceException
Deletes the stored data for the given job run.

Specified by:
deleteJobRunData in interface DefinitionStorage
Parameters:
jobName - the job
jobRunId - the id of the job run for which to delete the data
Throws:
PersistenceException - error accessing store

setClusterConfigService

public void setClusterConfigService(ClusterConfigService ccs)
set new ClusterConfigService. To be called by DS runtime before activation.

Parameters:
ccs - new ClusterConfigService

unsetClusterConfigService

public void unsetClusterConfigService(ClusterConfigService ccs)
remove an ClusterConfigService. To be called by DS runtime after deactivation.

Parameters:
ccs - new ClusterConfigService

SMILA (incubation) API documentation