| ibi Patterns .NET API

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | List of all members
NetricsServerInterface.NetricsConMgr Class Reference

Create connections to the ibi™ Patterns - Search Server. More...

## Public Types
enum | ProtocolChoice { DEFAULT , IPV4_ONLY , IPV6_ONLY , MIXED }
| Network protocol options for connecting to an ibi™ Patterns - Search Server. More...

## Public Member Functions
| NetricsConMgr ()
| Create a connection manager.
String | getHost ()
| Return the current ibi™ Patterns - Search host machine.
void | setHost (String host)
int | getPort ()
void | setDebugOn ()
| Set debug logging on.
void | setDebugOff ()
| Set debug logging off.
bool | isDebugOn ()
| Return true if the debug setting is turned on.
void | setConnectionPoolingOff ()
| Turn off connection pooling.
void | setConnectionPoolingCommon ()
| Set connection pooling to common mode.
void | setConnectionPoolingLocal ()
| Set connection pooling to local mode.
bool | isConnectionPoolingCommon ()
| Return true if the current connection pooling setting is common mode.
bool | isConnectionPoolingLocal ()
| Return true if the current connection pooling setting is local mode.
void | setNetProtocols (NetricsConMgr.ProtocolChoice protocols)
| Set the network protocols that will be used to connect to the ibi™ Patterns - Search Server.
NetricsServerInterface | newConnection ()
| Create a new connection.
NetricsTransaction | beginWork ()
| Create a new transaction connection.
NetricsTransaction | continueWork (long tran_id)
bool | getSSLEnabled ()
| Returns.
void | setSSLEnabled (bool enable)
| Sets the SSL enable flag.
RemoteCertificateValidationCallback | getCertificateValidator ()
| Get the current certificate-validation callback.
void | setCertificateValidator (RemoteCertificateValidationCallback certValidator)
| Sets the certificate-validation callback.

## Static Public Member Functions
static bool | DefaultCertificateValidator (object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
| Ignores server-name mismatches in certificate validation.

## Detailed Description

Create connections to the ibi™ Patterns - Search Server.

This is a factory class used to create a connection to the ibi™ Patterns - Search Server. Each object of this class is associated with a particular ibi™ Patterns - Search Server and contains all of the information necessary to connect to the engine. All of this information has default values, and an associated environment variable. Methods are provided to override these settings. If a value is set via a method call that value takes precedence, otherwise the value of the associated environment variable is used, if the environment variable does not exist in the environment the default value is used. The values are listed below.

Host Machine. An IP address or name resolvable to an IP address of the machine the ibi™ Patterns - Search Server is on.
Environment Variable: TIBCOPatternsServerHost
Default value: localhost

Host Port. The port number the ibi™ Patterns - Search Server is listening on. If the environment variable does not contain an integer string value it is ignored.
Environment Variable: TIBCOPatternsServerPort
Default value: 5051

Connection Pooling. The type of connection pooling to be used. The environment variable must have a value of: "common", "local" or "none". Other values are ignored.
Environment Variable: TIBCOPatternsConnectionPooling
Default value: common

Protocol Selection. Whether communications should use IPv4, IPv6, or defer the choice to network configuration. The environment variable must have a value of: "ipv4" or "ipv6" or "mixed". Other values are ignored.
Environment Variable: TIBCOPatternsConnectionProtocols
Default value: mixed, except on Windows Server 2003 (and Windows XP), where the default is ipv4.

Debug Logging. Whether all communications should be logged to standard error. These logs will be very large and verbose, they are only used for debugging. The environment variable must have a value of: "on" or "off". Other values are ignored.
Environment Variable: TIBCOPatternsConnectionDebug
Default value: off

None of the following methods should be called on an object that is being shared across multiple threads:

- setHost
- setPort
- setDebugOn
- setDebugOff
- setConnectionPoolingOff
- setConnectionPoolingCommon
- setConnectionPoolingLocal

The recommended procedure is to create and initialize a NetricsConMgr object in the main thread, it may then be passed to other threads, which may use it to create NetricsServerInterface or NetricsTransaction objects, but once shared between threads the NetricsConMgr object should never be updated by calling any of the methods listed above.

## Member Enumeration Documentation

## ◆ ProtocolChoice

enum NetricsServerInterface.NetricsConMgr.ProtocolChoice

Network protocol options for connecting to an ibi™ Patterns - Search Server.

Enumerator
DEFAULT | Use the default protocols.
IPV4_ONLY | Use only the IPv4 protocol.
IPV6_ONLY | Use only the IPv6 protocol.
MIXED | Defer choice between IPv4 and IPv6 to network configuration.

## Constructor & Destructor Documentation

## ◆ NetricsConMgr()

NetricsServerInterface.NetricsConMgr.NetricsConMgr | ( |  | ) |
| inline

Create a connection manager.

The settings are taken from the environment variables or default values as described above.

## Member Function Documentation

## ◆ beginWork()

NetricsTransaction NetricsServerInterface.NetricsConMgr.beginWork | ( |  | ) |
| inline

Create a new transaction connection.

This creates a new connection to the ibi™ Patterns - Search Server and associates it with a new explicit transaction. All operations made through the returned interface object that modify data on the ibi Patterns Server are associated with the transaction. This is the only means of creating explicit transactions through the .NET API.

An exception is thrown if a connection can't be established or a new transaction can't be created.

The interface object uses the connection settings of the connection manager object at the time it is created. Once created the interface object is separate from the connection manager object that created it. Changing settings in the connection manager object will not affect the settings in the interface object and vice versa.

See also
  NetricsTransaction

## ◆ continueWork()

NetricsTransaction NetricsServerInterface.NetricsConMgr.continueWork | ( | long | tran_id | ) |
| inline

Continue work on an existing explicit transaction.

This creates a new connection to the ibi™ Patterns - Search Server and associates it with an existing explicit transaction. All operations made through the returned interface object that modify data on the ibi Patterns Server are associated with the transaction.

The interface object uses the connection settings of the connection manager object at the time it is created. Once created the interface object is separate from the connection manager object that created it. Changing settings in the connection manager object will not affect the settings in the interface object and vice versa.

NetricsTransaction

## ◆ DefaultCertificateValidator()

static bool NetricsServerInterface.NetricsConMgr.DefaultCertificateValidator | ( | object | sender,
|  | X509Certificate | certificate,
|  | X509Chain | chain,
|  | SslPolicyErrors | sslPolicyErrors
| ) |  |
| inline static

Ignores server-name mismatches in certificate validation.

This is the ibi™ Patterns - Search .NET API default certificate validator. It bypasses server-name validation. This is because hosts are often specified by IP Address or a host name alias such as 'localhost', instead of an internet-registered host name.

See also
  RemoteCertificateValidationCallback

## ◆ getCertificateValidator()

RemoteCertificateValidationCallback NetricsServerInterface.NetricsConMgr.getCertificateValidator | ( |  | ) |
| inline

Get the current certificate-validation callback.

The validator is ignored if SSL is disabled.

Returns

  the current certificate validator. The default is DefaultCertificateValidator.

  A null return indicates the application has changed validation back to the .NET Framework default.

## ◆ getHost()

String NetricsServerInterface.NetricsConMgr.getHost | ( |  | ) |
| inline

Return the current ibi™ Patterns - Search host machine.

summary>Set the ibi™ Patterns - Search host machine.

This changes the host machine for this connection manager. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created via this object.

## ◆ getPort()

int NetricsServerInterface.NetricsConMgr.getPort | ( |  | ) |
| inline

summary>Set the port to use when connecting to the ibi™ Patterns - Search server.

This sets the port to use when connecting to the ibi™ Patterns - Search Server. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created via this object.

Parameters

  port | the port number to use when connecting.

## ◆ getSSLEnabled()

bool NetricsServerInterface.NetricsConMgr.getSSLEnabled | ( |  | ) |
| inline

Returns.

SSL is disabled by default.

Returns
  the SSL enable flag.

## ◆ newConnection()

NetricsServerInterface NetricsServerInterface.NetricsConMgr.newConnection | ( |  | ) |
| inline

Create a new connection.

This creates a new connection to the ibi™ Patterns - Search Server. All operations made through the returned interface object that modify data on the ibi Patterns Server are associated with separate implicit transactions that are automatically committed or aborted when each operation returns.

An exception is thrown if a connection can't be established.

The interface object uses the connection settings of the connection manager object at the time it is created. Once created the interface object is separate from the connection manager object that created it. Changing settings in the connection manager object will not affect the settings in the interface object and vice versa.

See also
  NetricsServerInterface

## ◆ setCertificateValidator()

void NetricsServerInterface.NetricsConMgr.setCertificateValidator | ( | RemoteCertificateValidationCallback | certValidator | ) |
| inline

Sets the certificate-validation callback.

The default is DefaultCertificateValidator. A custom certificate validator is needed only in unusual circumstances. For example if a self-signed certificate is in use.

A sample custom certificate validator for self-signed certificates:

private static bool
validateSelfSignedCertificate(object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors sslPolicyErrors)
{
if (sslPolicyErrors == SslPolicyErrors.None)
return true;
// A self-signed certificate should have exactly one chain status entry,
// and that entry should be "untrusted root"
if ((sslPolicyErrors &amp; SslPolicyErrors.RemoteCertificateChainErrors) != 0) {
if ((chain.ChainStatus.Length == 1) &amp;&amp; (chain.ChainStatus[0].Status == X509ChainStatusFlags.UntrustedRoot)) {
// The one acceptable case
sslPolicyErrors -= SslPolicyErrors.RemoteCertificateChainErrors;
}
else {
Console.WriteLine("{0} cert chain errors", chain.ChainStatus.Length);
foreach (var chainStatus in chain.ChainStatus) {
X509ChainStatusFlags xflags = chainStatus.Status;
Console.WriteLine("\t" + chainStatus.Status);
Console.WriteLine("\t" + chainStatus.StatusInformation);
}
return false;
}
}
// Self-signed certificates likely won't match the "domain name"
sslPolicyErrors = sslPolicyErrors &amp; ~SslPolicyErrors.RemoteCertificateNameMismatch;
if (sslPolicyErrors == SslPolicyErrors.None)
return true;
Console.WriteLine("Certificate error: {0}", sslPolicyErrors);
return false;
}

Parameters

  certValidator | The callback used to filter validation.

setSSLEnabled(bool)

See also
  setSSLEnabled(bool)

## ◆ setConnectionPoolingCommon()

void NetricsServerInterface.NetricsConMgr.setConnectionPoolingCommon | ( |  | ) |
| inline

Set connection pooling to common mode.

This causes any new NetricsServerInterface or NetricsTransaction objects created to use common connection pooling. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created.

When common connection pooling is used the interface object will use a pool of connections that is shared with other interface objects using common connection pooling. This mode minimizes the number of new connections that are made to the server.

## ◆ setConnectionPoolingLocal()

void NetricsServerInterface.NetricsConMgr.setConnectionPoolingLocal | ( |  | ) |
| inline

Set connection pooling to local mode.

This causes any new NetricsServerInterface or NetricsTransaction objects created to use local connection pooling. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created.

When local connection pooling is used the interface object keeps its own pool of connections. It will not share connections with other interface objects.

## ◆ setConnectionPoolingOff()

void NetricsServerInterface.NetricsConMgr.setConnectionPoolingOff | ( |  | ) |
| inline

Turn off connection pooling.

This causes any new NetricsServerInterface or NetricsTransaction objects created to not use connection pooling. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created.

With connection pooling off every command will establish a new connection to the server. The connection will be dropped when the command completes.

## ◆ setDebugOff()

void NetricsServerInterface.NetricsConMgr.setDebugOff | ( |  | ) |
| inline

Set debug logging off.

This causes any new NetricsServerInterface or NetricsTransaction objects created to have their connection debug logging turned off. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created.

Off is the default setting for debug logging.

## ◆ setDebugOn()

void NetricsServerInterface.NetricsConMgr.setDebugOn | ( |  | ) |
| inline

Set debug logging on.

This causes any new NetricsServerInterface or NetricsTransaction objects created to have their connection debug logging turned on. This doesn't affect NetricsServerInterface or NetricsTransactions objects already created.

Debug logging is generated to the standard error and is very verbose. It should only be used for debugging specific problems.

## ◆ setHost()

void NetricsServerInterface.NetricsConMgr.setHost | ( | String | host | ) |
| inline

summary>This returns the current ibi™ Patterns - Search listen port.

## ◆ setNetProtocols()

void NetricsServerInterface.NetricsConMgr.setNetProtocols | ( | NetricsConMgr::ProtocolChoice | protocols | ) |
| inline

Set the network protocols that will be used to connect to the ibi™ Patterns - Search Server.

Parameters

  protocols | Which protocols to use.

*‍/

## ◆ setSSLEnabled()

void NetricsServerInterface.NetricsConMgr.setSSLEnabled | ( | bool | enable | ) |
| inline

Sets the SSL enable flag.

SSL is disabled by default.

Parameters

  enable | Pass true to enable SSL, false to disable.

See also
  setCertificateValidator(RemoteCertificateValidationCallback)