org.openxri.xml
Class Service

java.lang.Object
  extended by org.openxri.xml.Service
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
AuthenticationService, AuthorityResolutionService, ContactService, DefaultService, ForwardingService, ProxyResolutionService, XDIService

public class Service
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This class describes the Service XML element used for XRI Authority resolution.

Author:
=chetan, =wil, =peacekeeper
See Also:
Serialized Form

Constructor Summary
Service()
          Contructs an empty Service element
Service(org.w3c.dom.Element oElem)
          This method constructs the object from DOM.
 
Method Summary
 void addLocalID(LocalID localId)
           
 void addMediaType(SEPMediaType mtype)
           
 void addMediaType(java.lang.String sVal)
          Adds a media type to this Service
 void addMediaType(java.lang.String sVal, java.lang.String match, java.lang.Boolean select)
          Adds a media type to this Service with attributes
 void addPath(SEPPath path)
           
 void addPath(java.lang.String sPath)
          Adds a URI to the service
 void addPath(java.lang.String sPath, java.lang.String match, java.lang.Boolean select)
          Adds a URI to the service with attributes
 void addRedirect(Redirect redirect)
           
 void addRef(Ref ref)
           
 void addType(SEPType type)
           
 void addType(java.lang.String sVal)
          Adds a type to this Service
 void addType(java.lang.String sVal, java.lang.String match, java.lang.Boolean select)
          Adds a type to this Service with attributes
 void addURI(SEPUri uri)
          Adds an SEPUri object to the list of URIs
 void addURI(java.lang.String sURI)
          Adds a URI to the service
 void addURI(java.lang.String sURI, java.lang.Integer priority, java.lang.String append)
          Adds a URI to the service with attributes
 java.lang.Object clone()
           
 java.lang.String dump()
          Returns object as a formatted XML string.
 boolean equals(java.lang.Object o)
           
 void fromDOM(org.w3c.dom.Element oElem)
          This method populates the object from DOM.
 java.lang.String getExtension()
           
 org.apache.xml.security.keys.KeyInfo getKeyInfo()
          Returns the key info element
 LocalID getLocalIDAt(int n)
           
 java.lang.String getMediaType()
          Deprecated.  
 SEPMediaType getMediaTypeAt(int n)
          Returns the media type at the given index.
 java.util.List getMediaTypes()
           
 int getNumLocalIDs()
           
 int getNumMediaTypes()
          Returns the number of media types in this service
 int getNumPaths()
          Returns the number of URIs
 int getNumRedirects()
           
 int getNumRefs()
           
 int getNumTypes()
          Returns the number of types in this service
 int getNumURIs()
          Returns the number of URIs
 java.util.HashMap getOtherChildrenVectorMap()
           
 java.util.Vector getOtherTagValues(java.lang.String sTag)
          Returns unspecified simple elements in the Service by Tag
 SEPPath getPathAt(int n)
          Get a Servie Path
 java.util.List getPaths()
           
 java.util.ArrayList getPrioritizedRedirects()
           
 java.util.ArrayList getPrioritizedRefs()
           
 java.util.ArrayList getPrioritizedURIs()
          Returns the URIs in sorted in priority order
 java.lang.Integer getPriority()
           
 java.lang.String getProviderId()
          Returns the authority id element value
 Redirect getRedirectAt(int n)
           
 java.util.Vector getRedirects()
           
 Ref getRefAt(int n)
           
 java.util.Vector getRefs()
           
 java.lang.String getType()
          Deprecated.  
 SEPType getTypeAt(int n)
          Returns the type at the given index.
 java.util.List getTypes()
           
 SEPUri getURI()
          Deprecated.  
 SEPUri getURIAt(int n)
          Returns the URI at the given index
 SEPUri getURIForScheme(java.lang.String sScheme)
          Returns the first URI for the given scheme
 java.util.List getURIs()
          Returns the a vector of URIs
 boolean matchType(java.lang.String sVal)
          Deprecated.  
 void reset()
          Resets the internal state of this object
 void setExtension(java.lang.String extension)
           
 void setKeyInfo(org.apache.xml.security.keys.KeyInfo oKeyInfo)
          Sets the key info element
 void setMediaType(java.lang.String sVal)
          Deprecated.  
 void setMediaTypes(java.util.List mediaTypes)
           
 boolean setOtherTagValues(java.lang.String sTag, java.lang.String sTagValue)
          Stores simple elements in the Service by Tag Here we are converting the String object that is being passed into XML Element before storing it into otherChildrenVectorMap Vector.
 void setPaths(java.util.List paths)
           
 void setPrioritizedURIs(PrioritizedList prioritizedURIs)
           
 void setPriority(java.lang.Integer priority)
           
 void setPriority(java.lang.String priority)
           
 void setProviderId(java.lang.String val)
          Sets the authority id element value
 void setType(java.lang.String sVal)
          Deprecated.  
 void setTypes(java.util.List types)
           
 void setURIs(java.util.List uris)
           
 org.w3c.dom.Node toDOM(org.w3c.dom.Document oDoc)
          This method will make DOM using the specified document.
 org.w3c.dom.Node toDOM(org.w3c.dom.Document doc, boolean wantFiltered)
          This method will make DOM using the specified document.
 java.lang.String toString()
          Returns formatted object.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Service

public Service()
Contructs an empty Service element


Service

public Service(org.w3c.dom.Element oElem)
        throws java.net.URISyntaxException
This method constructs the object from DOM. It does not keep a copy of the DOM around. Whitespace information is lost in this process.

Throws:
java.net.URISyntaxException
Method Detail

reset

public void reset()
Resets the internal state of this object


fromDOM

public void fromDOM(org.w3c.dom.Element oElem)
             throws java.net.URISyntaxException
This method populates the object from DOM. It does not keep a copy of the DOM around. Whitespace information is lost in this processs.

Throws:
java.net.URISyntaxException

getMediaType

public java.lang.String getMediaType()
Deprecated. 

Returns the media type element value


getNumMediaTypes

public int getNumMediaTypes()
Returns the number of media types in this service


getMediaTypeAt

public SEPMediaType getMediaTypeAt(int n)
Returns the media type at the given index.


setMediaType

public void setMediaType(java.lang.String sVal)
Deprecated. 

Sets the media type element value


addMediaType

public void addMediaType(java.lang.String sVal)
Adds a media type to this Service


addMediaType

public void addMediaType(java.lang.String sVal,
                         java.lang.String match,
                         java.lang.Boolean select)
Adds a media type to this Service with attributes


getType

public java.lang.String getType()
Deprecated. 

Returns the type element value


getNumTypes

public int getNumTypes()
Returns the number of types in this service


getTypeAt

public SEPType getTypeAt(int n)
Returns the type at the given index.


setType

public void setType(java.lang.String sVal)
Deprecated. 

Sets the type element value


addType

public void addType(java.lang.String sVal)
Adds a type to this Service


addType

public void addType(java.lang.String sVal,
                    java.lang.String match,
                    java.lang.Boolean select)
Adds a type to this Service with attributes


matchType

public boolean matchType(java.lang.String sVal)
Deprecated. 

Returns true if the given type is equivalent to the type of this service. TODO - this should probably compare the normalized type rather than performing a straight string comparison. Also, there may be multiple types associated with a service.


getNumURIs

public int getNumURIs()
Returns the number of URIs


getURI

public SEPUri getURI()
Deprecated. 

Returns the first URI


getURIAt

public SEPUri getURIAt(int n)
Returns the URI at the given index


getURIForScheme

public SEPUri getURIForScheme(java.lang.String sScheme)
Returns the first URI for the given scheme


getURIs

public java.util.List getURIs()
Returns the a vector of URIs


getPrioritizedURIs

public java.util.ArrayList getPrioritizedURIs()
Returns the URIs in sorted in priority order

Returns:

addURI

public void addURI(java.lang.String sURI)
Adds a URI to the service


addURI

public void addURI(java.lang.String sURI,
                   java.lang.Integer priority,
                   java.lang.String append)
Adds a URI to the service with attributes


addURI

public void addURI(SEPUri uri)
Adds an SEPUri object to the list of URIs

Parameters:
uri -

getPathAt

public SEPPath getPathAt(int n)
Get a Servie Path


addPath

public void addPath(java.lang.String sPath)
Adds a URI to the service


addPath

public void addPath(java.lang.String sPath,
                    java.lang.String match,
                    java.lang.Boolean select)
Adds a URI to the service with attributes


getNumPaths

public int getNumPaths()
Returns the number of URIs


getProviderId

public java.lang.String getProviderId()
Returns the authority id element value


setProviderId

public void setProviderId(java.lang.String val)
Sets the authority id element value


setKeyInfo

public void setKeyInfo(org.apache.xml.security.keys.KeyInfo oKeyInfo)
Sets the key info element


getKeyInfo

public org.apache.xml.security.keys.KeyInfo getKeyInfo()
Returns the key info element


setOtherTagValues

public boolean setOtherTagValues(java.lang.String sTag,
                                 java.lang.String sTagValue)
Stores simple elements in the Service by Tag Here we are converting the String object that is being passed into XML Element before storing it into otherChildrenVectorMap Vector. The reason we are doing this is, we need to preserve NameSpaces, and also support a scenario where a Child Element under Service Element, can have Sub Elements. With this it will preserve all the Text Nodes under the Sub Element.

Parameters:
sTag - - The tag name. Needs to be the Fully Qualified Name of the XML Element. For Example "usrns1:info1" or "info1" (If not using NameSpaces)
sTagValue - - The tag values. Needs to be valid XML String like -- "Newton"
Returns:
-- Boolean - -True if the String could be Successfully Parsed and Stored, Else it will return false

getOtherTagValues

public java.util.Vector getOtherTagValues(java.lang.String sTag)
Returns unspecified simple elements in the Service by Tag

Parameters:
sTag - - The tag name to get values for
Returns:
a vector of text values whose element tag names match sTag

setExtension

public void setExtension(java.lang.String extension)
                  throws java.net.URISyntaxException,
                         java.text.ParseException
Throws:
java.net.URISyntaxException
java.text.ParseException

getExtension

public java.lang.String getExtension()

toDOM

public org.w3c.dom.Node toDOM(org.w3c.dom.Document oDoc)
This method will make DOM using the specified document. If any DOM state has been stored with the object, it will not be used in this method. This method generates a reference-free copy of new DOM.

Parameters:
oDoc - - The document to use for generating DOM

toDOM

public org.w3c.dom.Node toDOM(org.w3c.dom.Document doc,
                              boolean wantFiltered)
This method will make DOM using the specified document. If any DOM state has been stored with the object, it will not be used in this method. This method generates a reference-free copy of new DOM.

Parameters:
doc - - The document to use for generating DOM
wantFiltered - - If true, the URIs will be sorted according to priority

toString

public java.lang.String toString()
Returns formatted object. Do not use if signature needs to be preserved.

Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()
Returns object as a formatted XML string.

Parameters:
sTab - - The characters to prepend before each new line

getPriority

public java.lang.Integer getPriority()
Returns:
Returns the priority.

setPriority

public void setPriority(java.lang.Integer priority)
Parameters:
priority - The priority to set.

setPriority

public void setPriority(java.lang.String priority)
Parameters:
priority - The priority to set.

getMediaTypes

public java.util.List getMediaTypes()
Returns:
Returns the mediaTypes.

getOtherChildrenVectorMap

public java.util.HashMap getOtherChildrenVectorMap()
Returns:
Returns the otherChildrenVectorMap.

getPaths

public java.util.List getPaths()
Returns:
Returns the paths.

getTypes

public java.util.List getTypes()
Returns:
Returns the types.

addType

public void addType(SEPType type)

addMediaType

public void addMediaType(SEPMediaType mtype)

addPath

public void addPath(SEPPath path)

setPrioritizedURIs

public void setPrioritizedURIs(PrioritizedList prioritizedURIs)
Parameters:
prioritizedURIs - The prioritizedURIs to set.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

setURIs

public void setURIs(java.util.List uris)
Parameters:
uris - The uris to set.

setMediaTypes

public void setMediaTypes(java.util.List mediaTypes)
Parameters:
mediaTypes - The mediaTypes to set.

setPaths

public void setPaths(java.util.List paths)
Parameters:
paths - The paths to set.

setTypes

public void setTypes(java.util.List types)
Parameters:
types - The types to set.

getRefs

public java.util.Vector getRefs()
Returns:
Returns a copy of the collection of Refs in the order as it appears in the original XRD

getRefAt

public Ref getRefAt(int n)

getNumRefs

public int getNumRefs()

addRef

public void addRef(Ref ref)

getPrioritizedRefs

public java.util.ArrayList getPrioritizedRefs()

getRedirects

public java.util.Vector getRedirects()
Returns:
Returns a copy of the collection of Redirects in the order as it appears in the original XRD

getRedirectAt

public Redirect getRedirectAt(int n)

getNumRedirects

public int getNumRedirects()

addRedirect

public void addRedirect(Redirect redirect)

getPrioritizedRedirects

public java.util.ArrayList getPrioritizedRedirects()

getNumLocalIDs

public int getNumLocalIDs()

getLocalIDAt

public LocalID getLocalIDAt(int n)

addLocalID

public void addLocalID(LocalID localId)

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object


Copyright © 2005-2012. All Rights Reserved.