.NET Based OPC UA Client/Server SDK  3.3.3.537
UnifiedAutomation.UaBase.ApplicationInstanceBase Class Reference

Represents an instance of a UA application. More...

Inherited by UnifiedAutomation.UaBase.ApplicationInstance.

Public Member Functions

 ApplicationInstanceBase ()
 Creates an instance of ApplicationInstanceBase. More...
 
ICertificateValidator FindCertificateValidator (string endpointUrl)
 Finds the certificate validator for the specified endpoint. More...
 
void UpdateCertificateValidator (string endpointUrl, ICertificateValidator validator)
 Updates the certificate validator associated with the endpoint. More...
 
void ChangeCertificate (ICertificate oldCertificate, ICertificate newCertificate)
 Changes the certificate. More...
 
MessageContext GetServerMessageContext ()
 Create a new message context for the server. More...
 
StatusCode GetEndpointStatus (EndpointDescription endpoint)
 Gets the endpoint status. More...
 
void SetEndpointStatus (EndpointDescription endpoint, StatusCode status)
 Sets the endpoint status. More...
 
virtual void SetApplicationSettings (UaSchema.IConfiguration settings)
 Sets the application settings. More...
 
GetConfigurationExtension< T > (bool silent, XmlQualifiedName elementName=null)
 Parses the extension. More...
 
void SetConfigurationExtension< T > (T extension)
 Updates the extension. More...
 
virtual void ValidateCertificate (ICertificate certificate)
 Verifies the certificate. More...
 
void ValidateCertificate (ICertificate certificate, string applicationUri, string endpointUrl)
 Verifies the certificate. More...
 
virtual void AddCertificateToTrustList (ICertificate certificate)
 Adds the certificate to trust list. More...
 
void Start ()
 Starts the application. More...
 
void Start (WaitCallback callback, object userData)
 Starts the application. More...
 
virtual void Start (ServerBase server, WaitCallback callback, object userData, bool silent=false)
 Starts the application. More...
 
virtual void CreateCertificateGroups ()
 Creates the certificate groups that appear in the ServerConfiguration object. More...
 
virtual void LoadConfiguration (bool silent, bool isServer)
 Loads the configuration. More...
 
virtual void SaveConfiguration (bool silent)
 Saves the configuration. More...
 

Protected Member Functions

virtual void CreateDefaultProtocolFactory ()
 Creates the default security provider. More...
 
virtual void CreateDefaultSecurityProvider ()
 Creates the default security provider. More...
 
void CallApplicationSettingsLoaded ()
 Calls the ApplicationSettingsLoaded event handler if set. More...
 
virtual void ChangesCompleted ()
 
virtual void ApplicationInDemoMode (ApplicationLicense license)
 
void StartGdsHandlerIfConfigured ()
 Calls GdsHandler.Start if not null and configured More...
 
string GetDefaultOrganisationName ()
 Gets the default organization name of the product. More...
 
virtual bool CheckConfiguration (bool silent)
 Checks the configuration. More...
 
virtual void CreateReverseConnect ()
 Creates a new instance of the ReverseConnect manager More...
 
EndpointDescription GetEndpointDescription (string endpointUrl, UaSchema.EndpointConfiguration configuration, string securityProfileUri, MessageSecurityMode securityMode, ApplicationDescription application)
 Gets the endpoint description. More...
 
void ApplyTraceSettings ()
 Applies the trace settings found in the ApplicationSettings. More...
 
bool LoadConfigurationFromFile (string filePath, bool silent)
 Loads the configuration from file. More...
 
bool LoadConfigurationFromResource (bool silent)
 Loads the configuration from embedded resource. More...
 
virtual void LoadDefaultConfiguration (bool isServer)
 Creates the default application settings. More...
 

Properties

static ApplicationInstanceBase Default [get]
 Gets the default ApplicationInstanceBase for the process. More...
 
string ApplicationName [get, set]
 Gets or sets the name of the application. More...
 
string ApplicationUri [get, set]
 Gets or sets the application URI. More...
 
ApplicationType ApplicationType [get, set]
 Gets or sets the type of the application. More...
 
string ProductUri [get, set]
 Gets or sets the product URI. More...
 
string ProductVersion [get, set]
 Gets or sets the product version. More...
 
IProtocolFactory ProtocolFactory [get, set]
 Get the object that provides access to protocols used by the application. More...
 
ISecurityProvider SecurityProvider [get, set]
 Get the object that provides access to cryptography services used by the application. More...
 
ICertificate ApplicationCertificate [get, set]
 Gets or sets the application certificate. More...
 
ICertificateStore TrustedStore [get, set]
 Gets or sets the trusted store. More...
 
ICertificateStore IssuerStore [get, set]
 Gets or sets the issuer store. More...
 
ICertificateStore RejectedStore [get, set]
 Gets or sets the rejected store. More...
 
ICertificateValidator CertificateValidator [get, set]
 Gets or sets the certificate validator. More...
 
EncodeableFactory KnownTypeFactory [get, set]
 Gets or sets the known type factory. More...
 
EndpointConfiguration DefaultEndpointConfiguration [get, set]
 Gets or sets the default endpoint configuration. More...
 
ApplicationThreadPool ThreadPool [get, set]
 Gets or sets the thread pool used by the application. More...
 
IList< CertificateGroupCertificateGroups [get]
 Gets the certificate groups used to manage configuration of certificates and trust lists. More...
 
ReverseConnectManager ReverseConnectManager [get]
 Gets the ReverseConnect manager for client applications More...
 
IGlobalDiscoveryService GdsHandler [get, set]
 Starts the Gds interaction if not null on Start. More...
 
IList< EndpointDescriptionEndpoints [get, set]
 Gets or sets the endpoints. More...
 
bool IsStarted [get, protected set]
 Gets a value indicating whether this instance is started. More...
 
bool AutoCreateCertificate [get, set]
 Gets or sets a value indicating whether the certificate should be automatically created. More...
 
bool SuppressErrorReporting [get, set]
 
UaSchema.IConfiguration ApplicationSettings [get, protected set]
 Gets the application settings. More...
 
string ConfigurationFilePath [get, set]
 Gets or sets the configuration file path. More...
 
string EmbeddedConfigurationAssemblyName [get, set]
 Gets or sets the name of the assembly which has the embedded resource containing the default configuration file. More...
 
bool ConfigurationDirty [get, set]
 
bool ConfigurationLoaded [get, set]
 

Events

CreateCertificateEventHandler MissingApplicationCertificate
 Occurs when the application certificate is missing. More...
 
UntrustedCertificateEventHandler UntrustedCertificate
 Occurs when an untrusted certificate is encountered. More...
 
EventHandler ConfigurationChanged
 Occurs if the configuration has changed and needs to be persisted. More...
 
EventHandler ApplicationSettingsLoaded
 Occurs after ApplicationSettings are loaded. Can be used to update ApplicationSettings in code. More...
 

Detailed Description

Represents an instance of a UA application.

Constructor & Destructor Documentation

UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationInstanceBase ( )

Creates an instance of ApplicationInstanceBase.

Member Function Documentation

virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.AddCertificateToTrustList ( ICertificate  certificate)
virtual

Adds the certificate to trust list.

Parameters
certificateThe certificate.
void UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplyTraceSettings ( )
protected

Applies the trace settings found in the ApplicationSettings.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.CallApplicationSettingsLoaded ( )
protected

Calls the ApplicationSettingsLoaded event handler if set.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.ChangeCertificate ( ICertificate  oldCertificate,
ICertificate  newCertificate 
)

Changes the certificate.

Parameters
oldCertificateThe old certificate.
newCertificateThe new certificate.
Exceptions
System.ArgumentNullExceptionnewCertificate
virtual bool UnifiedAutomation.UaBase.ApplicationInstanceBase.CheckConfiguration ( bool  silent)
protectedvirtual

Checks the configuration.

Parameters
silentif set to true then no exceptions will be thrown.
Returns
True if no errors occurred or if they could be automatically corrected.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.CreateCertificateGroups ( )
virtual

Creates the certificate groups that appear in the ServerConfiguration object.

virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.CreateDefaultProtocolFactory ( )
protectedvirtual

Creates the default security provider.

virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.CreateDefaultSecurityProvider ( )
protectedvirtual

Creates the default security provider.

By default an instance of DefaultSecurityProvider is created which cannot be used for the management of the own ApplicationInstace certificate. Subclasses may create another implementation of the ISecurityProvider interface.

Reimplemented in UnifiedAutomation.UaBase.ApplicationInstance.

virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.CreateReverseConnect ( )
protectedvirtual

Creates a new instance of the ReverseConnect manager

ICertificateValidator UnifiedAutomation.UaBase.ApplicationInstanceBase.FindCertificateValidator ( string  endpointUrl)

Finds the certificate validator for the specified endpoint.

Parameters
endpointUrlThe endpoint URL.
Returns
The certificate validator for the specified endpoint if one exists. The default certificate validator otherwise.
T UnifiedAutomation.UaBase.ApplicationInstanceBase.GetConfigurationExtension< T > ( bool  silent,
XmlQualifiedName  elementName = null 
)

Parses the extension.

Template Parameters
T
Parameters
silentif set to true then errors are suppressed.
elementNameName of the element.
Returns
The settings. Returns null if a suppressed error occurred or if the extension does not exist.

If the elementName is not null the type passed must support DataContract serialization or have the XmlRoot attribute defined.

Type Constraints
T :class 
T :new() 
string UnifiedAutomation.UaBase.ApplicationInstanceBase.GetDefaultOrganisationName ( )
protected

Gets the default organization name of the product.

EndpointDescription UnifiedAutomation.UaBase.ApplicationInstanceBase.GetEndpointDescription ( string  endpointUrl,
UaSchema.EndpointConfiguration  configuration,
string  securityProfileUri,
MessageSecurityMode  securityMode,
ApplicationDescription  application 
)
protected

Gets the endpoint description.

Parameters
endpointUrlThe endpoint URL.
configurationThe configuration for the endpoint.
securityProfileUriThe security profile URI.
securityModeThe security mode.
applicationThe application.
Returns
The endpoint description.
StatusCode UnifiedAutomation.UaBase.ApplicationInstanceBase.GetEndpointStatus ( EndpointDescription  endpoint)

Gets the endpoint status.

Parameters
endpointThe endpoint.
Returns
MessageContext UnifiedAutomation.UaBase.ApplicationInstanceBase.GetServerMessageContext ( )

Create a new message context for the server.

Returns
The message context.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.LoadConfiguration ( bool  silent,
bool  isServer 
)
virtual

Loads the configuration.

Parameters
silentif set to true then no exceptions will be thrown.
isServerif set to true the application is a server.

Reimplemented in UnifiedAutomation.UaBase.ApplicationInstance.

bool UnifiedAutomation.UaBase.ApplicationInstanceBase.LoadConfigurationFromFile ( string  filePath,
bool  silent 
)
protected

Loads the configuration from file.

Parameters
silentif set to true then no exceptions will be thrown.
filePathif set to true path to configuration file.
bool UnifiedAutomation.UaBase.ApplicationInstanceBase.LoadConfigurationFromResource ( bool  silent)
protected

Loads the configuration from embedded resource.

Parameters
silentif set to true then no exceptions will be thrown.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.LoadDefaultConfiguration ( bool  isServer)
protectedvirtual

Creates the default application settings.

Parameters
isServerif set to true the application is a server.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.SaveConfiguration ( bool  silent)
virtual

Saves the configuration.

Parameters
silentIf set to true then no exceptions will be thrown.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.SetApplicationSettings ( UaSchema.IConfiguration  settings)
virtual

Sets the application settings.

Parameters
settingsThe settings.

This method cannot be called after Start() has been called.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.SetConfigurationExtension< T > ( extension)

Updates the extension.

Template Parameters
T
Parameters
extensionThe extension.
Type Constraints
T :class 
void UnifiedAutomation.UaBase.ApplicationInstanceBase.SetEndpointStatus ( EndpointDescription  endpoint,
StatusCode  status 
)

Sets the endpoint status.

Parameters
endpointThe endpoint.
statusThe status.
void UnifiedAutomation.UaBase.ApplicationInstanceBase.Start ( )

Starts the application.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.Start ( WaitCallback  callback,
object  userData 
)

Starts the application.

Parameters
callbackThe method to call when initialization is complete.
userDataThe user data to be passed to the callback.
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.Start ( ServerBase  server,
WaitCallback  callback,
object  userData,
bool  silent = false 
)
virtual

Starts the application.

Parameters
serverThe server.
callbackThe method to call when initialization is complete.
userDataThe user data to be passed to the callback.
silentIf true no exceptions are thrown.

Reimplemented in UnifiedAutomation.UaBase.ApplicationInstance.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.StartGdsHandlerIfConfigured ( )
protected

Calls GdsHandler.Start if not null and configured

void UnifiedAutomation.UaBase.ApplicationInstanceBase.UpdateCertificateValidator ( string  endpointUrl,
ICertificateValidator  validator 
)

Updates the certificate validator associated with the endpoint.

Parameters
endpointUrlThe endpoint URL. If null then the default validator is updated.
validatorThe validator.
Exceptions
System.ArgumentNullExceptionvalidator
System.ArgumentExceptionNo validator has been configured for the specified endpoint.;endpointUrl
virtual void UnifiedAutomation.UaBase.ApplicationInstanceBase.ValidateCertificate ( ICertificate  certificate)
virtual

Verifies the certificate.

Parameters
certificateThe certificate.

This method uses the application configuration to determine the trust list. An exception is thrown if any error occurs.

void UnifiedAutomation.UaBase.ApplicationInstanceBase.ValidateCertificate ( ICertificate  certificate,
string  applicationUri,
string  endpointUrl 
)

Verifies the certificate.

Parameters
certificateThe certificate.
applicationUriIf not null the certificate must contain this URI.
endpointUrlIf not null the certificate hostnames must match this URL.

This method uses the application configuration to determine the trust list. An exception is thrown if any error occurs.

Property Documentation

ICertificate UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationCertificate
getset

Gets or sets the application certificate.

The application certificate.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationName
getset

Gets or sets the name of the application.

The name of the application.

UaSchema.IConfiguration UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationSettings
getprotected set

Gets the application settings.

Returns
The application settings.

Changing this object after Start() is called may have unpredictable effects.

ApplicationType UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationType
getset

Gets or sets the type of the application.

The type of the application.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationUri
getset

Gets or sets the application URI.

The application URI.

bool UnifiedAutomation.UaBase.ApplicationInstanceBase.AutoCreateCertificate
getset

Gets or sets a value indicating whether the certificate should be automatically created.

true if the certificate should be automatically created; otherwise, false.

IList<CertificateGroup> UnifiedAutomation.UaBase.ApplicationInstanceBase.CertificateGroups
get

Gets the certificate groups used to manage configuration of certificates and trust lists.

The certificate groups used to manage configuration of certificates and trust lists.

ICertificateValidator UnifiedAutomation.UaBase.ApplicationInstanceBase.CertificateValidator
getset

Gets or sets the certificate validator.

The certificate validator.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.ConfigurationFilePath
getset

Gets or sets the configuration file path.

An XML file matching the schema http://opcfoundation.org/UA/2011/03/SecuredApplication.xsd.

You can get valid configuration files by removing the outer XML tags from the app.config files from the examples. So the configuration file starts with a SecuredApplication tag.

ApplicationInstanceBase UnifiedAutomation.UaBase.ApplicationInstanceBase.Default
staticget

Gets the default ApplicationInstanceBase for the process.

EndpointConfiguration UnifiedAutomation.UaBase.ApplicationInstanceBase.DefaultEndpointConfiguration
getset

Gets or sets the default endpoint configuration.

The default endpoint configuration.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.EmbeddedConfigurationAssemblyName
getset

Gets or sets the name of the assembly which has the embedded resource containing the default configuration file.

The name of the assembly which has the embedded resource containing the default configuration file.

If not specified the EXE assembly is used.

IList<EndpointDescription> UnifiedAutomation.UaBase.ApplicationInstanceBase.Endpoints
getset

Gets or sets the endpoints.

The endpoints.

IGlobalDiscoveryService UnifiedAutomation.UaBase.ApplicationInstanceBase.GdsHandler
getset

Starts the Gds interaction if not null on Start.

bool UnifiedAutomation.UaBase.ApplicationInstanceBase.IsStarted
getprotected set

Gets a value indicating whether this instance is started.

true if this instance is started; otherwise, false.

ICertificateStore UnifiedAutomation.UaBase.ApplicationInstanceBase.IssuerStore
getset

Gets or sets the issuer store.

The issuer store.

EncodeableFactory UnifiedAutomation.UaBase.ApplicationInstanceBase.KnownTypeFactory
getset

Gets or sets the known type factory.

The known type factory.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.ProductUri
getset

Gets or sets the product URI.

The product URI.

string UnifiedAutomation.UaBase.ApplicationInstanceBase.ProductVersion
getset

Gets or sets the product version.

The product version.

IProtocolFactory UnifiedAutomation.UaBase.ApplicationInstanceBase.ProtocolFactory
getset

Get the object that provides access to protocols used by the application.

ICertificateStore UnifiedAutomation.UaBase.ApplicationInstanceBase.RejectedStore
getset

Gets or sets the rejected store.

The rejected store.

ReverseConnectManager UnifiedAutomation.UaBase.ApplicationInstanceBase.ReverseConnectManager
get

Gets the ReverseConnect manager for client applications

ISecurityProvider UnifiedAutomation.UaBase.ApplicationInstanceBase.SecurityProvider
getset

Get the object that provides access to cryptography services used by the application.

By default an instance of DefaultSecurityProvider is created which cannot be used for the management of the own ApplicationInstace certificate. Subclasses may create another implementation of the ISecurityProvider interface.

ApplicationThreadPool UnifiedAutomation.UaBase.ApplicationInstanceBase.ThreadPool
getset

Gets or sets the thread pool used by the application.

If this value is set all Client Sessions or Server Instances created with this ApplicationInstanceBase will use this thread pool. If this value is left null then each Client Session or Server Instance will create its own ThreadPool. Note that operations using .NET framework asynchronous I/O capabilities will still use .NET framework ThreadPool even if this property is set. If this property is set the ThreadPool settings in the ApplicationConfiguration are ignored.

This is an example for creating the ThreadPool:

var application = new ApplicationInstanceBase()
{
ThreadPool = new ApplicationThreadPool(10, 10000)
};
ICertificateStore UnifiedAutomation.UaBase.ApplicationInstanceBase.TrustedStore
getset

Gets or sets the trusted store.

The trusted store.

Event Documentation

EventHandler UnifiedAutomation.UaBase.ApplicationInstanceBase.ApplicationSettingsLoaded

Occurs after ApplicationSettings are loaded. Can be used to update ApplicationSettings in code.

EventHandler UnifiedAutomation.UaBase.ApplicationInstanceBase.ConfigurationChanged

Occurs if the configuration has changed and needs to be persisted.

This event can be raised from a background thread and BeginInvoke may need to be called if being handled by a UI.

CreateCertificateEventHandler UnifiedAutomation.UaBase.ApplicationInstanceBase.MissingApplicationCertificate

Occurs when the application certificate is missing.

This event is raised from the thread used to call Start.

UntrustedCertificateEventHandler UnifiedAutomation.UaBase.ApplicationInstanceBase.UntrustedCertificate

Occurs when an untrusted certificate is encountered.

This event can be raised from a background thread and Invoke may need to be called if being handled by a UI. This event has return parameters so BeginInvoke cannot be used. Displaying a modal dialog in the callback will not work if the UI thread is blocked on a another operation. This problem can be avoided by using asynchronous method calls when available.


The documentation for this class was generated from the following file: