org.purl.sword.base
Class DepositResponse

java.lang.Object
  extended by org.purl.sword.base.DepositResponse
Direct Known Subclasses:
AtomDocumentResponse

public class DepositResponse
extends Object

Represents a deposit response. This holds the SWORD Entry element.

Author:
Stuart Lewis, Neil Taylor

Constructor Summary
DepositResponse(int httpResponse)
          Create a new response with the specified http code.
 
Method Summary
 SWORDEntry getEntry()
          Get the SWORD Entry
 SWORDErrorDocument getErrorDocument()
          Get the SWORD Entry as an error document
 int getHttpResponse()
          Retrieve the HTTP Response code.
 String getLocation()
          Retrieve the Location header.
 String marshall()
          Marshall the data in the enclosed SWORD Entry.
 void setEntry(SWORDEntry entry)
          Set the entry element for this response.
 void setHttpResponse(int httpResponse)
          Set the HTTP Response code.
 void setLocation(String location)
          Set the HTTP Location header.
 String toString()
          Retrieve a string representation of this data.
 void unmarshall(String xml)
          Unmarshall the specified XML data into a SWORD Entry.
 SwordValidationInfo unmarshall(String xml, Properties validationContext)
           
 void unmarshallErrorDocument(String xml)
           
 SwordValidationInfo unmarshallErrorDocument(String xml, Properties validationContext)
          Unmarshall the specified XML data into a SWORD error document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DepositResponse

public DepositResponse(int httpResponse)
Create a new response with the specified http code.

Parameters:
httpResponse - Response code.
Method Detail

setEntry

public void setEntry(SWORDEntry entry)
Set the entry element for this response.

Parameters:
entry - The SWORD Entry.

getEntry

public SWORDEntry getEntry()
Get the SWORD Entry

Returns:
The entry

getErrorDocument

public SWORDErrorDocument getErrorDocument()
                                    throws SWORDException
Get the SWORD Entry as an error document

Returns:
The error document
Throws:
SWORDException - If this DespositResponse does not contain a SWORDErrorDocumentTest. If this is thrown, then the document stores an Entry.

getHttpResponse

public int getHttpResponse()
Retrieve the HTTP Response code.

Returns:
The response code.

setHttpResponse

public void setHttpResponse(int httpResponse)
Set the HTTP Response code.

Parameters:
httpResponse - The code.

getLocation

public String getLocation()
Retrieve the Location header.

Returns:
The Location header

setLocation

public void setLocation(String location)
Set the HTTP Location header.

Parameters:
location - The Location header.

marshall

public String marshall()
Marshall the data in the enclosed SWORD Entry.

Returns:
The string representation. Null if there was an error.

unmarshall

public void unmarshall(String xml)
                throws UnmarshallException
Unmarshall the specified XML data into a SWORD Entry.

Parameters:
xml - The XML data as a string.
Throws:
UnmarshallException - If there was an error unmarshalling the data.

unmarshall

public SwordValidationInfo unmarshall(String xml,
                                      Properties validationContext)
                               throws UnmarshallException
Throws:
UnmarshallException

unmarshallErrorDocument

public void unmarshallErrorDocument(String xml)
                             throws UnmarshallException
Throws:
UnmarshallException

unmarshallErrorDocument

public SwordValidationInfo unmarshallErrorDocument(String xml,
                                                   Properties validationContext)
                                            throws UnmarshallException
Unmarshall the specified XML data into a SWORD error document.

Parameters:
xml - The XML data as a string.
Throws:
UnmarshallException - If there was an error unmarshalling the data.

toString

public String toString()
Retrieve a string representation of this data. This is equivalent to calling unmarshall().

Overrides:
toString in class Object
Returns:
The marshalled data.


Copyright © 2013 DuraSpace. All Rights Reserved.