public class Server extends Object
ServiceRequests queries.
Server is assigned with at least one application instance certificate.
The initial server contains EndpointDiscoveryService by default.
Application,
service handler| Modifier and Type | Field and Description |
|---|---|
protected Application |
application
The application
|
protected List<EndpointServer.EndpointHandle> |
boundHandles
Bound handles
|
protected EndpointBindingCollection |
endpointBindings
Endpoints
|
protected EndpointDiscoveryService |
endpointDiscoveryService
Endpoint discovery service
|
static String |
HTTPS_BINARY_TRANSPORT_PROFILE_URI
Deprecated.
Use
UriUtil.HTTPS_BINARY_TRANSPORT_PROFILE_URI instead |
protected ServiceHandlerComposition |
serviceHandlers
Service Handler
|
static String |
SOAP_XML_TRANSPORT_PROFILE_URI
Deprecated.
Use
UriUtil.SOAP_XML_TRANSPORT_PROFILE_URI instead |
static String |
UATCP_BINARY_TRANSPORT_PROFILE_URI
Deprecated.
Use
UriUtil.UATCP_BINARY_TRANSPORT_PROFILE_URI instead |
protected List<UserTokenPolicy> |
userTokenPolicies
User Token Policies
|
| Constructor and Description |
|---|
Server(Application application)
Constructor for Server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addServiceHandler(Object serviceHandler)
Add Service Handler.
|
void |
addUserTokenPolicy(UserTokenPolicy policy)
addUserTokenPolicy.
|
List<EndpointServer.EndpointHandle> |
bind(String bindAddress,
Endpoint endpointAddress)
Bind an endpoint to the server.
|
List<EndpointServer.EndpointHandle> |
bind(String bindAddress,
String endpointUri,
Collection<SecurityMode> modes) |
List<EndpointServer.EndpointHandle> |
bind(String bindAddress,
String endpointUri,
SecurityMode... modes)
bind.
|
EndpointServer.ReverseEndpointHandle |
bindReverse(ReverseConnectionParameters parameters,
ScheduledExecutorService retryScheduledExecutorService)
Binds a "ReverseHello" pseudo-endpoint to the server.
|
void |
close()
Close the server.
|
ApplicationDescription |
createApplicationDescription()
createApplicationDescription.
|
static Server |
createServerApplication()
createServerApplication.
|
Application |
getApplication()
Getter for the field
application. |
EndpointServer[] |
getBindings()
getBindings.
|
EncoderContext |
getEncoderContext()
getEncoderContext.
|
EndpointBindingCollection |
getEndpointBindings()
Getter for the field
endpointBindings. |
Endpoint |
getEndpointByUri(String uri)
getEndpointByUri.
|
EndpointDescription[] |
getEndpointDescriptions()
getEndpointDescriptions.
|
EndpointDescription[] |
getEndpointDescriptions(SocketAddress requestAddress)
getEndpointDescriptions.
|
Endpoint[] |
getEndpoints()
getEndpoints.
|
EndpointServer |
getOrCreateEndpointServer(String scheme)
getOrCreateEndpointServer.
|
HttpsServer |
getOrCreateHttpsServer()
getOrCreateHttpsServer.
|
OpcTcpServer |
getOrCreateOpcTcpServer()
getOrCreateOpcTcpServer.
|
<T> T |
getServiceHandlerByService(Class<? extends ServiceRequest> requestClass)
Get Service Handler object by service.
|
ServiceHandlerComposition |
getServiceHandlerComposition()
getServiceHandlerComposition.
|
ServiceHandler[] |
getServiceHandlers()
Getter for the field
serviceHandlers. |
UserTokenPolicy[] |
getUserTokenPolicies()
Getter for the field
userTokenPolicies. |
boolean |
handlesService(Class<? extends IEncodeable> requestClass)
Query whether the server can handle a service.
|
boolean |
hasEndpoint(String uri)
hasEndpoint.
|
void |
removeUserTokenPolicy(UserTokenPolicy policy)
removeUserTokenPolicy.
|
void |
setEndpointBindings(EndpointBindingCollection newBindings)
Setter for the field
endpointBindings. |
String |
toString() |
@Deprecated public static final String SOAP_XML_TRANSPORT_PROFILE_URI
UriUtil.SOAP_XML_TRANSPORT_PROFILE_URI insteadSOAP_XML_TRANSPORT_PROFILE_URI="http://opcfoundation.org/UA-Profile/Tra"{trunked}@Deprecated public static final String UATCP_BINARY_TRANSPORT_PROFILE_URI
UriUtil.UATCP_BINARY_TRANSPORT_PROFILE_URI insteadUATCP_BINARY_TRANSPORT_PROFILE_URI="http://opcfoundation.org/UA-Profile/Tra"{trunked}@Deprecated public static final String HTTPS_BINARY_TRANSPORT_PROFILE_URI
UriUtil.HTTPS_BINARY_TRANSPORT_PROFILE_URI insteadHTTPS_BINARY_TRANSPORT_PROFILE_URI="http://opcfoundation.org/UA-Profile/Tra"{trunked}protected ServiceHandlerComposition serviceHandlers
protected List<UserTokenPolicy> userTokenPolicies
protected EndpointBindingCollection endpointBindings
protected EndpointDiscoveryService endpointDiscoveryService
protected Application application
protected List<EndpointServer.EndpointHandle> boundHandles
public Server(Application application)
Constructor for Server.
application - a Application object.public static Server createServerApplication()
createServerApplication.
Server object.public void addServiceHandler(Object serviceHandler)
The serviceHandler is either: (a) an implementation of ServiceHandler (b) an
object that contains methods that implement service requests. These methods are discovered
using Java Reflection.
The following list contains service methods grouped by service sets:
serviceHandler - instanceof ServiceHandler or Object implementing service requestscom.prosysopc.ua.stack.core.AttributeServiceSetHandler,
com.prosysopc.ua.stack.core.DiscoveryServiceSetHandler,
com.prosysopc.ua.stack.core.MethodServiceSetHandler,
com.prosysopc.ua.stack.core.MonitoredItemServiceSetHandler,
com.prosysopc.ua.stack.core.NodeManagementServiceSetHandler,
com.prosysopc.ua.stack.core.SessionServiceSetHandler,
com.prosysopc.ua.stack.core.SubscriptionServiceSetHandler,
The serviceHandler may implement one or more methods. In typical case service
handler implements one service set, e.g.
{@link com.prosysopc.ua.stack.core.SessionServiceSetHandler}.
A {@link com.prosysopc.ua.stack.core.ServiceFault} is returned to the client in case the
server doesn't the requested service method.
Example: addServiceHandler( new TestServiceSetHandler() { void
onTestStack(EndpointServiceRequest<TestStackRequest, TestStackResponse> req) {
req.sendResponse( new ServiceFault() ); } void
onTestStackEx(EndpointServiceRequest<TestStackExRequest, TestStackExResponse> req) {
req.sendFault(new ServiceFault()); } } );
public void addUserTokenPolicy(UserTokenPolicy policy)
addUserTokenPolicy.
policy - a UserTokenPolicy object.public List<EndpointServer.EndpointHandle> bind(String bindAddress, Endpoint endpointAddress) throws ServiceResultException
bindAddress - bind address for the endpointendpointAddress - endpoint to bindServiceResultException - if errorpublic List<EndpointServer.EndpointHandle> bind(String bindAddress, String endpointUri, Collection<SecurityMode> modes) throws ServiceResultException
ServiceResultExceptionpublic List<EndpointServer.EndpointHandle> bind(String bindAddress, String endpointUri, SecurityMode... modes) throws ServiceResultException
bind.
bindAddress - a String object.endpointUri - a String object.modes - a SecurityMode object.List object.ServiceResultException - if any.public EndpointServer.ReverseEndpointHandle bindReverse(ReverseConnectionParameters parameters, ScheduledExecutorService retryScheduledExecutorService) throws ServiceResultException
parameters - for forming and handling the connectionretryScheduledExecutorService - ScheduledExecutorService for reconnecting
schedulingServiceResultException - if any errorpublic void close()
public ApplicationDescription createApplicationDescription()
createApplicationDescription.
ApplicationDescription object.public Application getApplication()
Getter for the field application.
Application object.public EndpointServer[] getBindings()
getBindings.
EndpointServer objects.public EncoderContext getEncoderContext()
getEncoderContext.
EncoderContext object.public EndpointBindingCollection getEndpointBindings()
Getter for the field endpointBindings.
EndpointBindingCollection object.public EndpointDescription[] getEndpointDescriptions()
getEndpointDescriptions.
EndpointDescription objects.public EndpointDescription[] getEndpointDescriptions(SocketAddress requestAddress)
getEndpointDescriptions.
requestAddress - a SocketAddress object.EndpointDescription objects.public EndpointServer getOrCreateEndpointServer(String scheme) throws ServiceResultException
getOrCreateEndpointServer.
scheme - a String object.EndpointServer object.ServiceResultException - if any.public HttpsServer getOrCreateHttpsServer() throws ServiceResultException
getOrCreateHttpsServer.
HttpsServer object.ServiceResultException - if any.public OpcTcpServer getOrCreateOpcTcpServer() throws ServiceResultException
getOrCreateOpcTcpServer.
OpcTcpServer object.ServiceResultException - if any.public <T> T getServiceHandlerByService(Class<? extends ServiceRequest> requestClass)
For example, to acquire session manager: SessionManager sessionManager = x.getServiceHandlerByService( CreateSessionRequest.class );
T - service handler typerequestClass - Service request classpublic ServiceHandlerComposition getServiceHandlerComposition()
getServiceHandlerComposition.
ServiceHandlerComposition object.public ServiceHandler[] getServiceHandlers()
Getter for the field serviceHandlers.
ServiceHandler objects.public UserTokenPolicy[] getUserTokenPolicies()
Getter for the field userTokenPolicies.
UserTokenPolicy objects.public boolean handlesService(Class<? extends IEncodeable> requestClass)
requestClass - request class of the service, e.g. ReadRequestpublic boolean hasEndpoint(String uri)
hasEndpoint.
uri - a String object.public void removeUserTokenPolicy(UserTokenPolicy policy)
removeUserTokenPolicy.
policy - a UserTokenPolicy object.public void setEndpointBindings(EndpointBindingCollection newBindings)
Setter for the field endpointBindings.
newBindings - a
EndpointBindingCollection object.Copyright © 2026. All rights reserved.