org.gcube.vremanagement.resourcemanager.impl.resources
Class ScopedRunningInstance

java.lang.Object
  extended by org.gcube.vremanagement.resourcemanager.impl.resources.ScopedResource
      extended by org.gcube.vremanagement.resourcemanager.impl.resources.ScopedRunningInstance

public final class ScopedRunningInstance
extends ScopedResource

A scoped GCUBERunningInstance

Author:
Manuele Simi (ISTI-CNR)

Nested Class Summary
 
Nested classes/interfaces inherited from class org.gcube.vremanagement.resourcemanager.impl.resources.ScopedResource
ScopedResource.ResourceNotFound, ScopedResource.STATUS
 
Field Summary
static String TYPE
           
 
Fields inherited from class org.gcube.vremanagement.resourcemanager.impl.resources.ScopedResource
action, errorMessage, hostedOn, id, jointTime, lastModificationTime, logger, scope, status, success, type
 
Constructor Summary
protected ScopedRunningInstance(String id, org.gcube.common.core.scope.GCUBEScope scope, String... hostedOn)
           
 
Method Summary
protected  void addToScope()
          Adds the RI to the scope
protected  void find()
          Custom
 String getHostedOn()
           
protected  int getMaxFindAttempts()
          Number of times the resource is searched in the IS before to declare it lost
 GCUBEPackage getSourcePackage()
          Gets the package that generated this instance
protected  String getSourceServiceClass()
           
protected  String getSourceServiceName()
           
 boolean isUndeployNeeded()
           
protected  void removeFromScope()
          Removes the RI from the scope
 void reportFailureOnSourceService(String message, Exception e)
           
 void wasSuccessful()
           
 
Methods inherited from class org.gcube.vremanagement.resourcemanager.impl.resources.ScopedResource
doAction, equals, findResource, getAction, getErrorMessage, getId, getJointTime, getLastModificationTime, getLogger, getScope, getStatus, getType, hashCode, isSuccess, noHopeForMe, setErrorMessage, setHostedON, setJointTime, setScope, setStatus, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final String TYPE
See Also:
Constant Field Values
Constructor Detail

ScopedRunningInstance

protected ScopedRunningInstance(String id,
                                org.gcube.common.core.scope.GCUBEScope scope,
                                String... hostedOn)
Method Detail

find

protected void find()
             throws Exception
Description copied from class: ScopedResource
Custom

Specified by:
find in class ScopedResource
Throws:
ScopedResource.ResourceNotFound - if it is impossible to locate the resource
Exception

addToScope

protected void addToScope()
                   throws ScopedResource.ResourceNotFound,
                          Exception
Adds the RI to the scope

Specified by:
addToScope in class ScopedResource
Throws:
Exception - if it is not possible to add the resource
ScopedResource.ResourceNotFound - if the resource does not exist in the infrastructure

removeFromScope

protected void removeFromScope()
                        throws ScopedResource.ResourceNotFound,
                               ServiceNotFoundException,
                               Exception
Removes the RI from the scope

Specified by:
removeFromScope in class ScopedResource
Throws:
Exception - if it is not possible to remove the resource
ScopedResource.ResourceNotFound - if the resource does not exist in the infrastructure
ServiceNotFoundException

getSourceServiceClass

protected String getSourceServiceClass()

getSourceServiceName

protected String getSourceServiceName()

isUndeployNeeded

public boolean isUndeployNeeded()
                         throws ScopedResource.ResourceNotFound
Throws:
ScopedResource.ResourceNotFound

getHostedOn

public String getHostedOn()
Overrides:
getHostedOn in class ScopedResource
Returns:
the name of the gHN hosting the instance

reportFailureOnSourceService

public void reportFailureOnSourceService(String message,
                                         Exception e)

wasSuccessful

public void wasSuccessful()

getMaxFindAttempts

protected int getMaxFindAttempts()
Number of times the resource is searched in the IS before to declare it lost

Overrides:
getMaxFindAttempts in class ScopedResource
Returns:
the number of attempts to do

getSourcePackage

public GCUBEPackage getSourcePackage()
                              throws ServiceNotFoundException
Gets the package that generated this instance

Returns:
the service
Throws:
ServiceNotFoundException - if the service is not found


Copyright © 2012. All Rights Reserved.