org.objectledge.naming.db
Class DatabaseDirContext

java.lang.Object
  extended by org.objectledge.naming.db.DatabaseContext
      extended by org.objectledge.naming.db.DatabaseDirContext
All Implemented Interfaces:
Context, DirContext

public class DatabaseDirContext
extends DatabaseContext
implements DirContext

Database based implementation of java.naming.directory.DirContext interface.

Author:
Pawel Potempski

Field Summary
 
Fields inherited from class org.objectledge.naming.db.DatabaseContext
context, env, parser, persistence, PERSISTENCE
 
Fields inherited from interface javax.naming.directory.DirContext
ADD_ATTRIBUTE, REMOVE_ATTRIBUTE, REPLACE_ATTRIBUTE
 
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
  DatabaseDirContext(Hashtable env)
          The directory context constructor.
protected DatabaseDirContext(Hashtable env, PersistentContext context, Persistence persistence)
          The context constructor.
 
Method Summary
 void bind(Name name, Object obj, Attributes attrs)
          
 void bind(String name, Object obj, Attributes attrs)
          
 Context createSubcontext(Name name)
          
 DirContext createSubcontext(Name name, Attributes attrs)
          
 Context createSubcontext(String name)
          
 DirContext createSubcontext(String name, Attributes attrs)
          
private  void deleteAllAttributes(long contextId)
          Delete all attributes that belongs to specified context.
 void destroySubcontext(Name name)
          
private  Attributes filterAttributes(Attributes attributes, String[] attrIds)
          Filter attributes with attribute list.
private  Attributes getAllAttributes(long contextId)
          Get all attributes that belongs to specified context.
 Attributes getAttributes(Name name)
          
 Attributes getAttributes(Name name, String[] attrIds)
          
 Attributes getAttributes(String name)
          
 Attributes getAttributes(String name, String[] attrIds)
          
private  Map getChildrenAttributes(long parentId)
          Get all attributes from child contexts of specified context.
 DirContext getSchema(Name name)
          
 DirContext getSchema(String name)
          
 DirContext getSchemaClassDefinition(Name name)
          
 DirContext getSchemaClassDefinition(String name)
          
 Object lookup(Name name)
          
 void modifyAttributes(Name name, int modOp, Attributes attrs)
          
 void modifyAttributes(Name name, ModificationItem[] mods)
          
 void modifyAttributes(String name, int modOp, Attributes attrs)
          
 void modifyAttributes(String name, ModificationItem[] mods)
          
 void rebind(Name name, Object obj, Attributes attrs)
          
 void rebind(String name, Object obj, Attributes attrs)
          
 NamingEnumeration search(Name name, Attributes matchingAttributes)
          
 NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn)
          
 NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons)
          
 NamingEnumeration search(Name name, String filter, SearchControls cons)
          
 NamingEnumeration search(String name, Attributes matchingAttributes)
          
 NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn)
          
 NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons)
          
 NamingEnumeration search(String name, String filter, SearchControls cons)
          
 
Methods inherited from class org.objectledge.naming.db.DatabaseContext
addToEnvironment, bind, bind, close, composeName, composeName, createContextDelegate, destroySubcontext, getDelegate, getDN, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookupContext, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 
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, bind, bind, close, composeName, composeName, destroySubcontext, getEnvironment, getNameInNamespace, getNameParser, getNameParser, list, list, listBindings, listBindings, lookup, lookupLink, lookupLink, rebind, rebind, removeFromEnvironment, rename, rename, unbind, unbind
 

Constructor Detail

DatabaseDirContext

public DatabaseDirContext(Hashtable env)
The directory context constructor.

Parameters:
env - the environment.

DatabaseDirContext

protected DatabaseDirContext(Hashtable env,
                             PersistentContext context,
                             Persistence persistence)
                      throws NamingException
The context constructor.

Parameters:
env - the environment.
context - the persistent context delegate.
persistence - the persistence.
Throws:
NamingException - if operation failed.
Method Detail

lookup

public Object lookup(Name name)
              throws NamingException

Specified by:
lookup in interface Context
Overrides:
lookup in class DatabaseContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(Name name)
                         throws NamingException

Specified by:
getAttributes in interface DirContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(String name)
                         throws NamingException

Specified by:
getAttributes in interface DirContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(Name name,
                                String[] attrIds)
                         throws NamingException

Specified by:
getAttributes in interface DirContext
Throws:
NamingException

getAttributes

public Attributes getAttributes(String name,
                                String[] attrIds)
                         throws NamingException

Specified by:
getAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(Name name,
                             int modOp,
                             Attributes attrs)
                      throws NamingException

Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(String name,
                             int modOp,
                             Attributes attrs)
                      throws NamingException

Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(Name name,
                             ModificationItem[] mods)
                      throws NamingException

Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

modifyAttributes

public void modifyAttributes(String name,
                             ModificationItem[] mods)
                      throws NamingException

Specified by:
modifyAttributes in interface DirContext
Throws:
NamingException

bind

public void bind(Name name,
                 Object obj,
                 Attributes attrs)
          throws NamingException

Specified by:
bind in interface DirContext
Throws:
NamingException

bind

public void bind(String name,
                 Object obj,
                 Attributes attrs)
          throws NamingException

Specified by:
bind in interface DirContext
Throws:
NamingException

rebind

public void rebind(Name name,
                   Object obj,
                   Attributes attrs)
            throws NamingException

Specified by:
rebind in interface DirContext
Throws:
NamingException

rebind

public void rebind(String name,
                   Object obj,
                   Attributes attrs)
            throws NamingException

Specified by:
rebind in interface DirContext
Throws:
NamingException

destroySubcontext

public void destroySubcontext(Name name)
                       throws NamingException

Specified by:
destroySubcontext in interface Context
Overrides:
destroySubcontext in class DatabaseContext
Throws:
NamingException

createSubcontext

public DirContext createSubcontext(Name name,
                                   Attributes attrs)
                            throws NamingException

Specified by:
createSubcontext in interface DirContext
Throws:
NamingException

createSubcontext

public DirContext createSubcontext(String name,
                                   Attributes attrs)
                            throws NamingException

Specified by:
createSubcontext in interface DirContext
Throws:
NamingException

createSubcontext

public Context createSubcontext(String name)
                         throws NamingException

Specified by:
createSubcontext in interface Context
Overrides:
createSubcontext in class DatabaseContext
Throws:
NamingException

createSubcontext

public Context createSubcontext(Name name)
                         throws NamingException

Specified by:
createSubcontext in interface Context
Overrides:
createSubcontext in class DatabaseContext
Throws:
NamingException

getSchema

public DirContext getSchema(Name name)
                     throws NamingException

Specified by:
getSchema in interface DirContext
Throws:
NamingException

getSchema

public DirContext getSchema(String name)
                     throws NamingException

Specified by:
getSchema in interface DirContext
Throws:
NamingException

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(Name name)
                                    throws NamingException

Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException

getSchemaClassDefinition

public DirContext getSchemaClassDefinition(String name)
                                    throws NamingException

Specified by:
getSchemaClassDefinition in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes,
                                String[] attributesToReturn)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                Attributes matchingAttributes)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                Attributes matchingAttributes)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                String filter,
                                SearchControls cons)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                String filter,
                                SearchControls cons)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(Name name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

search

public NamingEnumeration search(String name,
                                String filterExpr,
                                Object[] filterArgs,
                                SearchControls cons)
                         throws NamingException

Specified by:
search in interface DirContext
Throws:
NamingException

getAllAttributes

private Attributes getAllAttributes(long contextId)
                             throws NamingException
Get all attributes that belongs to specified context.

Parameters:
contextId - the context id.
Returns:
the attributes.
Throws:
NamingException - thrown if operation fails.

deleteAllAttributes

private void deleteAllAttributes(long contextId)
                          throws NamingException
Delete all attributes that belongs to specified context.

Parameters:
contextId - the context id.
Throws:
NamingException - thrown if operation fails.

filterAttributes

private Attributes filterAttributes(Attributes attributes,
                                    String[] attrIds)
Filter attributes with attribute list.

Parameters:
attributes - the attributes to be filter.
attrIds - the filter.
Returns:
the filtered attributes.

getChildrenAttributes

private Map getChildrenAttributes(long parentId)
                           throws NamingException
Get all attributes from child contexts of specified context.

Parameters:
parentId - the parent context id.
Returns:
the map with attributes grouped by contexts.
Throws:
NamingException - thrown if operation fails.


Copyright © 2003-2006 objectledge.org. All Rights Reserved.