org.ow2.carol.cmi.smart.spi
Class SmartContext

java.lang.Object
  extended by org.ow2.carol.cmi.smart.spi.SmartContext
All Implemented Interfaces:
javax.naming.Context

public class SmartContext
extends java.lang.Object
implements javax.naming.Context

Context that is used in the SmartFactory.


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
SmartContext(javax.naming.Context wrapped, java.lang.ClassLoader classLoader)
          Create a new classloader with the given classloader and the wrapped context for delegation.
 
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)
          Bind a new clustered object.
 void bind(java.lang.String name, java.lang.Object obj)
          Bind a new clustered object.
 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)
           
 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)
           
 java.util.Hashtable<?,?> getEnvironment()
           
 java.lang.String getNameInNamespace()
           
 javax.naming.NameParser getNameParser(javax.naming.Name name)
           
 javax.naming.NameParser getNameParser(java.lang.String name)
           
 javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(javax.naming.Name name)
           
 javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(java.lang.String name)
           
 javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(javax.naming.Name name)
           
 javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(java.lang.String name)
           
 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, following links except for the terminal atomic component of the name.
 java.lang.Object lookupLink(java.lang.String name)
          Retrieves the named object, following links except for the terminal atomic component of the name.
 void rebind(javax.naming.Name name, java.lang.Object obj)
          Binds a name to an object, overwriting any existing binding.
 void rebind(java.lang.String name, java.lang.Object obj)
          Binds a name to an object, overwriting any existing binding.
 java.lang.Object removeFromEnvironment(java.lang.String propName)
           
 void rename(javax.naming.Name oldName, javax.naming.Name newName)
          Rename an object.
 void rename(java.lang.String oldName, java.lang.String newName)
          Rename an object.
 void unbind(javax.naming.Name name)
          Unbinds the named object.
 void unbind(java.lang.String name)
          Unbinds the named object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmartContext

public SmartContext(javax.naming.Context wrapped,
                    java.lang.ClassLoader classLoader)
Create a new classloader with the given classloader and the wrapped context for delegation.

Parameters:
wrapped - The context to wrap.
classLoader - classloader to use.
Method Detail

addToEnvironment

public java.lang.Object addToEnvironment(java.lang.String propName,
                                         java.lang.Object propVal)
                                  throws javax.naming.NamingException
Adds a new environment property to the environment of this context. If the property already exists, its value is overwritten.

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
Throws:
javax.naming.NamingException - if a naming exception is encountered

lookup

public java.lang.Object lookup(javax.naming.Name name)
                        throws javax.naming.NamingException
Retrieves the named object.

Specified by:
lookup in interface javax.naming.Context
Parameters:
name - the name of the object to look up
Returns:
the object bound to name
Throws:
javax.naming.NamingException - if a naming exception is encountered

lookup

public java.lang.Object lookup(java.lang.String name)
                        throws javax.naming.NamingException
Retrieves the named object.

Specified by:
lookup in interface javax.naming.Context
Parameters:
name - the name of the object to look up
Returns:
the object bound to name
Throws:
javax.naming.NamingException - if a naming exception is encountered

bind

public void bind(javax.naming.Name name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Bind a new clustered object.

Specified by:
bind in interface javax.naming.Context
Parameters:
name - The name to bind; may not be empty.
obj - The object to bind; possibly null.
Throws:
javax.naming.NamingException - if a naming exception is encountered.

bind

public void bind(java.lang.String name,
                 java.lang.Object obj)
          throws javax.naming.NamingException
Bind a new clustered object.

Specified by:
bind in interface javax.naming.Context
Parameters:
name - The name to bind; may not be empty.
obj - The object to bind; possibly null.
Throws:
javax.naming.NamingException - if a naming exception is encountered.

lookupLink

public java.lang.Object lookupLink(javax.naming.Name name)
                            throws javax.naming.NamingException
Retrieves the named object, following links except for the terminal atomic component of the name. If the object bound to name is not a link, returns the object itself.

Specified by:
lookupLink in interface javax.naming.Context
Parameters:
name - the name of the object to look up
Returns:
the object bound to name, not following the terminal link (if any).
Throws:
javax.naming.NamingException - if a naming exception is encountered

lookupLink

public java.lang.Object lookupLink(java.lang.String name)
                            throws javax.naming.NamingException
Retrieves the named object, following links except for the terminal atomic component of the name. If the object bound to name is not a link, returns the object itself.

Specified by:
lookupLink in interface javax.naming.Context
Parameters:
name - the name of the object to look up
Returns:
the object bound to name, not following the terminal link (if any).
Throws:
javax.naming.NamingException - if a naming exception is encountered

rebind

public void rebind(javax.naming.Name name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Binds a name to an object, overwriting any existing binding.

Specified by:
rebind in interface javax.naming.Context
Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
InvalidNameException

rebind

public void rebind(java.lang.String name,
                   java.lang.Object obj)
            throws javax.naming.NamingException
Binds a name to an object, overwriting any existing binding.

Specified by:
rebind in interface javax.naming.Context
Parameters:
name - the name to bind; may not be empty
obj - the object to bind; possibly null
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
InvalidNameException

rename

public void rename(javax.naming.Name oldName,
                   javax.naming.Name newName)
            throws javax.naming.NamingException
Rename an object.

Specified by:
rename in interface javax.naming.Context
Parameters:
oldName - the old name; may not be empty
newName - the new name; may not be empty
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
javax.naming.NameException

rename

public void rename(java.lang.String oldName,
                   java.lang.String newName)
            throws javax.naming.NamingException
Rename an object.

Specified by:
rename in interface javax.naming.Context
Parameters:
oldName - the old name; may not be empty
newName - the new name; may not be empty
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
javax.naming.NameException

unbind

public void unbind(javax.naming.Name name)
            throws javax.naming.NamingException
Unbinds the named object.

Specified by:
unbind in interface javax.naming.Context
Parameters:
name - the name to unbind; may not be empty
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
javax.naming.NameException

unbind

public void unbind(java.lang.String name)
            throws javax.naming.NamingException
Unbinds the named object.

Specified by:
unbind in interface javax.naming.Context
Parameters:
name - the name to unbind; may not be empty
Throws:
javax.naming.NamingException - if a naming exception is encountered
See Also:
javax.naming.NameException

removeFromEnvironment

public java.lang.Object removeFromEnvironment(java.lang.String propName)
                                       throws javax.naming.NamingException
Specified by:
removeFromEnvironment in interface javax.naming.Context
Throws:
javax.naming.NamingException

close

public void close()
           throws javax.naming.NamingException
Specified by:
close in interface javax.naming.Context
Throws:
javax.naming.NamingException

composeName

public javax.naming.Name composeName(javax.naming.Name name,
                                     javax.naming.Name prefix)
                              throws javax.naming.NamingException
Specified by:
composeName in interface javax.naming.Context
Throws:
javax.naming.NamingException

composeName

public java.lang.String composeName(java.lang.String name,
                                    java.lang.String prefix)
                             throws javax.naming.NamingException
Specified by:
composeName in interface javax.naming.Context
Throws:
javax.naming.NamingException

createSubcontext

public javax.naming.Context createSubcontext(javax.naming.Name name)
                                      throws javax.naming.NamingException
Specified by:
createSubcontext in interface javax.naming.Context
Throws:
javax.naming.NamingException

createSubcontext

public javax.naming.Context createSubcontext(java.lang.String name)
                                      throws javax.naming.NamingException
Specified by:
createSubcontext in interface javax.naming.Context
Throws:
javax.naming.NamingException

destroySubcontext

public void destroySubcontext(javax.naming.Name name)
                       throws javax.naming.NamingException
Specified by:
destroySubcontext in interface javax.naming.Context
Throws:
javax.naming.NamingException

destroySubcontext

public void destroySubcontext(java.lang.String name)
                       throws javax.naming.NamingException
Specified by:
destroySubcontext in interface javax.naming.Context
Throws:
javax.naming.NamingException

getEnvironment

public java.util.Hashtable<?,?> getEnvironment()
                                        throws javax.naming.NamingException
Specified by:
getEnvironment in interface javax.naming.Context
Throws:
javax.naming.NamingException

getNameInNamespace

public java.lang.String getNameInNamespace()
                                    throws javax.naming.NamingException
Specified by:
getNameInNamespace in interface javax.naming.Context
Throws:
javax.naming.NamingException

getNameParser

public javax.naming.NameParser getNameParser(javax.naming.Name name)
                                      throws javax.naming.NamingException
Specified by:
getNameParser in interface javax.naming.Context
Throws:
javax.naming.NamingException

getNameParser

public javax.naming.NameParser getNameParser(java.lang.String name)
                                      throws javax.naming.NamingException
Specified by:
getNameParser in interface javax.naming.Context
Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(javax.naming.Name name)
                                                                throws javax.naming.NamingException
Specified by:
list in interface javax.naming.Context
Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration<javax.naming.NameClassPair> list(java.lang.String name)
                                                                throws javax.naming.NamingException
Specified by:
list in interface javax.naming.Context
Throws:
javax.naming.NamingException

listBindings

public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(javax.naming.Name name)
                                                                  throws javax.naming.NamingException
Specified by:
listBindings in interface javax.naming.Context
Throws:
javax.naming.NamingException

listBindings

public javax.naming.NamingEnumeration<javax.naming.Binding> listBindings(java.lang.String name)
                                                                  throws javax.naming.NamingException
Specified by:
listBindings in interface javax.naming.Context
Throws:
javax.naming.NamingException


Copyright © 2008 OW2 Consortium. All Rights Reserved.