org.gcube.common.vremanagement.deployer.impl.state
Class DeployerResource

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
      extended by org.gcube.common.core.state.GCUBEStatefulResource<org.gcube.common.core.state.GCUBEWSResourceKey>
          extended by org.gcube.common.core.state.GCUBEWSResource
              extended by org.gcube.common.core.state.GCUBEWSFieldsSerializableResource
                  extended by org.gcube.common.vremanagement.deployer.impl.state.DeployerResource
All Implemented Interfaces:
Serializable, org.gcube.common.core.persistence.GCUBEWSFields2FilePersistenceDelegate.WSFieldsSerializable, org.gcube.common.core.utils.handlers.GCUBEServiceClient, org.globus.wsrf.PersistenceCallback, org.globus.wsrf.Resource, org.globus.wsrf.ResourceLifetime, org.globus.wsrf.ResourceProperties, org.globus.wsrf.TopicListAccessor

public class DeployerResource
extends org.gcube.common.core.state.GCUBEWSFieldsSerializableResource

Deployer stateful resource. The state is represented by the BaseTypedPackage serialized instances of the packages deployed on the gHN

Author:
Manuele Simi (ISTI-CNR)
See Also:
WSObjectsSerializableResource, GCUBEWSObjects2FilePersistenceDelegate, Serialized Form

Nested Class Summary
static class DeployerResource.NoSuchPackageException
          No package on the gHN has been found
 
Nested classes/interfaces inherited from class org.gcube.common.core.state.GCUBEStatefulResource
org.gcube.common.core.state.GCUBEStatefulResource.LOCK, org.gcube.common.core.state.GCUBEStatefulResource.TaskContext
 
Field Summary
protected static String DeployedPackagesRP
           
protected static String LastDeploymentRP
           
protected static String NumPackagesRP
           
 
Fields inherited from class org.gcube.common.core.state.GCUBEStatefulResource
logger, uuidGen
 
Constructor Summary
DeployerResource()
           
 
Method Summary
 void addPackage(BaseTypedPackage pack)
          Adds a new package to the resource state
 void clearLastDeployment()
           
 org.gcube.common.vremanagement.deployer.stubs.deployer.DeployedPackage[] getDeployedPackages()
          Gets for the RP DeployedPackages
 List<? extends Serializable> getFieldsToSerialize()
          
 String getLastDeployment()
          Gets the RP LastDeploymentRP
 Report getLastReport()
          Gets the last deployment report
 BaseTypedPackage getPackage(KeyData key)
          Gets a previously deployed package from the service's state
 Set<? extends BasePackage> getPackagesToUpdate()
          Gets the list of packages to be updated with new Scopes
protected  String[] getPropertyNames()
          
protected  void initialise(Object... arg0)
          
 boolean isDeployed(BaseTypedPackage pack)
          Checks if a package is already deployed here
 boolean isUndeployable(BaseTypedPackage base, Set<org.gcube.common.core.scope.GCUBEScope> scopes)
          Decides whether or not a package can be undeployed
 void removePackage(BaseTypedPackage pack)
          Removes a package from the resource state
 void setDeployedPackages(org.gcube.common.vremanagement.deployer.stubs.deployer.DeployedPackage[] packages)
          Sets for the RP DeployedPackages
 void setFieldsToSerialize(List<? extends Serializable> objs)
           
 void setLastDeployment(String lastDeployment)
          Sets for the RP LastDeploymentRP
 
Methods inherited from class org.gcube.common.core.state.GCUBEWSResource
getCurrentTime, getEPR, getPorttypeContext, getProperty, getPublisher, getResourcePropertySet, getServiceContext, getTerminationTime, getTopicList, getTopicNames, initialise, initialiseContainers, inScope, load, publish, setPortTypeContext, setTerminationTime, unpublish
 
Methods inherited from class org.gcube.common.core.state.GCUBEStatefulResource
getID, getLock, getScheduledTasks, getScope, launchTask, onRemove, setID, setPersistenceDelegate, stopTask, store
 
Methods inherited from class org.gcube.common.core.utils.handlers.GCUBEServiceClientImpl
getPortTypeMap, setPortTypeMap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.globus.wsrf.PersistenceCallback
store
 

Field Detail

NumPackagesRP

protected static final String NumPackagesRP
See Also:
Constant Field Values

DeployedPackagesRP

protected static final String DeployedPackagesRP
See Also:
Constant Field Values

LastDeploymentRP

protected static final String LastDeploymentRP
See Also:
Constant Field Values
Constructor Detail

DeployerResource

public DeployerResource()
Method Detail

initialise

protected void initialise(Object... arg0)
                   throws Exception

Specified by:
initialise in class org.gcube.common.core.state.GCUBEWSResource
Throws:
Exception

getPropertyNames

protected String[] getPropertyNames()

Overrides:
getPropertyNames in class org.gcube.common.core.state.GCUBEWSResource

getFieldsToSerialize

public List<? extends Serializable> getFieldsToSerialize()

Specified by:
getFieldsToSerialize in interface org.gcube.common.core.persistence.GCUBEWSFields2FilePersistenceDelegate.WSFieldsSerializable
Overrides:
getFieldsToSerialize in class org.gcube.common.core.state.GCUBEWSFieldsSerializableResource

setFieldsToSerialize

public void setFieldsToSerialize(List<? extends Serializable> objs)
Specified by:
setFieldsToSerialize in interface org.gcube.common.core.persistence.GCUBEWSFields2FilePersistenceDelegate.WSFieldsSerializable
Overrides:
setFieldsToSerialize in class org.gcube.common.core.state.GCUBEWSFieldsSerializableResource

setLastDeployment

public void setLastDeployment(String lastDeployment)
Sets for the RP LastDeploymentRP

Parameters:
lastDeployment - the callback ID related to the last deployment operation invoked

clearLastDeployment

public void clearLastDeployment()

getLastDeployment

public String getLastDeployment()
Gets the RP LastDeploymentRP

Returns:
the callback ID related to the last deployment operation invoked

getDeployedPackages

public org.gcube.common.vremanagement.deployer.stubs.deployer.DeployedPackage[] getDeployedPackages()
Gets for the RP DeployedPackages

Returns:
the packages deployed on the node

setDeployedPackages

public void setDeployedPackages(org.gcube.common.vremanagement.deployer.stubs.deployer.DeployedPackage[] packages)
Sets for the RP DeployedPackages

Parameters:
packages - the packages deployed on the node

addPackage

public void addPackage(BaseTypedPackage pack)
Adds a new package to the resource state

Parameters:
pack - the package to add

getPackage

public BaseTypedPackage getPackage(KeyData key)
                            throws DeployerResource.NoSuchPackageException
Gets a previously deployed package from the service's state

Parameters:
key - the key of the package to look for
Returns:
the package
Throws:
DeployerResource.NoSuchPackageException - if the package is not in the service's state

isDeployed

public boolean isDeployed(BaseTypedPackage pack)
Checks if a package is already deployed here

Parameters:
pack - the package to check

removePackage

public void removePackage(BaseTypedPackage pack)
                   throws DeployerResource.NoSuchPackageException
Removes a package from the resource state

Parameters:
pack - the package to remove
Throws:
DeployerResource.NoSuchPackageException

getPackagesToUpdate

public Set<? extends BasePackage> getPackagesToUpdate()
Gets the list of packages to be updated with new Scopes

Returns:
the list of packages to update

getLastReport

public Report getLastReport()
                     throws Report.ReportNotFoundException
Gets the last deployment report

Returns:
the last deployment report
Throws:
Report.ReportNotFoundException - if the report is not valid or does not exist

isUndeployable

public boolean isUndeployable(BaseTypedPackage base,
                              Set<org.gcube.common.core.scope.GCUBEScope> scopes)
Decides whether or not a package can be undeployed

Parameters:
base - the package to check
scopes - the undeployment scope(s)
Returns:
true if the package can be undeployed, false otherwise


Copyright © 2013. All Rights Reserved.