|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.prosysopc.ua.UaApplication
com.prosysopc.ua.server.UaServer
public class UaServer
Basic implementation of the OPC UA server.
You need to create a UaServer object and callinit() 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.
| Nested Class Summary | |
|---|---|
class |
UaServer.DiscoveryServer
Service handler that serves onFindServers & onRegisteredServer requests. onGetEndpoint request is handled by a default EndpointDiscoveryService. |
class |
UaServer.NodeManagerUaServer
Server internal namespace (NamespaceIndex 1) |
| Nested classes/interfaces inherited from class com.prosysopc.ua.UaApplication |
|---|
UaApplication.a, UaApplication.DiagnosticMask, UaApplication.Protocol |
| Field Summary | |
|---|---|
protected ApplicationIdentity |
applicationIdentity
|
protected ServiceHandler |
attributeServiceHandler
|
protected DiagnosticsManager |
diagnosticsManager
|
protected Set<String> |
discoveryUris
|
protected ScheduledExecutorService |
executor
|
protected Set<String> |
httpsUris
|
protected UaServerListener |
listener
|
protected NodeManagerRoot |
nodeManagerRoot
|
protected NodeManagerTable |
nodeManagerTable
|
protected UaServer.NodeManagerUaServer |
nodeManagerUaServer
|
protected NodeManagementServiceHandler |
nodeServiceHandler
|
protected org.opcfoundation.ua.transport.security.SecurityMode[] |
securityModes
|
protected Set<String> |
serverUris
|
protected SessionManager |
sessionManager
|
protected SessionManagerListener |
sessionManagerListener
|
protected SessionServiceHandler |
sessionServiceHandler
|
protected SubscriptionManager |
subscriptionManager
|
protected SubscriptionServiceHandler |
subscriptionServiceHandler
|
| Constructor Summary | |
|---|---|
UaServer()
Creates a new UA Server. |
|
| Method Summary | |
|---|---|
void |
addEndpoint(String uri,
org.opcfoundation.ua.transport.security.SecurityMode securityMode,
org.opcfoundation.ua.core.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 |
addServiceHandler(Object serviceHandler)
Add a custom serviceHandler. |
void |
addToServerArray(String uri)
Add a server description to the serverArray. |
void |
addUserTokenPolicy(org.opcfoundation.ua.core.UserTokenPolicy policy)
|
void |
close()
|
protected AttributeServiceHandler |
createAttributeServiceHandler()
|
protected DiagnosticsManager |
createDiagnosticsManager()
|
protected ScheduledExecutorService |
createExecutor()
This is called when a executor would be created for the UaServer. |
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()
|
protected SessionManager |
createSessionManager()
|
protected SessionServiceHandler |
createSessionServiceHandler()
|
protected SubscriptionManager |
createSubscriptionManager()
|
protected SubscriptionServiceHandler |
createSubscriptionServiceHandler()
|
NodeManagerTable |
getAddressSpace()
|
ApplicationIdentity |
getApplicationIdentity()
|
ServiceHandler |
getAttributeServiceHandler()
|
Set<InetAddress> |
getBindAddresses()
|
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. |
org.opcfoundation.ua.transport.security.SecurityMode |
getDiscoveryServerRegistrationSecurityMode()
|
String |
getDiscoveryServerUrl()
|
protected String |
getDiscoveryUriOf(String uri)
|
org.opcfoundation.ua.encoding.EncoderContext |
getEncoderContext()
|
org.opcfoundation.ua.core.EndpointDescription |
getEndpoint(String uri,
org.opcfoundation.ua.transport.security.SecurityMode securityMode)
Find an endpoint definition for a specific URI & SecurityMode combination |
org.opcfoundation.ua.core.EndpointConfiguration |
getEndpointConfiguration()
|
org.opcfoundation.ua.core.EndpointDescription[] |
getEndpoints()
Get the list of endpoints. |
org.opcfoundation.ua.core.EndpointDescription[] |
getEndpoints(String uri)
Find all endpoint definitions for a specific URI |
static org.opcfoundation.ua.builtintypes.UnsignedByte |
getEndpointSecurityLevel(org.opcfoundation.ua.transport.security.SecurityMode sm)
Calculate the SecurityLevel of the SecurityMode. |
protected ScheduledExecutorService |
getExecutor()
|
String[] |
getHostNames()
|
protected int |
getHttpsPort()
|
protected org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] |
getHttpsSecurityPolicies()
|
org.opcfoundation.ua.transport.https.HttpsSettings |
getHttpsSettings()
|
int |
getHttpsWorkerThreadCount()
|
UaServerListener |
getListener()
|
Locale[] |
getLocales()
|
NodeManagementServiceHandler |
getNodeManagementServiceHandler()
|
NodeManagerRoot |
getNodeManagerRoot()
|
NodeManagerTable |
getNodeManagerTable()
Deprecated. Use getAddressSpace() |
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. |
org.opcfoundation.ua.transport.security.SecurityMode[] |
getSecurityModes()
|
protected org.opcfoundation.ua.application.Server |
getServer()
|
String |
getServerName()
|
String |
getServerName(UaApplication.Protocol protocol)
Get the protocol specific serverName definition. |
String[] |
getServerUris()
The endpoint URIs to which the server listens to. |
SessionManager |
getSessionManager()
|
SessionServiceHandler |
getSessionServiceHandler()
|
SubscriptionManager |
getSubscriptionManager()
|
SubscriptionServiceHandler |
getSubscriptionServiceHandler()
|
org.opcfoundation.ua.core.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(). |
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,
org.opcfoundation.ua.transport.security.SecurityMode securityMode)
Remove an endpoint definition for a specific URI & SecurityMode combination You should call addEnpoint after init() has been called. |
void |
removeEndpointHost(String uri)
Removes all endpoints that have the given endpointUrl. |
void |
removeLocale(Locale locale)
|
void |
removeUserTokenPolicy(org.opcfoundation.ua.core.UserTokenPolicy policy)
|
boolean |
requestServerStateChange(ServiceContext serviceContext,
org.opcfoundation.ua.core.ServerState state,
org.opcfoundation.ua.builtintypes.DateTime estimatedReturnTime,
org.opcfoundation.ua.builtintypes.UnsignedInteger secondsTillShutdown,
org.opcfoundation.ua.builtintypes.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. clients cannot make FindServers requests. |
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(org.opcfoundation.ua.transport.security.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(org.opcfoundation.ua.core.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(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy... httpsSecurityPolicies)
Define the security policies used for the HTTPS protocol. |
void |
setHttpsSettings(org.opcfoundation.ua.transport.https.HttpsSettings httpsSettings)
|
void |
setHttpsWorkerThreadCount(int httpsWorkerThreadCount)
The number of worker threads to use for the HTTPS server. |
void |
setListener(UaServerListener listener)
|
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 |
setSecurityModes(org.opcfoundation.ua.transport.security.SecurityMode[] securityModes)
Define the supported SecurityModes. |
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(org.opcfoundation.ua.core.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,
org.opcfoundation.ua.builtintypes.LocalizedText shutdownReason)
Shutdown the server. |
void |
shutdown(int secondsTillShutdown,
org.opcfoundation.ua.builtintypes.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,
org.opcfoundation.ua.builtintypes.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 org.opcfoundation.ua.core.RegisteredServer |
toRegisteredServer(String semaphoreFilePath,
boolean isOnline,
UaServer uaServer)
|
protected void |
updateNamespaceArray()
|
protected void |
updateServerArray()
|
protected void |
validateUserError(Session session,
org.opcfoundation.ua.core.UserIdentityToken userToken,
Exception e)
|
protected boolean |
validateUserIdentity(Session session,
ServerUserIdentity userIdentity)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected ApplicationIdentity applicationIdentity
protected ServiceHandler attributeServiceHandler
protected Set<String> discoveryUris
protected Set<String> httpsUris
protected UaServerListener listener
protected NodeManagerRoot nodeManagerRoot
protected NodeManagerTable nodeManagerTable
protected UaServer.NodeManagerUaServer nodeManagerUaServer
protected NodeManagementServiceHandler nodeServiceHandler
protected org.opcfoundation.ua.transport.security.SecurityMode[] securityModes
protected Set<String> serverUris
protected SessionManager sessionManager
protected ScheduledExecutorService executor
protected final SessionManagerListener sessionManagerListener
protected SessionServiceHandler sessionServiceHandler
protected SubscriptionManager subscriptionManager
protected SubscriptionServiceHandler subscriptionServiceHandler
protected DiagnosticsManager diagnosticsManager
| Constructor Detail |
|---|
public UaServer()
| Method Detail |
|---|
public static org.opcfoundation.ua.builtintypes.UnsignedByte getEndpointSecurityLevel(org.opcfoundation.ua.transport.security.SecurityMode sm)
sm -
protected static org.opcfoundation.ua.core.RegisteredServer toRegisteredServer(String semaphoreFilePath,
boolean isOnline,
UaServer uaServer)
public void addEndpoint(String uri,
org.opcfoundation.ua.transport.security.SecurityMode securityMode,
org.opcfoundation.ua.core.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 policies
UaServerException - if the server is running, i.e start has been calledremoveEndpoint(String, SecurityMode)
public String[] addEndpointHost(String hostName)
throws UaServerException
init() and before start() is called.
hostName -
UaServerException
public void addLocale(Locale locale)
throws UaServerException
locale -
UaServerExceptionpublic void addServiceHandler(Object serviceHandler)
serviceHandler -
public void addToServerArray(String uri)
throws StatusException
uri - the URI of the server to add.
StatusException
public void addUserTokenPolicy(org.opcfoundation.ua.core.UserTokenPolicy policy)
throws UaServerException
policy -
UaServerExceptionpublic void close()
public NodeManagerTable getAddressSpace()
getAddressSpace in class UaApplicationpublic ApplicationIdentity getApplicationIdentity()
public ServiceHandler getAttributeServiceHandler()
public Set<InetAddress> getBindAddresses()
EndpointUtil.getInetAddresses(boolean enableIPv6), using
the current value of isEnableIPv6().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 org.opcfoundation.ua.transport.security.SecurityMode getDiscoveryServerRegistrationSecurityMode()
getDiscoveryServerAddress()setDiscoveryServerRegistrationSecurityMode(SecurityMode)public String getDiscoveryServerUrl()
getDiscoveryServerAddress().getAddress()public org.opcfoundation.ua.encoding.EncoderContext getEncoderContext()
getEncoderContext in class UaApplication
public org.opcfoundation.ua.core.EndpointDescription getEndpoint(String uri,
org.opcfoundation.ua.transport.security.SecurityMode securityMode)
uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.securityMode - The security mode of the endpoint
public org.opcfoundation.ua.core.EndpointConfiguration getEndpointConfiguration()
public org.opcfoundation.ua.core.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 org.opcfoundation.ua.core.EndpointDescription[] getEndpoints(String uri)
uri - the server URI. Use UaApplication.formatUri(Protocol, String, int, String)
to compose one.
public String[] getHostNames()
public org.opcfoundation.ua.transport.https.HttpsSettings getHttpsSettings()
public int getHttpsWorkerThreadCount()
setHttpsWorkerThreadCount(int)public UaServerListener getListener()
public Locale[] getLocales()
Application.getLocales()public NodeManagementServiceHandler getNodeManagementServiceHandler()
public NodeManagerRoot getNodeManagerRoot()
@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 want
public org.opcfoundation.ua.transport.security.SecurityMode[] getSecurityModes()
public String getServerName()
public String getServerName(UaApplication.Protocol protocol)
protocol - the protocol whose serverName you want
getServerName() if no
specific value is deifned.
public 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 org.opcfoundation.ua.core.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 false.
public boolean isFailOnBindError()
setFailOnBindError(boolean)public boolean isRunning()
start(),
shutdown(int, LocalizedText)@Deprecated public boolean isUseAllIpAddresses()
@Deprecated public boolean isUseCanonicalHostName()
getServerUris()).
Default: true
isUseHostName()@Deprecated public boolean isUseHostName()
getServerUris()).
Default: true
isUseCanonicalHostName()@Deprecated public boolean isUseLocalhost()
getServerUris()).
Default: true
public 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 format
ServiceException - if the mode cannot be loaded into the server
ModelException
IOException
SAXExceptionpublic 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 offline
public void registerServer(String discoveryUrl,
boolean isOnline)
throws UaServerException
discoveryUrl - the URL of the discovery serverisOnline - whether to register online (server running) or offline
UaServerExceptionsetDiscoveryServerUrl(java.lang.String)
public void removeEndpoint(String uri,
org.opcfoundation.ua.transport.security.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 uri)
init(), otherwise it wont do anything. Also calling this after start()
does not have effect on the bound endpoints.
uri - the given endpointUrl
public void removeLocale(Locale locale)
throws UaServerException
locale -
UaServerException
public void removeUserTokenPolicy(org.opcfoundation.ua.core.UserTokenPolicy policy)
throws UaServerException
policy -
UaServerException
public boolean requestServerStateChange(ServiceContext serviceContext,
org.opcfoundation.ua.core.ServerState state,
org.opcfoundation.ua.builtintypes.DateTime estimatedReturnTime,
org.opcfoundation.ua.builtintypes.UnsignedInteger secondsTillShutdown,
org.opcfoundation.ua.builtintypes.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 shutdown
StatusException - StatusCodes.Bad_UserAccessDenied if the user is not authorized
to request the state changepublic void setApplicationIdentity(ApplicationIdentity identity)
ApplicationIdentity.loadOrCreateCertificate(org.opcfoundation.ua.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(org.opcfoundation.ua.transport.security.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.
Default: SecurityMode.BASIC128RSA15_SIGN_ENCRYPT
discoveryServerRegistrationSecurityMode - the discoveryServerRegistrationSecurityMode to
set
public void setDiscoveryServerUrl(String discoveryServerUrl)
throws URISyntaxException
discoveryServerUrl - the discoveryServerUrl to set
URISyntaxException - 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(org.opcfoundation.ua.core.EndpointConfiguration endpointConfiguration)
endpointConfiguration - the value to set. Use null to reset back to
EndpointConfiguration.defaults().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: true
failOnBindError - the failOnBindError to set
public void setHttpsSecurityPolicies(org.opcfoundation.ua.transport.security.HttpsSecurityPolicy... httpsSecurityPolicies)
throws UaServerException
httpsSecurityPolicies - the httpsSecurityPolicies to set
UaServerException - if the server is runningpublic void setHttpsSettings(org.opcfoundation.ua.transport.https.HttpsSettings httpsSettings)
httpsSettings - the httpsSettings to setpublic void setHttpsWorkerThreadCount(int httpsWorkerThreadCount)
init() is called.
Default: 10
httpsWorkerThreadCount - the httpsWorkerThreadCount to setpublic void setListener(UaServerListener listener)
listener - the listener to set
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. 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 already
public 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.
UaServerException - if the server isRunning already
public void setSecurityModes(org.opcfoundation.ua.transport.security.SecurityMode[] securityModes)
throws UaServerException
securityModes - the securityMode to set
UaServerException - if the server isRunning already
public 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 set
UaServerException - 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: true
useCanonicalHostName - 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: true
useHostName - the useHostName to setsetUseAllIpAddresses(boolean),
setUseCanonicalHostName(boolean),
setUseLocalhost(boolean)
@Deprecated
public void setUseLocalhost(boolean useLocalhost)
throws UaServerException
getServerUris()).
Default: false
useLocalhost - 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(org.opcfoundation.ua.core.UserTokenPolicy... userTokenPolicies)
throws UaServerException
userTokenPolicies - the securityMode to set
UaServerException - 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,
org.opcfoundation.ua.builtintypes.LocalizedText shutdownReason)
secondsTillShutdown - the delay after notifying the clients about the shutdownshutdownReason - the shutdown reason message provided for the clients
public void shutdown(int secondsTillShutdown,
org.opcfoundation.ua.builtintypes.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 NodeManager createNewNodeManager(ServiceContext serviceContext,
String namespaceUri)
throws StatusException
serviceContext - namespaceUri -
StatusException - if the operation is not allowed.protected NodeManagementServiceHandler createNodeManagementServiceHandler()
protected SessionManager createSessionManager()
StatusExceptionprotected SessionServiceHandler createSessionServiceHandler()
protected SubscriptionManager createSubscriptionManager()
protected SubscriptionServiceHandler createSubscriptionServiceHandler()
protected UaServer.DiscoveryServer getDiscoveryServer()
protected String getDiscoveryUriOf(String uri)
throws URISyntaxException
uri -
URISyntaxExceptionprotected ScheduledExecutorService getExecutor()
protected int getHttpsPort()
protected org.opcfoundation.ua.transport.security.HttpsSecurityPolicy[] getHttpsSecurityPolicies()
protected org.opcfoundation.ua.application.Server getServer()
protected void initAggregateFunctions()
protected void initServerArray()
throws UaServerException
UaServerException
protected void initServiceHandlers()
throws UaServerException
UaServerException
protected void logRegisterServerError(String discoveryServerUrl,
boolean isOnline,
UaServerException e)
isOnline - discoveryServerUrl - e -
protected void setHttpsPort(int httpsPort)
throws UaServerException
httpsPort - the httpsPort to set
UaServerException
protected void shutdownBegin(int secondsTillShutdown,
org.opcfoundation.ua.builtintypes.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
StatusException
protected void validateUserError(Session session,
org.opcfoundation.ua.core.UserIdentityToken userToken,
Exception e)
session - userToken - e -
protected boolean validateUserIdentity(Session session,
ServerUserIdentity userIdentity)
throws StatusException
session - userIdentity -
StatusException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||