[TIBCO.EMS.UFOCLIENT .NET client library 6.3 documentation]

Create ILookupContext objects

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

Syntax

public class LookupContextFactory : LookupContextFactory
Public Class LookupContextFactory _
	Inherits LookupContextFactory
public ref class LookupContextFactory : public 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(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 { 
                    LookupContextFactory factory = new LookupContextFactory();
                    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.

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

Inheritance Hierarchy

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

See Also