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

java.lang.Object
  extended by org.gcube.vremanagement.resourcemanager.impl.resources.ScopedResource
Direct Known Subclasses:
ScopedAnyResource, ScopedDeployedService, ScopedGHN, ScopedRunningInstance

public abstract class ScopedResource
extends java.lang.Object

An abstract model for a scoped GCUBEResource

Author:
Manuele Simi (ISTI-CNR)

Nested Class Summary
 class ScopedResource.ResourceNotFound
          Unable to find the resource in the infrastructure
static class ScopedResource.STATUS
          resource's legal statuses
 
Constructor Summary
ScopedResource(java.lang.String id, java.lang.String type, GCUBEScope scope)
           
 
Method Summary
 void doAction(Operator.ACTION action)
           
 boolean equals(java.lang.Object obj)
          
 void findResource()
          Looks for the resource in the infrastructure
 Operator.ACTION getAction()
           
 java.lang.String getErrorMessage()
           
 java.lang.String getHostedOn()
           
 java.lang.String getId()
           
 java.util.Date getJointTime()
           
 java.util.Date getLastModificationTime()
           
 GCUBEScope getScope()
           
 ScopedResource.STATUS getStatus()
           
 java.lang.String getType()
           
 int hashCode()
          
 boolean isSuccess()
           
 void setErrorMessage(java.lang.String errorMessage)
           
 void setHostedON(java.lang.String hostedOn)
           
 void setJointTime(java.util.Date time)
          Updates the time the resource joined the scope
 void setStatus(ScopedResource.STATUS status)
           
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ScopedResource

public ScopedResource(java.lang.String id,
                      java.lang.String type,
                      GCUBEScope scope)
Method Detail

findResource

public void findResource()
                  throws ScopedResource.ResourceNotFound
Looks for the resource in the infrastructure

Throws:
ScopedResource.ResourceNotFound - if it is impossible to locate the resource

doAction

public void doAction(Operator.ACTION action)
              throws ScopedResource.ResourceNotFound,
                     java.lang.Exception
Throws:
ScopedResource.ResourceNotFound
java.lang.Exception

getId

public java.lang.String getId()
Returns:
the resource ID

getType

public java.lang.String getType()
Returns:
the resource type

getScope

public final GCUBEScope getScope()
Returns:
the scope

getAction

public Operator.ACTION getAction()
Returns:
the action

getErrorMessage

public java.lang.String getErrorMessage()
Returns:
the errorMessage

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)
Parameters:
errorMessage - the errorMessage to set

setJointTime

public void setJointTime(java.util.Date time)
Updates the time the resource joined the scope

Parameters:
time - the new joint time

isSuccess

public boolean isSuccess()
Returns:
the success

getHostedOn

public java.lang.String getHostedOn()
Returns:
the node on which the Scope is hosted

setHostedON

public void setHostedON(java.lang.String hostedOn)

getJointTime

public java.util.Date getJointTime()

getLastModificationTime

public java.util.Date getLastModificationTime()

getStatus

public ScopedResource.STATUS getStatus()
Returns:
the status

setStatus

public void setStatus(ScopedResource.STATUS status)
Parameters:
status - the status to set

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)

Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object