public class UaServer extends UaApplication
init() for it after you have specified the
security settings and endpointUrls to which you wish to bind it.
The endpoints are defined either as a list of URLs or even simpler by setting the Port and
ServerName. The current host name of the server where the application is run is added to the list
of URLs automatically. If you define UseLocalhost, the URL with the 'localhost' host name is also
added to the list of Urls.
Note: Because the java stack currently only supports the OPC Binary protocol, you cannot define a
port for the HTTP protocol.
By default, the server will contain a SessionManager, AttributeManager, SubscriptionManager and
NodeManagerTable, which contains the NodeManagerRoot and the NodeManagerServer.
Use addNodeManager to add your own nodes into the server: do not add nodes to the NodeManagerRoot
or NodeManagerServer.
You can also use addServiceHandler to add handlers for services that are not handled by the
default implementation. However, you should take care that each service only has one handler in
the server.
If you wish to replace the service handlers with your custom implementation, you must derive your
own version of the server and override initServiceHandlers.
After you have finished with all initializations, call start() to make the server
available for client connections, and to start the managers.| Modifier and Type | Class and Description |
|---|---|
class |
UaServer.DiscoveryServer
Service handler that serves onFindServers & onRegisteredServer requests.
|
static class |
UaServer.NodeManagerUaServer
Server internal namespace (NamespaceIndex 1).
|
UaApplication.DiagnosticMask, UaApplication.Protocol| Modifier and Type | Field and Description |
|---|---|
protected ApplicationIdentity |
applicationIdentity |
protected AttributeServiceHandler |
attributeServiceHandler |
protected DiagnosticsManager |
diagnosticsManager |
protected Set<String> |
discoveryUris |
protected ScheduledExecutorService |
executor |
protected Set<SecurityMode> |
httpsSecurityModes |
protected Set<String> |
httpsUris |
protected UaServerListener |
listener |
protected NodeManagerRoot |
nodeManagerRoot |
protected NodeManagerTable |
nodeManagerTable |
protected UaServer.NodeManagerUaServer |
nodeManagerUaServer |
protected NodeManagementServiceHandler |
nodeServiceHandler |
protected Set<SecurityMode> |
securityModes |
protected Set<String> |
serverUris |
protected SessionManager |
sessionManager |
protected SessionManagerListener |
sessionManagerListener |
protected SessionServiceHandler |
sessionServiceHandler |
protected SubscriptionManager |
subscriptionManager |
protected SubscriptionServiceHandler |
subscriptionServiceHandler |
| Constructor and Description |
|---|
UaServer()
Creates a new UA Server.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEndpoint(String uri,
SecurityMode securityMode,
UserTokenPolicy... userTokenPolicies)
Add an endpoint definition for a specific URI, SecurityMode & UserTokenPolicies combination
You should call addEndpoint after
init() has been called. |
String[] |
addEndpointHost(String hostName)
Add a specific hostName to the list of server URIs, in addition to what the default properties
define.
|
void |
addLocale(Locale locale) |
void |
addReverseConnection(ReverseConnectionParameters parameters)
Adds a ReverseHello connection.
|
void |
addReverseConnection(String clientServerEndpointUrl)
Adds a ReverseHello connection.
|
void |
addReverseConnection(String clientServerEndpointUrl,
String endpointUrlForClientConnection)
Adds a ReverseHello connection.
|
void |
addServiceHandler(Object serviceHandler)
Add a custom serviceHandler.
|
void |
addToServerArray(String uri)
Add a server description to the serverArray.
|
void |
addUserTokenPolicy(UserTokenPolicy policy) |
void |
close() |
protected AttributeServiceHandler |
createAttributeServiceHandler()
Creates the AttributeServiceHandler to use for the server.
|
protected DiagnosticsManager |
createDiagnosticsManager() |
protected ScheduledExecutorService |
createExecutor()
This is called when a executor would be created for the UaServer.
|
protected UaLoopbackClient |
createLoopbackClient(Consumer<EndpointServiceRequest<?,?>> requestConsumer)
Creates a new
UaLoopbackClient using the given consumer. |
protected NodeManager |
createNewNodeManager(ServiceContext serviceContext,
String namespaceUri)
Creates a new node manager as a response to an AddNodes request with a NodeId that is not
managed by any node managers, yet.
|
protected NodeManagementServiceHandler |
createNodeManagementServiceHandler()
Return
NodeManagementServiceHandler, this can be used to override the
NodeManagementServiceHandler used by the server by returning a custom subtype. |
protected NodeManagerRoot |
createNodeManagerRoot()
Return
NodeManagerRoot, this can be used to override the NodeManagerRoot used
by the server by returning a custom subtype. |
protected NodeManagerTable |
createNodeManagerTable()
Return
NodeManagerTable, this can be used to override the NodeManagerTable used
by the server by returning a custom subtype. |
protected UaServer.NodeManagerUaServer |
createNodeManagerUaServer(String applicationUri)
Return
UaServer.NodeManagerUaServer, this can be used to override the
UaServer.NodeManagerUaServer used by the server by returning a custom subtype. |
protected SessionManager |
createSessionManager()
Return
SessionManager, this can be used to override the SessionManager used by
the server by returning a custom subtype. |
protected SessionServiceHandler |
createSessionServiceHandler()
Return
SessionServiceHandler, this can be used to override the
SessionServiceHandler used by the server by returning a custom subtype. |
protected SubscriptionManager |
createSubscriptionManager()
Return
SubscriptionManager, this can be used to override the
SubscriptionManager used by the server by returning a custom subtype. |
protected SubscriptionServiceHandler |
createSubscriptionServiceHandler()
Return
SubscriptionServiceHandler, this can be used to override the
SubscriptionServiceHandler used by the server by returning a custom subtype. |
NodeManagerTable |
getAddressSpace() |
ApplicationIdentity |
getApplicationIdentity()
Returns the
ApplicationIdentity of this UaServer. |
AttributeServiceHandler |
getAttributeServiceHandler()
Returns the
AttributeServiceHandler of this UaServer. |
Set<InetAddress> |
getBindAddresses()
Returns the InetAddresses the server should be bound to listen.
|
Set<InetAddress> |
getBindAddresses(UaApplication.Protocol protocol)
Get the addresses to bind the server endpoints that use a specific protocol.
|
DiagnosticsManager |
getDiagnosticsManager() |
protected UaServer.DiscoveryServer |
getDiscoveryServer() |
UaAddress |
getDiscoveryServerAddress() |
long |
getDiscoveryServerRegistrationPeriod()
The period used for re-registering to the Discovery Server.
|
SecurityMode |
getDiscoveryServerRegistrationSecurityMode() |
String |
getDiscoveryServerUrl() |
protected String |
getDiscoveryUriOf(String uri) |
EncoderContext |
getEncoderContext() |
EndpointDescription |
getEndpoint(String uri,
SecurityMode securityMode)
Find an endpoint definition for a specific URI & SecurityMode combination
|
EndpointConfiguration |
getEndpointConfiguration() |
String[] |
getEndpointHosts()
Get all EndpointHosts defined with
addEndpointHost(String). |
EndpointDescription[] |
getEndpoints()
Get the list of endpoints.
|
EndpointDescription[] |
getEndpoints(String uri)
Find all endpoint definitions for a specific URI
|
static UnsignedByte |
getEndpointSecurityLevel(SecurityMode sm)
Calculate the SecurityLevel of the SecurityMode.
|
protected ScheduledExecutorService |
getExecutor() |
String[] |
getHostNames()
Deprecated.
Use
getEndpointHosts() instead. |
protected int |
getHttpsPort() |
Set<SecurityMode> |
getHttpsSecurityModes() |
protected HttpsSecurityPolicy[] |
getHttpsSecurityPolicies() |
HttpsSettings |
getHttpsSettings() |
int |
getHttpsWorkerThreadCount() |
UaServerListener |
getListener() |
Locale[] |
getLocales() |
UaLoopbackClient |
getLoopbackClient()
Returns an
UaClient, that is directly connected (java-internally) to this Server. |
Integer |
getMaxOpcHttpsConnections()
|
Integer |
getMaxOpcTcpConnections()
|
NodeManagementServiceHandler |
getNodeManagementServiceHandler()
Returns the
NodeManagementServiceHandler of this UaServer. |
NodeManagerRoot |
getNodeManagerRoot()
Returns
NodeManagerRoot, the NamespaceIndex 0 NodeManager of this UaServer. |
NodeManagerTable |
getNodeManagerTable()
Deprecated.
|
UaServer.NodeManagerUaServer |
getNodeManagerUaServer() |
int |
getPort()
The port in which the server is listening to the OPC Binary protocol.
|
int |
getPort(UaApplication.Protocol protocol)
Get the protocol specific TCP/IP port number.
|
PubSubConfigurator |
getPubSubConfigurator()
This method is designed for SDK internal use only, but it is called from other packages thus
being public.
|
Set<SecurityMode> |
getSecurityModes()
Live set to the security modes the server supports for the opc.tcp endpoints.
|
protected Server |
getServer() |
String |
getServerName() |
String |
getServerName(UaApplication.Protocol protocol)
Get the protocol specific serverName definition.
|
ServerTable |
getServerTable()
Returns the server's ServerTable (from node
VariableIdentifiers.Server_ServerArray). |
String[] |
getServerUris()
The endpoint URIs to which the server listens to.
|
SessionManager |
getSessionManager() |
SessionServiceHandler |
getSessionServiceHandler() |
SubscriptionManager |
getSubscriptionManager() |
SubscriptionServiceHandler |
getSubscriptionServiceHandler() |
UserTokenPolicy[] |
getUserTokenPolicies() |
void |
init()
Initializes the server.
|
protected void |
initAggregateFunctions()
Initialize the Aggregate Functions under the ServerCapabilities node, from the
AggregateCalculator.
|
protected void |
initServerArray() |
protected void |
initServiceHandlers() |
boolean |
isDiscoveryEndpointEnabled() |
boolean |
isEnableIPv6()
Returns true if IPv6 networking is enabled or false otherwise.
|
boolean |
isFailOnBindError() |
boolean |
isRunning() |
boolean |
isUseAllIpAddresses()
Deprecated.
|
boolean |
isUseCanonicalHostName()
Deprecated.
|
boolean |
isUseHostName()
Deprecated.
|
boolean |
isUseLocalhost()
Deprecated.
|
protected void |
logRegisterServerError(String discoveryServerUrl,
boolean isOnline,
UaServerException e) |
void |
registerAndLoadModel(ServerCodegenModel codegenModel,
URI nodeSetXml)
Specify an information model to use in the application.
|
void |
registerModel(ServerCodegenModel codegenModel)
Register an information model to use in the application.
|
boolean |
registerServer(boolean isOnline)
Register the server on the DiscoveryServer at
getDiscoveryServerUrl(). |
protected boolean |
registerServer(boolean isOnline,
boolean callLDS)
Same as
registerServer(boolean), but allows skipping calling the LocalDiscoveryServer
(with callLDS false). |
void |
registerServer(String discoveryUrl,
boolean isOnline)
Register the server on a discovery server with RegisterServer2 and then with RegisterServer if
RegisterServer2 fails.
|
void |
removeEndpoint(String uri,
SecurityMode securityMode)
Remove an endpoint definition for a specific URI & SecurityMode combination
You should call addEnpoint after
init() has been called. |
void |
removeEndpointHost(String hostName)
Removes all endpoints that use hostName - as defined by
addEndpointHost(java.lang.String), or using the
default HostName of the computer. |
void |
removeEndpoints(String uri)
Removes all endpoints that have the given endpointUrl.
|
void |
removeLocale(Locale locale) |
void |
removeReverseConnection(ReverseConnectionParameters reverseConnectionParameters)
Removes a previously added reverse connection.
|
void |
removeReverseConnection(String clientServerEndpointUrl)
Removes a previously added reverse connection.
|
void |
removeReverseConnection(String clientServerEndpointUrl,
String endpointUrlForClientConnection)
Deprecated.
starting from SDK 5.1.0, the second parameter no longer has a meaning as
ReverseConnectionParameters.equals(Object) is only based on the
ReverseConnectionParameters.getClientServerEndpointUrl(). Thus,
removeReverseConnection(String) should be used instead. |
void |
removeUserTokenPolicy(UserTokenPolicy policy) |
boolean |
requestServerStateChange(ServiceContext serviceContext,
ServerState state,
DateTime estimatedReturnTime,
UnsignedInteger secondsTillShutdown,
LocalizedText reason,
Boolean restart)
Request a change in server state (shutdown or restart server).
|
void |
setApplicationIdentity(ApplicationIdentity identity)
Define the application identity of the server.
|
void |
setBindAddresses(Set<InetAddress> bindAddresses)
Define the InetAddresses the server endpoints should be bound to.
|
void |
setBindAddresses(UaApplication.Protocol protocol,
Set<InetAddress> bindAddresses)
Define the InetAddresses the server endpoints should be bound to.
|
void |
setDiscoveryEndpointEnabled(boolean discoveryEndpointEnabled)
If this is set to false, the internal discovery server is not created and this server does not
offer any Discovery Services, e.g.
|
void |
setDiscoveryServerAddress(UaAddress discoveryServerAddress)
Set DiscoveryServer address, same as setDiscoveryServerUrl, but this method does not throw
exception as UaAddress instances have valid syntax.
|
void |
setDiscoveryServerRegistrationPeriod(long discoveryServerRegistrationPeriod)
Define the period used for re-registering to the Discovery Server.
|
void |
setDiscoveryServerRegistrationSecurityMode(SecurityMode discoveryServerRegistrationSecurityMode)
Define the SecurityMode to use when registering to the Discovery Server.
|
void |
setDiscoveryServerUrl(String discoveryServerUrl)
Define the discovery server in which the server is registered automatically.
|
void |
setEnableIPv6(boolean enableIPv6)
Define whether to use IPv6 addresses.
|
void |
setEndpointConfiguration(EndpointConfiguration endpointConfiguration)
Define the EndpointConfiguration to use for all default endpoints.
|
void |
setFailOnBindError(boolean failOnBindError)
Define whether the server
start() should fail, if any of the endpoint bindings fail. |
protected void |
setHttpsPort(int httpsPort)
Defines the IP port number to use for the HTTPS connection.
|
void |
setHttpsSecurityPolicies(HttpsSecurityPolicy... httpsSecurityPolicies)
Define the security policies used for the HTTPS protocol.
|
void |
setHttpsSettings(HttpsSettings httpsSettings) |
void |
setHttpsWorkerThreadCount(int httpsWorkerThreadCount)
The number of worker threads to use for the HTTPS server.
|
void |
setListener(UaServerListener listener) |
void |
setMaxOpcHttpsConnections(Integer maxOpcHttpsConnections)
Maximum number of concurrent opc.https connections.
|
void |
setMaxOpcTcpConnections(Integer maxOpcTcpConnections)
Maximum number of concurrent opc.tcp connections.
|
void |
setPort(int port)
The port in which the server is listening to the OPC Binary protocol.
|
void |
setPort(UaApplication.Protocol protocol,
int port)
Define the TCP/IP port number for a specific protocol.
|
void |
setPubSubConfigurator(PubSubConfigurator pubSubConfigurator) |
void |
setSecurityModes(SecurityMode[] securityModes)
Deprecated.
use
getSecurityModes() and add to the set directly. This method replaces
all existing ones. |
void |
setServerName(String serverName)
Define the default server name.
|
void |
setServerName(UaApplication.Protocol protocol,
String serverName)
Define the server name for a specific protocol.
|
void |
setUseAllIpAddresses(boolean useAllIpAddresses)
Deprecated.
The server is no longer defining endpoints for different IP addresses. Use
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to. |
void |
setUseCanonicalHostName(boolean useCanonicalHostName)
Deprecated.
The server is no longer defining endpoints for different host names. Use
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to. |
void |
setUseHostName(boolean useHostName)
Deprecated.
The server is no longer defining endpoints for different host names. Use
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to. |
void |
setUseLocalhost(boolean useLocalhost)
Deprecated.
|
void |
setUserTokenPolicies(UserTokenPolicy... userTokenPolicies)
Define the supported UserTokenPolicies.
|
void |
setUserValidator(UserValidator userValidator)
Define your custom user validator to check the users that are logging in to the server.
|
void |
shutdown(int secondsTillShutdown,
LocalizedText shutdownReason)
Shutdown the server.
|
void |
shutdown(int secondsTillShutdown,
LocalizedText shutdownReason,
boolean closeServer)
Shutdown the server.
|
void |
shutdown(int secondsTillShutdown,
String shutdownReason)
Shutdown the server.
|
void |
shutdown(int secondsTillShutdown,
String shutdownReason,
boolean closeServer)
Shutdown the server.
|
protected void |
shutdownBegin(int secondsTillShutdown,
LocalizedText shutdownReason)
Begin server shutdown process
|
protected void |
shutdownEnd(boolean closeServer)
Complete the shutdown process
|
protected void |
shutdownSleep(int secondsTillShutdown)
Wait before completing shutdown
|
void |
start()
Starts the server using the current configuration.
|
protected static RegisteredServer |
toRegisteredServer(String semaphoreFilePath,
boolean isOnline,
UaServer uaServer) |
protected void |
updateNamespaceArray() |
protected void |
updateServerArray() |
protected void |
updateServerCapabilities()
Sets the ServerCabalitities, Updates Nodes below /Root/Objects/Server/ServerCapabilities/.
|
protected void |
validateUserError(Session session,
UserIdentityToken userToken,
Exception e) |
protected boolean |
validateUserIdentity(Session session,
ServerUserIdentity userIdentity) |
formatUri, getAggregateCalculator, getCertificateValidator, getKnownDataTypeDictionary, getNamespaceTable, getOperationLimits, getRegisteredClasses, getSdkVersion, getVersion, isAutoDiscoverCodegenModels, registerAutoDiscoveredModels, registerModelInternal, setAutoDiscoverCodegenModels, setCertificateValidator, setOperationLimits, validateApplicationCertificateprotected ApplicationIdentity applicationIdentity
protected AttributeServiceHandler attributeServiceHandler
protected UaServerListener listener
protected NodeManagerRoot nodeManagerRoot
protected NodeManagerTable nodeManagerTable
protected UaServer.NodeManagerUaServer nodeManagerUaServer
protected NodeManagementServiceHandler nodeServiceHandler
protected Set<SecurityMode> httpsSecurityModes
protected Set<SecurityMode> securityModes
protected SessionManager sessionManager
protected ScheduledExecutorService executor
protected final SessionManagerListener sessionManagerListener
protected SessionServiceHandler sessionServiceHandler
protected SubscriptionManager subscriptionManager
protected SubscriptionServiceHandler subscriptionServiceHandler
protected DiagnosticsManager diagnosticsManager
public UaServer()
public static UnsignedByte getEndpointSecurityLevel(SecurityMode sm)
protected static RegisteredServer toRegisteredServer(String semaphoreFilePath, boolean isOnline, UaServer uaServer)
public void addEndpoint(String uri, SecurityMode securityMode, UserTokenPolicy... userTokenPolicies) throws UaServerException
init() has been called.
Cannot be modified after calling start(), i.e. when the server isRunning().uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.securityMode - The security mode of the endpointuserTokenPolicies - Supported user token policiesUaServerException - if the server is running, i.e start has been calledremoveEndpoint(String, SecurityMode)public String[] addEndpointHost(String hostName) throws UaServerException
start() is called.
Note that by default, the server is always initialized using
ApplicationIdentity.getActualHostName().hostName - the hostname or IP address to use for the endpointUrls when initializing the
server endpoints.UaServerExceptionremoveEndpointHost(String),
getEndpointHosts()public void addLocale(Locale locale) throws UaServerException
locale - UaServerExceptionpublic void addReverseConnection(ReverseConnectionParameters parameters)
start()s.
Calling this method while the server is running will add and initialize the reverse connection.
NOTE! Calling this method multiple times only adds one connection, additional calls have no
effect. Additionally, please note that only
ReverseConnectionParameters.getClientServerEndpointUrl() is used to determine is there
already a connection. This is to say, there can only be a single connection per client
listening address.parameters - for the reverse connectionIllegalArgumentException - if called while the server is running and the reverse
connection cannot be initializedpublic void addReverseConnection(String clientServerEndpointUrl)
start()s.
Calling this method while the server is running will add and initialize the reverse connection.
NOTE! Calling this method multiple times only adds one connection, additional calls have no
effect.
NOTE! This method assumes the server has only one EndpointUrl, which is typically based on the
hostname of this machine. If there are multiple, one of them is used. Typically it shouldn't
matter which one is used, but if it does, please use
addReverseConnection(String, String) instead.
clientServerEndpointUrl - address of a client, that has opened a Socket for ReverseHello
calls made by the server.IllegalArgumentException - if called while the server is running and the reverse
connection cannot be initializedpublic void addReverseConnection(String clientServerEndpointUrl, String endpointUrlForClientConnection)
start()s.
Calling this method while the server is running will add and initialize the reverse connection.
NOTE! Calling this method multiple times only adds one connection, additional calls have no
effect.clientServerEndpointUrl - address of a client, that has opened a Socket for ReverseHello
calls made by the server.endpointUrlForClientConnection - The EndpointUrl, which the client should use when
connecting. This must be one of the EndpointUrls in EndpointDescriptions provided by the
server. Additionally a client might listen only on one of them, so this must be
coordinated with the client side application configuration.IllegalArgumentException - if called while the server is running and the reverse
connection cannot be initializedpublic void addServiceHandler(Object serviceHandler)
serviceHandler - public void addToServerArray(String uri) throws StatusException
uri - the URI of the server to add.StatusExceptionpublic void addUserTokenPolicy(UserTokenPolicy policy) throws UaServerException
policy - UaServerExceptionpublic void close()
public NodeManagerTable getAddressSpace()
getAddressSpace in class UaApplicationpublic ApplicationIdentity getApplicationIdentity()
ApplicationIdentity of this UaServer.getApplicationIdentity in class UaApplicationpublic AttributeServiceHandler getAttributeServiceHandler()
AttributeServiceHandler of this UaServer.public Set<InetAddress> getBindAddresses()
isEnableIPv6() is true, otherwise the IPv4 wildcard '0.0.0.0'.public Set<InetAddress> getBindAddresses(UaApplication.Protocol protocol)
getBindAddresses(), if no protocol specific values are defined with
#setBindAddresses(Protocol, Set).protocol - SocketExceptionpublic DiagnosticsManager getDiagnosticsManager()
public UaAddress getDiscoveryServerAddress()
public long getDiscoveryServerRegistrationPeriod()
public SecurityMode getDiscoveryServerRegistrationSecurityMode()
getDiscoveryServerAddress()setDiscoveryServerRegistrationSecurityMode(SecurityMode)public String getDiscoveryServerUrl()
getDiscoveryServerAddress().getAddress()public EncoderContext getEncoderContext()
getEncoderContext in class UaApplicationpublic EndpointDescription getEndpoint(String uri, SecurityMode securityMode)
uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.securityMode - The security mode of the endpointpublic EndpointConfiguration getEndpointConfiguration()
public String[] getEndpointHosts()
addEndpointHost(String).
* Note that by default, the server is always initialized using
ApplicationIdentity.getActualHostName().
removeEndpointHost(String)public EndpointDescription[] getEndpoints()
init(), and they
are bound when you call start(). Between those calls, you can modify the list
according to your needs using addEndpoint(String, SecurityMode, UserTokenPolicy...)
and removeEndpoint(String, SecurityMode).public EndpointDescription[] getEndpoints(String uri)
uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.@Deprecated public String[] getHostNames()
getEndpointHosts() instead.addEndpointHost(String).public Set<SecurityMode> getHttpsSecurityModes()
public HttpsSettings getHttpsSettings()
public int getHttpsWorkerThreadCount()
setHttpsWorkerThreadCount(int)public UaServerListener getListener()
public Locale[] getLocales()
Application.getLocales()public UaLoopbackClient getLoopbackClient()
UaClient, that is directly connected (java-internally) to this Server. Calls
made using this client are directly forward to the ServiceHandlers (such as
AttributeServiceHandler e.g. for Read/Write) if this UaServer. The Session
Session of this Client is the same as Session.INTERNAL_SESSION and has access to
everything.public Integer getMaxOpcHttpsConnections()
public Integer getMaxOpcTcpConnections()
public NodeManagementServiceHandler getNodeManagementServiceHandler()
NodeManagementServiceHandler of this UaServer.public NodeManagerRoot getNodeManagerRoot()
NodeManagerRoot, the NamespaceIndex 0 NodeManager of this UaServer. It
contains the Core Information Model of the OPC UA Specification.@Deprecated public NodeManagerTable getNodeManagerTable()
getAddressSpace()public UaServer.NodeManagerUaServer getNodeManagerUaServer()
public int getPort()
#getPort(Protocol) with Protocol.Opc.public int getPort(UaApplication.Protocol protocol)
protocol - the protocol whose port you wantpublic PubSubConfigurator getPubSubConfigurator() throws StatusException
StatusExceptionpublic Set<SecurityMode> getSecurityModes()
SecurityModes that opc.tcp endpoints of the server supportpublic String getServerName()
public String getServerName(UaApplication.Protocol protocol)
protocol - the protocol whose serverName you wantgetServerName() if no
specific value is deifned.public ServerTable getServerTable()
UaApplicationVariableIdentifiers.Server_ServerArray).
The indexes of the table are used if References of a node in the server points to another
server via ExpandedNodeId.getServerIndex(). The index 0 always means the local server
and has the local server's ApplicationUrigetServerTable in class UaApplicationpublic String[] getServerUris() throws UaServerException
UaServerException - if the local hostname or all IP addresses cannot be resolvedsetUseLocalhost(boolean),
setUseHostName(boolean),
setUseAllIpAddresses(boolean),
setPort(int),
setServerName(String)public SessionManager getSessionManager()
public SessionServiceHandler getSessionServiceHandler()
public SubscriptionManager getSubscriptionManager()
public SubscriptionServiceHandler getSubscriptionServiceHandler()
public UserTokenPolicy[] getUserTokenPolicies()
addUserTokenPolicy(UserTokenPolicy),
removeUserTokenPolicy(UserTokenPolicy)public void init()
throws UaServerException
start().UaServerException - if the initialization failspublic boolean isDiscoveryEndpointEnabled()
setDiscoveryEndpointEnabled(boolean)public boolean isEnableIPv6()
setEnableIPv6(boolean). Default value is true.public boolean isFailOnBindError()
setFailOnBindError(boolean)public boolean isRunning()
start(),
shutdown(int, LocalizedText)@Deprecated public boolean isUseAllIpAddresses()
@Deprecated public boolean isUseCanonicalHostName()
getServerUris()).
Default: trueisUseHostName()@Deprecated public boolean isUseHostName()
getServerUris()).
Default: trueisUseCanonicalHostName()@Deprecated public boolean isUseLocalhost()
getServerUris()).
Default: truepublic void registerAndLoadModel(ServerCodegenModel codegenModel, URI nodeSetXml) throws SAXException, IOException, ModelException, ServiceException
Uses registerModel(com.prosysopc.ua.server.ServerCodegenModel) and NodeManagerTable.loadModel(URI).
codegenModel - the InformationModel generated by the Code GeneratornodeSetXml - the XML definition of the information model in NodeSet2.xml formatServiceException - if the mode cannot be loaded into the serverModelExceptionIOExceptionSAXExceptionpublic void registerModel(ServerCodegenModel codegenModel)
codegenModel - the model created by the codegen.public boolean registerServer(boolean isOnline)
getDiscoveryServerUrl().
Also if isDiscoveryEndpointEnabled() is true it registers the server in the internal
DiscoveryServer, which is available from the same port as the server.
The method does not raise any exceptions, contrary to registerServer(String, boolean),
which does not use discoveryServerUrl.
The method is called automatically from init(), start() and
shutdown(int, LocalizedText).isOnline - whether to register the server online or offlinepublic void registerServer(String discoveryUrl, boolean isOnline) throws UaServerException
discoveryUrl - the URL of the discovery serverisOnline - whether to register online (server running) or offlineUaServerExceptionsetDiscoveryServerUrl(java.lang.String)public void removeEndpoint(String uri, SecurityMode securityMode)
init() has been called.
If you modify the list after calling start(), your list will not be up to date
according to what is actually in use in the server.uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.securityMode - The security mode of the endpointaddEndpoint(String, SecurityMode, UserTokenPolicy...)public void removeEndpointHost(String hostName)
addEndpointHost(java.lang.String), or using the
default HostName of the computer.hostName - the hostName or IP address for which to remove all Endpoints. Corresponds to
the host added with addEndpointHostpublic void removeEndpoints(String uri)
init(), otherwise it wont do anything. Also calling this after start()
does not have effect on the bound endpoints.uri - the given endpointUrlpublic void removeLocale(Locale locale) throws UaServerException
locale - UaServerExceptionpublic void removeReverseConnection(ReverseConnectionParameters reverseConnectionParameters)
addReverseConnection(ReverseConnectionParameters) again. Please note that only
ReverseConnectionParameters.getClientServerEndpointUrl() matters here and this method
behaves the same as calling removeReverseConnection(String) with it.reverseConnectionParameters - same as in a previous
addReverseConnection(ReverseConnectionParameters) or
ReverseConnectionParameters.equals(Object) to it (Note that that only depends on
ReverseConnectionParameters.getClientServerEndpointUrl()).public void removeReverseConnection(String clientServerEndpointUrl)
addReverseConnection(String) again.clientServerEndpointUrl - same as in a previous
addReverseConnection(String, String)@Deprecated public void removeReverseConnection(String clientServerEndpointUrl, String endpointUrlForClientConnection)
ReverseConnectionParameters.equals(Object) is only based on the
ReverseConnectionParameters.getClientServerEndpointUrl(). Thus,
removeReverseConnection(String) should be used instead.addReverseConnection(String, String) again.clientServerEndpointUrl - same as in a previous
addReverseConnection(String, String)endpointUrlForClientConnection - same as in a previous
addReverseConnection(String, String)public void removeUserTokenPolicy(UserTokenPolicy policy) throws UaServerException
policy - UaServerExceptionpublic boolean requestServerStateChange(ServiceContext serviceContext, ServerState state, DateTime estimatedReturnTime, UnsignedInteger secondsTillShutdown, LocalizedText reason, Boolean restart) throws StatusException
serviceContext - calling context, including the session information, which defines the
userIdentitystate - the state in which the server will beestimatedReturnTime - the time in which the server is expected to be in running statesecondsTillShutdown - the number of seconds until shutdownreason - reason for the requestrestart - a flag indicating whether the server will be restarted after shutdownStatusException - StatusCodes.Bad_UserAccessDenied if the user is not authorized
to request the state changepublic void setApplicationIdentity(ApplicationIdentity identity)
ApplicationIdentity.loadOrCreateCertificate(com.prosysopc.ua.stack.core.ApplicationDescription, java.lang.String, java.lang.String, java.io.File, boolean, java.lang.String...)). Also make sure the the
ApplicationDescription is set in the identity.identity - public void setBindAddresses(UaApplication.Protocol protocol, Set<InetAddress> bindAddresses)
EndpointUtil.getInetAddresses(boolean enableIPv6),
using the current value of isEnableIPv6().
Use the method to make the server respond in only some of the available network interfaces.
Default: Use what is available from EndpointUtil.getInetAddresses(boolean enableIPv6),
using the current value of isEnableIPv6().protocol - the protocol to which these addresses are used. Must not be nullbindAddresses - the bindAddresses to set. If null, the protocol specific values are not to
be used. The common values available from getBindAddresses() are to be used
then.public void setBindAddresses(Set<InetAddress> bindAddresses)
EndpointUtil.getInetAddresses(boolean enableIPv6),
using the current value of isEnableIPv6().
Use the method to make the server respond in only some of the available network interfaces.
Default: Use what is available from EndpointUtil.getInetAddresses(boolean enableIPv6),
using the current value of isEnableIPv6().bindAddresses - the bindAddresses to set. Use null to reset to default value.public void setDiscoveryEndpointEnabled(boolean discoveryEndpointEnabled)
discoveryEndpointEnabled - public void setDiscoveryServerAddress(UaAddress discoveryServerAddress)
discoveryServerAddress - the addresssetDiscoveryServerUrl(java.lang.String)public void setDiscoveryServerRegistrationPeriod(long discoveryServerRegistrationPeriod)
discoveryServerRegistrationPeriod - the period to set in minutesregisterServer(boolean),
setDiscoveryServerUrl(java.lang.String)public void setDiscoveryServerRegistrationSecurityMode(SecurityMode discoveryServerRegistrationSecurityMode)
Note that according to the OPC UA specification, only secure connections are enabled, but the actual mode to use may be configurable, depending on the actual Discovery Server installation.
discoveryServerRegistrationSecurityMode - the discoveryServerRegistrationSecurityMode to
setpublic void setDiscoveryServerUrl(String discoveryServerUrl) throws URISyntaxException
discoveryServerUrl - the discoveryServerUrl to setURISyntaxException - if the url is not validregisterServer(boolean),
setDiscoveryServerRegistrationPeriod(long),
setDiscoveryServerAddress(com.prosysopc.ua.UaAddress)public void setEnableIPv6(boolean enableIPv6)
enableIPv6 - set true to enable or false to disable IPv6 networking.public void setEndpointConfiguration(EndpointConfiguration endpointConfiguration)
endpointConfiguration - the value to set. Use null to reset back to
Endpoint.createDefaultEndpointConfiguration().public void setFailOnBindError(boolean failOnBindError)
start() should fail, if any of the endpoint bindings fail.
The property can be used to overcome problems in some hostname/IP address problems, in case the
server tries to bind to invalid addresses, for example.
The draw back is that if there is a server already bound to the address, the new one will start
up, but never runs.
Default: truefailOnBindError - the failOnBindError to setpublic void setHttpsSecurityPolicies(HttpsSecurityPolicy... httpsSecurityPolicies) throws UaServerException
httpsSecurityPolicies - the httpsSecurityPolicies to setUaServerException - if the server is runningpublic void setHttpsSettings(HttpsSettings httpsSettings)
httpsSettings - the httpsSettings to setpublic void setHttpsWorkerThreadCount(int httpsWorkerThreadCount)
init() is called.
Default: 10httpsWorkerThreadCount - the httpsWorkerThreadCount to setpublic void setListener(UaServerListener listener)
listener - the listener to setpublic void setMaxOpcHttpsConnections(Integer maxOpcHttpsConnections)
start() has been called has no effect unless the server is restarted.
Default value: 'null', in which case the value from getSessionManager() is used
(SessionManager.getMaxSessionCount()) as the limit.public void setMaxOpcTcpConnections(Integer maxOpcTcpConnections)
start() has been called has no effect unless the server is restarted.
Default value: 'null', in which case the value from getSessionManager() is used
(SessionManager.getMaxSessionCount()) as the limit.public void setPort(int port)
throws UaServerException
#setPort(Protocol, int) with Protocol.Opc.port - The binary port number. If 0, the binary protocol is disabled. If -1, the OS will
automatically select a free port. Do not use any of the standard port numbers used by
well-known TCP/IP services. Recommended numbers start from 1024. 4840 is reserved for
the Local Discovery Server, but if you do not intend to run one, you can bind your
server in there.UaServerException - if the server isRunning alreadypublic void setPort(UaApplication.Protocol protocol, int port) throws UaServerException
protocol - the UA protocol for which the name is applied toport - the port number to set. If 0, the specific protocol is not enabled in the server.
If -1, the OS will automatically select a free port.UaServerException - if the server isRunning alreadypublic void setPubSubConfigurator(PubSubConfigurator pubSubConfigurator)
@Deprecated public void setSecurityModes(SecurityMode[] securityModes) throws UaServerException
getSecurityModes() and add to the set directly. This method replaces
all existing ones.securityModes - the securityMode to setUaServerException - if the server isRunning alreadypublic void setServerName(UaApplication.Protocol protocol, String serverName) throws UaServerException
protocol - the UA protocol for which the name is applied toserverName - the serverName to set. If null, then the specific value is reset and the
default will be used.UaServerException - if the server isRunning alreadysetServerName(String)public void setServerName(String serverName) throws UaServerException
#setServerName(Protocol, String)serverName - the serverName to setUaServerException - if the server isRunning alreadysetServerName(String)@Deprecated public void setUseAllIpAddresses(boolean useAllIpAddresses)
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to.useAllIpAddresses - if true, all IP addresses are added to endpointUrlssetUseHostName(boolean),
setUseCanonicalHostName(boolean),
setUseLocalhost(boolean)@Deprecated public void setUseCanonicalHostName(boolean useCanonicalHostName)
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to.InetAddress#getLocalHost().getCanonicalHostName() is added to the
endpoints (getServerUris()).
Depending on the Operating system, CanonicalHostName can contain the domain part of the host
name or be without it.
Default: trueuseCanonicalHostName - the useCanonicalHostName to setsetUseAllIpAddresses(boolean),
setUseHostName(boolean),
setUseLocalhost(boolean)@Deprecated public void setUseHostName(boolean useHostName)
setBindAddresses(Set) instead to define to which actual addresses the
endpoints are bound to.getServerUris()).
Depending on the Operating system, HostName can contain the domain part of the host name or be
without it.
Default: trueuseHostName - the useHostName to setsetUseAllIpAddresses(boolean),
setUseCanonicalHostName(boolean),
setUseLocalhost(boolean)@Deprecated public void setUseLocalhost(boolean useLocalhost) throws UaServerException
getServerUris()).
Default: falseuseLocalhost - if true, 'localhost' will be added to the list of endpoints.UaServerException - if the server isRunning alreadysetUseAllIpAddresses(boolean),
setUseCanonicalHostName(boolean),
setUseHostName(boolean)public void setUserTokenPolicies(UserTokenPolicy... userTokenPolicies) throws UaServerException
userTokenPolicies - the securityMode to setUaServerException - if the server isRunning alreadypublic void setUserValidator(UserValidator userValidator)
userValidator - the validator to use. Set to null to accept all users.public void shutdown(int secondsTillShutdown,
LocalizedText shutdownReason)
secondsTillShutdown - the delay after notifying the clients about the shutdownshutdownReason - the shutdown reason message provided for the clientspublic void shutdown(int secondsTillShutdown,
LocalizedText shutdownReason,
boolean closeServer)
secondsTillShutdown - the delay after notifying the clients about the shutdownshutdownReason - the shutdown reason message provided for the clientscloseServer - determine whether the server is also closed at the same. Use 'false' if you
intend to restart the server again, by calling start(). It will leave the node
managers intact, and they will not need to be re-initialized. Default is true.public void shutdown(int secondsTillShutdown,
String shutdownReason)
secondsTillShutdown - the delay after notifying the clients about the shutdownshutdownReason - the shutdown reason message provided for the clients (without any locale
information)public void shutdown(int secondsTillShutdown,
String shutdownReason,
boolean closeServer)
secondsTillShutdown - the delay after notifying the clients about the shutdownshutdownReason - the shutdown reason message provided for the clients (without any locale
information)closeServer - determine whether the server is also closed at the same. Use 'false' if you
intend to restart the server again, by calling start(). It will leave the node
managers intact, and they will not need to be re-initialized. Default is true.public void start()
throws UaServerException
init(), if it is not called.
generally, you should call init, initialize your own server stuff, and call start.UaServerException - if the server fails to start.init(),
close()protected AttributeServiceHandler createAttributeServiceHandler()
protected DiagnosticsManager createDiagnosticsManager()
protected ScheduledExecutorService createExecutor()
protected UaLoopbackClient createLoopbackClient(Consumer<EndpointServiceRequest<?,?>> requestConsumer)
UaLoopbackClient using the given consumer. This method can be be used to
override the UaLoopbackClient returned by getLoopbackClient().requestConsumer - the EndpointServiceRequest Consumerprotected NodeManager createNewNodeManager(ServiceContext serviceContext, String namespaceUri) throws StatusException
StatusExceptionprotected NodeManagementServiceHandler createNodeManagementServiceHandler()
NodeManagementServiceHandler, this can be used to override the
NodeManagementServiceHandler used by the server by returning a custom subtype.protected NodeManagerRoot createNodeManagerRoot()
NodeManagerRoot, this can be used to override the NodeManagerRoot used
by the server by returning a custom subtype.protected NodeManagerTable createNodeManagerTable()
NodeManagerTable, this can be used to override the NodeManagerTable used
by the server by returning a custom subtype.protected UaServer.NodeManagerUaServer createNodeManagerUaServer(String applicationUri)
UaServer.NodeManagerUaServer, this can be used to override the
UaServer.NodeManagerUaServer used by the server by returning a custom subtype. The returned
NodeManagerUaServer (or subtype) shall use the given 'applicationUri' parameter as the
NamespaceUri.protected SessionManager createSessionManager()
SessionManager, this can be used to override the SessionManager used by
the server by returning a custom subtype. The returned SessionManager shall use 'this' as the
constructor parameter.protected SessionServiceHandler createSessionServiceHandler()
SessionServiceHandler, this can be used to override the
SessionServiceHandler used by the server by returning a custom subtype.protected SubscriptionManager createSubscriptionManager()
SubscriptionManager, this can be used to override the
SubscriptionManager used by the server by returning a custom subtype.protected SubscriptionServiceHandler createSubscriptionServiceHandler()
SubscriptionServiceHandler, this can be used to override the
SubscriptionServiceHandler used by the server by returning a custom subtype.protected UaServer.DiscoveryServer getDiscoveryServer()
protected String getDiscoveryUriOf(String uri)
uri - IllegalArgumentExceptionprotected ScheduledExecutorService getExecutor()
protected int getHttpsPort()
protected HttpsSecurityPolicy[] getHttpsSecurityPolicies()
protected Server getServer()
protected void initAggregateFunctions()
protected void initServerArray()
throws UaServerException
UaServerExceptionprotected void initServiceHandlers()
throws UaServerException
UaServerExceptionprotected void logRegisterServerError(String discoveryServerUrl, boolean isOnline, UaServerException e)
isOnline - discoveryServerUrl - e - protected boolean registerServer(boolean isOnline,
boolean callLDS)
registerServer(boolean), but allows skipping calling the LocalDiscoveryServer
(with callLDS false).protected void setHttpsPort(int httpsPort)
throws UaServerException
httpsPort - the httpsPort to setUaServerExceptionprotected void shutdownBegin(int secondsTillShutdown,
LocalizedText shutdownReason)
secondsTillShutdown - seconds to wait until shutdownshutdownReason - reason for shutdownprotected void shutdownEnd(boolean closeServer)
closeServer - whether the server is closedprotected void shutdownSleep(int secondsTillShutdown)
secondsTillShutdown - seconds to waitprotected void updateNamespaceArray()
protected void updateServerArray()
throws StatusException
StatusExceptionprotected void updateServerCapabilities()
protected void validateUserError(Session session, UserIdentityToken userToken, Exception e)
session - userToken - e - protected boolean validateUserIdentity(Session session, ServerUserIdentity userIdentity) throws StatusException
session - userIdentity - StatusExceptionCopyright © 2026. All rights reserved.