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

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

public class Session
extends Object
implements 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
           
 
Field Summary
protected  org.gcube.common.core.utils.logging.GCUBELog logger
           
 
Constructor Summary
Session(String id, Session.OPERATION operation, org.gcube.common.core.scope.GCUBEScope... scope)
          Builds a new empty report
 
Method Summary
 void addDeployedInstances(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(ScopedDeployedSoftware service)
           
 Map<String,DeployerReport> getAllGHNReports()
          Gets all the GHN reports received
 String getDeploymentPlan()
           
 String getId()
           
 Calendar getLastUpdate()
           
 Session.OPERATION getOperation()
           
 org.gcube.common.core.scope.GCUBEScope getScope()
           
 Set<ScopedDeployedSoftware> getServices()
           
 boolean isSessionClosed()
          Checks whether the report is closed or no
static Session load(String id)
          Loads the report from the file system
static String loadAsString(String id)
          Loads the report from the file system
 void reportBrokerWork(boolean wasSuccessful, String brokerMessage)
           
 void save()
          Saves the report on the local file system
 void setDeploymentPlan(String plan)
           
 void startChecker()
          Starts the session checker
 String toXML()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.gcube.common.core.utils.logging.GCUBELog logger
Constructor Detail

Session

public Session(String id,
               Session.OPERATION operation,
               org.gcube.common.core.scope.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 Exception
Adds a Deployer Report to the Resource Report

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

addResource

public void addResource(ScopedResource resource)

addService

public void addService(ScopedDeployedSoftware service)

toXML

public String toXML()
             throws IOException
Throws:
IOException

getLastUpdate

public Calendar getLastUpdate()
Returns:
the lastUpdate

getId

public String getId()
Returns:
the resource report identifier

getScope

public org.gcube.common.core.scope.GCUBEScope getScope()
Returns:
the scope this report belongs to

save

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

Throws:
IOException - if the saving fails

load

public static Session load(String id)
                    throws IOException
Loads the report from the file system

Parameters:
id - the report ID
Returns:
the report
Throws:
IOException - if the report does not have a valid serialization

loadAsString

public static String loadAsString(String id)
                           throws IOException
Loads the report from the file system

Parameters:
id - the report ID
Returns:
the string representation of the report
Throws:
IOException - if the report does not have a valid serialization

reportBrokerWork

public void reportBrokerWork(boolean wasSuccessful,
                             String brokerMessage)

addDeployedInstances

public void addDeployedInstances(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

isSessionClosed

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

Returns:
true if the report is closed, false otherwise

getServices

public Set<ScopedDeployedSoftware> getServices()

getAllGHNReports

public Map<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(String plan)

getDeploymentPlan

public String getDeploymentPlan()
                         throws IOException
Throws:
IOException

startChecker

public void startChecker()
Starts the session checker



Copyright © 2013. All Rights Reserved.