uk.ac.soton.itinnovation.grid.pbac2.pdp.staticpolicy
Class ITInnovationServicePolicyImpl

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.pbac2.pdp.staticpolicy.ITInnovationServicePolicyImpl
All Implemented Interfaces:
ServicePolicy

public class ITInnovationServicePolicyImpl
extends Object
implements ServicePolicy

IT Innovation version of the static service policy inside the PDP. This determines the behaviour of the service: allowable states, transitions, process roles, operations, etc.


Constructor Summary
ITInnovationServicePolicyImpl(String resourceTypeID, String modelData)
          Constructor that creates this policy implementation for a particular resourceType.
 
Method Summary
 void checkAuthorised(Set<String> myProcessRoles, String action, String stateName)
          Decides whether a user with the given roles may perform the requested operation for a resource in the given state.
 void checkRoleValid(String processRole)
          Checks if the process role specified is valid for this resource type.
 Set<String> getAvailableSignals(String stateName)
          Get the signals available in the given state.
 String getNextState(String oldStateName, String event)
          Gets the next state given the current state and the event.
 String[] getValidProcessRoles()
          List the valid process roles for this model.
 void undeployPolicy()
          Removes a policy from the persistent store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ITInnovationServicePolicyImpl

public ITInnovationServicePolicyImpl(String resourceTypeID,
                                     String modelData)
                              throws SAXException,
                                     InvalidResourceTypeException
Constructor that creates this policy implementation for a particular resourceType. Reads in the modelData String and creates a model from it.

Parameters:
resourceTypeID - the ID of the resourceType we want a policy for.
modelData - a Stream representing the xml state model
Throws:
SAXExcoption - if the xml state model is badly formed.
InvalidResourceTypeException - if the modelData is in error.
SAXException
Method Detail

undeployPolicy

public void undeployPolicy()
Description copied from interface: ServicePolicy
Removes a policy from the persistent store.

Specified by:
undeployPolicy in interface ServicePolicy

getNextState

public String getNextState(String oldStateName,
                           String event)
                    throws EventCurrentlyUnavailableException,
                           InvalidStateException,
                           InvalidEventException
Description copied from interface: ServicePolicy
Gets the next state given the current state and the event.

Specified by:
getNextState in interface ServicePolicy
Parameters:
oldStateName - the current state
event - the event name
Returns:
the state to which the resource should transition
Throws:
EventCurrentlyUnavailableException - if the event is valid but not allowed in this state
InvalidStateException - if the oldState is not in the model
InvalidEventException - if the event is not in the model

getAvailableSignals

public Set<String> getAvailableSignals(String stateName)
                                throws InvalidStateException
Description copied from interface: ServicePolicy
Get the signals available in the given state.

Specified by:
getAvailableSignals in interface ServicePolicy
Returns:
a set of signal names
Throws:
InvalidStateException

checkAuthorised

public void checkAuthorised(Set<String> myProcessRoles,
                            String action,
                            String stateName)
                     throws InvalidActionException,
                            InvalidStateException,
                            NotAuthorisedException,
                            ActionCurrentlyUnavailableException
Description copied from interface: ServicePolicy
Decides whether a user with the given roles may perform the requested operation for a resource in the given state.

Specified by:
checkAuthorised in interface ServicePolicy
Parameters:
myProcessRoles - the roles to which the user belongs
action - the requested SOAP operation
stateName - the current process state of the resource
Throws:
InvalidActionException - the action isn't valid for this model
InvalidStateException - the state isn't valid for this model
NotAuthorisedException - if the operation is not possible in any state given the set of process roles
ActionCurrentlyUnavailableException - if the operation is valid for at least one of roles sepcified, but not in the current state

checkRoleValid

public void checkRoleValid(String processRole)
                    throws InvalidProcessRoleException
Description copied from interface: ServicePolicy
Checks if the process role specified is valid for this resource type.

Specified by:
checkRoleValid in interface ServicePolicy
Throws:
InvalidProcessRoleException - the role isn't valid for this model

getValidProcessRoles

public String[] getValidProcessRoles()
Description copied from interface: ServicePolicy
List the valid process roles for this model.

Specified by:
getValidProcessRoles in interface ServicePolicy
Returns:
an array of process role names.


Copyright © 2001-2008 University of Southampton IT Innovation Centre. All Rights Reserved.