[TIBCO.EMS .NET client library 7.0 documentation]

Create ILookupContext objects

Namespace:  TIBCO.EMS
Assembly:  TIBCO.EMS (in TIBCO.EMS.dll)

Syntax

public class LookupContextFactory
Public Class LookupContextFactory
public ref class LookupContextFactory

Remarks

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(String, Hashtable) 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

Examples

 Copy Code
                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 { 
                    LookupContextFactory factory = new LookupContextFactory();
                    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.

Examples

 Copy Code
                 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 { 
                    LookupContextFactory factory = new LookupContextFactory();
                    ILookupContext searcher = factory.CreateContext(LookupContextFactory.LDAP_CONTEXT, env);
                    TIBCO.EMS.Queue queue = (TIBCO.EMS.Queue)searcher.Lookup("theQueueName");
                    ...
                } catch (NamingException) {
                    ...
                }
            

Inheritance Hierarchy

System..::.Object
  TIBCO.EMS..::.LookupContextFactory

See Also