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

java.lang.Object
  extended by org.gcube.vremanagement.resourcemanager.impl.state.Session
All Implemented Interfaces:
java.io.Serializable

public class Session
extends java.lang.Object
implements java.io.Serializable

Session for each service operation. It holds all the information related to the activities performed to satisfy the caller's request.

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

Nested Class Summary
static class Session.DEPSTATUS
          Status of a dependency resolver request
static class Session.OPERATION
           
 
Constructor Summary
Session(java.lang.String id, Session.OPERATION operation, GCUBEScope... scope)
          Builds a new empty report
 
Method Summary
 void addDeployedInstances(java.util.Set<DeployerReport.DeployedRunningInstance> instances)
          Adds newly deployed instances to the report.
 void addGHNReport(DeployerReport report)
          Adds a Deployer Report to the Resource Report
 void addResource(ScopedResource resource)
           
 void addService(ScopedDeployedService service)
           
 java.util.Map<java.lang.String,DeployerReport> getAllGHNReports()
          Gets all the GHN reports received
 java.lang.String getDeploymentPlan()
           
 java.lang.String getId()
           
 java.util.Calendar getLastUpdate()
           
 Session.OPERATION getOperation()
           
 GCUBEScope getScope()
           
 java.util.Set<ScopedDeployedService> getServices()
           
 boolean isReportClosed()
          Checks whether the report is closed or no
 void reportBrokerWork(boolean wasSuccessful, java.lang.String brokerMessage)
           
 void save()
          Saves the report on the local file system
 void setDeploymentPlan(java.lang.String plan)
           
 java.lang.String toXML()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Session

public Session(java.lang.String id,
               Session.OPERATION operation,
               GCUBEScope... scope)
Builds a new empty report

Parameters:
id - the session ID assigned to the operation
Method Detail

addGHNReport

public void addGHNReport(DeployerReport report)
                  throws java.lang.Exception
Adds a Deployer Report to the Resource Report

Parameters:
report - the string representation of the report, as sent by a Deployer service
Throws:
java.lang.Exception - if a problem in the report parsing occurs

addResource

public void addResource(ScopedResource resource)

addService

public void addService(ScopedDeployedService service)

toXML

public java.lang.String toXML()
                       throws java.io.IOException
Throws:
java.io.IOException

getLastUpdate

public java.util.Calendar getLastUpdate()
Returns:
the lastUpdate

getId

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

getScope

public GCUBEScope getScope()
Returns:
the scope this report belongs to

save

public void save()
          throws java.io.IOException
Saves the report on the local file system

Throws:
java.io.IOException - if the saving fails

reportBrokerWork

public void reportBrokerWork(boolean wasSuccessful,
                             java.lang.String brokerMessage)

addDeployedInstances

public void addDeployedInstances(java.util.Set<DeployerReport.DeployedRunningInstance> instances)
Adds newly deployed instances to the report. These instances are reported to be activated by the Deployer following a deployment request

Parameters:
instances - the new instances

isReportClosed

public boolean isReportClosed()
Checks whether the report is closed or no

Returns:
true if the report is closed, false otherwise

getServices

public java.util.Set<ScopedDeployedService> getServices()

getAllGHNReports

public java.util.Map<java.lang.String,DeployerReport> getAllGHNReports()
Gets all the GHN reports received

Returns:
a map where the key is the GHN ID and the value is the related report

getOperation

public Session.OPERATION getOperation()
Returns:
the Session.OPERATION related to this report

setDeploymentPlan

public void setDeploymentPlan(java.lang.String plan)

getDeploymentPlan

public java.lang.String getDeploymentPlan()
                                   throws java.io.IOException
Throws:
java.io.IOException