TIBCO EMS .NET API 10.2
TIBCO EMS .NET API 10.2
TIBCO.EMS.LookupContextFactory Class Reference

Create ILookupContext objects More...

Inheritance diagram for TIBCO.EMS.LookupContextFactory:
TIBCO.EMS.UFO.LookupContextFactory

Public Member Functions

 LookupContextFactory ()
 Default constructor to create a context factory More...
 
virtual ILookupContext CreateContext (String name, Hashtable props)
 Returns the initial context used to search for administered objects More...
 

Public Attributes

const String LDAP_CONTEXT = "ldap"
 Public const string to create a ldap context to lookup administered object in an ldap server. More...
 
const String TIBJMS_NAMING_CONTEXT = "tibjmsnaming"
 Public const string to create a tibjmsnaming context to lookup administered object inside the tibjmsnaming server. More...
 

Detailed Description

Create ILookupContext objects

To lookup administered objects (ConnectionFactories, Topics and Queues) in either a third-party LDAP naming server or the TIBCO EMS Naming server, clients create an instance of the LookupContextFactory and invoke the CreateContext method to get an ILookupContext object.

Users can create an instance of the LookupContextFactory and the invoke the CreateContext method to get a LDAP_CONTEXT or TIBJMS_NAMING_CONTEXT object.

Example for creating a context for looking up objects in the built in naming/directory server

Hashtable env = new Hashtable();
env.Add(LookupContext.PROVIDER_URL, "tibjmsnaming://localhost:7222");
env.Add(LookupContext.SECURITY_PRINCIPAL", "myUserName");
env.Add(LookupContext.SECURITY_CREDENTIALS", "myPassword");
try {
ILookupContext searcher = factory.CreateContext(LookupContextFactory.TIBJMS_NAMING_CONTEXT, env);
TIBCO.EMS.Queue queue = (TIBCO.EMS.Queue)searcher.Lookup("theQueueName");
...
} catch (NamingException) {
...
}

This example shows how to lookup an object in the LDAP server by getting an LdapLookupContext from the LookupConextFactory.

Hashtable table = new Hashtable();
table.Add(LdapLookupConsts.LDAP_SERVER_URL, "10.105.185.30:10389");
table.Add(LdapLookupConsts.LDAP_BASE_DN, "ou=People,dc=emsproject");
table.Add(LdapLookupConsts.LDAP_PRINCIPAL, "cn=Manager");
table.Add(LdapLookupConsts.LDAP_CREDENTIAL, "password");
table.Add(LdapLookupConsts.LDAP_CONN_TYPE, "ldap");
try {
ILookupContext searcher = factory.CreateContext(LookupContextFactory.LDAP_CONTEXT, env);
TIBCO.EMS.Queue queue = (TIBCO.EMS.Queue)searcher.Lookup("theQueueName");
...
} catch (NamingException) {
...
}

Constructor & Destructor Documentation

TIBCO.EMS.LookupContextFactory.LookupContextFactory ( )
inline

Default constructor to create a context factory

Member Function Documentation

virtual ILookupContext TIBCO.EMS.LookupContextFactory.CreateContext ( String  name,
Hashtable  props 
)
inlinevirtual

Returns the initial context used to search for administered objects

This method returns an ILookupContext object that is the initial context used to look up administered object in the EMS server or an LDAP server. The currently supported contexts are tibjmsnaming and ldap.

Before calling CreateContext, first create a hash table of properties and their values.

This example demonstrates how to create an initial context for looking up a queue object in the EMS naming server:

Hashtable env = new Hashtable();
env.Add(LookupContext.PROVIDER_URL, "tibjmsnaming://localhost:7222");
env.Add(LookupContext.SECURITY_PRINCIPAL", "myUserName");
env.Add(LookupContext.SECURITY_CREDENTIALS", "myPassword");
ILookupContext searcher = factory.CreateContext(
TIBCO.EMS.Queue queue = (TIBCO.EMS.Queue)searcher.Lookup("theQueueName");

This example shows how to look up a connection factory, named testConnFact, in a third-party LDAP server located at the URL: 10.105.185.30:10389:

Hashtable env = new Hashtable();
table.Add(LdapLookupConsts.LDAP_SERVER_URL, "10.105.185.30:10389");
table.Add(LdapLookupConsts.LDAP_BASE_DN,"ou=People,dc=nmunjal1");
table.Add(LdapLookupConsts.LDAP_PRINCIPAL, "cn=Manager");
table.Add(LdapLookupConsts.LDAP_CREDENTIAL, "password");
table.Add(LdapLookupConsts.LDAP_CONN_TYPE, "ldap");
ILookupContext searcher = contextFactory.CreateContext(
ConnectionFactory cf = (ConnectionFactory)searcher.Lookup("cn=testConnFact");

This example shows how to look up a connection factory object in the LDAP server via TLS.

Hashtable props = new Hashtable();
props.Add(LdapLookupConsts.LDAP_SERVER_URL", "adc1.na.tibco.com:10636");
props.Add(LdapLookupConsts.LDAP_BASE_DN", "ou=People,dc=test-user");
props.Add(LdapLookupConsts.LDAP_PRINCIPAL", "cn=Manager");
props.Add(LdapLookupConsts.LDAP_CREDENTIAL", "password");
props.Add(LdapLookupConsts.LDAP_SEARCH_SCOPE, "subtree");
props.Add(LdapLookupConsts.LDAP_CONN_TYPE, "ldaps");
props.Add(LdapLookupConsts.LDAP_CERT_NAME, "certName");
props.Add(LdapLookupConsts.LDAP_CERT_STORE_LOCATION, "currentuser");
LdapLookupSSLParams sslparams = new LdapLookupSSLParams();
sslparams.SetSSLQueryClientCertificateCallback(QueryClientCertificateCallback);
sslparams.SetSSLVerifyServerCertificateCallback(VerifyServerCertificateCallback);
props.Add(LdapLookupConsts.LDAP_SSL_PARAMS, sslparams);
ILookupContext searcher = contextFactory.CreateContext(
props);
ConnectionFactory cf = searcher.Lookup("cn=testConnFact");
Console.WriteLine("cf = " + cf.ToString());
Parameters
nameCan be either:
propsHash table of properties.
Returns
An object that implements ILookupContext interface
Exceptions
ArgumentExceptionIf name is null or invalid name (anything other than tibjmsnaming or ldap) is specified

Reimplemented in TIBCO.EMS.UFO.LookupContextFactory.

Member Data Documentation

const String TIBCO.EMS.LookupContextFactory.LDAP_CONTEXT = "ldap"

Public const string to create a ldap context to lookup administered object in an ldap server.

const String TIBCO.EMS.LookupContextFactory.TIBJMS_NAMING_CONTEXT = "tibjmsnaming"

Public const string to create a tibjmsnaming context to lookup administered object inside the tibjmsnaming server.


Copyright © Cloud Software Group, Inc. All rights reserved.