uk.ac.soton.itinnovation.grid.service.sla
Class SLAServiceImpl

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
      extended by uk.ac.soton.itinnovation.grid.service.sla.SLAServiceImpl
All Implemented Interfaces:
ManagedGridService, SLAResource, SLAService, SLAServiceSOAP, SLATemplateResource, WebAdmin, WSResourceLifetime, WSRFService, WSTrust, GridService, IdentifiableResource, PolicyManagement, ResourceMetadata, Signallable

public class SLAServiceImpl
extends GridServiceLite
implements SLAServiceSOAP, WebAdmin


Field Summary
static String SLA_GROUP_SERVICE_ADMINS
           
static String SLA_MANAGED_SERVICES
          A group name for the group of services that are trusted by the SLA manager to call startActivity(...), continueActivity(...) etc.
static String SLA_RESOURCE_TYPE
           
static String SLA_SERVICE_RESOURCE_TYPE
           
 
Fields inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
groupUtils, management, NO_ACCOUNT_NEEDED, pbacUtils, pdp, proxyFactory, thisServiceAddress, wsdlCache
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.management.ManagedGridService
FREE_SERVICE
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.wstrust.WSTrust
DEFAULT_WSTRUST_ISSUER, requestSecurityToken, VALIDATE_SUBJECT_DESCRIPTION, WSTRUST_REQUEST_TYPE_ISSUANCE, WSTRUST_REQUEST_TYPE_VALIDATION, WSTRUST_SAML_1_1, WSTRUST_STATUS, WSTRUST_STATUS_INVALID, WSTRUST_STATUS_VALID, XMLNS_WSTRUST, XMLNS_WSU
 
Constructor Summary
SLAServiceImpl()
           
 
Method Summary
 void addOwnerRule(MatchRule rule)
          Deprecated. 
 void addUserRule(MatchRule rule)
          Deprecated. 
 boolean checkUser(SubjectDescription user)
          Test whether this user has the 'user' role.
 void closeSLA()
          Close an SLA
 void closeSLAInternal(String resourceID)
           
 void closeSLALocal(String slaID)
           
 void continueActivity(org.apache.axis.message.addressing.EndpointReferenceType activityEPR, Constraint[] cons)
          Checks that a change in an activity should be permitted.
 org.apache.axis.message.addressing.EndpointReferenceType createSLA(SLAProposal terms, String label, MatchRule owner)
          Create a new agreement.
 String createSLALocal(MatchRule owner, String label, SLAProposal terms, Conversation managingConversation)
           
 org.apache.axis.message.addressing.EndpointReferenceType createSLATemplate(Document doc, MatchRule owner)
          Create a new SLA Template.
 String createSLATemplateFromDoc(Document xmlDoc, MatchRule owner)
           
 void deleteSLATemplate()
           
 void deleteSLATemplate(String resourceID)
           
 void destroy()
           
 void disablePolling()
          Used by unit tests.
 void ensurePoliciesDeployed()
          Ensure that any required PBAC policies are deployed.
 void ensureSingleResourcePoolExists()
           
 void finishActivityInternal(String activityID)
           
 void finishServiceInternal(String endpoint)
           
 void forceCloseSLAInternal(String slaID)
           
 void forceCloseSLALocal(String slaID)
           
 TradeAccountConversation getAccount(org.apache.axis.message.addressing.EndpointReferenceType epr)
           
 Activity getActivity(String activityID)
           
 List<String> getAdditionalFederationMethods()
           
 List<org.apache.axis.message.addressing.EndpointReferenceType> getAdditionalFederations()
           
 Document getAtomFeed(String atomFeed, String serviceBase)
          Return notices from the service as an Atom feed.
 org.apache.axis.message.addressing.EndpointReferenceType getEPR(String conversationID)
          We have to override the GridServiceLite method here because it assumes that GridResources have the conversationID (String) as their primary key in the DB.
 List<String> getFederatedMethods()
           
 MatchRule[] getOwnerRules()
          Deprecated. 
 ResourcePool getResourcePool()
           
 ResourcePool getResourcePool(org.hibernate.Session session)
           
 org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
          List the resources managed by this service for which the caller has some role.
protected  Class<? extends GridResource> getResourceType(String resourceID)
          Return the class of this resource's bean.
 SLA getSLA(String slaID)
           
 SLA getSLALocal(String resourceId)
           
protected  org.apache.axis.message.addressing.EndpointReferenceType[] getSLAResources()
           
 String getSLAState()
          Gets the state of an SLA
 SLATemplate getSLATemplate()
          Get the template details.
 SLATemplate getSLATemplate(org.hibernate.Session session, String resourceID)
           
 SLATemplate getSLATemplate(String slaID)
           
 SLATemplate getSLATemplateAdmin(String slaID)
           
 SLATemplate getSLATerms()
          Gets the Terms for an SLA
 SLAUsageSummary getUsage(Date start, Date end, long reportInterval, long maxReports)
          Gets usage reports from an sla
 SLAUsageSummary getUsage(String conversationID, Date start, Date end, long reportInterval, long maxReports)
           
 Document getUsageSummary()
          Deprecated. 
 Document getUsageSummary(String conversationID)
           
 MatchRule[] getUserRules()
          Deprecated. 
 void publishSLATemplate()
          Publish an SLA Template.
 void publishSLATemplate(String resourceID)
           
 String registerMetrics(Document xmlDoc)
           
 void reloadConfiguration()
          Reload the configuration.
 void removeIdFromTemplateXML(Element template)
           
 void removeOwnerRule(MatchRule rule)
          Deprecated. 
 void removeUserRule(MatchRule rule)
          Deprecated. 
 Document RequestSecurityToken_Validation(Element request)
          Validate security tokens.
 void resumeSLAInternal(String resourceID)
           
 void resumeSLALocal(String slaID)
           
 void setAdditionalFederation(org.apache.axis.message.addressing.EndpointReferenceType[] federations, String[] methods)
           
 String setCapacity(Document xmlDoc)
           
 void setLabel(String label)
          Change the resource's label.
 void startActivity(org.apache.axis.message.addressing.EndpointReferenceType activityEPR, Constraint[] cons, UsageReport[] usage)
          Check that an activity should be started.
 void suspendSLAInternal(String resourceID)
           
 void suspendSLALocal(String slaID)
           
 void withdrawSLATemplate()
          Withdraw (unpublish) an SLA Template.
 void withdrawSLATemplate(String resourceID)
           
 
Methods inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
addHibernatedObject, addPolicyRule, addTrustedAccountService, deleteHibernatedObject, generateEPR, getAvailableSignals, getConversationFromContext, getCurrentUser, getEPR, getManagingConversation, getPolicyRules, getPrivateKey, getResourceFromEPR, GetResourceProperty, getResources, getResources, getResourcesFromEPRs, getSelectedRegistries, getServiceDatabaseKey, getServiceFromEPR, getServiceMatchPattern, getServiceProviderCertificate, getServiceProviderID, getServiceProviderIssuer, getTrustedAccountServices, getValidRoles, loadLocalRegistry, removePolicyRule, removeTrustedAccountService, RequestSecurityToken_Issuance, RequestSecurityToken, setLabel, signal, toMatchRules, validateOwner
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.management.ManagedGridService
addTrustedAccountService, getTrustedAccountServices, removeTrustedAccountService
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.wsrf.WSRFService
GetResourceProperty
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.GridService
getServiceProviderID, getServiceProviderIssuer
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.IdentifiableResource
getServiceMatchPattern
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.PolicyManagement
addPolicyRule, getPolicyRules, getValidRoles, removePolicyRule
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.ResourceMetadata
getEPR
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.comms.wstrust.WSTrust
RequestSecurityToken
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.Signallable
getAvailableSignals, signal
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.PolicyManagement
addPolicyRule, getPolicyRules, getValidRoles, removePolicyRule
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.Signallable
getAvailableSignals, signal
 

Field Detail

SLA_RESOURCE_TYPE

public static final String SLA_RESOURCE_TYPE
See Also:
Constant Field Values

SLA_SERVICE_RESOURCE_TYPE

public static final String SLA_SERVICE_RESOURCE_TYPE
See Also:
Constant Field Values

SLA_MANAGED_SERVICES

public static final String SLA_MANAGED_SERVICES
A group name for the group of services that are trusted by the SLA manager to call startActivity(...), continueActivity(...) etc.

See Also:
Constant Field Values

SLA_GROUP_SERVICE_ADMINS

public static final String SLA_GROUP_SERVICE_ADMINS
See Also:
Constant Field Values
Constructor Detail

SLAServiceImpl

public SLAServiceImpl()
               throws RemoteException
Throws:
RemoteException
Method Detail

disablePolling

public void disablePolling()
Used by unit tests.


reloadConfiguration

public void reloadConfiguration()
                         throws Exception
Reload the configuration. Used by the admin tool.

Throws:
Exception

ensurePoliciesDeployed

public void ensurePoliciesDeployed()
                            throws RemoteException
Description copied from interface: WebAdmin
Ensure that any required PBAC policies are deployed.

Specified by:
ensurePoliciesDeployed in interface WebAdmin
Throws:
RemoteException

registerMetrics

public String registerMetrics(Document xmlDoc)
                       throws XPathExpressionException
Throws:
XPathExpressionException

getSLATemplateAdmin

public SLATemplate getSLATemplateAdmin(String slaID)
                                throws RemoteException
Throws:
RemoteException

getSLATerms

public SLATemplate getSLATerms()
                        throws RemoteException
Description copied from interface: SLAResource
Gets the Terms for an SLA

Specified by:
getSLATerms in interface SLAResource
Throws:
RemoteException

getSLATemplate

public SLATemplate getSLATemplate()
                           throws RemoteException
Description copied from interface: SLATemplateResource
Get the template details.

Specified by:
getSLATemplate in interface SLATemplateResource
Throws:
RemoteException

getSLATemplate

public SLATemplate getSLATemplate(String slaID)
                           throws RemoteException
Throws:
RemoteException

getResourceType

protected Class<? extends GridResource> getResourceType(String resourceID)
                                                 throws RemoteException
Description copied from class: GridServiceLite
Return the class of this resource's bean. Override this in subclasses if your service is contextualised. Often, resourceID can be ignored as each service only manages one type of bean anyway.

Overrides:
getResourceType in class GridServiceLite
Throws:
RemoteException

getEPR

public org.apache.axis.message.addressing.EndpointReferenceType getEPR(String conversationID)
                                                                throws RemoteException
We have to override the GridServiceLite method here because it assumes that GridResources have the conversationID (String) as their primary key in the DB. That is not the case with SLAs which use a long.

Overrides:
getEPR in class GridServiceLite
Throws:
RemoteException
See Also:
GridServiceLite.getEPR()

getSLATemplate

public SLATemplate getSLATemplate(org.hibernate.Session session,
                                  String resourceID)
                           throws RemoteException
Throws:
RemoteException

getSLA

public SLA getSLA(String slaID)
           throws RemoteException
Throws:
RemoteException

getActivity

public Activity getActivity(String activityID)
                     throws RemoteException
Throws:
RemoteException

getResourcePool

public ResourcePool getResourcePool(org.hibernate.Session session)

ensureSingleResourcePoolExists

public void ensureSingleResourcePoolExists()

getResourcePool

public ResourcePool getResourcePool()

setCapacity

public String setCapacity(Document xmlDoc)
                   throws RemoteException,
                          XPathExpressionException
Throws:
RemoteException
XPathExpressionException

createSLATemplate

public org.apache.axis.message.addressing.EndpointReferenceType createSLATemplate(Document doc,
                                                                                  MatchRule owner)
                                                                           throws RemoteException
Description copied from interface: SLAService
Create a new SLA Template.

Specified by:
createSLATemplate in interface SLAService
Parameters:
doc - the document to create the SLA Template from
owner - a match rule to identify the owner of the SLA Template in future
Returns:
the EPR of the new SLA Template
Throws:
RemoteException

removeIdFromTemplateXML

public void removeIdFromTemplateXML(Element template)

createSLATemplateFromDoc

public String createSLATemplateFromDoc(Document xmlDoc,
                                       MatchRule owner)
                                throws RemoteException
Throws:
RemoteException

createSLA

public org.apache.axis.message.addressing.EndpointReferenceType createSLA(SLAProposal terms,
                                                                          String label,
                                                                          MatchRule owner)
                                                                   throws RemoteException
Description copied from interface: SLAService
Create a new agreement.

Specified by:
createSLA in interface SLAService
Parameters:
terms - a filled-in SLA Proposal
label - a label to use for the SLA
owner - a match rule to identify the owner of the SLA in future
Returns:
the EPR of the new SLA
Throws:
RemoteException

createSLALocal

public String createSLALocal(MatchRule owner,
                             String label,
                             SLAProposal terms,
                             Conversation managingConversation)
                      throws RemoteException
Throws:
RemoteException

publishSLATemplate

public void publishSLATemplate(String resourceID)
                        throws RemoteException
Throws:
RemoteException

publishSLATemplate

public void publishSLATemplate()
                        throws RemoteException
Description copied from interface: SLATemplateResource
Publish an SLA Template.

Specified by:
publishSLATemplate in interface SLATemplateResource
Throws:
RemoteException

withdrawSLATemplate

public void withdrawSLATemplate(String resourceID)
                         throws RemoteException
Throws:
RemoteException

withdrawSLATemplate

public void withdrawSLATemplate()
                         throws RemoteException
Description copied from interface: SLATemplateResource
Withdraw (unpublish) an SLA Template.

Specified by:
withdrawSLATemplate in interface SLATemplateResource
Throws:
RemoteException

deleteSLATemplate

public void deleteSLATemplate(String resourceID)
                       throws RemoteException
Throws:
RemoteException

deleteSLATemplate

public void deleteSLATemplate()
                       throws RemoteException
Throws:
RemoteException

closeSLALocal

public void closeSLALocal(String slaID)
                   throws RemoteException,
                          GridErrorException
Throws:
RemoteException
GridErrorException

forceCloseSLALocal

public void forceCloseSLALocal(String slaID)
                        throws RemoteException,
                               GridErrorException
Throws:
RemoteException
GridErrorException

forceCloseSLAInternal

public void forceCloseSLAInternal(String slaID)
                           throws RemoteException,
                                  GridErrorException
Throws:
RemoteException
GridErrorException

closeSLAInternal

public void closeSLAInternal(String resourceID)
                      throws RemoteException
Throws:
RemoteException

finishActivityInternal

public void finishActivityInternal(String activityID)
                            throws RemoteException
Throws:
RemoteException

finishServiceInternal

public void finishServiceInternal(String endpoint)
                           throws RemoteException
Throws:
RemoteException

closeSLA

public void closeSLA()
              throws RemoteException
Description copied from interface: SLAResource
Close an SLA

Specified by:
closeSLA in interface SLAResource
Throws:
RemoteException

suspendSLALocal

public void suspendSLALocal(String slaID)
                     throws RemoteException,
                            GridErrorException
Throws:
RemoteException
GridErrorException

suspendSLAInternal

public void suspendSLAInternal(String resourceID)
                        throws RemoteException
Throws:
RemoteException

resumeSLALocal

public void resumeSLALocal(String slaID)
                    throws RemoteException,
                           GridErrorException
Throws:
RemoteException
GridErrorException

resumeSLAInternal

public void resumeSLAInternal(String resourceID)
                       throws RemoteException,
                              GridErrorException
Throws:
RemoteException
GridErrorException

checkUser

public boolean checkUser(SubjectDescription user)
                  throws RemoteException
Description copied from interface: SLAResource
Test whether this user has the 'user' role.

Specified by:
checkUser in interface SLAResource
Parameters:
user - user to test.
Returns:
true if this is a valid user of the SLA, or false if not
Throws:
RemoteException - if the caller is not permitted to check

RequestSecurityToken_Validation

public Document RequestSecurityToken_Validation(Element request)
                                         throws RemoteException
Description copied from class: GridServiceLite
Validate security tokens. Called by GridServiceLite.RequestSecurityToken(org.w3c.dom.Element) for validation requests.

Overrides:
RequestSecurityToken_Validation in class GridServiceLite
Throws:
RemoteException

startActivity

public void startActivity(org.apache.axis.message.addressing.EndpointReferenceType activityEPR,
                          Constraint[] cons,
                          UsageReport[] usage)
                   throws RemoteException
Description copied from interface: SLAResource
Check that an activity should be started.

Specified by:
startActivity in interface SLAResource
Parameters:
activityEPR - the new resource (must implement ReportAPI port type).
cons - requirements
Throws:
RemoteException - if the activity should not be started

continueActivity

public void continueActivity(org.apache.axis.message.addressing.EndpointReferenceType activityEPR,
                             Constraint[] cons)
                      throws RemoteException
Description copied from interface: SLAResource
Checks that a change in an activity should be permitted.

Specified by:
continueActivity in interface SLAResource
Parameters:
activityEPR - the new resource (must implement ReportAPI port type).
cons - the new requirements
Throws:
RemoteException - if the change should be refused

getAtomFeed

public Document getAtomFeed(String atomFeed,
                            String serviceBase)
                     throws RemoteException
Return notices from the service as an Atom feed.

Specified by:
getAtomFeed in interface WebAdmin
Parameters:
atomFeed - the URL of the feed
serviceBase - the service administration URL (for creating hyperlinks)
Throws:
RemoteException
See Also:
AtomUtils

getAccount

public TradeAccountConversation getAccount(org.apache.axis.message.addressing.EndpointReferenceType epr)

getResources

public org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
                                                                        throws RemoteException
Description copied from interface: GridService
List the resources managed by this service for which the caller has some role.

Specified by:
getResources in interface GridService
Throws:
RemoteException

getSLAResources

protected org.apache.axis.message.addressing.EndpointReferenceType[] getSLAResources()
                                                                              throws RemoteException
Throws:
RemoteException

getSLAState

public String getSLAState()
                   throws RemoteException
Description copied from interface: SLAResource
Gets the state of an SLA

Specified by:
getSLAState in interface SLAResource
Throws:
RemoteException

addOwnerRule

@Deprecated
public void addOwnerRule(MatchRule rule)
                  throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
Add a rule controlling who has the 'owner' role.

Specified by:
addOwnerRule in interface SLAResource
Parameters:
rule - the rule to add
Throws:
RemoteException

removeOwnerRule

@Deprecated
public void removeOwnerRule(MatchRule rule)
                     throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
Remove a rule controlling who has the 'owner' role.

Specified by:
removeOwnerRule in interface SLAResource
Parameters:
rule - the rule to add
Throws:
RemoteException

getOwnerRules

@Deprecated
public MatchRule[] getOwnerRules()
                          throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
List the current rules used to determine whether someone has the 'owner' role (which allows them to charge to this account.

Specified by:
getOwnerRules in interface SLAResource
Throws:
RemoteException

addUserRule

@Deprecated
public void addUserRule(MatchRule rule)
                 throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
Enable access to an SLA to another user

Specified by:
addUserRule in interface SLAResource
Parameters:
rule - the rule to add
Throws:
RemoteException

removeUserRule

@Deprecated
public void removeUserRule(MatchRule rule)
                    throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
Disable access to an SLA for a user

Specified by:
removeUserRule in interface SLAResource
Parameters:
rule - the rule to add
Throws:
RemoteException

getUserRules

@Deprecated
public MatchRule[] getUserRules()
                         throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
List the current rules used to determine whether someone has the 'user' role (which allows them to charge to this account.

Specified by:
getUserRules in interface SLAResource
Throws:
RemoteException

getUsage

public SLAUsageSummary getUsage(Date start,
                                Date end,
                                long reportInterval,
                                long maxReports)
                         throws RemoteException
Description copied from interface: SLAResource
Gets usage reports from an sla

Specified by:
getUsage in interface SLAResource
Parameters:
start - the start time of the usage interval to request.
end - the end time of the usage interval to request.
reportInterval - the specified time between reports in milliseconds.
maxReports - the max number of reports to return.
Throws:
RemoteException

getUsage

public SLAUsageSummary getUsage(String conversationID,
                                Date start,
                                Date end,
                                long reportInterval,
                                long maxReports)
                         throws RemoteException
Throws:
RemoteException

getUsageSummary

@Deprecated
public Document getUsageSummary()
                         throws RemoteException
Deprecated. 

Description copied from interface: SLAResource
Old way to get usage.

Specified by:
getUsageSummary in interface SLAResource
Throws:
RemoteException

getUsageSummary

public Document getUsageSummary(String conversationID)
                         throws RemoteException
Throws:
RemoteException

getSLALocal

public SLA getSLALocal(String resourceId)

setLabel

public void setLabel(String label)
              throws RemoteException
Description copied from interface: ResourceMetadata
Change the resource's label. Each resource is given a label by the client when it is created. This label is returned in the metadata from getResources, making it easier for other users to identify the resource.

Specified by:
setLabel in interface ResourceMetadata
Overrides:
setLabel in class GridServiceLite
Parameters:
label - the new label
Throws:
RemoteException

destroy

public void destroy()
             throws ResourceUnknownFault,
                    ResourceNotDestroyedFault,
                    RemoteException
Specified by:
destroy in interface WSResourceLifetime
Throws:
ResourceUnknownFault
ResourceNotDestroyedFault
RemoteException

getAdditionalFederations

public List<org.apache.axis.message.addressing.EndpointReferenceType> getAdditionalFederations()
Specified by:
getAdditionalFederations in interface ManagedGridService

getAdditionalFederationMethods

public List<String> getAdditionalFederationMethods()
Specified by:
getAdditionalFederationMethods in interface ManagedGridService

setAdditionalFederation

public void setAdditionalFederation(org.apache.axis.message.addressing.EndpointReferenceType[] federations,
                                    String[] methods)
                             throws RemoteException
Specified by:
setAdditionalFederation in interface ManagedGridService
Throws:
RemoteException

getFederatedMethods

public List<String> getFederatedMethods()
Specified by:
getFederatedMethods in interface ManagedGridService


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