Class GenericURLContext
- All Implemented Interfaces:
Context
- Direct Known Subclasses:
iiopURLContext
- Author:
- Scott Seligman, Rosanna Lee
-
Field Summary
FieldsFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddToEnvironment(String propName, Object propVal) voidvoidvoidclose()composeName(String name, String prefix) composeName(Name name, Name prefix) createSubcontext(String name) createSubcontext(Name name) voiddestroySubcontext(String name) voiddestroySubcontext(Name name) protected ContextGets the context in which to continue the operation.getNameParser(String name) getNameParser(Name name) protected abstract ResolveResultgetRootURLContext(String url, Hashtable<?, ?> env) Resolves 'name' into a target context with remaining name.protected StringgetURLPrefix(String url) Finds the prefix of a URL.protected NamegetURLSuffix(String prefix, String url) Returns the suffix of the url.listBindings(String name) listBindings(Name name) lookupLink(String name) lookupLink(Name name) voidvoidremoveFromEnvironment(String propName) voidvoidvoidvoidprotected booleanDetermines whether two URLs are the same.
-
Field Details
-
myEnv
-
-
Constructor Details
-
GenericURLContext
-
-
Method Details
-
close
- Specified by:
closein interfaceContext- Throws:
NamingException
-
getNameInNamespace
- Specified by:
getNameInNamespacein interfaceContext- Throws:
NamingException
-
getRootURLContext
protected abstract ResolveResult getRootURLContext(String url, Hashtable<?, ?> env) throws NamingExceptionResolves 'name' into a target context with remaining name. For example, with a JNDI URL "jndi://dnsname/rest_name", this method resolves "jndi://dnsname/" to a target context, and returns the target context with "rest_name". The definition of "root URL" and how much of the URL to consume is implementation specific. If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.- Throws:
NamingException
-
getURLSuffix
Returns the suffix of the url. The result should be identical to that of calling getRootURLContext().getRemainingName(), but without the overhead of doing anything with the prefix like creating a context.This method returns a Name instead of a String because to give the provider an opportunity to return a Name (for example, for weakly separated naming systems like COS naming).
The default implementation uses skips 'prefix', calls CorbaUtils.decode() on it, and returns the result as a single component CompositeName. Subclass should override if this is not appropriate. This method is used only by rename(). If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.
For many URL schemes, this method is very similar to URL.getFile(), except getFile() will return a leading slash in the 2nd, 3rd, and 4th cases. For schemes like "ldap" and "iiop", the leading slash must be skipped before the name is an acceptable format for operation by the Context methods. For schemes that treat the leading slash as significant (such as "file"), the subclass must override getURLSuffix() to get the correct behavior. Remember, the behavior must match getRootURLContext().
URL Suffix foo://host:port <empty string> foo://host:port/rest/of/name rest/of/name foo:///rest/of/name rest/of/name foo:/rest/of/name rest/of/name foo:rest/of/name rest/of/name- Throws:
NamingException
-
getURLPrefix
Finds the prefix of a URL. Default implementation looks for slashes and then extracts prefixes using String.substring(). Subclass should override if this is not appropriate. This method is used only by rename(). If rename() is supported for a particular URL scheme, getRootURLContext(), getURLPrefix(), and getURLSuffix() must be in sync wrt how URLs are parsed and returned.URL Prefix foo://host:port foo://host:port foo://host:port/rest/of/name foo://host:port foo:///rest/of/name foo:// foo:/rest/of/name foo: foo:rest/of/name foo:
- Throws:
NamingException
-
urlEquals
Determines whether two URLs are the same. Default implementation uses String.equals(). Subclass should override if this is not appropriate. This method is used by rename(). -
getContinuationContext
Gets the context in which to continue the operation. This method is called when this context is asked to process a multicomponent Name in which the first component is a URL. Treat the first component like a junction: resolve it and then use NamingManager.getContinuationContext() to get the target context in which to operate on the remainder of the name (n.getSuffix(1)).- Throws:
NamingException
-
lookup
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
lookup
- Specified by:
lookupin interfaceContext- Throws:
NamingException
-
bind
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
bind
- Specified by:
bindin interfaceContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
rebind
- Specified by:
rebindin interfaceContext- Throws:
NamingException
-
unbind
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-
unbind
- Specified by:
unbindin interfaceContext- Throws:
NamingException
-
rename
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
rename
- Specified by:
renamein interfaceContext- Throws:
NamingException
-
list
- Specified by:
listin interfaceContext- Throws:
NamingException
-
list
- Specified by:
listin interfaceContext- Throws:
NamingException
-
listBindings
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
listBindings
- Specified by:
listBindingsin interfaceContext- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
destroySubcontext
- Specified by:
destroySubcontextin interfaceContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
createSubcontext
- Specified by:
createSubcontextin interfaceContext- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
lookupLink
- Specified by:
lookupLinkin interfaceContext- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
getNameParser
- Specified by:
getNameParserin interfaceContext- Throws:
NamingException
-
composeName
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
composeName
- Specified by:
composeNamein interfaceContext- Throws:
NamingException
-
removeFromEnvironment
- Specified by:
removeFromEnvironmentin interfaceContext- Throws:
NamingException
-
addToEnvironment
- Specified by:
addToEnvironmentin interfaceContext- Throws:
NamingException
-
getEnvironment
- Specified by:
getEnvironmentin interfaceContext- Throws:
NamingException
-