TIBCO EMS .NET API 8.5
TIBCO EMS .NET API 8.5
TIBCO.EMS.UFO.LookupContextFactory Class Reference

Create ILookupContext objects More...

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

Public Member Functions

 LookupContextFactory ()
 Default constructor to create a context factory More...
 
override TIBCO.EMS.ILookupContext CreateContext (String name, Hashtable props)
 Returns the initial context used to search for administered objects More...
 
- Public Member Functions inherited from TIBCO.EMS.LookupContextFactory
 LookupContextFactory ()
 Default constructor to create a context factory More...
 

Additional Inherited Members

- Public Attributes inherited from TIBCO.EMS.LookupContextFactory
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(TIBCO.EMS.LookupContext.PROVIDER_URL, "tibjmsnaming://localhost:7222");
env.Add(TIBCO.EMS.LookupContext.SECURITY_PRINCIPAL", "myUserName");
env.Add(TIBCO.EMS.LookupContext.SECURITY_CREDENTIALS", "myPassword");
try {
TIBOCO.EMS.ILookupContext searcher = factory.CreateContext(LookupContextFactory.TIBJMS_NAMING_CONTEXT, env);
TIBCO.EMS.UFO.Queue queue = (TIBCO.EMS.UFO.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. By passing a Hashtable filled with keys from LdapLookupConsts and corresponding values, the LookupContext is configured.

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.UFO.Queue queue = (TIBCO.EMS.UFO.Queue)searcher.Lookup("theQueueName");
...
} catch (NamingException) {
...
}

Constructor & Destructor Documentation

TIBCO.EMS.UFO.LookupContextFactory.LookupContextFactory ( )
inline

Default constructor to create a context factory

Member Function Documentation

override TIBCO.EMS.ILookupContext TIBCO.EMS.UFO.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 (defined in LdapLookupConsts and LookupContext) 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.UFO.Queue queue = (TIBCO.EMS.UFO.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 SSL.

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");
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 from TIBCO.EMS.LookupContextFactory.


Copyright © TIBCO Software Inc. All rights reserved.