|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.ogsadai.activity.ResponseDocumentBuilder
A ResponseBuilder
to assemble an OGSA-DAI response
document that conforms to the OGSA-DAI response document XML
schema.
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement. |
private static DAILogger |
LOG
Logger object for logging in this class. |
(package private) org.w3c.dom.Document |
mResponse
The response document that is being built. |
(package private) org.w3c.dom.Element |
mRootElement
Reference to the response document's root element for convenience. |
Constructor Summary | |
ResponseDocumentBuilder()
Constructor - creates a skeleton response document. |
Method Summary | |
private void |
addClientException(org.w3c.dom.Document doc,
org.w3c.dom.Element parent,
java.lang.Throwable exception)
This method adds information about an exception arising due to information provided by a client, to an XML document. |
private void |
addClientExceptionAuthz(org.w3c.dom.Document doc,
org.w3c.dom.Element parent,
DAIAuthorizationException exception)
This method adds information about an authorization exception, to an XML document. |
private void |
addClientExceptionDetail(org.w3c.dom.Document doc,
org.w3c.dom.Element parent,
java.lang.Throwable exception)
This method adds information about an exception arising due to information provided by a client, to an XML document. |
private void |
addServerException(org.w3c.dom.Document doc,
org.w3c.dom.Element parent,
java.lang.Throwable exception)
This method adds information about an internal server-side exception, details of which should not be exposed to a client, to an XML document. |
void |
buildError(java.lang.String name,
java.lang.Throwable cause)
Assembles part of the response document describing an error that has occurred while processing part of a request. |
void |
buildRequestError(java.lang.String cause)
Assembles the part of the response document describing the status of a request that has failed due to an error. |
void |
buildRequestStatus(ProcessingStatus status)
Assembles the part of the response document describing the status of the request. |
void |
buildResult(java.lang.String name,
ProcessingStatus status,
byte[] data)
Assembles part of the response document describing the result of processing part of the request. |
void |
buildResult(java.lang.String name,
Status status,
byte[] data)
Assembles part of the response document describing the result of processing part of the request. |
void |
buildSessionDetails(Session session)
Assembles the part of the response document identifying the session that the request was joined to. |
org.w3c.dom.Document |
getResponseDocument()
Gets the assembled response document. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final DAILogger LOG
final org.w3c.dom.Document mResponse
final org.w3c.dom.Element mRootElement
Constructor Detail |
public ResponseDocumentBuilder()
Method Detail |
public void buildResult(java.lang.String name, ProcessingStatus status, byte[] data)
ResponseBuilder
buildResult
in interface ResponseBuilder
name
- The name associated with the resultstatus
- The status of the result.data
- The result data. This may be null
or an empty
String
if the result contains no result data.public void buildResult(java.lang.String name, Status status, byte[] data)
ResponseBuilder
buildResult
in interface ResponseBuilder
name
- The name associated with the resultstatus
- The status of the result.data
- The result data. This may be null
or an empty
array if the result contains no result data.public void buildError(java.lang.String name, java.lang.Throwable cause)
ResponseBuilder
buildError
in interface ResponseBuilder
name
- The name associated with the resultcause
- Cause of the error.public void buildRequestStatus(ProcessingStatus status)
ResponseBuilder
buildRequestStatus
in interface ResponseBuilder
status
- Request status.public void buildRequestError(java.lang.String cause)
ResponseBuilder
buildRequestError
in interface ResponseBuilder
cause
- Name of the cause of the failue e.g. an activity name.public void buildSessionDetails(Session session)
ResponseBuilder
buildSessionDetails
in interface ResponseBuilder
session
- Session the request was joined topublic org.w3c.dom.Document getResponseDocument()
Document
private void addClientException(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.Throwable exception)
The information is in the form of an XML fragment:
<ns1:activityFault xmlns:ns1="http://ogsadai.org.uk/namespaces/2005/10/types"> <ns1:reason> <ns1:errorID>ID</ns1:errorID> <ns1:msg>MESSAGE</ns1:msg> <ns1:params>PARAM-ONE</ns1:params> <ns1:params>PARAM-TWO</ns1:params> </ns1:reason> <ns1:reason> <ns1:errorID>ID</ns1:errorID> <ns1:msg>MESSAGE</ns1:msg> <ns1:params>PARAM-ONE</ns1:params> <ns1:params>PARAM-TWO</ns1:params> </ns1:reason> <ns1:reason> <ns1:errorID>ID</ns1:errorID> <ns1:msg>MESSAGE</ns1:msg> <ns1:params>PARAM-ONE</ns1:params> <ns1:params>PARAM-TWO</ns1:params> </ns1:reason> </ns1:activityFault>
The exception traverses all exceptions in the given train
until either the bottom of the chain is reached or a
DAIAuthorizationException
is reached (in which
case it is not appropriate to give further information).
doc
- XML document to which the information is to be added.parent
- XML element to which the information is to be added, as a
child.exception
- Exception for which the information is to be created.private void addClientExceptionDetail(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.Throwable exception)
The information is in the form of an XML fragment:
<ns1:errorID>ID</ns1:errorID> <ns1:msg>MESSAGE</ns1:msg> <ns1:params>PARAM-ONE</ns1:params> <ns1:params>PARAM-TWO</ns1:params>
doc
- XML document to which the information is to be added.parent
- XML element to which the information is to be added, as a
child.exception
- Exception for which the information is to be created.private void addClientExceptionAuthz(org.w3c.dom.Document doc, org.w3c.dom.Element parent, DAIAuthorizationException exception)
The information is in the form of an XML fragment:
<ns1:errorID> uk.org.ogsadai.AUTHORISATION_FAULT </ns1:errorID> <ns1:msg> Authorisation fault. Consult the OGSA-DAI Service Provider with ID UNIQUE-SERVER-SIDE-ID. </ns1:msg> <ns1:params>UNIQUE-SERVER-SIDE-ID>/ns1:params>
doc
- XML document to which the information is to be added.parent
- XML element to which the information is to be added, as a
child.exception
- Exception for which the information is to be created.private void addServerException(org.w3c.dom.Document doc, org.w3c.dom.Element parent, java.lang.Throwable exception)
The information is in the form of an XML fragment:
<ns1:activityFault xmlns:ns1="http://ogsadai.org.uk/namespaces/2005/10/types"> <ns1:reason> <ns1:errorID>uk.org.ogsadai.INTERNAL_FAULT</ns1:errorID> <ns1:msg> Internal fault. Consult the OGSA-DAI Service Provider with ID UNIQUE-SERVER-SIDE-ID. </ns1:msg> <ns1:params>UNIQUE-SERVER-SIDE-ID>/ns1:params> </ns1:reason> </ns1:activityFault>
doc
- XML document to which the information is to be added.parent
- XML element to which the information is to be added, as a
child.exception
- Exception for which the information is to be created.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |