|
JACK 5.2 Application Interface | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectaos.dci.jndi.PortalContext
A JNDI service provider that integrates with an existing portal.
This JNDI Context object only provides the lookup(),
list() and listBindings() functionality.
An instance of this class is returned by the
InitialPortalContext.getInitialContext(Hashtable)
method.
The lookup(String) method can handle names like:
"@portal_name",
returning the String address of the Portal.
"agent_name", returning the Portal's
Addressable object for the agent if known
at the local Portal. Otherwise null.
"agent_name@portal_name", returning the Portal's
Route object for the agent if known at
the given Portal. Otherwise null.
The list(String) and listBindings(String) methods
can handle patterns like:
"*", listing all local agents without qualification.
"*@*", listing all known agent names fully qualified
with portal name.
"*@portal", listing all known agent names local
to the given portal, fully qualified with the given portal name.
An example of using this interface follows:
import java.util.Enumeration;
import java.util.Hashtable;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.naming.NameClassPair;
import javax.naming.Binding;
public class JNDI_Utils {
protected static InitialContext iContext = null;
// Call this after your local portal has been created!
public static void jndiInit() {
Hashtable props = new Hashtable(3);
props.put(Context.INITIAL_CONTEXT_FACTORY,
"aos.dci.jndi.InitialPortalContext");
// DCI only allows one portal per process currently.
// so we can provide an empty (or null) portal name and
// the first (only) portal in the process will be used.
props.put(Context.PROVIDER_URL, "");
try {
iContext = new InitialContext(props);
} catch ( NamingException ex ) {
ex.printStackTrace();
}
}
public static void jndiLookup(String n) {
try {
System.err.println("=>["+iContext.lookup(n)+"]");
} catch (NamingException ex) {
ex.printStackTrace();
}
}
public static void jndiList(String n) {
try {
Enumeration en = iContext.list(n);
if ( en == null ) {
System.err.println("WARNING: list() => null");
return;
}
while (en.hasMoreElements()) {
NameClassPair o = (NameClassPair) en.nextElement();
System.err.println("=> \""+o.getName()+
"\" (type="+o.getClassName()+")");
}
} catch (NamingException ex) {
ex.printStackTrace();
}
}
public static void jndiListBindings(String n) {
try {
Enumeration en = iContext.listBindings(n);
if ( en == null ) {
System.err.println("WARNING: list() => null");
return;
}
while (en.hasMoreElements()) {
NameClassPair o = (NameClassPair) en.nextElement();
System.err.println("=> \""+o.getName()+
"\" (type="+o.getClassName()+
") obj="+o.getObject()));
}
} catch (NamingException ex) {
ex.printStackTrace();
}
}
}
| Field Summary |
| Fields inherited from interface javax.naming.Context |
APPLET, AUTHORITATIVE, BATCHSIZE, DNS_URL, INITIAL_CONTEXT_FACTORY, LANGUAGE, OBJECT_FACTORIES, PROVIDER_URL, REFERRAL, SECURITY_AUTHENTICATION, SECURITY_CREDENTIALS, SECURITY_PRINCIPAL, SECURITY_PROTOCOL, STATE_FACTORIES, URL_PKG_PREFIXES |
| Constructor Summary | |
PortalContext(java.lang.String local_portal_name,
java.util.Hashtable env)
Constructor, not used directly. |
|
| Method Summary | |
void |
bind(javax.naming.Name name,
java.lang.Object obj)
This operation is not supported. |
void |
bind(java.lang.String name,
java.lang.Object obj)
This operation is not supported. |
javax.naming.Name |
composeName(javax.naming.Name name,
javax.naming.Name prefix)
This operation is not supported. |
java.lang.String |
composeName(java.lang.String name,
java.lang.String prefix)
This operation is not supported. |
javax.naming.Context |
createSubcontext(javax.naming.Name name)
This operation is not supported. |
javax.naming.Context |
createSubcontext(java.lang.String name)
This operation is not supported. |
void |
destroySubcontext(javax.naming.Name name)
This operation is not supported. |
void |
destroySubcontext(java.lang.String name)
This operation is not supported. |
javax.naming.NameParser |
getNameParser(javax.naming.Name name)
This operation is not supported. |
javax.naming.NameParser |
getNameParser(java.lang.String name)
This operation is not supported. |
javax.naming.NamingEnumeration |
list(javax.naming.Name name)
Same as calling list(nameToString(name)). |
javax.naming.NamingEnumeration |
list(java.lang.String name)
Return a list of known portals matching the given pattern. |
javax.naming.NamingEnumeration |
listBindings(javax.naming.Name name)
Same as calling listBindings(nameToString(name)). |
javax.naming.NamingEnumeration |
listBindings(java.lang.String name)
Same as calling list(name) but the
NameClassPairs in the list will also contain the
underlying object as well as the name. |
java.lang.Object |
lookup(javax.naming.Name name)
Calls lookup(nameToString(name)). |
java.lang.Object |
lookup(java.lang.String name)
Returns an Object representing the given name or null if not found. |
java.lang.Object |
lookupLink(javax.naming.Name name)
This is the same as calling lookup(nameToString(name)). |
java.lang.Object |
lookupLink(java.lang.String name)
This is the same as calling lookup(String name) since this flat context does not treat links specially. |
protected java.lang.String |
nameToString(javax.naming.Name name)
Convert a composite name to a String
but since only simple names are used in this implementation,
this is basically a no-op. |
void |
rebind(javax.naming.Name name,
java.lang.Object obj)
This operation is not supported. |
void |
rebind(java.lang.String name,
java.lang.Object obj)
This operation is not supported. |
void |
rename(javax.naming.Name oldname,
javax.naming.Name newname)
This operation is not supported. |
void |
rename(java.lang.String oldname,
java.lang.String newname)
This operation is not supported. |
void |
unbind(javax.naming.Name name)
This operation is not supported. |
void |
unbind(java.lang.String name)
This operation is not supported. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.naming.Context |
addToEnvironment, close, getEnvironment, getNameInNamespace, removeFromEnvironment |
| Constructor Detail |
public PortalContext(java.lang.String local_portal_name,
java.util.Hashtable env)
InitialPortalContext.getInitialContext(Hashtable)
instead.
| Method Detail |
protected java.lang.String nameToString(javax.naming.Name name)
String
but since only simple names are used in this implementation,
this is basically a no-op.
name - The non-null composite or compound name to process.
public java.lang.Object lookup(java.lang.String name)
lookup in interface javax.naming.Contextpublic java.lang.Object lookup(javax.naming.Name name)
lookup in interface javax.naming.Context
public void bind(java.lang.String name,
java.lang.Object obj)
bind in interface javax.naming.Context
public void bind(javax.naming.Name name,
java.lang.Object obj)
bind in interface javax.naming.Context
public void rebind(java.lang.String name,
java.lang.Object obj)
rebind in interface javax.naming.Context
public void rebind(javax.naming.Name name,
java.lang.Object obj)
rebind in interface javax.naming.Contextpublic void unbind(java.lang.String name)
unbind in interface javax.naming.Contextpublic void unbind(javax.naming.Name name)
unbind in interface javax.naming.Context
public void rename(java.lang.String oldname,
java.lang.String newname)
rename in interface javax.naming.Context
public void rename(javax.naming.Name oldname,
javax.naming.Name newname)
rename in interface javax.naming.Contextpublic javax.naming.NamingEnumeration list(java.lang.String name)
NamingEnumeration consists of
NameClassPair items.
list in interface javax.naming.Contextpublic javax.naming.NamingEnumeration list(javax.naming.Name name)
list in interface javax.naming.Contextpublic javax.naming.NamingEnumeration listBindings(java.lang.String name)
list(name) but the
NameClassPairs in the list will also contain the
underlying object as well as the name.
See the class definition above for details about recognized patterns.
listBindings in interface javax.naming.Contextpublic javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
listBindings in interface javax.naming.Contextpublic void destroySubcontext(java.lang.String name)
destroySubcontext in interface javax.naming.Contextpublic void destroySubcontext(javax.naming.Name name)
destroySubcontext in interface javax.naming.Contextpublic javax.naming.Context createSubcontext(java.lang.String name)
createSubcontext in interface javax.naming.Contextpublic javax.naming.Context createSubcontext(javax.naming.Name name)
createSubcontext in interface javax.naming.Contextpublic java.lang.Object lookupLink(java.lang.String name)
lookupLink in interface javax.naming.Contextpublic java.lang.Object lookupLink(javax.naming.Name name)
lookupLink in interface javax.naming.Contextpublic javax.naming.NameParser getNameParser(java.lang.String name)
getNameParser in interface javax.naming.Contextpublic javax.naming.NameParser getNameParser(javax.naming.Name name)
getNameParser in interface javax.naming.Context
public java.lang.String composeName(java.lang.String name,
java.lang.String prefix)
composeName in interface javax.naming.Context
public javax.naming.Name composeName(javax.naming.Name name,
javax.naming.Name prefix)
composeName in interface javax.naming.Context
|
JACK 5.2 Application Interface | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
US Government Restricted Rights
The JACK Modules and relevant Software Material have been developed entirely at private expense and are accordingly provided with RESTRICTED RIGHTS. Use, duplication, or disclosure by Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of DFARS 252.227-7013 or subparagraph (c)(1) and (2) of the Commercial Computer Software Restricted Rights and 48 CFR 52.2270-19, as applicable.