uk.ac.soton.itinnovation.grid.service.data
Class DataServiceModule

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
      extended by uk.ac.soton.itinnovation.grid.service.data.DataServiceModule
All Implemented Interfaces:
DataService, DataServiceSOAP, DataStagerResource, LocalDataService, ManagedGridService, ReportAPI, WebAdmin, WSResourceLifetime, WSRFService, GridService, PolicyManagement, ResourceMetadata, Signallable

public class DataServiceModule
extends GridServiceLite
implements LocalDataService


Field Summary
static String DATA_SERVICE_RESOURCE_TYPE
           
 
Fields inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
management, NO_ACCOUNT_NEEDED, pdp, thisServiceAddress
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.data.DataStagerResource
DATA_RESOURCE_TYPE
 
Fields inherited from interface uk.ac.soton.itinnovation.grid.comms.management.ManagedGridService
FREE_SERVICE
 
Constructor Summary
DataServiceModule()
           
 
Method Summary
 void addOwnerRule(MatchRule rule)
          Deprecated. 
 void adoptFileLocal(String resourceID, File data)
          Adopt 'data' into stager.
protected  void chargeForUsage(TradeAccountConversation account, String resourceID, SubjectDescription user, BigDecimal amount, String currency, String message)
          Charge usage to an account.
 DataStagerStatus checkData()
          Reports on the status of the data stager.
 DataStagerStatus checkDataLocal(String conversationID)
          Reports on the status of a data stager.
 boolean checkReadAccess(SubjectDescription delegate)
          Checks if the quoted delegate may read from this data stager.
 boolean checkWriteAccess(SubjectDescription delegate)
          Checks if the quoted delegate may write to this data stager
 void copyFrom(org.apache.axis.message.addressing.EndpointReferenceType source)
          Copy data from another data stager.
 void copyFromLocal(String conversationID, org.apache.axis.message.addressing.EndpointReferenceType source)
          Copy data from another data stager.
 void copyFromURL(String source)
          Copy data from a normal web resource identified by a URL.
 void copyFromURLInternal(String conversationID, String source)
           
 void copyFromURLLocal(String conversationID, String source)
          Copy data from a resource identified by a URL.
 void copyOrLinkLocal(String resourceID, File destination)
          Copy the contents of resourceID to destination or, if possible, hard-link instead.
 void copyTo(org.apache.axis.message.addressing.EndpointReferenceType target)
          Copy data to another data stager.
 void copyToInternal(String conversationID, SubjectDescription user, org.apache.axis.message.addressing.EndpointReferenceType target)
           
 void copyToLocal(String conversationID, SubjectDescription user, org.apache.axis.message.addressing.EndpointReferenceType target)
          Copy data to another data stager.
 org.apache.axis.message.addressing.EndpointReferenceType createStagingArea(String label, MatchRule owner)
          Create a new staging area.
 void deleteContents()
          Delete data in the staging area.
 void deleteContentsInternal(String dataResourceID)
           
 void destroy()
          WSResource lifetime destroy
 void destroyLocal(String resourceId)
           
 void disableR(MatchRule delegate)
          Deprecated. 
 void disableW(MatchRule delegate)
          Deprecated. 
 void enableR(MatchRule delegate)
          Deprecated. 
 void enableW(MatchRule delegate)
          Deprecated. 
 void ensurePoliciesDeployed()
          Ensure that any required PBAC policies are deployed.
 void finishData()
          Deprecated. 
 void finishDataLocal(String resourceID)
          Like finishData, but takes the conversation as an argument instead of getting it from the process context.
 Document getAtomFeed(String atomFeed, String serviceBase)
          Return notices from the service as an Atom feed.
 MatchRule[] getManagerRules()
          Deprecated. 
 NotificationMessage[] getMessages()
          Returns all usage messages
 NotificationMessage[] getMessagesN(int MaximumNumber)
          Returns usage messages
 MatchRule[] getOwnerRules()
          Deprecated. 
 MatchRule[] getReaderRules()
          Deprecated. 
 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.
 MatchRule[] getWriterRules()
          Deprecated. 
 String initStagingAreaLocal(MatchRule user, String label, org.apache.axis.message.addressing.EndpointReferenceType ownerEPR, String eventListenerClassName, boolean internal)
          Create a new empty data stager managed not by a managing service, but a proxy class.
 String initStagingAreaLocal(MatchRule user, String label, StorableInStateRepository managingConversation, boolean internal)
          Create a new empty data stager.
 javax.activation.DataHandler read()
          Read data from the stager.
 void reloadConfiguration()
          Reload the configuration.
 void removeOwnerRule(MatchRule rule)
          Deprecated. 
 void save(javax.activation.DataHandler data)
          Store data in the stager.
 void writeEnable()
          Write enable the staging area.
 void writeProtect()
          Write protect the staging area.
 
Methods inherited from class uk.ac.soton.itinnovation.grid.service.utils.gridservit.GridServiceLite
addHibernatedObject, addPolicyRule, addTrustedAccountService, deleteHibernatedObject, generateEPR, getAvailableSignals, getConversationFromContext, getCurrentUser, getEPR, getEPR, getManagingConversation, getPolicyRules, getPrivateKey, getResourceFromEPR, GetResourceProperty, getResources, getResources, getResourcesFromEPRs, getServiceFromEPR, getServiceProviderCertificate, getServiceProviderID, getServiceProviderIssuer, getTrustedAccountServices, getValidRoles, removePolicyRule, removeTrustedAccountService, RequestSecurityToken_Issuance, RequestSecurityToken_Validation, RequestSecurityToken, setLabel, setLabel, signal, 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.data.LocalDataService
getEPR
 
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, setLabel
 
Methods inherited from interface uk.ac.soton.itinnovation.grid.types.Signallable
getAvailableSignals, signal
 
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
 

Field Detail

DATA_SERVICE_RESOURCE_TYPE

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

DataServiceModule

public DataServiceModule()
Method Detail

reloadConfiguration

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

Throws:
Exception - if the configuration is not yet valid
GridFailureException

ensurePoliciesDeployed

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

Specified by:
ensurePoliciesDeployed in interface WebAdmin
Throws:
GridFailureException

createStagingArea

public org.apache.axis.message.addressing.EndpointReferenceType createStagingArea(String label,
                                                                                  MatchRule owner)
                                                                           throws RemoteException
Description copied from interface: DataService
Create a new staging area.

Specified by:
createStagingArea in interface DataService
Parameters:
label - label for new stager
owner - A rule to allow access for the owner role
Returns:
the End Point Reference of the new resource
Throws:
RemoteException

initStagingAreaLocal

public String initStagingAreaLocal(MatchRule user,
                                   String label,
                                   org.apache.axis.message.addressing.EndpointReferenceType ownerEPR,
                                   String eventListenerClassName,
                                   boolean internal)
                            throws RemoteException
Description copied from interface: LocalDataService
Create a new empty data stager managed not by a managing service, but a proxy class. In some situations the author of a service may want to use data stagers internally to contain information (eg. the job service uses data stagers to hold inputs and outputs to the job). Using this method allows the service author to define a proxy class to send usage reports to, so that they can be aggregated from all data stagers and sent in one go. The service class should implement the DataEventListener interface and be supplied as the eventListener argument to this method.

Specified by:
initStagingAreaLocal in interface LocalDataService
Parameters:
user - the initial policy; the role can be "owner", "manager", "reader" or "writer"
label - label for new stager
ownerEPR - the EPR of a resource that "owns" this stager. A conversation using this EPR will be passed to the eventListener implementation when an event occurs. The service can then call getEndpointRef to retreive it.
eventListenerClassName - the full class name of an implementation of DataEventListener
internal - stager is part of another resource (e.g., the output of a job). This should be true when using this method
Returns:
the new resourceID
Throws:
RemoteException

initStagingAreaLocal

public String initStagingAreaLocal(MatchRule user,
                                   String label,
                                   StorableInStateRepository managingConversation,
                                   boolean internal)
                            throws RemoteException
Description copied from interface: LocalDataService
Create a new empty data stager. This is used by initStagingArea(), and directly by the job service. 'user' gets the given role, but must be able to bill to accountEPR. It does NOT check that managingConversation is trusted or that the user has permission to use it Internal resources are not returned by getResources() and cannot be destroyed via the public interface.

Specified by:
initStagingAreaLocal in interface LocalDataService
Parameters:
user - the initial policy; the role can be "owner", "manager", "reader" or "writer"
label - label for new stager
managingConversation - an SLAConversation or TradeAccountConversation to manage this resource, or null if free
internal - stager is part of another resource (e.g., the output of a job)
Returns:
the new resourceID
Throws:
RemoteException

save

public void save(javax.activation.DataHandler data)
          throws RemoteException
Description copied from interface: DataStagerResource
Store data in the stager.

Specified by:
save in interface DataStagerResource
Parameters:
data - - data handler for the SOAP attachment
Throws:
RemoteException

read

public javax.activation.DataHandler read()
                                  throws GridFailureException
Description copied from interface: DataStagerResource
Read data from the stager.

Specified by:
read in interface DataStagerResource
Returns:
DataHandler
Throws:
GridFailureException

copyFrom

public void copyFrom(org.apache.axis.message.addressing.EndpointReferenceType source)
              throws GridFailureException
Description copied from interface: DataStagerResource
Copy data from another data stager.

Specified by:
copyFrom in interface DataStagerResource
Parameters:
source - the data stager from which the data will be fetched
Throws:
GridFailureException

copyFromLocal

public void copyFromLocal(String conversationID,
                          org.apache.axis.message.addressing.EndpointReferenceType source)
                   throws GridFailureException
Description copied from interface: LocalDataService
Copy data from another data stager.

Specified by:
copyFromLocal in interface LocalDataService
Parameters:
conversationID - the resource ID of the local data stager into which data will be copied
source - the data stager from which the data will be fetched
Throws:
GridFailureException

copyFromURL

public void copyFromURL(String source)
                 throws GridFailureException
Description copied from interface: DataStagerResource
Copy data from a normal web resource identified by a URL. If the protocol is HTTPS then this service provider needs to trust the CA for the source's certificate. For HTTP and FTP protocols, there is no security (integrity or confidentiality). Note: to copy from a GRIA data stager, use DataStagerResource.copyFrom(org.apache.axis.message.addressing.EndpointReferenceType) instead.

Specified by:
copyFromURL in interface DataStagerResource
Parameters:
source - the source from which the data will be fetched
Throws:
GridFailureException

copyFromURLLocal

public void copyFromURLLocal(String conversationID,
                             String source)
                      throws GridFailureException
Description copied from interface: LocalDataService
Copy data from a resource identified by a URL. If the protocol is HTTPS then this service provider needs to trust the CA for the source's certificate. For HTTP and FTP protocols, there is no security (integrity or confidentiality).

Specified by:
copyFromURLLocal in interface LocalDataService
Parameters:
conversationID - the resource ID of the local data stager into which data will be copied
source - the source URL from which the data will be fetched
Throws:
GridFailureException

copyFromURLInternal

public void copyFromURLInternal(String conversationID,
                                String source)
                         throws GridFailureException
Throws:
GridFailureException

copyTo

public void copyTo(org.apache.axis.message.addressing.EndpointReferenceType target)
            throws GridFailureException
Description copied from interface: DataStagerResource
Copy data to another data stager.

Specified by:
copyTo in interface DataStagerResource
Parameters:
target - the data stager to which this stager's data will be copied
Throws:
GridFailureException

copyToLocal

public void copyToLocal(String conversationID,
                        SubjectDescription user,
                        org.apache.axis.message.addressing.EndpointReferenceType target)
                 throws GridFailureException
Description copied from interface: LocalDataService
Copy data to another data stager.

Specified by:
copyToLocal in interface LocalDataService
Parameters:
conversationID - the resource ID of the local data stager from which data will be copied
user - the SubjectDescription of the user who needs access to the target stager
target - the data stager into which the data will be copied
Throws:
GridFailureException

copyToInternal

public void copyToInternal(String conversationID,
                           SubjectDescription user,
                           org.apache.axis.message.addressing.EndpointReferenceType target)
                    throws GridFailureException
Throws:
GridFailureException

writeEnable

public void writeEnable()
                 throws GridFailureException
Description copied from interface: DataStagerResource
Write enable the staging area.

Specified by:
writeEnable in interface DataStagerResource
Throws:
GridFailureException
See Also:
DataStagerResource.writeProtect()

writeProtect

public void writeProtect()
                  throws GridFailureException
Description copied from interface: DataStagerResource
Write protect the staging area. The save() and delete() operations cannot be performed after this, until writeEnable is used.

Specified by:
writeProtect in interface DataStagerResource
Throws:
GridFailureException

addOwnerRule

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

Description copied from interface: DataStagerResource
Adds a rule to the ACL for the 'owner' role.

Specified by:
addOwnerRule in interface DataStagerResource
Parameters:
rule - the rule to add
Throws:
GridFailureException

removeOwnerRule

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

Description copied from interface: DataStagerResource
Removes a rule from the ACL for the 'owner' role.

Specified by:
removeOwnerRule in interface DataStagerResource
Parameters:
rule - the rule to add
Throws:
GridFailureException

enableR

@Deprecated
public void enableR(MatchRule delegate)
             throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
Enable read for the staging area and a delegate.

Specified by:
enableR in interface DataStagerResource
Parameters:
delegate - - delegate user
Throws:
GridFailureException

disableR

@Deprecated
public void disableR(MatchRule delegate)
              throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
Disable read for the staging area and a delegate.

Specified by:
disableR in interface DataStagerResource
Parameters:
delegate - - delegate user
Throws:
GridFailureException

enableW

@Deprecated
public void enableW(MatchRule delegate)
             throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
Enable write for the staging area and a delegate.

Specified by:
enableW in interface DataStagerResource
Parameters:
delegate - - delegate user
Throws:
GridFailureException

disableW

@Deprecated
public void disableW(MatchRule delegate)
              throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
Disable write for the staging area and a delegate.

Specified by:
disableW in interface DataStagerResource
Parameters:
delegate - - delegate user
Throws:
GridFailureException

getReaderRules

@Deprecated
public MatchRule[] getReaderRules()
                           throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
List the current reader rules.

Specified by:
getReaderRules in interface DataStagerResource
Throws:
GridFailureException

getWriterRules

@Deprecated
public MatchRule[] getWriterRules()
                           throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
List the current writer rules.

Specified by:
getWriterRules in interface DataStagerResource
Throws:
GridFailureException

getManagerRules

@Deprecated
public MatchRule[] getManagerRules()
                            throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
List the current manager rules.

Specified by:
getManagerRules in interface DataStagerResource
Throws:
GridFailureException

getOwnerRules

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

Description copied from interface: DataStagerResource
List the current owner rules.

Specified by:
getOwnerRules in interface DataStagerResource
Throws:
GridFailureException

deleteContents

public void deleteContents()
                    throws GridFailureException
Description copied from interface: DataStagerResource
Delete data in the staging area.

Specified by:
deleteContents in interface DataStagerResource
Throws:
GridFailureException

deleteContentsInternal

public void deleteContentsInternal(String dataResourceID)
                            throws GridFailureException
Throws:
GridFailureException

checkReadAccess

public boolean checkReadAccess(SubjectDescription delegate)
                        throws GridFailureException
Description copied from interface: DataStagerResource
Checks if the quoted delegate may read from this data stager.

Specified by:
checkReadAccess in interface DataStagerResource
Parameters:
delegate - - delegate user
Returns:
boolean - success / failure
Throws:
GridFailureException

checkWriteAccess

public boolean checkWriteAccess(SubjectDescription delegate)
                         throws GridFailureException
Description copied from interface: DataStagerResource
Checks if the quoted delegate may write to this data stager

Specified by:
checkWriteAccess in interface DataStagerResource
Parameters:
delegate - - delegate user
Returns:
boolean - success / failure
Throws:
GridFailureException

checkData

public DataStagerStatus checkData()
                           throws GridFailureException
Description copied from interface: DataStagerResource
Reports on the status of the data stager.

Specified by:
checkData in interface DataStagerResource
Throws:
GridFailureException

checkDataLocal

public DataStagerStatus checkDataLocal(String conversationID)
                                throws GridFailureException
Description copied from interface: LocalDataService
Reports on the status of a data stager.

Specified by:
checkDataLocal in interface LocalDataService
Parameters:
conversationID - The resource ID of the data stager being checked.
Throws:
GridFailureException

finishData

@Deprecated
public void finishData()
                throws GridFailureException
Deprecated. 

Description copied from interface: DataStagerResource
Finishes the staging area.

Specified by:
finishData in interface DataStagerResource
Throws:
GridFailureException

finishDataLocal

public void finishDataLocal(String resourceID)
                     throws GridFailureException
Description copied from interface: LocalDataService
Like finishData, but takes the conversation as an argument instead of getting it from the process context. This allows in-process calls (e.g., from the job service).

Specified by:
finishDataLocal in interface LocalDataService
Throws:
GridFailureException

getResources

public org.apache.axis.message.addressing.EndpointReferenceType[] getResources()
                                                                        throws GridFailureException
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:
GridFailureException

getResourceType

protected Class<? extends GridResource> getResourceType(String resourceID)
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

copyOrLinkLocal

public void copyOrLinkLocal(String resourceID,
                            File destination)
                     throws GridFailureException
Description copied from interface: LocalDataService
Copy the contents of resourceID to destination or, if possible, hard-link instead. Note: if new data is uploaded to the stager, the hard-linked copy will NOT change (a new file is created instead). You MUST NOT modify 'destination' in any way - it is read-only.

Specified by:
copyOrLinkLocal in interface LocalDataService
Throws:
GridFailureException - if the stager doesn't exist or is empty.

adoptFileLocal

public void adoptFileLocal(String resourceID,
                           File data)
                    throws GridFailureException
Adopt 'data' into stager. Picks a temporary file name in the data directory and renames 'data' to it. The stager has ownership of the file, and will unlink it when the stager is finished. The file's contents will not be modified (it will become read-only), but the filename 'data' will no longer exist when this call returns.

Specified by:
adoptFileLocal in interface LocalDataService
Parameters:
resourceID - stager which will aquire data, must be empty on entry
data - existing file to be adopted, must be on same filesystem as data root
Throws:
GridFailureException

getAtomFeed

public Document getAtomFeed(String atomFeed,
                            String serviceBase)
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)
See Also:
AtomUtils

chargeForUsage

protected void chargeForUsage(TradeAccountConversation account,
                              String resourceID,
                              SubjectDescription user,
                              BigDecimal amount,
                              String currency,
                              String message)
                       throws GridFailureException
Charge usage to an account. Note: to avoid deadlocks, you MUST NOT hold a database connection (hibernate session) while calling this.

Parameters:
resourceID - the resource being used
user - the person using the stager
amount - the amount to charge
message - the message for the user's account statement This method doesn't check that the user is authorised to use the account. That is only done when creating a resource, to prevent the problem where we have access to the account but the user doesn't. We don't check after that, because the user may have been granted access by the owner of the new resource, despite not having access to the account.
Throws:
GridFailureException

getMessagesN

public NotificationMessage[] getMessagesN(int MaximumNumber)
Description copied from interface: ReportAPI
Returns usage messages

Specified by:
getMessagesN in interface ReportAPI
Parameters:
MaximumNumber - of messages. If more available returns the first.
Returns:
an array containing usage messages.

getMessages

public NotificationMessage[] getMessages()
Description copied from interface: ReportAPI
Returns all usage messages

Specified by:
getMessages in interface ReportAPI
Returns:
an array containing all usage messages.

destroy

public void destroy()
             throws ResourceNotDestroyedFault
WSResource lifetime destroy

Specified by:
destroy in interface WSResourceLifetime
Throws:
ResourceNotDestroyedFault

destroyLocal

public void destroyLocal(String resourceId)
                  throws GridFailureException
Throws:
GridFailureException


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