|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Communication
public class Communication
Communication support class.
Field Summary | |
---|---|
static int |
REPOLL_INTERVAL
Automatic repolling interval for pending requests, in seconds. |
Constructor Summary | |
---|---|
Communication(XKMSContext context,
URI uri)
Prepares a new communication. |
Method Summary | |
---|---|
String |
getOriginalResult()
Gets original String result message after
removal of wrapping. |
XResultType |
getResult()
Gets result message as imported into library. |
XResultType |
sendAndRetryRequest(XRequestAbstractType request,
TransportMethod method)
See sendRequest . |
XResultType |
sendAndRetryRequest(XRequestAbstractType request,
TransportMethod method,
int timeout)
Send message to an XKMS service and retry on represent/twophase. |
void |
sendSingleRequest(XMessageAbstractType request,
TransportMethod method)
Sends message to an XKMS service and stores the result. |
void |
setCreateOnly(boolean createonly)
Sets option of create only request and let sendRequest terminate immediately. |
void |
setDebugName(String debugnameprefix)
Sets option of dumping ALL requests and responses to specified filename(s). |
void |
setShowProgress(boolean showprogress)
Sets option of showing progress characters on console. |
void |
setShowRawtext(boolean showrawtext)
Sets option of showing full raw requests/responses on console. |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int REPOLL_INTERVAL
Constructor Detail |
---|
public Communication(XKMSContext context, URI uri) throws XKMSException
context
- XKMSContext to use for (un)marshalling.uri
- Remote destination to connect to.
XKMSException
- if passed a null
parameter.Method Detail |
---|
public void sendSingleRequest(XMessageAbstractType request, TransportMethod method) throws Exception
The result can be obtained with getResult()
and getOriginalResult()
.
request
- the message to sendmethod
- type of message wrapping to use
Exception
public XResultType sendAndRetryRequest(XRequestAbstractType request, TransportMethod method, int timeout) throws XKMSException
Convenience method which hides the difficulties of communicating with an XKMS server. It sends the request to specified host and port, performs the represent and pending mechanism (if necessary) and returns the result. If the server insists on performing the result asynchronously, the client will poll the server in regular intervals. The caller can specify how long this should take at maximum by specifying a timeout value (in seconds). When approximately the given time has elapsed and still no result is available, an XKMSException is thrown.
request
- message to sendmethod
- type of message wrapping to usetimeout
- maximum amount of time to poll for a result.
-1
means infinite timeout
XKMSException
- if something goes wrongpublic XResultType sendAndRetryRequest(XRequestAbstractType request, TransportMethod method) throws XKMSException
sendRequest
.
Calls sendAndRetryRequest(XRequestAbstractType, TransportMethod, int)
with timeout=100.
XKMSException
public String getOriginalResult()
String
result message after
removal of wrapping.
The recovery of the raw message is necessary if one wants to store it, as import+reexport of message with the library destroys XML signatures.
public XResultType getResult()
public void setShowProgress(boolean showprogress)
Characters:
s - sending
r - receiving
2 - twophase protocol
w - pending wait
public void setShowRawtext(boolean showrawtext)
public void setCreateOnly(boolean createonly)
public void setDebugName(String debugnameprefix)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |