org.purl.sword.base
Class ServiceDocument

java.lang.Object
  extended by org.purl.sword.base.ServiceDocument

public class ServiceDocument
extends Object

A representation of a SWORD Service Document. http://www.ukoln.ac.uk/repositories/digirep/index/SWORD_APP_Profile_0.5

Author:
Stuart Lewis, Neil Taylor

Constructor Summary
ServiceDocument()
          Create a new instance and set the initial service level to Zero.
ServiceDocument(Service service)
          Create a new instance and store the specified Service document.
ServiceDocument(String version)
          Create a new instance and set the specified service level.
 
Method Summary
 Service getService()
          Retrieve the Service object associated with this document.
 String marshall()
          Marshall the data in the Service element and generate a String representation.
 void setService(Service service)
          Set the service object associated with this document.
 String toString()
          Return the Service Document in it's XML form.
 void unmarshall(nu.xom.Element element)
          Unmarshall the specified element.
 SwordValidationInfo unmarshall(nu.xom.Element element, Properties validationProperties)
          Unmarshall the specified element, and return the generated validation information.
 void unmarshall(String xml)
          Convert the specified XML string into a set of objects used within the service.
 SwordValidationInfo unmarshall(String xml, Properties validationProperties)
           
 SwordValidationInfo validate()
           
 SwordValidationInfo validate(Properties validationContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceDocument

public ServiceDocument()
Create a new instance and set the initial service level to Zero.


ServiceDocument

public ServiceDocument(String version)
Create a new instance and set the specified service level.

Parameters:
version - The SWORD version.

ServiceDocument

public ServiceDocument(Service service)
Create a new instance and store the specified Service document.

Parameters:
service - The Service object.
Method Detail

setService

public void setService(Service service)
Set the service object associated with this document.

Parameters:
service - The new Service object.

getService

public Service getService()
Retrieve the Service object associated with this document.

Returns:
The Service object.

toString

public String toString()
Return the Service Document in it's XML form.

Overrides:
toString in class Object
Returns:
The ServiceDocument

marshall

public String marshall()
Marshall the data in the Service element and generate a String representation. The returned string is UTF-8 format.

Returns:
A string of XML, or null if there was an error marshalling the data.

unmarshall

public void unmarshall(String xml)
                throws UnmarshallException
Convert the specified XML string into a set of objects used within the service. A new Service object will be created and stored. This will dispose of any previous Service object associated with this object.

Parameters:
xml - The XML string.
Throws:
UnmarshallException - If there was a problem unmarshalling the data. This might be as a result of an error in parsing the XML string, extracting information.

unmarshall

public SwordValidationInfo unmarshall(String xml,
                                      Properties validationProperties)
                               throws UnmarshallException
Parameters:
xml -
validationProperties -
Returns:
Throws:
UnmarshallException

unmarshall

public void unmarshall(nu.xom.Element element)
                throws UnmarshallException
Unmarshall the specified element. This version does not generate any valiation information.

Parameters:
element -
Throws:
UnmarshallException

unmarshall

public SwordValidationInfo unmarshall(nu.xom.Element element,
                                      Properties validationProperties)
                               throws UnmarshallException
Unmarshall the specified element, and return the generated validation information.

Parameters:
element -
validationProperties -
Returns:
Throws:
UnmarshallException

validate

public SwordValidationInfo validate()

validate

public SwordValidationInfo validate(Properties validationContext)


Copyright © 2010 DuraSpace. All Rights Reserved.