public class NamingContext
extends java.lang.Object
implements javax.naming.event.EventContext, java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
(package private) static java.util.concurrent.ConcurrentHashMap<java.net.InetSocketAddress,java.lang.ref.WeakReference<Naming>> |
cachedServers |
static java.lang.String |
DEFAULT_DISCOVERY_GROUP_ADDRESS
The default discovery multicast information
|
static int |
DEFAULT_DISCOVERY_GROUP_PORT |
static int |
DEFAULT_DISCOVERY_TIMEOUT |
(package private) java.util.Hashtable |
env |
private static java.lang.RuntimePermission |
GET_HA_NAMING_SERVER |
private static java.lang.RuntimePermission |
GET_LOCAL_SERVER |
private static boolean |
GLOBAL_JNP_DISABLE_DISCOVERY
Global JNP disable discovery system property: -Djboss.global.jnp.disableDiscover=[true|false]
At the VM level, this property controls how disable discovery behaves in
absence of per context jnp.disableDiscovery property.
|
private static java.util.Hashtable<java.lang.String,Naming> |
haServers
HAJNDI keyed by partition name
|
private static int |
HOST_INDEX |
static java.lang.String |
JNP_DISABLE_DISCOVERY
A flag to disable the broadcast discovery queries
|
static java.lang.String |
JNP_DISCOVERY_GROUP
The multicast IP/address to which the discovery query is sent
|
static java.lang.String |
JNP_DISCOVERY_PORT
The port to which the discovery query is sent
|
static java.lang.String |
JNP_DISCOVERY_TIMEOUT
The time in MS to wait for a discovery query response
|
static java.lang.String |
JNP_DISCOVERY_TTL
The time-to-live for the multicast discovery packets
|
static java.lang.String |
JNP_LOCAL_ADDRESS
The local address to bind the connected bootstrap socket to
|
static java.lang.String |
JNP_LOCAL_PORT
The local port to bind the connected bootstrap socket to
|
static java.lang.String |
JNP_MAX_RETRIES
An integer that controls the number of connection retry attempts will
be made on the initial connection to the naming server.
|
static java.lang.String |
JNP_NAMING_INSTANCE
The Naming instance to use for the root Context creation
|
static java.lang.String |
JNP_NAMING_INSTANCE_NAME
The name to associate with Naming instance to use for the root Context
|
static java.lang.String |
JNP_PARSED_NAME
An internal property added by parseNameForScheme if the input name uses a
url prefix that was removed during cannonicalization.
|
static java.lang.String |
JNP_PARTITION_NAME
The cluster partition discovery should be restricted to
|
static java.lang.String |
JNP_SOCKET_FACTORY
The javax.net.SocketFactory impl to use for the bootstrap socket
|
static java.lang.String |
JNP_USE_RELATIVE_NAME
A flag indicating the style of names passed to NamingManager method.
|
private static Naming |
localServer
The jvm local server used for non-transport access to the naming
server
|
private static org.jboss.logging.Logger |
log
The JBoss logging interface
|
static int |
MAX_RETRIES
An obsolete constant replaced by the JNP_MAX_RETRIES value
|
(package private) Naming |
naming |
(package private) javax.naming.NameParser |
parser |
private static int |
PORT_INDEX |
(package private) javax.naming.Name |
prefix |
(package private) static long |
serialVersionUID |
private static java.lang.RuntimePermission |
SET_HA_NAMING_SERVER |
private static java.lang.RuntimePermission |
SET_LOCAL_SERVER |
| Constructor and Description |
|---|
NamingContext(java.util.Hashtable e,
javax.naming.Name baseName,
Naming server) |
| Modifier and Type | Method and Description |
|---|---|
void |
addNamingListener(javax.naming.Name target,
int scope,
javax.naming.event.NamingListener l) |
void |
addNamingListener(java.lang.String target,
int scope,
javax.naming.event.NamingListener l) |
(package private) static void |
addServer(java.net.InetSocketAddress addr,
Naming server) |
(package private) static void |
addServer(java.lang.String name,
Naming server)
Deprecated.
|
java.lang.Object |
addToEnvironment(java.lang.String propName,
java.lang.Object propVal) |
void |
bind(javax.naming.Name name,
java.lang.Object obj) |
void |
bind(java.lang.String name,
java.lang.Object obj) |
private void |
checkRef(java.util.Hashtable refEnv) |
void |
close() |
javax.naming.Name |
composeName(javax.naming.Name name,
javax.naming.Name prefix) |
java.lang.String |
composeName(java.lang.String name,
java.lang.String prefix) |
private java.lang.Object |
createMarshalledValuePair(java.lang.Object obj)
Isolate the creation of the MarshalledValuePair in a privileged block
when running under a security manager so the following permissions can
be isolated from the caller:
RuntimePermission("createClassLoader")
ReflectPermission("suppressAccessChecks")
SerializablePermission("enableSubstitution")
|
javax.naming.Context |
createSubcontext(javax.naming.Name name) |
javax.naming.Context |
createSubcontext(java.lang.String name) |
void |
destroySubcontext(javax.naming.Name name) |
void |
destroySubcontext(java.lang.String name) |
private Naming |
discoverServer(java.util.Hashtable serverEnv)
This methods sends a broadcast message on the network and asks and HA-JNDI
server to sent it the HA-JNDI stub
|
private javax.naming.Name |
getAbsoluteName(javax.naming.Name n) |
private java.util.Hashtable |
getEnv(javax.naming.Name n) |
java.util.Hashtable |
getEnvironment() |
static Naming |
getHANamingServerForPartition(java.lang.String partitionName) |
static Naming |
getLocal() |
java.lang.String |
getNameInNamespace() |
javax.naming.NameParser |
getNameParser(javax.naming.Name name) |
javax.naming.NameParser |
getNameParser(java.lang.String name) |
Naming |
getNaming() |
private java.lang.Object |
getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
Use the NamingManager.getObjectInstance to resolve the raw object obtained
from the naming server.
|
private java.lang.Object |
getObjectInstanceWrapFailure(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
Resolve the final object and wrap any non-NamingException errors in a
NamingException with the cause passed as the root cause.
|
(package private) static Naming |
getServer(java.lang.String host,
int port,
java.util.Hashtable serverEnv) |
private java.lang.Object |
getStateToBind(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
Use the NamingManager.getStateToBind to obtain the actual object to bind
into jndi.
|
private boolean |
handleStaleNamingStub(java.lang.Exception e,
java.util.Hashtable refEnv)
JBAS-4574.
|
javax.naming.NamingEnumeration |
list(javax.naming.Name name) |
javax.naming.NamingEnumeration |
list(java.lang.String name) |
javax.naming.NamingEnumeration |
listBindings(javax.naming.Name name) |
javax.naming.NamingEnumeration |
listBindings(java.lang.String name) |
(package private) static javax.net.SocketFactory |
loadSocketFactory(java.util.Hashtable serverEnv)
Create a SocketFactory based on the JNP_SOCKET_FACTORY property in the
given env.
|
java.lang.Object |
lookup(javax.naming.Name name) |
java.lang.Object |
lookup(java.lang.String name) |
java.lang.Object |
lookupLink(javax.naming.Name name)
Lookup the object referred to by name but don't dereferrence the final
component.
|
java.lang.Object |
lookupLink(java.lang.String name) |
private static int |
parseHostPort(java.lang.String url,
java.lang.Object[] output,
int defaultPort)
Parse a naming provider url for the host/port information
|
(package private) static java.lang.String |
parseNameForScheme(javax.naming.Name n,
java.util.Hashtable nameEnv)
Called to remove any url scheme atoms and extract the naming service
hostname:port information.
|
void |
rebind(javax.naming.Name name,
java.lang.Object obj) |
void |
rebind(java.lang.String name,
java.lang.Object obj) |
java.lang.Object |
removeFromEnvironment(java.lang.String propName) |
static void |
removeHANamingServerForPartition(java.lang.String partitionName) |
void |
removeNamingListener(javax.naming.event.NamingListener l) |
(package private) static void |
removeServer(java.util.Hashtable serverEnv) |
void |
rename(javax.naming.Name oldName,
javax.naming.Name newName) |
void |
rename(java.lang.String oldname,
java.lang.String newname) |
protected java.lang.Object |
resolveLink(java.lang.Object res,
java.util.Hashtable refEnv) |
static void |
setHANamingServerForPartition(java.lang.String partitionName,
Naming haServer) |
static void |
setLocal(Naming server) |
void |
setNaming(Naming server) |
protected boolean |
shouldDiscoveryHappen(boolean globalDisableDiscovery,
java.lang.String perCtxDisableDiscovery) |
boolean |
targetMustExist() |
void |
unbind(javax.naming.Name name) |
void |
unbind(java.lang.String name) |
private boolean |
useAbsoluteName(java.util.Hashtable env)
Determine the form of the name to pass to the NamingManager operations.
|
static final long serialVersionUID
public static final java.lang.String JNP_SOCKET_FACTORY
public static final java.lang.String JNP_LOCAL_ADDRESS
public static final java.lang.String JNP_LOCAL_PORT
public static final java.lang.String JNP_DISABLE_DISCOVERY
public static final java.lang.String JNP_PARTITION_NAME
public static final java.lang.String JNP_DISCOVERY_GROUP
public static final java.lang.String JNP_DISCOVERY_PORT
public static final java.lang.String JNP_DISCOVERY_TTL
public static final java.lang.String JNP_DISCOVERY_TIMEOUT
public static final java.lang.String JNP_PARSED_NAME
public static final java.lang.String JNP_USE_RELATIVE_NAME
public static final java.lang.String JNP_MAX_RETRIES
public static final java.lang.String JNP_NAMING_INSTANCE
public static final java.lang.String JNP_NAMING_INSTANCE_NAME
private static final boolean GLOBAL_JNP_DISABLE_DISCOVERY
public static final java.lang.String DEFAULT_DISCOVERY_GROUP_ADDRESS
public static final int DEFAULT_DISCOVERY_GROUP_PORT
public static final int DEFAULT_DISCOVERY_TIMEOUT
public static int MAX_RETRIES
private static org.jboss.logging.Logger log
private static java.util.Hashtable<java.lang.String,Naming> haServers
private static java.lang.RuntimePermission GET_HA_NAMING_SERVER
private static java.lang.RuntimePermission SET_HA_NAMING_SERVER
private static Naming localServer
checkRef(Hashtable),
LocalOnlyContextFactory}private static java.lang.RuntimePermission GET_LOCAL_SERVER
private static java.lang.RuntimePermission SET_LOCAL_SERVER
private static int HOST_INDEX
private static int PORT_INDEX
Naming naming
java.util.Hashtable env
javax.naming.Name prefix
javax.naming.NameParser parser
static java.util.concurrent.ConcurrentHashMap<java.net.InetSocketAddress,java.lang.ref.WeakReference<Naming>> cachedServers
public NamingContext(java.util.Hashtable e,
javax.naming.Name baseName,
Naming server)
throws javax.naming.NamingException
javax.naming.NamingExceptionpublic static void setHANamingServerForPartition(java.lang.String partitionName,
Naming haServer)
public static void removeHANamingServerForPartition(java.lang.String partitionName)
public static Naming getHANamingServerForPartition(java.lang.String partitionName)
static void addServer(java.lang.String name,
Naming server)
addServer(InetSocketAddress, Naming)name - server - static void addServer(java.net.InetSocketAddress addr,
Naming server)
static Naming getServer(java.lang.String host, int port, java.util.Hashtable serverEnv) throws javax.naming.NamingException
javax.naming.NamingExceptionstatic javax.net.SocketFactory loadSocketFactory(java.util.Hashtable serverEnv)
throws java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException,
java.lang.reflect.InvocationTargetException
java.lang.ClassNotFoundExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionjava.lang.reflect.InvocationTargetExceptionstatic void removeServer(java.util.Hashtable serverEnv)
static java.lang.String parseNameForScheme(javax.naming.Name n,
java.util.Hashtable nameEnv)
throws javax.naming.InvalidNameException
n - the name component to the parsed. After returning n will have all
scheme related atoms removed.javax.naming.InvalidNameExceptionpublic static Naming getLocal()
public static void setLocal(Naming server)
public Naming getNaming()
public void setNaming(Naming server)
public void rebind(java.lang.String name,
java.lang.Object obj)
throws javax.naming.NamingException
rebind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void rebind(javax.naming.Name name,
java.lang.Object obj)
throws javax.naming.NamingException
rebind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void bind(java.lang.String name,
java.lang.Object obj)
throws javax.naming.NamingException
bind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void bind(javax.naming.Name name,
java.lang.Object obj)
throws javax.naming.NamingException
bind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object lookup(java.lang.String name)
throws javax.naming.NamingException
lookup in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object lookup(javax.naming.Name name)
throws javax.naming.NamingException
lookup in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void unbind(java.lang.String name)
throws javax.naming.NamingException
unbind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void unbind(javax.naming.Name name)
throws javax.naming.NamingException
unbind in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void rename(java.lang.String oldname,
java.lang.String newname)
throws javax.naming.NamingException
rename in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void rename(javax.naming.Name oldName,
javax.naming.Name newName)
throws javax.naming.NamingException
rename in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NamingEnumeration list(java.lang.String name)
throws javax.naming.NamingException
list in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NamingEnumeration list(javax.naming.Name name)
throws javax.naming.NamingException
list in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NamingEnumeration listBindings(java.lang.String name)
throws javax.naming.NamingException
listBindings in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
throws javax.naming.NamingException
listBindings in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.String composeName(java.lang.String name,
java.lang.String prefix)
throws javax.naming.NamingException
composeName in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.Name composeName(javax.naming.Name name,
javax.naming.Name prefix)
throws javax.naming.NamingException
composeName in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NameParser getNameParser(java.lang.String name)
throws javax.naming.NamingException
getNameParser in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.NameParser getNameParser(javax.naming.Name name)
throws javax.naming.NamingException
getNameParser in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.Context createSubcontext(java.lang.String name)
throws javax.naming.NamingException
createSubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionpublic javax.naming.Context createSubcontext(javax.naming.Name name)
throws javax.naming.NamingException
createSubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object addToEnvironment(java.lang.String propName,
java.lang.Object propVal)
throws javax.naming.NamingException
addToEnvironment in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object removeFromEnvironment(java.lang.String propName)
throws javax.naming.NamingException
removeFromEnvironment in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.util.Hashtable getEnvironment()
throws javax.naming.NamingException
getEnvironment in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void close()
throws javax.naming.NamingException
close in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.String getNameInNamespace()
throws javax.naming.NamingException
getNameInNamespace in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void destroySubcontext(java.lang.String name)
throws javax.naming.NamingException
destroySubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void destroySubcontext(javax.naming.Name name)
throws javax.naming.NamingException
destroySubcontext in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object lookupLink(java.lang.String name)
throws javax.naming.NamingException
lookupLink in interface javax.naming.Contextjavax.naming.NamingExceptionpublic java.lang.Object lookupLink(javax.naming.Name name)
throws javax.naming.NamingException
lookupLink in interface javax.naming.Contextjavax.naming.NamingExceptionpublic void addNamingListener(javax.naming.Name target,
int scope,
javax.naming.event.NamingListener l)
throws javax.naming.NamingException
addNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic void addNamingListener(java.lang.String target,
int scope,
javax.naming.event.NamingListener l)
throws javax.naming.NamingException
addNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic void removeNamingListener(javax.naming.event.NamingListener l)
throws javax.naming.NamingException
removeNamingListener in interface javax.naming.event.EventContextjavax.naming.NamingExceptionpublic boolean targetMustExist()
throws javax.naming.NamingException
targetMustExist in interface javax.naming.event.EventContextjavax.naming.NamingExceptionprotected java.lang.Object resolveLink(java.lang.Object res,
java.util.Hashtable refEnv)
throws javax.naming.NamingException
javax.naming.NamingExceptionprotected boolean shouldDiscoveryHappen(boolean globalDisableDiscovery,
java.lang.String perCtxDisableDiscovery)
private java.lang.Object createMarshalledValuePair(java.lang.Object obj)
throws java.io.IOException
java.io.IOExceptionprivate boolean useAbsoluteName(java.util.Hashtable env)
env - - the env of NamingContext that op was called onprivate java.lang.Object getStateToBind(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
throws javax.naming.NamingException
obj - - the value passed to bind/rebindname - - the name passed to bind/rebindenv - - the env of NamingContext that bind/rebind was called onjavax.naming.NamingExceptionprivate java.lang.Object getObjectInstance(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
throws java.lang.Exception
obj - - raw value obtained from the naming servername - - the name passed to the lookup openv - - the env of NamingContext that the op was called onjava.lang.Exceptionprivate java.lang.Object getObjectInstanceWrapFailure(java.lang.Object obj,
javax.naming.Name name,
java.util.Hashtable env)
throws javax.naming.NamingException
obj - - raw value obtained from the naming servername - - the name passed to the lookup openv - - the env of NamingContext that the op was called onjavax.naming.NamingExceptionprivate Naming discoverServer(java.util.Hashtable serverEnv) throws javax.naming.NamingException
javax.naming.NamingExceptionprivate void checkRef(java.util.Hashtable refEnv)
throws javax.naming.NamingException
javax.naming.NamingExceptionprivate static int parseHostPort(java.lang.String url,
java.lang.Object[] output,
int defaultPort)
url - - the naming provider url string to parseoutput, - [0] = the host name/address, [1] = the parsed port as an IntegerdefaultPort - - the default port to return in output[1] if no port
was seen in the url string.private javax.naming.Name getAbsoluteName(javax.naming.Name n)
throws javax.naming.NamingException
javax.naming.NamingExceptionprivate java.util.Hashtable getEnv(javax.naming.Name n)
throws javax.naming.InvalidNameException
javax.naming.InvalidNameExceptionprivate boolean handleStaleNamingStub(java.lang.Exception e,
java.util.Hashtable refEnv)
e - the exception that may be due to a stale stubrefEnv - the naming environment associated with the failed calltrue if e indicates a stale
naming stub and we were able to succesfully flush the
cache and acquire a new stub; false otherwise.