org.opcfoundation.ua.transport.endpoint
Class EndpointServiceRequest<Request extends ServiceRequest,Response extends ServiceResponse>

java.lang.Object
  extended by org.opcfoundation.ua.transport.endpoint.EndpointServiceRequest<Request,Response>
Direct Known Subclasses:
PendingRequest

public abstract class EndpointServiceRequest<Request extends ServiceRequest,Response extends ServiceResponse>
extends Object

Asynchronous message exchange. A service request to be processed by a server (as opposed to service request queried by a client).

To send service error use sendResponse(new ServiceFault());


Field Summary
protected  Endpoint endpoint
           
protected  Request request
           
protected  Server server
           
 
Constructor Summary
EndpointServiceRequest(Request request, Server server, Endpoint endpoint)
          Constructor for EndpointServiceRequest.
 
Method Summary
abstract  ServerSecureChannel getChannel()
          getChannel.
 Endpoint getEndpoint()
          Get endpoint
 Request getRequest()
          Get Request.
 Server getServer()
          Get server
 void sendException(Throwable e)
          Convert Throwable into an Service fault and send that to the client.
 void sendFault(ServiceFault fault)
          Send a service fault
abstract  void sendResponse(AsyncWrite response)
          Send response.
abstract  AsyncWrite sendResponse(Response response)
          Send a response.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

server

protected Server server

endpoint

protected Endpoint endpoint

request

protected Request extends ServiceRequest request
Constructor Detail

EndpointServiceRequest

public EndpointServiceRequest(Request request,
                              Server server,
                              Endpoint endpoint)

Constructor for EndpointServiceRequest.

Parameters:
request - a Request object.
server - a Server object.
endpoint - a Endpoint object.
Method Detail

getRequest

public Request getRequest()
Get Request. The request is in Complete state.

Returns:
read request

getServer

public Server getServer()
Get server

Returns:
server

getEndpoint

public Endpoint getEndpoint()
Get endpoint

Returns:
endpoint

sendResponse

public abstract void sendResponse(AsyncWrite response)
Send response.

Parameters:
response - async write wrapping response or ServiceFault

sendResponse

public abstract AsyncWrite sendResponse(Response response)
Send a response.

Parameters:
response - to send, either ServiceFault or ServiceResult
Returns:
monitor for write status

sendFault

public void sendFault(ServiceFault fault)
Send a service fault

Parameters:
fault - error

sendException

public void sendException(Throwable e)
Convert Throwable into an Service fault and send that to the client. NOTE! This is a convenience method that exposes stack trace to the client. Use with care!

Parameters:
e - ServiceResultException or other

getChannel

public abstract ServerSecureChannel getChannel()

getChannel.

Returns:
a ServerSecureChannel object.


Copyright © 2018. All rights reserved.