Assembly: TIBCO.EMS (in TIBCO.EMS.dll)
Syntax
public interface ILookupContext |
Public Interface ILookupContext |
public interface class ILookupContext |
Remarks
ILookupContext is implemented by the LookupContext and LdapLookupContext classes. LookupContext is mainly used to lookup up JMS administered objects (such as connection factories and destinations) in the TIBCO EMS server, whereas LdapLookupContext is used for looking up JMS administered objects in an LDAP server.
Users obtain an object of type ILookupContext (implemented by LookupContext and LdapLookupContext) by calling the LookupContextFactory.CreateContext method.
Examples
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=nmunjal1"); table.Add(LdapLookupConsts.LDAP_PRINCIPAL, "cn=Manager"); table.Add(LdapLookupConsts.LDAP_CONN_TYPE, "ldap"); LookupContextFactory contextFactory = new LookupContextFactory(); ILookupContext searcher = contextFactory.CreateContext("ldap", table); ConnectionFactory cf = (ConnectionFactory)searcher.Lookup("cn=testConnFact"); |
This example shows how to lookup and an 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"); props.Add(LdapLookupConsts.LDAP_CERT_STORE_NAME, "My"); props.Add(LdapLookupConsts.LDAP_CERT_STORE_LOCATION, "currentuser"); optional ssl params: LdapLookupSSLParams sslparams = new LdapLookupSSLParams(); sslparams.SetSSLQueryClientCertificateCallback(QueryClientCertificateCallback); sslparams.SetSSLVerifyServerCertificateCallback(VerifyServerCertificateCallback); props.Add(LdapLookupConsts.LDAP_SSL_PARAMS, sslparams); LookupContextFactory contextFactory = new LookupContextFactory(); ILookupContext searcher = contextFactory.CreateContext("ldap", props); ConnectionFactory cf = searcher.Lookup("cn=testConnFact"); Console.WriteLine("cf = " + cf.ToString()); |
For lookup of objects in TIBCO 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"); try { // old style code will still work LookupContext searcher = new LookupContext(env); // new code LookupContextFactory contextFactory = new LookupContextFactory(); ILookupContext searcher = contextFactory.CreateContext("tibjmsnaming", env); TIBCO.EMS.Queue queue = (TIBCO.EMS.Queue)searcher.Lookup("theQueueName"); ... } catch (NamingException) { ... } |