com.sun.xml.registry.common
Class BulkResponseImpl

java.lang.Object
  extended by com.sun.xml.registry.common.JAXRResponseImpl
      extended by com.sun.xml.registry.common.BulkResponseImpl
All Implemented Interfaces:
BulkResponse, JAXRResponse

public class BulkResponseImpl
extends JAXRResponseImpl
implements BulkResponse

Implementation of BulkResponse.

Author:
Farrukh S. Najmi
See Also:

Field Summary
 
Fields inherited from class com.sun.xml.registry.common.JAXRResponseImpl
requestId, status
 
Fields inherited from interface javax.xml.registry.JAXRResponse
STATUS_FAILURE, STATUS_SUCCESS, STATUS_UNAVAILABLE, STATUS_WARNING
 
Constructor Summary
BulkResponseImpl()
           
 
Method Summary
 void addCollection(Collection bCollection)
          Helper method for adding to the response's already existing collection.
 void addException(Collection bException)
          Add multiple exceptions to exception collection.
 void addException(JAXRException except)
          Add single exception to exceptions collection.
static BulkResponse combineBulkResponses(Collection responses)
          Utility method for combining the contents of many bulk responses into one.
 Collection getCollection()
          Get the Collection of of objects returned as a response of a bulk operation.
 Collection getExceptions()
          Get the JAXRException in case of partial commit.
 boolean isPartialResponse()
          Returns true if the reponse is a partial response due to a large result set.
 void setCollection(Collection collection)
          Set the collection of the bulk response.
 void setExceptions(Collection bException)
          Add multiple exceptions to exception collection.
 void setPartialResponse(boolean isPartial)
          Sets isPartial, which is true in the case of a large result set.
 void setPartialResponse(String isPartial)
          Bindings classes return a string rather than boolean, which is passed here to set isPartial.
 void updateResponse(BulkResponse update)
          Updates information in BulkResponse in the case of asynchronous connection.
 
Methods inherited from class com.sun.xml.registry.common.JAXRResponseImpl
getRequestId, getStatus, isAvailable, setRequestId, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.xml.registry.JAXRResponse
getRequestId, getStatus, isAvailable
 

Constructor Detail

BulkResponseImpl

public BulkResponseImpl()
Method Detail

getCollection

public Collection getCollection()
                         throws JAXRException
Get the Collection of of objects returned as a response of a bulk operation. This method should block when the response content is not yet available.

Specified by:
getCollection in interface BulkResponse
Returns:
Collection of RegistryObject instances. The Collection may be empty but not null.
Throws:
JAXRException - If the JAXR provider encounters an internal error
See Also:
RegistryObject

setCollection

public void setCollection(Collection collection)
Set the collection of the bulk response. This should only be set before sending to the client. Setting the collection after returning to the client should be done through the updateResponse() method.


addCollection

public void addCollection(Collection bCollection)
Helper method for adding to the response's already existing collection. This method should only be called before returning the response to the client.


getExceptions

public Collection getExceptions()
                         throws JAXRException
Get the JAXRException in case of partial commit. Return null if none. This method should block when the response content is not yet available.

Specified by:
getExceptions in interface BulkResponse
Returns:
Collection of RegistryException instances. Return null if result is available and there is no RegistryException.
Throws:
JAXRException - If the JAXR provider encounters an internal error
See Also:
RegistryException

addException

public void addException(Collection bException)
Add multiple exceptions to exception collection. This method should only be called before returning the response to the client.


setExceptions

public void setExceptions(Collection bException)
Add multiple exceptions to exception collection. This method should only be called before returning the response to the client.


addException

public void addException(JAXRException except)
Add single exception to exceptions collection. This method should only be called before returning the response to the client.


isPartialResponse

public boolean isPartialResponse()
                          throws JAXRException
Returns true if the reponse is a partial response due to a large result set.

Specified by:
isPartialResponse in interface BulkResponse
Returns:
true if the response is partial; false otherwise
Throws:
JAXRException - If the JAXR provider encounters an internal error

setPartialResponse

public void setPartialResponse(boolean isPartial)
                        throws JAXRException
Sets isPartial, which is true in the case of a large result set. This should be set before setting the collection when creating the bulk response.

Throws:
JAXRException

setPartialResponse

public void setPartialResponse(String isPartial)
                        throws JAXRException
Bindings classes return a string rather than boolean, which is passed here to set isPartial. This should be set before setting the collection when creating a bulk response.

Throws:
JAXRException

updateResponse

public void updateResponse(BulkResponse update)
                    throws JAXRException
Updates information in BulkResponse in the case of asynchronous connection. If connection is asynchronous, the response should be sent with status = STATUS_UNAVAILABLE. The provider calls the update method to store the information, reset the status, and notify() the thread in case a client has called a method resulting in a wait() until the information is available.

Throws:
JAXRException

combineBulkResponses

public static BulkResponse combineBulkResponses(Collection responses)
Utility method for combining the contents of many bulk responses into one. This is useful for JAXR calls that will include multiple calls to the registry for information. If any of the given responses have isPartial set to true, then the returned response will have isPartial set to true as well. This method does not set requestId on the returned bulk response. Status for the returned response is determined after the information has been filled in as follows: 1. default = STATUS_SUCCESS 2. if partial, STATUS_WARNING 3. if exceptions.size() > 0, STATUS_FAILURE

Parameters:
responses - A Collection of BulkResponses
Returns:
A BulkResponse containing all the included information


Copyright © 2005-2013 Oracle Corporation. All Rights Reserved.