uk.ac.soton.itinnovation.grid.types
Class ConversationID

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.types.ConversationID

public abstract class ConversationID
extends Object

Utility class for handling EPRs. This class contains methods to create, update and query EPRs. In particular, it handles the label and resource ID elements used by the GRIA services.


Field Summary
static QName BILLING_INFO
          The name of the SOAP header containing an account or SLA.
static String GRID_NS
          XML namespace for some of our elements.
static String GRID_NS_2007
           
static String GRID_NS_2008
           
static PrefixedQName ITI_CONVERSATION_NAME
          The SOAP header element that identifies the primary context.
static QName RESOURCE_JAVA_TYPE_LEGACY
          In GRIA versions before 5.3, we stored the Java interface in the metadata.
static QName RESOURCE_PARENT
           
static String XMLNS_OGSA_BP
          OGSA Basic Profile.
 
Method Summary
static void addAdditionalToken(org.apache.axis.message.addressing.EndpointReferenceType EPR, Element token)
          Add a security token to the EPR's metadata.
static void addKeyInfo(org.apache.axis.message.addressing.EndpointReferenceType EPR, X509Certificate serverCert)
          Add the service's key information.
static org.apache.axis.message.addressing.EndpointReferenceType deserialiseEPR(String xml)
          Construct an EPR from its String XML representation.
static MessageElement[] getAdditionalTokens(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get all extra security tokens.
static String getConversationFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Returns the ConversationID from an EPR, or null if there isn't one.
static String getConversationFromParameters(org.apache.axis.message.addressing.ReferenceParametersType refParams)
          Get a resource ID.
static String getDefaultSLA(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the resource default sla (if any) from the EPR's metadata.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(org.apache.axis.message.addressing.AttributedURI endpoint, String conversationID)
          Construct an EPR with the given address and resource ID.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(Element element)
          Construct an EPR from an XML element representation.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(String URLreference)
          Split URLreference at the '#' and use the fragment as the resource ID.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(String endpoint, String conversationID)
          Construct an EPR with the given address and resource ID.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(URL endpoint, String conversationID)
          Construct an EPR with the given address and resource ID.
static org.apache.axis.message.addressing.EndpointReferenceType getEPR(URL endpoint, String conversationID, String label)
          Create a new EPR.
static Class<?> getJavaType(org.apache.axis.message.addressing.EndpointReferenceType epr)
          Get the Java interface for a remote resource.
static X509Certificate getKeyInfo(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the service's certificate.
static MessageElement getKeyInfo(X509Certificate serverCert)
          Gets a MessageElement containing the service provider's key information.
static String getLabel(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the human-readable label (if any) from the EPR's metadata.
static String getManagingResource(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the managing resource (if any) from the EPR's metadata.
static String getMeta(org.apache.axis.message.addressing.EndpointReferenceType EPR, QName key)
          Return the string contents of the first metadata element with the given name.
static URL getParent(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the parent object's URL
static String getPullPoint(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the pull-point (if any) from the EPR's metadata.
static String getResourceStatus(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the resource status (if any) from the EPR's metadata.
static String getResourceType(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the resource type (if any) from the EPR's metadata.
static Element getTokenSource(org.apache.axis.message.addressing.EndpointReferenceType EPR)
          Get the token source (if any) from the EPR's metadata.
static String getURLFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)
           
static String getURLReferenceFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)
           
static org.apache.axis.message.addressing.EndpointReferenceType sanitised(org.apache.axis.message.addressing.EndpointReferenceType source)
          Return a minimal EPR with just the endpoint, conversation ID and KeyInfo fields.
static void setDefaultSLA(org.apache.axis.message.addressing.EndpointReferenceType EPR, String sla)
          Set the default SLA in the EPR's metadata.
static void setLabel(org.apache.axis.message.addressing.EndpointReferenceType EPR, String label)
           
static void setManagingResource(org.apache.axis.message.addressing.EndpointReferenceType EPR, String managingResource)
          Set the managing resource in the EPR's metadata.
static void setMeta(org.apache.axis.message.addressing.EndpointReferenceType EPR, QName key, String value)
          Set a meta-data element to the given string value.
static void setMetaNode(org.apache.axis.message.addressing.EndpointReferenceType EPR, QName key, Node value)
          Set a meta-data element to the given Node value.
static void setParent(org.apache.axis.message.addressing.EndpointReferenceType EPR, String parent)
          Set the RESOURCE_PARENT metadata element to this value.
static void setParent(org.apache.axis.message.addressing.EndpointReferenceType EPR, URL parent)
          Set the RESOURCE_PARENT metadata element to this value.
static void setPullPoint(org.apache.axis.message.addressing.EndpointReferenceType EPR, String pullpoint)
          Set the pull-point in the EPR's metadata.
static void setResourceStatus(org.apache.axis.message.addressing.EndpointReferenceType EPR, String status)
          Set the resource status in the EPR's metadata.
static void setResourceType(org.apache.axis.message.addressing.EndpointReferenceType EPR, String type)
          Set the resource type in the EPR's metadata.
static void setTokenSource(org.apache.axis.message.addressing.EndpointReferenceType EPR, Element tokenSource)
          Set the token source in the EPR's metadata.
static boolean updateMetadata(org.apache.axis.message.addressing.EndpointReferenceType EPR, org.apache.axis.message.addressing.EndpointReferenceType newEPR)
          Updates an EPR with values from newEPR.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GRID_NS

public static final String GRID_NS
XML namespace for some of our elements.

See Also:
Constant Field Values

GRID_NS_2007

public static final String GRID_NS_2007
See Also:
Constant Field Values

GRID_NS_2008

public static final String GRID_NS_2008
See Also:
Constant Field Values

XMLNS_OGSA_BP

public static final String XMLNS_OGSA_BP
OGSA Basic Profile. Basic Security Profile 1.0 - Core January 31, 2006

See Also:
Constant Field Values

RESOURCE_PARENT

public static final QName RESOURCE_PARENT

RESOURCE_JAVA_TYPE_LEGACY

public static final QName RESOURCE_JAVA_TYPE_LEGACY
In GRIA versions before 5.3, we stored the Java interface in the metadata. This can be used when upgrading.


BILLING_INFO

public static final QName BILLING_INFO
The name of the SOAP header containing an account or SLA. This is typically used when creating a new resource, to indicate where usage of the resource should be reported.


ITI_CONVERSATION_NAME

public static final PrefixedQName ITI_CONVERSATION_NAME
The SOAP header element that identifies the primary context.

Method Detail

getConversationFromEPR

public static String getConversationFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Returns the ConversationID from an EPR, or null if there isn't one.


getURLFromEPR

public static String getURLFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)

getURLReferenceFromEPR

public static String getURLReferenceFromEPR(org.apache.axis.message.addressing.EndpointReferenceType EPR)

getConversationFromParameters

public static String getConversationFromParameters(org.apache.axis.message.addressing.ReferenceParametersType refParams)
Get a resource ID.

Parameters:
refParams - the reference parameters from an EPR to check
Returns:
the value of the first ITI_CONVERSATION_NAME reference parameter, or null if there isn't one

getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(Element element)
Construct an EPR from an XML element representation. If you have the XML in a string then use deserialiseEPR(String).

Parameters:
element - the EPR in an XML Element
Returns:
the EPR

getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(URL endpoint,
                                                                              String conversationID)
Construct an EPR with the given address and resource ID.

Parameters:
endpoint - the service endpoint address
conversationID - the value for the resource ID reference parameter

getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(String endpoint,
                                                                              String conversationID)
Construct an EPR with the given address and resource ID.

Parameters:
endpoint - the service endpoint address
conversationID - the value for the resource ID reference parameter

getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(org.apache.axis.message.addressing.AttributedURI endpoint,
                                                                              String conversationID)
Construct an EPR with the given address and resource ID.

Parameters:
endpoint - the service endpoint address
conversationID - the value for the resource ID reference parameter

getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(String URLreference)
Split URLreference at the '#' and use the fragment as the resource ID. If there is no '#' in the URL, the resulting EPR won't contain a resource ID.


getEPR

public static org.apache.axis.message.addressing.EndpointReferenceType getEPR(URL endpoint,
                                                                              String conversationID,
                                                                              String label)
Create a new EPR. The conversationID is stored as a reference parameter. If label is given, it is stored as a Dublin Core Title element in the EPR's metadata.

Parameters:
endpoint - the address of the service endpoint
conversationID - the unique ID identifying this resource
label - a human-readable name for the resource, or null.

deserialiseEPR

public static org.apache.axis.message.addressing.EndpointReferenceType deserialiseEPR(String xml)
Construct an EPR from its String XML representation.


getLabel

public static String getLabel(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the human-readable label (if any) from the EPR's metadata.

Returns:
the label, or null if there isn't one.

setLabel

public static void setLabel(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                            String label)

getParent

public static URL getParent(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the parent object's URL

Returns:
the parent's URL, or null if there isn't one.

setParent

public static void setParent(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                             URL parent)
Set the RESOURCE_PARENT metadata element to this value. Used by the GRIA client to record parent-child relationships between EPRs, for example.

Parameters:
EPR - the EPR to modify
parent - the URL Reference of the parent (in the form "service#resource")
See Also:
getEPR(String)

setParent

public static void setParent(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                             String parent)
Set the RESOURCE_PARENT metadata element to this value. Used by the GRIA client to record parent-child relationships between EPRs, for example.

Parameters:
EPR - the EPR to modify
parent - the URL Reference of the parent (in the form "service#resource")
See Also:
getEPR(String)

getDefaultSLA

public static String getDefaultSLA(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the resource default sla (if any) from the EPR's metadata.

Returns:
the type, or null if there isn't one.

setDefaultSLA

public static void setDefaultSLA(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                 String sla)
Set the default SLA in the EPR's metadata.


getResourceStatus

public static String getResourceStatus(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the resource status (if any) from the EPR's metadata.

Returns:
the status, or null if there isn't one.

setResourceStatus

public static void setResourceStatus(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                     String status)
Set the resource status in the EPR's metadata.


getResourceType

public static String getResourceType(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the resource type (if any) from the EPR's metadata.

Returns:
the type, or null if there isn't one.

setResourceType

public static void setResourceType(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                   String type)
Set the resource type in the EPR's metadata.


getManagingResource

public static String getManagingResource(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the managing resource (if any) from the EPR's metadata.

Returns:
the URI-reference for the resource, or null if there isn't one.

setManagingResource

public static void setManagingResource(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                       String managingResource)
Set the managing resource in the EPR's metadata.

Parameters:
managingResource - the ID (in the form http://service/...#ConversationID) of the managing resource

getKeyInfo

public static X509Certificate getKeyInfo(org.apache.axis.message.addressing.EndpointReferenceType EPR)
                                  throws org.apache.ws.security.WSSecurityException
Get the service's certificate.

Returns:
the certificate, or null if the EPR doesn't give it
Throws:
org.apache.ws.security.WSSecurityException

getKeyInfo

public static MessageElement getKeyInfo(X509Certificate serverCert)
Gets a MessageElement containing the service provider's key information.

Parameters:
serverCert - the servers X509 Certificate
Returns:
a MessageElement containing the service provider's key

addKeyInfo

public static void addKeyInfo(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                              X509Certificate serverCert)
Add the service's key information. This is used to store the X.509 certificate of the service, so that clients can check the signature, even if the service's certificate isn't globally trusted by them.


getPullPoint

public static String getPullPoint(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the pull-point (if any) from the EPR's metadata.

Returns:
the pull-point, or null if there isn't one.

setPullPoint

public static void setPullPoint(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                String pullpoint)
Set the pull-point in the EPR's metadata.


getTokenSource

public static Element getTokenSource(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get the token source (if any) from the EPR's metadata.

Returns:
the token source, or null if there isn't one.

setTokenSource

public static void setTokenSource(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                  Element tokenSource)
Set the token source in the EPR's metadata.

Parameters:
tokenSource - a WS-Policy Element
See Also:
WSTrustUtils.createTokenSourcePolicy(org.apache.axis.message.addressing.EndpointReferenceType)

getAdditionalTokens

public static MessageElement[] getAdditionalTokens(org.apache.axis.message.addressing.EndpointReferenceType EPR)
Get all extra security tokens. Returns an array of metadata elements with the QName AdditionalSecurityToken.ADDITIONAL_SECURITY_TOKEN.

Returns:
an array containing all metadata elements which are additional tokens
See Also:
addAdditionalToken(org.apache.axis.message.addressing.EndpointReferenceType, org.w3c.dom.Element)

addAdditionalToken

public static void addAdditionalToken(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                      Element token)
Add a security token to the EPR's metadata. This token may be useful to security systems checking a user's access to the EPR.


getMeta

public static String getMeta(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                             QName key)
Return the string contents of the first metadata element with the given name.

Parameters:
EPR - the EPR to search
key - the name of the meta-data element

updateMetadata

public static boolean updateMetadata(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                                     org.apache.axis.message.addressing.EndpointReferenceType newEPR)
Updates an EPR with values from newEPR. If an element doesnt exist in the EPR metadata and exists in the newERP it is added, If an element exists in both EPR, the newEPR value is used

Parameters:
EPR - the EPR to update
newEPR - the EndpointReferenceType with new values
Returns:
boolean value if the EPR was updated

setMetaNode

public static void setMetaNode(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                               QName key,
                               Node value)
Set a meta-data element to the given Node value. If an element with this key already exists, its contents are replaced with this value.

Parameters:
EPR - the EPR to modify
key - the name of the meta-data element to create or update
value - the new value for the element

setMeta

public static void setMeta(org.apache.axis.message.addressing.EndpointReferenceType EPR,
                           QName key,
                           String value)
Set a meta-data element to the given string value. If an element with this key already exists, its contents are replaced with this value.

Parameters:
EPR - the EPR to modify
key - the name of the meta-data element to create or update
value - the new value for the element

sanitised

public static org.apache.axis.message.addressing.EndpointReferenceType sanitised(org.apache.axis.message.addressing.EndpointReferenceType source)
Return a minimal EPR with just the endpoint, conversation ID and KeyInfo fields.


getJavaType

public static Class<?> getJavaType(org.apache.axis.message.addressing.EndpointReferenceType epr)
Get the Java interface for a remote resource.

Parameters:
epr - the EPR for the remote resource, with the type in its metadata
Returns:
an interface If the type isn't known, Object is returned


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