Class RequestBundle
java.lang.Object
co.ecg.alpaca.toolkit.messaging.request.RequestBundle
- All Implemented Interfaces:
Supplier<ResponseBundle>
@Component
@Scope("prototype")
public class RequestBundle
extends Object
implements Supplier<ResponseBundle>
The Request Bundle object represents a group of Requests sent to the
BroadWorks Server. These are bundled into a single XML request and returned
as a bundle. The number of requests in a bundle is limited to 15 due to
BroadWorks limitation.
- Author:
- Matthew Keathley
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequest
(Request<?> request) Adds a new request to the bundlevoid
createDocument
(BroadWorksServer broadWorksServer, Request.Protocol protocol) Creates the XML DOM Document for this request bundle.This generates a Response object from a Request.fire()
This generates a Response object from a Request.void
formRequest
(boolean readFromCache) Forms the RequestBundleget()
Get the OCS protocolboolean
isFull()
Checks if the Request Bundle can hold any more elementsboolean
isValid()
Returns True if the Request has no constraint violationssend()
This generates aFuture
message from a Request.This generates a String message from a Request through the givenOCSClient
.void
void
setHandler
(ResponseBundleHandler handler) void
setResponseFuture
(Future<String> responseFuture) toString()
The RequestBundle as transformed into the expected XML messagevalidate()
Returns the set of Constraint Violations for the RequestBundle.
-
Constructor Details
-
RequestBundle
-
-
Method Details
-
addRequest
Adds a new request to the bundle- Parameters:
request
- The Request to be added.- Throws:
RequestException
- Thrown if the Request is invalid or the bundle is too large.
-
createDocument
Creates the XML DOM Document for this request bundle. This is typically called during Request object creation.- Parameters:
broadWorksServer
- The BroadWorksServer for this RequestBundleprotocol
- The Protocol to user for this RequestBundle
-
fire
This generates a Response object from a Request. It reads from the cache if available.- Throws:
RequestException
- Thrown if an error occurs while sending this bundle to BroadWorks.
-
send
This generates aFuture
message from a Request. -
send
This generates a String message from a Request through the givenOCSClient
.- Parameters:
ocsClient
- The OCSClient to send the request through.
-
execute
This generates a Response object from a Request.- Parameters:
ocsClient
- Specify the OCSClient to send this request bundle. If NULL the OCSSwitchboard is used.responseString
- The response string if the request has already been sent- Throws:
RequestException
- Thrown if an error occurs while sending this bundle to BroadWorks.
-
formRequest
public void formRequest(boolean readFromCache) Forms the RequestBundle- Parameters:
readFromCache
- Enables reading from the JCS cache for retrieving the response. Defaults to 'true'.
-
getBroadWorksServer
-
setBroadWorksServer
-
getBroadWorksServerForRequest
-
getRequestBundle
-
setHandler
-
getResponseFuture
-
setResponseFuture
-
getOCSProtocol
Get the OCS protocol- Returns:
- The OCS protocol enum
-
isFull
public boolean isFull()Checks if the Request Bundle can hold any more elements- Returns:
- Returns true if the size of the bundle is greater or equal to 15.
-
isValid
public boolean isValid()Returns True if the Request has no constraint violations- Returns:
- Return true if there are no validation errors for requests in the bundle.
-
toString
The RequestBundle as transformed into the expected XML message -
validate
Returns the set of Constraint Violations for the RequestBundle.- Returns:
- Returns the set of constraint violations for all requests in the bundle.
-
get
- Specified by:
get
in interfaceSupplier<ResponseBundle>
-