Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

oracle.xdb.spi
Class XDBResourceContext

java.lang.Object
  |
  +--oracle.xdb.dom.XDBNode
        |
        +--oracle.xdb.dom.XDBDocument
              |
              +--oracle.xdb.spi.XDBResource
                    |
                    +--oracle.xdb.spi.XDBResourceContext
All Implemented Interfaces:
javax.naming.Context, Document, Node, Resource

public class XDBResourceContext
extends XDBResource
implements javax.naming.Context

This class implements the guts of the XDB JNDI SPI. The current implementation has no federation support, being completely unaware of the existence of other namespaces.


Field Summary
protected  java.util.Hashtable m_env
           
protected  java.lang.String m_path
           
protected  XDBElement m_resElem
           
static int OBJ_BINARY_DOC
           
static int OBJ_CONTAINER
           
static int OBJ_DOCUMENT
           
static long RES_OBJ
           
protected static XDBNameParser s_parser
           

 

Fields inherited from class oracle.xdb.dom.XDBNode
m_conn, m_owner, m_xobcstate

 

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

 

Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE

 

Constructor Summary
XDBResourceContext(java.util.Hashtable env)
           
XDBResourceContext(java.util.Hashtable env, java.lang.String path, long cstate)
           

 

Method Summary
 java.lang.Object addToEnvironment(java.lang.String propName, java.lang.Object propVal)
          Adds a new environment property to the environment of this context.
 void bind(javax.naming.Name name, java.lang.Object obj)
          Binds the given name to the object.
 void bind(java.lang.String name, java.lang.Object obj)
          Binds the given name to the object.
 void close()
          Closes this context, signaling the implementation to free the resources taken up by this context.
 javax.naming.Name composeName(javax.naming.Name name, javax.naming.Name prefix)
          Composes a name by combining the prefix with the name.
 java.lang.String composeName(java.lang.String name, java.lang.String prefix)
          Composes a name by combining the prefix with the name.
 javax.naming.Context createSubcontext(javax.naming.Name name)
          Creates a new subcontext, bound to the given name.
 javax.naming.Context createSubcontext(java.lang.String name)
          Creates a new subcontext, bound to the given name.
 void destroySubcontext(javax.naming.Name name)
          Unbinds the named subcontext.
 void destroySubcontext(java.lang.String name)
          Unbinds the named subcontext.
 java.util.Hashtable getEnvironment()
          Retrieves the environment properties for this context.
 java.lang.String getNameInNamespace()
          Retrieves the full name of this context within its own namespace.
 javax.naming.NameParser getNameParser(javax.naming.Name name)
          Retrieves the parser associated with the named context.
 javax.naming.NameParser getNameParser(java.lang.String name)
          Retrieves the parser associated with the named context.
static java.lang.String getSchemaNameNative(long cstate, java.lang.String[] name)
           
 javax.naming.NamingEnumeration list(javax.naming.Name name)
          Enumerates the names bound in the named context, along with the class names of objects bounds to them.
 javax.naming.NamingEnumeration list(java.lang.String name)
          Enumerates the names bound in the named context, along with the class names of objects bounds to them.
 javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
          Enumerates the names bound in the named context, along with the objects bounds to them.
 javax.naming.NamingEnumeration listBindings(java.lang.String name)
          Enumerates the names bound in the named context, along with the objects bounds to them.
 java.lang.Object lookup(javax.naming.Name name)
          Retrieves the named object.
 java.lang.Object lookup(java.lang.String name)
          Retrieves the named object.
 java.lang.Object lookupLink(javax.naming.Name name)
          Retrieves the named object.
 java.lang.Object lookupLink(java.lang.String name)
          Retrieves the named object.
 void rebind(javax.naming.Name name, java.lang.Object obj)
          Binds the given name to the object, overwriting any existing binding for the name.
 void rebind(java.lang.String name, java.lang.Object obj)
          Binds the given name to the object, overwriting any existing binding for the name.
 java.lang.Object removeFromEnvironment(java.lang.String propName)
          Removes an environment property from the environment of this context.
 void rename(javax.naming.Name oldname, javax.naming.Name newname)
          Binds a new name to the object already bound to another name, then unbinds the old name.
 void rename(java.lang.String oldname, java.lang.String newname)
          Bind a new name to the object already bound to another name, then unbinds the old name.
 void unbind(javax.naming.Name name)
          Unbinds the name object.
 void unbind(java.lang.String name)
          Unbinds the name object.

 

Methods inherited from class oracle.xdb.spi.XDBResource
getACL, getAuthor, getCharacterSet, getComment, getContentBinary, getContentType, getContentXML, getCreationDate, getCreator, getDisplayName, getLanguage, getLastModifier, getModificationDate, getOwner, getOwnerId, getSchemaElement, getServerEnv, getSize, getVersionId, isFolder, save, setACL, setAuthor, setCharacterSet, setComment, setContent, setContentType, setCreationDate, setCreator, setDisplayName, setLanguage, setLastModifier, setModificationDate, setOwner, setOwnerId, setSchemaElement, setVersionId

 

Methods inherited from class oracle.xdb.dom.XDBDocument
appendChild, createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, finalize, getDoctype, getDocumentElement, getElementById, getElementsByTagName, getElementsByTagNameNS, getEnvNative, getFirstChild, getGP, getImplementation, getLastChild, getNextSibling, getNodeName, getOwnerDocument, getPreviousSibling, hasChildNodes, importNode, insertBefore, isClosed, removeChild, replaceChild

 

Methods inherited from class oracle.xdb.dom.XDBNode
cloneNode, equals, getAttributes, getChildNodes, getExpandedName, getLocalName, getNamespaceURI, getNodeFromCState, getNodeType, getNodeValue, getParentNode, getPrefix, getQualifiedName, getSchemaNode, hasAttributes, hashCode, isSupported, normalize, setNodeValue, setNodeXob, setOwner, setPrefix, setXobCstate, toCState, toString, write

 

Methods inherited from class java.lang.Object
clone, getClass, notify, notifyAll, wait, wait, wait

 

Methods inherited from interface org.w3c.dom.Node
cloneNode, getAttributes, getChildNodes, getLocalName, getNamespaceURI, getNodeType, getNodeValue, getParentNode, getPrefix, hasAttributes, isSupported, normalize, setNodeValue, setPrefix

 

Field Detail

RES_OBJ

public static final long RES_OBJ
See Also:
Constant Field Values

OBJ_CONTAINER

public static final int OBJ_CONTAINER
See Also:
Constant Field Values

OBJ_DOCUMENT

public static final int OBJ_DOCUMENT
See Also:
Constant Field Values

OBJ_BINARY_DOC

public static final int OBJ_BINARY_DOC
See Also:
Constant Field Values

s_parser

protected static XDBNameParser s_parser

m_path

protected java.lang.String m_path

m_env

protected java.util.Hashtable m_env

m_resElem

protected XDBElement m_resElem
Constructor Detail

XDBResourceContext

public XDBResourceContext(java.util.Hashtable env)
                   throws javax.naming.NamingException,
                          javax.naming.OperationNotSupportedException,
                          java.sql.SQLException

XDBResourceContext

public XDBResourceContext(java.util.Hashtable env,
                          java.lang.String path,
                          long cstate)
                   throws javax.naming.NamingException,
                          javax.naming.OperationNotSupportedException,
                          java.sql.SQLException
Method Detail

getSchemaNameNative

public static java.lang.String getSchemaNameNative(long cstate,
                                                   java.lang.String[] name)

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws javax.naming.NamingException
Retrieves the named object. If the name resolves to a subcontext, the corresponding XDBResourceContext object is returned. If the name resolves to an XML document, the corresponding XDBDocument object is returned.
Specified by:
lookup in interface javax.naming.Context
Parameters:
name - the name to look up, relative to the current context.
Returns:
the object bound and the given name
Throws:
javax.naming.NameNotFoundException - name not found
javax.naming.NamingException - other naming exception
See Also:
XDBDocument

lookup

public java.lang.Object lookup(javax.naming.Name name)
                        throws javax.naming.NamingException
Retrieves the named object. If the name resolves to a subcontext, the corresponding XDBResourceContext object is returned. If the name resolves to an XML document, the corresponding XDBDocument object is returned.
Specified by:
lookup in interface javax.naming.Context
Parameters:
name - the name to look up, relative to the current context.
Returns:
the object bound and the given name
javax.naming.NamingException
See Also:
XDBDocument

bind

public void bind(java.lang.String name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Binds the given name to the object. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist. The object must be an instance of XDBDocument.
Specified by:
bind in interface javax.naming.Context
Parameters:
name - the name to bind to; may not be empty
obj - the XDBDocument object to bind; may not be null
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception
See Also:
XDBDocument

bind

public void bind(javax.naming.Name name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Binds the given name to the object. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist. The object must be an instance of XDBDocument.
Specified by:
bind in interface javax.naming.Context
Parameters:
name - the name to bind to; may not be empty
obj - the XDBDocument object to bind; may not be null
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception
See Also:
XDBDocument

rebind

public void rebind(java.lang.String name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Binds the given name to the object, overwriting any existing binding for the name. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist. The object must be an instance of XDBDocument.
Specified by:
rebind in interface javax.naming.Context
Parameters:
name - the name to bind to; may not be empty
obj - the XDBDocument object to bind; may not be null
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception
See Also:
XDBDocument

rebind

public void rebind(javax.naming.Name name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Binds the given name to the object, overwriting any existing binding for the name. All intermediate contexts and the target context (that named by all but terminal atomic component of the name) must already exist. The object must be an instance of XDBDocument.
Specified by:
rebind in interface javax.naming.Context
Parameters:
name - the name to bind to; may not be empty
obj - the XDBDocument object to bind; may not be null
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception
See Also:
XDBDocument

unbind

public void unbind(java.lang.String name)
            throws javax.naming.NamingException
Unbinds the name object. This method will not throw an exception if the terminal atomic name is not found, as long as the intermediate contexts exist. This method cannot be used to unbind a name bound to a subcontext; use destroySubcontext instead.
Specified by:
unbind in interface javax.naming.Context
Parameters:
name - the name to unbind
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.OperationNotSupportedException - name bound to subcontext
javax.naming.NamingException - other naming exception
See Also:
XDBContext.destroySubcontext(java.lang.String)

unbind

public void unbind(javax.naming.Name name)
            throws javax.naming.NamingException
Unbinds the name object. This method will not throw an exception if the terminal atomic name is not found, as long as the intermediate contexts exist. This method cannot be used to unbind a name bound to a subcontext; use destroySubcontext instead.
Specified by:
unbind in interface javax.naming.Context
Parameters:
name - the name to unbind
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.OperationNotSupportedException - name bound to subcontext
javax.naming.NamingException - other naming exception
See Also:
XDBContext.destroySubcontext(javax.naming.Name)

rename

public void rename(java.lang.String oldname,
                   java.lang.String newname)
            throws javax.naming.NamingException
Bind a new name to the object already bound to another name, then unbinds the old name.
Specified by:
rename in interface javax.naming.Context
Parameters:
oldname - the name of the existing binding; may not be empty
newname - the name to the new binding; may not be empty
Throws:
javax.naming.NamingException - name not found
javax.naming.OperationNotSupportedException - name bound to subcontext
javax.naming.NamingException - other naming exception

rename

public void rename(javax.naming.Name oldname,
                   javax.naming.Name newname)
            throws javax.naming.NamingException
Binds a new name to the object already bound to another name, then unbinds the old name.
Specified by:
rename in interface javax.naming.Context
Parameters:
oldname - the name of the existing binding; may not be empty
newname - the name to the new binding; may not be empty
Throws:
javax.naming.NamingException - name not found
javax.naming.OperationNotSupportedException - name bound to subcontext , * @exception javax.naming.NamingException other naming exception

list

public javax.naming.NamingEnumeration list(java.lang.String name)
                                    throws javax.naming.NamingException
Enumerates the names bound in the named context, along with the class names of objects bounds to them. The contents of any subcontexts are not included. If a binding is added to or removed from this context, the enumeration is invalidated.
Specified by:
list in interface javax.naming.Context
Parameters:
name - the name of the context to list
Returns:
an enumeration of the names and class names of the bindings in this context. Each element of the enumeration is of type NameClassPair.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception
See Also:
NameClassPair

list

public javax.naming.NamingEnumeration list(javax.naming.Name name)
                                    throws javax.naming.NamingException
Enumerates the names bound in the named context, along with the class names of objects bounds to them. The contents of any subcontexts are not included. If a binding is added to or removed from this context, the enumeration will become invalid. Further operations on the enumeration will produce undefined results. Currently, all objects in the namespace will be of type "XDBContext" or "XDBDocument", for subcontexts and all other bindings, respectively.
Specified by:
list in interface javax.naming.Context
Parameters:
name - the name of the context to list
Returns:
an enumeration of the names and class names of the bindings in this context. Each element of the enumeration is of type NameClassPair.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception
See Also:
NameClassPair

listBindings

public javax.naming.NamingEnumeration listBindings(java.lang.String name)
                                            throws javax.naming.NamingException
Enumerates the names bound in the named context, along with the objects bounds to them. The contents of any subcontexts are not included. If a binding is added to or removed from this context, the enumeration will become invalid. Further operations on the enumeration will produce undefined results. Currently, all objects in the namespace will be of type XDBContext or XDBDocument, for subcontexts and all other bindings, respectively.
Specified by:
listBindings in interface javax.naming.Context
Parameters:
name - the name of the context to list
Returns:
an enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception
See Also:
Binding

listBindings

public javax.naming.NamingEnumeration listBindings(javax.naming.Name name)
                                            throws javax.naming.NamingException
Enumerates the names bound in the named context, along with the objects bounds to them. The contents of any subcontexts are not included. If a binding is added to or removed from this context, the enumeration will become invalid. Further operations on the enumeration will produce undefined results.
Specified by:
listBindings in interface javax.naming.Context
Parameters:
name - the name of the context to list
Returns:
an enumeration of the bindings in this context. Each element of the enumeration is of type Binding.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception
See Also:
Binding

destroySubcontext

public void destroySubcontext(java.lang.String name)
                       throws javax.naming.NamingException
Unbinds the named subcontext. The subcontext must be empty. This method will not throw an exception if the terminal atomic name is not found, as long as the intermediate contexts exist.
Specified by:
destroySubcontext in interface javax.naming.Context
Parameters:
name - the name of the context to unbind
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.ContextNotEmptyException - context not empty
javax.naming.NamingException - other naming exception

destroySubcontext

public void destroySubcontext(javax.naming.Name name)
                       throws javax.naming.NamingException
Unbinds the named subcontext. The subcontext must be empty. This method will not throw an exception if the terminal atomic name is not found, as long as the intermediate contexts exist.
Specified by:
destroySubcontext in interface javax.naming.Context
Parameters:
name - the name of the context to unbind
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.ContextNotEmptyException - context not empty
javax.naming.NamingException - other naming exception

createSubcontext

public javax.naming.Context createSubcontext(java.lang.String name)
                                      throws javax.naming.NamingException
Creates a new subcontext, bound to the given name. All intermediate contexts must already exist. The new context inherits the environment properties of the current context.
Specified by:
createSubcontext in interface javax.naming.Context
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception

createSubcontext

public javax.naming.Context createSubcontext(javax.naming.Name name)
                                      throws javax.naming.NamingException
Creates a new subcontext, bound to the given name. All intermediate contexts must already exist. The new context inherits the environment properties of the current context.
Specified by:
createSubcontext in interface javax.naming.Context
Throws:
javax.naming.NameNotFoundException - parent path not found
javax.naming.NotContextException - parent path not a context
javax.naming.NameAlreadyBoundException - name already bound
javax.naming.NamingException - other naming exception

lookupLink

public java.lang.Object lookupLink(java.lang.String name)
                            throws javax.naming.NamingException
Retrieves the named object. If the name resolves to a subcontext, the corresponding XDBContext object is returned. If the name resolves to an XML document, the corresponding XDBDocument object is returned. This namespace does not support links, and thus this method is functionally identical to the lookup method.
Specified by:
lookupLink in interface javax.naming.Context
Parameters:
name - the name to look up, relative to the current context.
Returns:
the object bound and the given name
javax.naming.NamingException
See Also:
XDBContext.lookup(java.lang.String), XDBDocument

lookupLink

public java.lang.Object lookupLink(javax.naming.Name name)
                            throws javax.naming.NamingException
Retrieves the named object. If the name resolves to a subcontext, the corresponding XDBContext object is returned. If the name resolves to an XML document, the corresponding XDBDocument object is returned. This namespace does not support links, and thus this method is functionally identical to the lookup method.
Specified by:
lookupLink in interface javax.naming.Context
Parameters:
name - the name to look up, relative to the current context.
Returns:
the object bound and the given name
javax.naming.NamingException
See Also:
XDBContext.lookup(javax.naming.Name), XDBDocument

getNameParser

public javax.naming.NameParser getNameParser(java.lang.String name)
                                      throws javax.naming.NamingException
Retrieves the parser associated with the named context.
Specified by:
getNameParser in interface javax.naming.Context
Parameters:
name - the name of the context from which to get the parser
Returns:
a name parser that can parse compound names into their atomic components.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception

getNameParser

public javax.naming.NameParser getNameParser(javax.naming.Name name)
                                      throws javax.naming.NamingException
Retrieves the parser associated with the named context.
Specified by:
getNameParser in interface javax.naming.Context
Parameters:
name - the name of the context from which to get the parser
Returns:
a name parser that can parse compound names into their atomic components.
Throws:
javax.naming.NameNotFoundException - context name not found
javax.naming.NotContextException - name not bound to context
javax.naming.NamingException - other naming exception

composeName

public java.lang.String composeName(java.lang.String name,
                                    java.lang.String prefix)
Composes a name by combining the prefix with the name. The result is the given name appended to the end of the prefix, with the appropriate separator in between. Note that currently, this method differs slightly from the standard JNDI spec: when given legal input (in terms of the JNDI spec), this method will give the correct output; however, this method does not require that the prefix be the name of this context relative to one of its ancestors in the way JNDI requires.
Specified by:
composeName in interface javax.naming.Context
Parameters:
name - the name to append
Returns:
the composition of prefix and name

composeName

public javax.naming.Name composeName(javax.naming.Name name,
                                     javax.naming.Name prefix)
                              throws javax.naming.NamingException
Composes a name by combining the prefix with the name. The result is the given name appended to the end of the prefix, with the appropriate separator in between. Note that currently, this method differs slightly from the standard JNDI spec: when given legal input (in terms of the JNDI spec), this method will give the correct output; however, this method does not require that the prefix be the name of this context relative to one of its ancestors in the way JNDI requires.
Specified by:
composeName in interface javax.naming.Context
Parameters:
name - the name to append
Returns:
the composition of prefix and name
javax.naming.NamingException

addToEnvironment

public java.lang.Object addToEnvironment(java.lang.String propName,
                                         java.lang.Object propVal)
Adds a new environment property to the environment of this context. If the property already exists, its value is overwritten and the former value is returned.
Specified by:
addToEnvironment in interface javax.naming.Context
Parameters:
propName - the name of the environment property to add; may not be null
propVal - the value of the property to add; may not be null
Returns:
the previous value of the property, or null if the property was not in the environment before

removeFromEnvironment

public java.lang.Object removeFromEnvironment(java.lang.String propName)
Removes an environment property from the environment of this context. Nothing is done if the property does not exist.
Specified by:
removeFromEnvironment in interface javax.naming.Context
Parameters:
propName - the name of the environment property to remove; may not be null
Returns:
the value of the property, or null if the property was not in the environment

getEnvironment

public java.util.Hashtable getEnvironment()
                                   throws javax.naming.NamingException
Retrieves the environment properties for this context. The result is a new copy of the environment; changes made to the returned object have no effect on the context.
Specified by:
getEnvironment in interface javax.naming.Context
Returns:
a copy of the environment of this context
javax.naming.NamingException

close

public void close()
Closes this context, signaling the implementation to free the resources taken up by this context. Once the context has been closed, the caller should not invoke any other method on the contet. Invoking this method again has no effect; invoking any other method will give undefined results.
Specified by:
close in interface javax.naming.Context
Overrides:
close in class XDBDocument

getNameInNamespace

public java.lang.String getNameInNamespace()
                                    throws javax.naming.NamingException
Retrieves the full name of this context within its own namespace.
Specified by:
getNameInNamespace in interface javax.naming.Context
Returns:
the absolute pathname of this context
javax.naming.NamingException

Oracle® Application Server
XML Java API Reference
10g Release 2 (10.1.2)

Part no. B12024-03
September 2004

Copyright © 2003, 2004, Oracle. All rights reserved.