org.gcube.vremanagement.resourcemanager.impl.state
Class ScopeState

java.lang.Object
  extended by java.util.Observable
      extended by org.gcube.vremanagement.resourcemanager.impl.state.ScopeState

public final class ScopeState
extends Observable

A list of scoped resources

Author:
Manuele Simi (ISTI-CNR)

Nested Class Summary
static class ScopeState.OPERATION
           
 
Field Summary
protected  ScopeState.OPERATION lastOperationPerformed
          last operation performed on the list
protected  org.gcube.common.core.utils.logging.GCUBELog logger
           
 
Constructor Summary
protected ScopeState()
           
 
Method Summary
 void addResources(Set<ScopedResource> newresources)
          Adds a new resources to the list
 void changeDescription(String description)
          Changes the scope description
 boolean containsResource(String id)
           
 void forceResourceRemoval(Set<ScopedResource> resources)
          Removes the resource from the state, no matter about its actual status
 Collection<ScopedResource> getAllResources()
          Gets all the ScopedResources
 String getDescription()
           
 String getDesigner()
          Gets the scope designer
 Date getEndTime()
           
 ScopeState.OPERATION getLastOperationPerformed()
           
 Session getLastReport()
          Gets the last active Session
 String getManager()
          Gets the scope manager
 String getName()
           
 VirtualNode getNode(String name)
          Gets the node by its name
 VirtualNode getNodeById(String id)
          Gets the node by its identifier
 RawScopeState getRawScopeState()
          Gets the RawScopeState
 ScopedDeployedSoftware getRelatedDeployedSoftware(GCUBEPackage sourceService)
          Gets the deployed service of the given service, if any
 ScopedResource getResource(String id)
          Gets the resource with the given id
 Set<ScopedResource> getResourcesByType(String type)
          Gets resources of the given type
 org.gcube.common.core.scope.GCUBEScope getScope()
          Gets the resource's scope
 Date getStartTime()
           
protected  void initialize(org.gcube.common.core.scope.GCUBEScope scope, String name, boolean securityEnabled, String... description)
           
 boolean isDisposed()
           
 boolean isSecurityEnabled()
           
 void markAsDisposed()
           
 void notifyObservers()
           
 void notifyObservers(Object whatschanged)
           
protected  void removeAllResources()
          Empty the list of resources
 void removeAllResourcesByType(String type)
          Removes all the resource of the given type
 void removeResources(Set<ScopedResource> oldresources)
          Removes the resources from the scope
 void setDesigner(String designer)
          Sets the scope designer identity
 void setEndTime(Date endTime)
           
 void setLastOperationPerformed(ScopeState.OPERATION operation)
           
 void setLastSession(Session report)
          Sets the last active Session
 void setManager(String manager)
          Sets the scope manager identity
 void setName(String name)
           
 void setRawScopeState(RawScopeState state)
          Sets the new RawScopeState it usually invoked at deserialization time, see Serializer.load(ScopeState, GCUBEScope)
 void setSecurity(boolean securityEnabled)
           
 void setStartTime(Date startTime)
           
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected org.gcube.common.core.utils.logging.GCUBELog logger

lastOperationPerformed

protected ScopeState.OPERATION lastOperationPerformed
last operation performed on the list

Constructor Detail

ScopeState

protected ScopeState()
Method Detail

initialize

protected void initialize(org.gcube.common.core.scope.GCUBEScope scope,
                          String name,
                          boolean securityEnabled,
                          String... description)

setManager

public void setManager(String manager)
Sets the scope manager identity

Parameters:
manager - the manager

setDesigner

public void setDesigner(String designer)
Sets the scope designer identity

Parameters:
manager - the manager

changeDescription

public void changeDescription(String description)
Changes the scope description

Parameters:
description - the description

addResources

public void addResources(Set<ScopedResource> newresources)
Adds a new resources to the list

Parameters:
newresources - the resources to add

getResourcesByType

public Set<ScopedResource> getResourcesByType(String type)
Gets resources of the given type

Parameters:
type - the type to filter
Returns:
the collection of resources

getResource

public ScopedResource getResource(String id)
Gets the resource with the given id

Parameters:
id - the resource identified
Returns:
the resource

containsResource

public boolean containsResource(String id)

removeAllResourcesByType

public void removeAllResourcesByType(String type)
Removes all the resource of the given type

Parameters:
type - the type of resources to remove

removeResources

public void removeResources(Set<ScopedResource> oldresources)
                     throws VirtualNode.NoGHNFoundException
Removes the resources from the scope

Parameters:
oldresources - the resources to remove
Throws:
VirtualNode.NoGHNFoundException

forceResourceRemoval

public void forceResourceRemoval(Set<ScopedResource> resources)
Removes the resource from the state, no matter about its actual status

Parameters:
resources -

removeAllResources

protected void removeAllResources()
Empty the list of resources


getScope

public org.gcube.common.core.scope.GCUBEScope getScope()
Gets the resource's scope

Returns:
the scope

notifyObservers

public void notifyObservers(Object whatschanged)
Overrides:
notifyObservers in class Observable

notifyObservers

public void notifyObservers()
Overrides:
notifyObservers in class Observable

getAllResources

public Collection<ScopedResource> getAllResources()
Gets all the ScopedResources

Returns:
all the ScopedResources

getManager

public String getManager()
Gets the scope manager

Returns:
the scope manger

getDesigner

public String getDesigner()
Gets the scope designer

Returns:
the scope designer

getDescription

public String getDescription()

getName

public String getName()

getEndTime

public Date getEndTime()

getStartTime

public Date getStartTime()

isSecurityEnabled

public boolean isSecurityEnabled()

setEndTime

public void setEndTime(Date endTime)

setStartTime

public void setStartTime(Date startTime)

setName

public void setName(String name)

getLastOperationPerformed

public ScopeState.OPERATION getLastOperationPerformed()
Returns:
the the last operation performed on the list

setLastOperationPerformed

public void setLastOperationPerformed(ScopeState.OPERATION operation)
Parameters:
operation - the last operation performed on the list

getRawScopeState

public RawScopeState getRawScopeState()
Gets the RawScopeState

Returns:
the raw state

setRawScopeState

public void setRawScopeState(RawScopeState state)
Sets the new RawScopeState it usually invoked at deserialization time, see Serializer.load(ScopeState, GCUBEScope)

Parameters:
state -

setSecurity

public void setSecurity(boolean securityEnabled)

getLastReport

public Session getLastReport()
Gets the last active Session

Returns:
the session

setLastSession

public void setLastSession(Session report)
Sets the last active Session

Parameters:
session - the session

isDisposed

public boolean isDisposed()
Returns:
the isDisposed

markAsDisposed

public void markAsDisposed()
Parameters:
isDisposed - the isDisposed to set

getNode

public VirtualNode getNode(String name)
                    throws VirtualNode.NoGHNFoundException
Gets the node by its name

Parameters:
name - the name
Returns:
the node
Throws:
VirtualNode.NoGHNFoundException - if the node does not exist

getNodeById

public VirtualNode getNodeById(String id)
                        throws VirtualNode.NoGHNFoundException
Gets the node by its identifier

Parameters:
id - the identifier
Returns:
the node
Throws:
VirtualNode.NoGHNFoundException - if the node does not exist

getRelatedDeployedSoftware

public ScopedDeployedSoftware getRelatedDeployedSoftware(GCUBEPackage sourceService)
                                                  throws ServiceNotFoundException
Gets the deployed service of the given service, if any

Parameters:
scopeState - the state where to search the deployed service
sourceService - the service
Returns:
the deployed service
Throws:
ServiceNotFoundException


Copyright © 2012. All Rights Reserved.