You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/06/22 22:48:56 UTC
svn commit: r549955 [10/16] - in
/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java: javax/naming/
javax/naming/directory/ javax/naming/event/ javax/naming/ldap/
javax/naming/spi/ org/apache/harmony/jndi/internal/
org/apache/harmony/jndi/inter...
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirObjectFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirObjectFactory.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirObjectFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirObjectFactory.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -24,8 +23,8 @@
import javax.naming.directory.Attributes;
/**
- * An <code>DirObjectFactory</code> creates objects of a specified type.
- * <code>DirObjectFactory</code> is a specific version of
+ * An <code>DirObjectFactory</code> creates objects of a specified type.
+ * <code>DirObjectFactory</code> is a specific version of
* <code>ObjectFactory</code> for <code>DirectoryManager</code>.
*
* @see ObjectFactory
@@ -33,33 +32,26 @@
*/
public interface DirObjectFactory extends ObjectFactory {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Similar to <code>ObjectFactory.getObjectInstance</code>, with an
+ * Similar to <code>ObjectFactory.getObjectInstance</code>, with an
* additional <code>attributes</code> parameter.
*
- * @param o an object
- * @param n a name
- * @param c a context
- * @param envmt a context environment
- * @param a some attributes
- * @return the created object
- * @throws Exception if an exception occurs
+ * @param o
+ * an object
+ * @param n
+ * a name
+ * @param c
+ * a context
+ * @param envmt
+ * a context environment
+ * @param a
+ * some attributes
+ * @return the created object
+ * @throws Exception
+ * if an exception occurs
* @see ObjectFactory#getObjectInstance(Object, Name, Context, Hashtable)
*/
- Object getObjectInstance(
- Object o,
- Name n,
- Context c,
- Hashtable<?, ?> envmt,
- Attributes a)
- throws Exception;
+ Object getObjectInstance(Object o, Name n, Context c,
+ Hashtable<?, ?> envmt, Attributes a) throws Exception;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirStateFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirStateFactory.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirStateFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirStateFactory.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -25,9 +24,9 @@
import javax.naming.directory.Attributes;
/**
- * The <code>DirStateFactory</code> interface describes a factory used to get
- * the state of an object to be bound. <code>DirStateFactory</code> is a
- * specific version of <code>StateFactory</code> for
+ * The <code>DirStateFactory</code> interface describes a factory used to get
+ * the state of an object to be bound. <code>DirStateFactory</code> is a
+ * specific version of <code>StateFactory</code> for
* <code>DirectoryManager</code>.
*
* @see StateFactory
@@ -35,83 +34,58 @@
*/
public interface DirStateFactory extends StateFactory {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
* Similar to <code>StateFactory.getStateToBind</code> with an additional
* <code>attributes</code> parameter.
*
- * @param o an object
- * @param n a name
- * @param c a context
- * @param envmt a context environment
- * @param a some attributes
- * @return the state as a <code>Result</code> instance, containing
- * an object and associated attributes.
- * @throws NamingException if an exception occurs
+ * @param o
+ * an object
+ * @param n
+ * a name
+ * @param c
+ * a context
+ * @param envmt
+ * a context environment
+ * @param a
+ * some attributes
+ * @return the state as a <code>Result</code> instance, containing an
+ * object and associated attributes.
+ * @throws NamingException
+ * if an exception occurs
* @see StateFactory#getStateToBind(Object, Name, Context, Hashtable)
*/
- Result getStateToBind(
- Object o,
- Name n,
- Context c,
- Hashtable<?, ?> envmt,
- Attributes a)
- throws NamingException;
-
- /*
- * -------------------------------------------------------------------
- * Inner classes
- * -------------------------------------------------------------------
- */
+ Result getStateToBind(Object o, Name n, Context c, Hashtable<?, ?> envmt,
+ Attributes a) throws NamingException;
/**
- * Used by the <code>DirectoryManager.getStateToBind</code> method as
- * the returning value.
+ * Used by the <code>DirectoryManager.getStateToBind</code> method as the
+ * returning value.
*/
public static class Result {
- /*
- * -------------------------------------------------------------------
- * Instance variables
- * -------------------------------------------------------------------
- */
-
// the Object returned by DirectoryManager.getStateToBind.
private Object obj;
// the Attributes returned by DirectoryManager.getStateToBind.
private Attributes attrs;
- /*
- * -------------------------------------------------------------------
- * Constructors
- * -------------------------------------------------------------------
- */
-
/**
* Creates an instance of <code>DirStateFactory.Result</code>
*
- * @param o the object returned by
- * <code>DirectoryManager.getStateToBind</code>. May be null.
- * @param a the attributes returned by
- * <code>DirectoryManager.getStateToBind</code>. May be null.
+ * @param o
+ * the object returned by
+ * <code>DirectoryManager.getStateToBind</code>. May be
+ * null.
+ * @param a
+ * the attributes returned by
+ * <code>DirectoryManager.getStateToBind</code>. May be
+ * null.
*/
public Result(Object o, Attributes a) {
this.obj = o;
this.attrs = a;
}
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
* Returns the object associated with this result.
*
@@ -132,5 +106,3 @@
}
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/DirectoryManager.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.net.URL;
@@ -56,45 +55,56 @@
* <p>
* The <code>Name</code> and <code>Hashtable</code> arguments passed to the
* <code>DirectoryManager</code> methods remain owned purely by the calling
- * method. They must not be changed or referenced.</p>
+ * method. They must not be changed or referenced.
+ * </p>
* <p>
- * Multithreaded access to this class must be safe.</p>
- *
+ * Multithreaded access to this class must be safe.
+ * </p>
*/
public class DirectoryManager extends NamingManager {
- private DirectoryManager(){//private to prevent it being instanced
+ // Private to prevent it being instanced
+ private DirectoryManager() {
}
/**
- * Create an object using an object factory.
- * Returns a new <code>Object</code> or the supplied <code>Object o</code>
- * if one cannot be created.
- *
- * The behaviour is like that for the
- * <code>getObjectInstance</code> method of <code>NamingManager</code>
- * however it should be noted that the intermediate object factory may be
- * either of type <code>DirObjectFactory</code> or of type
- * <code>ObjectFactory</code>; in the former case, the supplied
- * <code>Attributes</code> must be passed when getting the object,
- * otherwise the supplied <code>Attributes</code> are ignored.
- *
- * @param o An object which may provide reference or location information.
- * May be null.
- * @param n The name of the <code>Object</code> relative to the default
- * initial context (or relative to the Context c if it is supplied)
- * @param c The <code>Context</code> to which the Name is relative
- * @param h a <code>Hashtable</code> containing environment properties and
- * values - may be null
- * @param a <code>Attributes</code> - if some or all of the attributes of
- * <code>Object o</code> are already known they can be supplied so
- * that the factory does not have to do the work of looking them up.
- * @return the created object
- * @throws NamingException if one is encountered
- * @throws Exception if any other exception is encountered
+ * Create an object using an object factory. Returns a new
+ * <code>Object</code> or the supplied <code>Object o</code> if one
+ * cannot be created.
+ *
+ * The behaviour is like that for the <code>getObjectInstance</code>
+ * method of <code>NamingManager</code> however it should be noted that
+ * the intermediate object factory may be either of type
+ * <code>DirObjectFactory</code> or of type <code>ObjectFactory</code>;
+ * in the former case, the supplied <code>Attributes</code> must be passed
+ * when getting the object, otherwise the supplied <code>Attributes</code>
+ * are ignored.
+ *
+ * @param o
+ * An object which may provide reference or location information.
+ * May be null.
+ * @param n
+ * The name of the <code>Object</code> relative to the default
+ * initial context (or relative to the Context c if it is
+ * supplied)
+ * @param c
+ * The <code>Context</code> to which the Name is relative
+ * @param h
+ * a <code>Hashtable</code> containing environment properties
+ * and values - may be null
+ * @param a
+ * <code>Attributes</code> - if some or all of the attributes
+ * of <code>Object o</code> are already known they can be
+ * supplied so that the factory does not have to do the work of
+ * looking them up.
+ * @return the created object
+ * @throws NamingException
+ * if one is encountered
+ * @throws Exception
+ * if any other exception is encountered
*/
- public static Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> h,
- Attributes a) throws NamingException, Exception {
+ public static Object getObjectInstance(Object o, Name n, Context c,
+ Hashtable<?, ?> h, Attributes a) throws NamingException, Exception {
// 1. try ObjectFactoryBuilder, if it is set
if (null != ofb) {
@@ -114,11 +124,12 @@
}
// if o is a Referenceable or a Reference
if (null != ref) {
- // if a factory class name is supplied by the reference, use it to create
+ // if a factory class name is supplied by the reference, use it to
+ // create
if (null != ref.getFactoryClassName()) {
return getObjectInstanceByFactoryInReference(ref, o, n, c, h, a);
}
- // see if ref has any StringRefAddrs of address type URL,
+ // see if ref has any StringRefAddrs of address type URL,
Object result = getObjectInstanceByUrlRefAddr(n, c, h, ref);
// if success, return it
if (null != result) {
@@ -137,31 +148,27 @@
}
/**
- * Check the type of factory, DirObjectFactory or ObjectFactory, and
- * call getObjectInstance() on the property type.
+ * Check the type of factory, DirObjectFactory or ObjectFactory, and call
+ * getObjectInstance() on the property type.
*/
private static Object getObjectInstanceFromGivenFactory(
- ObjectFactory factory,
- Object o,
- Name n,
- Context c,
- Hashtable<?, ?> h,
- Attributes a) throws Exception {
+ ObjectFactory factory, Object o, Name n, Context c,
+ Hashtable<?, ?> h, Attributes a) throws Exception {
if (factory instanceof DirObjectFactory) {
- return ((DirObjectFactory) factory).getObjectInstance(o, n, c, h, a);
+ return ((DirObjectFactory) factory)
+ .getObjectInstance(o, n, c, h, a);
}
return factory.getObjectInstance(o, n, c, h);
}
- private static Object getObjectInstanceByObjectFactory(Object o, Name n, Context c,
- Hashtable<?, ?> h, Attributes a) throws NamingException, Exception {
+ private static Object getObjectInstanceByObjectFactory(Object o, Name n,
+ Context c, Hashtable<?, ?> h, Attributes a) throws NamingException,
+ Exception {
// obtain object factories from hashtable and service provider resource
// file
- String fnames[] =
- EnvironmentReader.getFactoryNamesFromEnvironmentAndProviderResource(
- h,
- c,
- Context.OBJECT_FACTORIES);
+ String fnames[] = EnvironmentReader
+ .getFactoryNamesFromEnvironmentAndProviderResource(h, c,
+ Context.OBJECT_FACTORIES);
for (String element : fnames) {
// new factory instance by its class name
ObjectFactory factory = null;
@@ -171,7 +178,8 @@
continue;
}
// create object using factory
- Object obj = getObjectInstanceFromGivenFactory(factory, o, n, c, h, a);
+ Object obj = getObjectInstanceFromGivenFactory(factory, o, n, c, h,
+ a);
if (null != obj) {
return obj;
}
@@ -180,44 +188,38 @@
return null;
}
- private static Object getObjectInstanceByUrlRefAddr(Name n, Context c, Hashtable<?, ?> h,
- Reference ref) throws NamingException {
+ private static Object getObjectInstanceByUrlRefAddr(Name n, Context c,
+ Hashtable<?, ?> h, Reference ref) throws NamingException {
// obtain pkg prefixes from hashtable and service provider resource file
- String pkgPrefixes[] =
- EnvironmentReader.getFactoryNamesFromEnvironmentAndProviderResource(
- h,
- c,
- Context.URL_PKG_PREFIXES);
+ String pkgPrefixes[] = EnvironmentReader
+ .getFactoryNamesFromEnvironmentAndProviderResource(h, c,
+ Context.URL_PKG_PREFIXES);
// for each RefAddr
Enumeration<RefAddr> enumeration = ref.getAll();
while (enumeration.hasMoreElements()) {
RefAddr addr = enumeration.nextElement();
// if it is StringRefAddr and type is URL
if (addr instanceof StringRefAddr
- && addr.getType().equalsIgnoreCase("URL")) { //$NON-NLS-1$
+ && addr.getType().equalsIgnoreCase("URL")) { //$NON-NLS-1$
// get the url address
String url = (String) ((StringRefAddr) addr).getContent();
// try create using url context factory
- Object obj =
- getObjectInstanceByUrlContextFactory(
- url,
- n,
- c,
- h,
- pkgPrefixes,
- UrlParser.getScheme(url));
+ Object obj = getObjectInstanceByUrlContextFactory(url, n, c, h,
+ pkgPrefixes, UrlParser.getScheme(url));
// if success, return the created obj
if (null != obj) {
return obj;
}
}
}
- // failed to create using any StringRefAddr of address type URL, return null
+ // failed to create using any StringRefAddr of address type URL, return
+ // null
return null;
}
- private static Object getObjectInstanceByUrlContextFactory(String url, Name n, Context c,
- Hashtable<?, ?> h, String pkgPrefixes[], String schema) throws NamingException {
+ private static Object getObjectInstanceByUrlContextFactory(String url,
+ Name n, Context c, Hashtable<?, ?> h, String pkgPrefixes[],
+ String schema) throws NamingException {
// if schema is empty or null, fail, return null
if (null == schema || 0 == schema.length()) {
return null;
@@ -227,8 +229,8 @@
ObjectFactory factory = null;
try {
// create url context factory instance
- String clsName =
- element + "." + schema + "." + schema + "URLContextFactory"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ String clsName = element
+ + "." + schema + "." + schema + "URLContextFactory"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
factory = (ObjectFactory) classForName(clsName).newInstance();
} catch (Exception e) {
// failed to create factory, continue trying
@@ -237,8 +239,9 @@
try {
// create obj using url context factory
/*
- * Unit test shows it is ObjectFactory here, not DirObjectFactory
- * // Object obj = factory.getObjectInstance(url, n, c, h, a);
+ * Unit test shows it is ObjectFactory here, not
+ * DirObjectFactory // Object obj =
+ * factory.getObjectInstance(url, n, c, h, a);
*/
Object obj = factory.getObjectInstance(url, n, c, h);
// if create success, return it
@@ -251,8 +254,8 @@
throw (NamingException) e;
}
// jndi.21=Failed to create object instance
- NamingException nex =
- new NamingException(Messages.getString("jndi.21")); //$NON-NLS-1$
+ NamingException nex = new NamingException(Messages
+ .getString("jndi.21")); //$NON-NLS-1$
nex.setRootCause(e);
throw nex;
}
@@ -261,23 +264,23 @@
return null;
}
- private static Object getObjectInstanceByFactoryInReference(Reference ref, Object o,
- Name n, Context c, Hashtable<?, ?> h, Attributes a) throws Exception {
+ private static Object getObjectInstanceByFactoryInReference(Reference ref,
+ Object o, Name n, Context c, Hashtable<?, ?> h, Attributes a)
+ throws Exception {
ObjectFactory factory = null;
// try load the factory by its class name
try {
- factory =
- (ObjectFactory) classForName(ref.getFactoryClassName()).newInstance();
+ factory = (ObjectFactory) classForName(ref.getFactoryClassName())
+ .newInstance();
} catch (ClassNotFoundException e) {
// Ignored.
}
// try load the factory from its class location
if (null == factory && null != ref.getFactoryClassLocation()) {
- factory =
- (ObjectFactory) loadFactoryFromLocation(ref.getFactoryClassName(),
- ref.getFactoryClassLocation());
+ factory = (ObjectFactory) loadFactoryFromLocation(ref
+ .getFactoryClassName(), ref.getFactoryClassLocation());
}
// if factory cannot be loaded
if (null == factory) {
@@ -290,11 +293,11 @@
}
/*
- * If cannot load class, return null.
- * Throws any exceptions except ClassNotFoundException
+ * If cannot load class, return null. Throws any exceptions except
+ * ClassNotFoundException
*/
- private static Object loadFactoryFromLocation(String clsName, String location)
- throws Exception {
+ private static Object loadFactoryFromLocation(String clsName,
+ String location) throws Exception {
// convert location into an array of URL, separated by ' '
StringTokenizer st = new StringTokenizer(location, " "); //$NON-NLS-1$
@@ -317,44 +320,46 @@
}
/**
- * Get the state of an Object.
- * Returns a <code>DirStateFactory</code>. Result which cannot be null. It
- * contains the attributes and object to be bound, either of which may be
- * null. Once returned the caller is the owner of it.
- * The behaviour is like that for the <code>getStateToBind</code> method of
- * <code>NamingManager</code> however it should be noted that the
- * intermediate state factory may be of type <code>DirStateFactory</code>
- * rather than just <code>StateFactory</code> in which case it should also
- * use the supplied <code>Attributes</code> when getting the state.
- *
- * @param o An object which may provide reference or location information.
- * May be null.
- * @param n The name of the <code>Object</code> relative to the default
- * initial context (or relative to the Context c if it is supplied)
- * @param c The <code>Context</code> to which the <code>Name</code> is
- * relative
- * @param h a <code>Hashtable</code> containing environment properties and
- * values - may be null
- * @param a <code>Attributes</code> - if some or all of the attributes of
- * <code>Object o</code> are already known they can be supplied so
- * that the factory does not have to do the work of looking them up.
- * @return the state of the object
- * @throws NamingException if one is encountered
+ * Get the state of an Object. Returns a <code>DirStateFactory</code>.
+ * Result which cannot be null. It contains the attributes and object to be
+ * bound, either of which may be null. Once returned the caller is the owner
+ * of it. The behaviour is like that for the <code>getStateToBind</code>
+ * method of <code>NamingManager</code> however it should be noted that
+ * the intermediate state factory may be of type
+ * <code>DirStateFactory</code> rather than just <code>StateFactory</code>
+ * in which case it should also use the supplied <code>Attributes</code>
+ * when getting the state.
+ *
+ * @param o
+ * An object which may provide reference or location information.
+ * May be null.
+ * @param n
+ * The name of the <code>Object</code> relative to the default
+ * initial context (or relative to the Context c if it is
+ * supplied)
+ * @param c
+ * The <code>Context</code> to which the <code>Name</code> is
+ * relative
+ * @param h
+ * a <code>Hashtable</code> containing environment properties
+ * and values - may be null
+ * @param a
+ * <code>Attributes</code> - if some or all of the attributes
+ * of <code>Object o</code> are already known they can be
+ * supplied so that the factory does not have to do the work of
+ * looking them up.
+ * @return the state of the object
+ * @throws NamingException
+ * if one is encountered
*/
- public static DirStateFactory.Result getStateToBind(
- Object o,
- Name n,
- Context c,
- Hashtable<?, ?> h,
- Attributes a)
- throws NamingException {
-
- // obtain state factories from hashtable and service provider resource file
- String fnames[] =
- EnvironmentReader.getFactoryNamesFromEnvironmentAndProviderResource(
- h,
- c,
- Context.STATE_FACTORIES);
+ public static DirStateFactory.Result getStateToBind(Object o, Name n,
+ Context c, Hashtable<?, ?> h, Attributes a) throws NamingException {
+
+ // obtain state factories from hashtable and service provider resource
+ // file
+ String fnames[] = EnvironmentReader
+ .getFactoryNamesFromEnvironmentAndProviderResource(h, c,
+ Context.STATE_FACTORIES);
for (String element : fnames) {
// new factory instance by its class name
@@ -366,7 +371,8 @@
}
if (factory instanceof DirStateFactory) {
// try obtain state using the DirStateFactory
- Result r = ((DirStateFactory) factory).getStateToBind(o, n, c, h, a);
+ Result r = ((DirStateFactory) factory).getStateToBind(o, n, c,
+ h, a);
// if the result is not null, return it
if (null != r) {
return r;
@@ -386,26 +392,28 @@
}
/**
- * Create the next <code>DirContext</code> when using federation so that
- * the <code>DirContext</code> operation can be reinvoked.
- * This should work similarly to
- * <code>NamingManager.getContinuationContext</code> except that a
- * reference to a <code>DirContext</code> is returned.
+ * Create the next <code>DirContext</code> when using federation so that
+ * the <code>DirContext</code> operation can be reinvoked. This should
+ * work similarly to <code>NamingManager.getContinuationContext</code>
+ * except that a reference to a <code>DirContext</code> is returned.
* <p>
* This method is also responsible for setting the property denoted by the
* <code>CPE</code> string to be the supplied
- * <code>CannotProceedException</code> for that environment.</p>
- *
- * @param cpe the <code>CannotProceedException</code> generated by the
- * <code>DirContext</code> of the previous naming system when
- * it can proceed no further.
- * @return the next <code>DirContext</code> when using federation
- * @throws NamingException if the resolved object is not set or if a
- * <code>DirContext</code> cannot be obtained from it either
- * directly or indirectly.
+ * <code>CannotProceedException</code> for that environment.
+ * </p>
+ *
+ * @param cpe
+ * the <code>CannotProceedException</code> generated by the
+ * <code>DirContext</code> of the previous naming system when
+ * it can proceed no further.
+ * @return the next <code>DirContext</code> when using federation
+ * @throws NamingException
+ * if the resolved object is not set or if a
+ * <code>DirContext</code> cannot be obtained from it either
+ * directly or indirectly.
*/
- public static DirContext getContinuationDirContext(CannotProceedException cpe)
- throws NamingException {
+ public static DirContext getContinuationDirContext(
+ CannotProceedException cpe) throws NamingException {
// obtain next context using NamingManager
Context nextContext = null;
try {
@@ -413,54 +421,52 @@
} catch (CannotProceedException e) {
// tolerate CannotProceedException here
}
-
+
// if it is a DirContext
if (nextContext instanceof DirContext) {
// return as DirContext
return (DirContext) nextContext;
- } else {
- // in case it's Context but not DirContext, wrap it as DirContext and return
- return new Context2DirContextWrapper(nextContext, cpe);
}
+ // in case it's Context but not DirContext, wrap it as DirContext
+ // and return
+ return new Context2DirContextWrapper(nextContext, cpe);
}
private static Class<?> classForName(final String className)
- throws ClassNotFoundException {
+ throws ClassNotFoundException {
- Class<?> cls = AccessController.doPrivileged(new PrivilegedAction<Class<?>>() {
- public Class<?> run() {
- // try thread context class loader first
- try {
- return Class.forName(
- className,
- true,
- Thread.currentThread().getContextClassLoader());
- } catch (ClassNotFoundException e) {
- // Could happen.
- }
- // try system class loader second
- try {
- return Class.forName(
- className,
- true,
- ClassLoader.getSystemClassLoader());
- } catch (ClassNotFoundException e1) {
- // Not found here either.
- }
- // return null, if fail to load class
- return null;
- }
- });
+ Class<?> cls = AccessController
+ .doPrivileged(new PrivilegedAction<Class<?>>() {
+ public Class<?> run() {
+ // try thread context class loader first
+ try {
+ return Class.forName(className, true, Thread
+ .currentThread().getContextClassLoader());
+ } catch (ClassNotFoundException e) {
+ // Could happen.
+ }
+ // try system class loader second
+ try {
+ return Class.forName(className, true, ClassLoader
+ .getSystemClassLoader());
+ } catch (ClassNotFoundException e1) {
+ // Not found here either.
+ }
+ // return null, if fail to load class
+ return null;
+ }
+ });
if (cls == null) {
// jndi.1C=class {0} not found
- throw new ClassNotFoundException(Messages.getString("jndi.1C", className)); //$NON-NLS-1$
+ throw new ClassNotFoundException(Messages.getString(
+ "jndi.1C", className)); //$NON-NLS-1$
}
return cls;
}
-
+
/**
* An inner class that transforms a Context instance into DirContext.
*/
@@ -490,7 +496,8 @@
throw cpe;
}
- public NamingEnumeration<Binding> listBindings(String s) throws NamingException {
+ public NamingEnumeration<Binding> listBindings(String s)
+ throws NamingException {
return getContext().listBindings(s);
}
@@ -502,7 +509,8 @@
return getContext().lookupLink(s);
}
- public NamingEnumeration<NameClassPair> list(Name n) throws NamingException {
+ public NamingEnumeration<NameClassPair> list(Name n)
+ throws NamingException {
return getContext().list(n);
}
@@ -510,7 +518,8 @@
return getContext().lookup(s);
}
- public Object addToEnvironment(String s, Object o) throws NamingException {
+ public Object addToEnvironment(String s, Object o)
+ throws NamingException {
return getContext().addToEnvironment(s, o);
}
@@ -560,7 +569,8 @@
getContext().rebind(s, o);
}
- public NamingEnumeration<Binding> listBindings(Name n) throws NamingException {
+ public NamingEnumeration<Binding> listBindings(Name n)
+ throws NamingException {
return getContext().listBindings(n);
}
@@ -568,7 +578,8 @@
return getContext().getNameParser(n);
}
- public NamingEnumeration<NameClassPair> list(String s) throws NamingException {
+ public NamingEnumeration<NameClassPair> list(String s)
+ throws NamingException {
return getContext().list(s);
}
@@ -633,11 +644,13 @@
return getContext().getEnvironment();
}
- public void bind(Name name, Object obj, Attributes attributes) throws NamingException {
+ public void bind(Name name, Object obj, Attributes attributes)
+ throws NamingException {
getDirContext().bind(name, obj, attributes);
}
- public void bind(String s, Object obj, Attributes attributes) throws NamingException {
+ public void bind(String s, Object obj, Attributes attributes)
+ throws NamingException {
getDirContext().bind(s, obj, attributes);
}
@@ -655,7 +668,8 @@
return getDirContext().getAttributes(name);
}
- public Attributes getAttributes(Name name, String[] as) throws NamingException {
+ public Attributes getAttributes(Name name, String[] as)
+ throws NamingException {
return getDirContext().getAttributes(name, as);
}
@@ -663,7 +677,8 @@
return getDirContext().getAttributes(s);
}
- public Attributes getAttributes(String s, String[] as) throws NamingException {
+ public Attributes getAttributes(String s, String[] as)
+ throws NamingException {
return getDirContext().getAttributes(s, as);
}
@@ -675,11 +690,13 @@
return getDirContext().getSchema(s);
}
- public DirContext getSchemaClassDefinition(Name name) throws NamingException {
+ public DirContext getSchemaClassDefinition(Name name)
+ throws NamingException {
return getDirContext().getSchemaClassDefinition(name);
}
- public DirContext getSchemaClassDefinition(String s) throws NamingException {
+ public DirContext getSchemaClassDefinition(String s)
+ throws NamingException {
return getDirContext().getSchemaClassDefinition(s);
}
@@ -688,8 +705,8 @@
getDirContext().modifyAttributes(name, i, attributes);
}
- public void modifyAttributes(Name name, ModificationItem[] modificationItems)
- throws NamingException {
+ public void modifyAttributes(Name name,
+ ModificationItem[] modificationItems) throws NamingException {
getDirContext().modifyAttributes(name, modificationItems);
}
@@ -698,31 +715,34 @@
getDirContext().modifyAttributes(s, i, attributes);
}
- public void modifyAttributes(String s, ModificationItem[] modificationItems)
- throws NamingException {
+ public void modifyAttributes(String s,
+ ModificationItem[] modificationItems) throws NamingException {
getDirContext().modifyAttributes(s, modificationItems);
}
- public void rebind(Name name, Object obj, Attributes attributes) throws NamingException {
+ public void rebind(Name name, Object obj, Attributes attributes)
+ throws NamingException {
getDirContext().rebind(name, obj, attributes);
}
- public void rebind(String s, Object obj, Attributes attributes) throws NamingException {
+ public void rebind(String s, Object obj, Attributes attributes)
+ throws NamingException {
getDirContext().rebind(s, obj, attributes);
}
- public NamingEnumeration<SearchResult> search(Name name, Attributes attributes)
- throws NamingException {
+ public NamingEnumeration<SearchResult> search(Name name,
+ Attributes attributes) throws NamingException {
return getDirContext().search(name, attributes);
}
- public NamingEnumeration<SearchResult> search(Name name, Attributes attributes,
- String[] as) throws NamingException {
+ public NamingEnumeration<SearchResult> search(Name name,
+ Attributes attributes, String[] as) throws NamingException {
return getDirContext().search(name, attributes, as);
}
- public NamingEnumeration<SearchResult> search(Name name, String filter, Object[] objs,
- SearchControls searchControls) throws NamingException {
+ public NamingEnumeration<SearchResult> search(Name name, String filter,
+ Object[] objs, SearchControls searchControls)
+ throws NamingException {
return getDirContext().search(name, filter, objs, searchControls);
}
@@ -731,24 +751,27 @@
return getDirContext().search(name, filter, searchControls);
}
- public NamingEnumeration<SearchResult> search(String name, Attributes attributes)
- throws NamingException {
+ public NamingEnumeration<SearchResult> search(String name,
+ Attributes attributes) throws NamingException {
return getDirContext().search(name, attributes);
}
- public NamingEnumeration<SearchResult> search(String name, Attributes attributes,
- String[] as) throws NamingException {
+ public NamingEnumeration<SearchResult> search(String name,
+ Attributes attributes, String[] as) throws NamingException {
return getDirContext().search(name, attributes, as);
}
- public NamingEnumeration<SearchResult> search(String name, String filter,
- Object[] objs, SearchControls searchControls) throws NamingException {
+ public NamingEnumeration<SearchResult> search(String name,
+ String filter, Object[] objs, SearchControls searchControls)
+ throws NamingException {
return getDirContext().search(name, filter, objs, searchControls);
}
- public NamingEnumeration<SearchResult> search(String name, String filter,
- SearchControls searchControls) throws NamingException {
+ public NamingEnumeration<SearchResult> search(String name,
+ String filter, SearchControls searchControls)
+ throws NamingException {
return getDirContext().search(name, filter, searchControls);
}
}
+
}
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactory.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactory.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -23,33 +22,26 @@
import javax.naming.NamingException;
/**
- * An implementation of <code>InitialContextFactory</code> creates an initial
- * context so that the JNDI application can begin to invoke naming operations
- * on that context. The class implementing this interface should be public and
+ * An implementation of <code>InitialContextFactory</code> creates an initial
+ * context so that the JNDI application can begin to invoke naming operations on
+ * that context. The class implementing this interface should be public and
* should also provide a public constructor taking no arguments.
- *
*/
public interface InitialContextFactory {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Returns a non-null initial context object on which naming operations can be
- * invoked. The specified <code>envmt</code> parameter may be null or may be
- * used to customize the requested <code>Context</code> object. The
- * implementation may clone or copy the <code>envmt</code> object,
- * but will not modify the original object.
+ * Returns a non-null initial context object on which naming operations can
+ * be invoked. The specified <code>envmt</code> parameter may be null or
+ * may be used to customize the requested <code>Context</code> object. The
+ * implementation may clone or copy the <code>envmt</code> object, but
+ * will not modify the original object.
*
- * @param envmt the context environment as a <code>Hashtable</code>
+ * @param envmt
+ * the context environment as a <code>Hashtable</code>
* @return a non-null initial context object
- * @throws NamingException if a naming exception occurs
+ * @throws NamingException
+ * if a naming exception occurs
*/
Context getInitialContext(Hashtable<?, ?> envmt) throws NamingException;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactoryBuilder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactoryBuilder.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactoryBuilder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/InitialContextFactoryBuilder.java Fri Jun 22 13:48:49 2007
@@ -15,44 +15,36 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
import javax.naming.NamingException;
/**
- * An initial context factory builder creates an initial context factory, and
- * an initial context factory creates initial contexts. A variety of different
+ * An initial context factory builder creates an initial context factory, and an
+ * initial context factory creates initial contexts. A variety of different
* initial context implementations may be used by a JNDI application. The
- * application uses <code>NamingManager.setInitialContextFactoryBuilder()</code>
- * to specify its own or its preferred builder to override JNDI default policies.
- * Any such builder must implement the <code>InitialContextFactoryBuilder</code>
- * interface.
- *
+ * application uses <code>NamingManager.setInitialContextFactoryBuilder()</code>
+ * to specify its own or its preferred builder to override JNDI default
+ * policies. Any such builder must implement the
+ * <code>InitialContextFactoryBuilder</code> interface.
*/
public interface InitialContextFactoryBuilder {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Uses the environment properties in the specified <code>envmt</code>
- * parameter to create an initial context factory. If the implementation
- * needs to keep a copy of <code>envmt</code> or to change it, it will
- * clone or copy the specified object and use that instead.
- * The <code>envmt</code> parameter may be null.
+ * Uses the environment properties in the specified <code>envmt</code>
+ * parameter to create an initial context factory. If the implementation
+ * needs to keep a copy of <code>envmt</code> or to change it, it will
+ * clone or copy the specified object and use that instead. The
+ * <code>envmt</code> parameter may be null.
*
- * @param envmt the context environment as a <code>Hashtable</code>
+ * @param envmt
+ * the context environment as a <code>Hashtable</code>
* @return an initial context factory - cannot be null.
- * @throws NamingException if an initial context factory could not be created.
+ * @throws NamingException
+ * if an initial context factory could not be created.
*/
InitialContextFactory createInitialContextFactory(Hashtable<?, ?> envmt)
- throws NamingException;
+ throws NamingException;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/NamingManager.java Fri Jun 22 13:48:49 2007
@@ -94,7 +94,6 @@
*
* @see DirectoryManager
*/
-
public class NamingManager {
/**
@@ -106,7 +105,7 @@
static InitialContextFactoryBuilder icfb;
static ObjectFactoryBuilder ofb;
-
+
NamingManager() {
super();
// package private to prevent it being instanced but make it can be
@@ -129,7 +128,7 @@
* @throws NamingException
* for other errors encountered.
*/
- public static void setInitialContextFactoryBuilder(
+ public static void setInitialContextFactoryBuilder(
InitialContextFactoryBuilder icfb) throws IllegalStateException,
SecurityException, NamingException {
// check security access
@@ -180,7 +179,7 @@
if (null != NamingManager.ofb) {
// jndi.1F=ObjectFactoryBuilder cannot be reset
- throw new IllegalStateException(Messages.getString("jndi.1F")); //$NON-NLS-1$
+ throw new IllegalStateException(Messages.getString("jndi.1F")); //$NON-NLS-1$
}
// check security access
@@ -222,8 +221,8 @@
// create InitialContext using factory specified in hashtable
try {
// get factory class name
- String factoryClassName =
- (String) h.get(Context.INITIAL_CONTEXT_FACTORY);
+ String factoryClassName = (String) h
+ .get(Context.INITIAL_CONTEXT_FACTORY);
// new factory instance
Class<?> factoryClass = classForName(factoryClassName);
InitialContextFactory factory = (InitialContextFactory) factoryClass
@@ -235,9 +234,10 @@
throw e;
} catch (Exception e) {
// failed, throw NoInitialContextException
- // jndi.20=Failed to create InitialContext using factory specified in hashtable {0}
- NamingException nex = new NoInitialContextException(
- Messages.getString("jndi.20", h)); //$NON-NLS-1$
+ // jndi.20=Failed to create InitialContext using factory specified
+ // in hashtable {0}
+ NamingException nex = new NoInitialContextException(Messages
+ .getString("jndi.20", h)); //$NON-NLS-1$
nex.setRootCause(e);
throw nex;
}
@@ -418,8 +418,8 @@
}
private static Object getObjectInstanceByUrlContextFactory(String url,
- Name n, Context c, Hashtable<?, ?> h, String pkgPrefixes[], String schema)
- throws NamingException {
+ Name n, Context c, Hashtable<?, ?> h, String pkgPrefixes[],
+ String schema) throws NamingException {
// if schema is empty or null, fail, return null
if (null == schema || 0 == schema.length()) {
return null;
@@ -450,7 +450,8 @@
throw (NamingException) e;
}
// jndi.21=Failed to create object instance
- NamingException nex = new NamingException(Messages.getString("jndi.21")); //$NON-NLS-1$
+ NamingException nex = new NamingException(Messages
+ .getString("jndi.21")); //$NON-NLS-1$
nex.setRootCause(e);
throw nex;
}
@@ -557,9 +558,8 @@
* @throws NamingException
* if one is encountered
*/
- public static Object getStateToBind(Object o, Name n,
- Context c, Hashtable<?, ?> h)
- throws NamingException {
+ public static Object getStateToBind(Object o, Name n, Context c,
+ Hashtable<?, ?> h) throws NamingException {
// obtain state factories from hashtable and service provider resource
// file
@@ -667,8 +667,8 @@
} catch (Exception e) {
// other exception, throw as NamingException
// jndi.22=other exception happens: {0}
- NamingException nex = new NamingException(
- Messages.getString("jndi.22", e.toString())); //$NON-NLS-1$
+ NamingException nex = new NamingException(Messages.getString(
+ "jndi.22", e.toString())); //$NON-NLS-1$
nex.setRootCause(e);
throw nex;
}
@@ -715,7 +715,7 @@
* if the resolved object is null or if a context cannot be
* obtained from it either directly or indirectly.
*/
- @SuppressWarnings("unchecked") //$NON-NLS-1$
+ @SuppressWarnings("unchecked")
public static Context getContinuationContext(CannotProceedException cpe)
throws NamingException {
@@ -725,7 +725,8 @@
if (cpe.getEnvironment() == null) {
cpe.setEnvironment(new Hashtable<String, CannotProceedException>());
}
- ((Hashtable<String, CannotProceedException>) cpe.getEnvironment()).put(CPE, cpe);
+ ((Hashtable<String, CannotProceedException>) cpe.getEnvironment()).put(
+ CPE, cpe);
// if resolved object is null
if (null == cpe.getResolvedObj()) {
@@ -787,10 +788,11 @@
if (cls == null) {
// jndi.1C=class {0} not found
- throw new ClassNotFoundException(
- Messages.getString("jndi.1C", className)); //$NON-NLS-1$
+ throw new ClassNotFoundException(Messages.getString(
+ "jndi.1C", className)); //$NON-NLS-1$
}
return cls;
}
+
}
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactory.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactory.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -23,88 +22,85 @@
import javax.naming.Context;
/**
- * An <code>ObjectFactory</code> creates objects of a specified type. A variety
- * of different objects may be used by a JNDI application; these objects are
- * meaningful to the application and can be manipulated according to the
- * methods available to the class of the object, such as a printer object.
- * The class implementing this interface should be public, should also provide
- * a public constructor taking no arguments, and should be thread-safe. Where
- * URL is mentioned below, this refers to RFC 1738 and related RFCs.
- *
+ * An <code>ObjectFactory</code> creates objects of a specified type. A
+ * variety of different objects may be used by a JNDI application; these objects
+ * are meaningful to the application and can be manipulated according to the
+ * methods available to the class of the object, such as a printer object. The
+ * class implementing this interface should be public, should also provide a
+ * public constructor taking no arguments, and should be thread-safe. Where URL
+ * is mentioned below, this refers to RFC 1738 and related RFCs.
*/
public interface ObjectFactory {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Creates an object of the type specified by parameter <code>o</code>,
+ * Creates an object of the type specified by parameter <code>o</code>,
* including any reference or location details, customized by the specified
- * <code>envmt</code> parameter.
+ * <code>envmt</code> parameter.
* <p>
* Object factories are specified via environment properties from several
- * sources including provider properties files (see the specification of
- * the <code>Context</code> interface) and may comprise a list of factories.
- * Each object factory in the list is used by
- * <code>NamingManager.getObjectInstance()</code> which invokes this method
- * on each of them until a non-null result is achieved or until the list is
- * exhausted. If an <code>ObjectFactory</code> throws an exception, it
- * should be passed back to the code that invoked
- * <code>NamingManager.getObjectInstance()</code> and no further object
- * factories in the list are examined. An exception should only be thrown
- * by an object factory if it is intended that no other object factories
- * be examined. Usually, if an <code>ObjectFactory</code> is unable to
- * create an object, then null should be returned.</p>
- * <p>
- * A special case of <code>ObjectFactory</code> is a URL context factory
- * which is used either to create an object whose location is specified by
- * a URL passed as the object <code>o</code> or creates contexts for
+ * sources including provider properties files (see the specification of the
+ * <code>Context</code> interface) and may comprise a list of factories.
+ * Each object factory in the list is used by
+ * <code>NamingManager.getObjectInstance()</code> which invokes this
+ * method on each of them until a non-null result is achieved or until the
+ * list is exhausted. If an <code>ObjectFactory</code> throws an
+ * exception, it should be passed back to the code that invoked
+ * <code>NamingManager.getObjectInstance()</code> and no further object
+ * factories in the list are examined. An exception should only be thrown by
+ * an object factory if it is intended that no other object factories be
+ * examined. Usually, if an <code>ObjectFactory</code> is unable to create
+ * an object, then null should be returned.
+ * </p>
+ * <p>
+ * A special case of <code>ObjectFactory</code> is a URL context factory
+ * which is used either to create an object whose location is specified by a
+ * URL passed as the object <code>o</code> or creates contexts for
* resolving URLs. The <code>getObjectInstance()</code> method of a URL
- * context factory must obey these rules:</p>
- * <p>
- * 1. When <code>Object o</code> is null, return a new Context object
- * suitable for resolving any URL of the scheme supported by this factory.</p>
+ * context factory must obey these rules:
+ * </p>
* <p>
- * 2. When <code>Object o</code> is a URL string, return a new object
- * (usually a context) identified by the URL, so that names relatively
- * lower than that context may be resolved. </p>
- * <p>
- * 3. When <code>Object o</code> is an <code>Array</code> object with more
- * than one URL string (order is not important), return a new object
- * (usually a context) identified by the URL as in rule 2, above. The URLs
- * in the array are considered to be equivalent in relation to the
- * associated context, but the object (context) factory can choose whether
- * or not to verify that they are truly equivalent.</p>
- * <p>
- * 4. Otherwise, the behaviour of this method depends on the context
- * factory implementation.</p>
+ * 1. When <code>Object o</code> is null, return a new Context object
+ * suitable for resolving any URL of the scheme supported by this factory.
+ * </p>
+ * <p>
+ * 2. When <code>Object o</code> is a URL string, return a new object
+ * (usually a context) identified by the URL, so that names relatively lower
+ * than that context may be resolved.
+ * </p>
+ * <p>
+ * 3. When <code>Object o</code> is an <code>Array</code> object with
+ * more than one URL string (order is not important), return a new object
+ * (usually a context) identified by the URL as in rule 2, above. The URLs
+ * in the array are considered to be equivalent in relation to the
+ * associated context, but the object (context) factory can choose whether
+ * or not to verify that they are truly equivalent.
+ * </p>
+ * <p>
+ * 4. Otherwise, the behaviour of this method depends on the context factory
+ * implementation.
+ * </p>
*
- * @param o may be null or may contain location or reference details
- * @param n the name relative to the context <code>c</code> of the
- * object being created and may be null; the implementation
- * may clone or copy this object, but will not modify the
- * original.
- * @param c may be null when the name is relative to the default
- * initial context, or specifies the context to which the
- * name is relative (if a factory uses this context object,
- * synchronization should be used as Context objects are not
- * thread-safe).
- * @param envmt may be null; the implementation may clone or copy this
- * object, but will not modify the original.
- * @return either an object of the specified type or null if no
- * object could be created.
- * @throws Exception causes no further object factory will be tried
+ * @param o
+ * may be null or may contain location or reference details
+ * @param n
+ * the name relative to the context <code>c</code> of the
+ * object being created and may be null; the implementation may
+ * clone or copy this object, but will not modify the original.
+ * @param c
+ * may be null when the name is relative to the default initial
+ * context, or specifies the context to which the name is
+ * relative (if a factory uses this context object,
+ * synchronization should be used as Context objects are not
+ * thread-safe).
+ * @param envmt
+ * may be null; the implementation may clone or copy this object,
+ * but will not modify the original.
+ * @return either an object of the specified type or null if no object could
+ * be created.
+ * @throws Exception
+ * causes no further object factory will be tried
*/
- Object getObjectInstance(
- Object o,
- Name n,
- Context c,
- Hashtable<?, ?> envmt)
- throws Exception;
+ Object getObjectInstance(Object o, Name n, Context c, Hashtable<?, ?> envmt)
+ throws Exception;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactoryBuilder.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactoryBuilder.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactoryBuilder.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ObjectFactoryBuilder.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -25,36 +24,30 @@
* An object factory builder creates an object factory, and an object factory
* creates objects of a specified type. A variety of different objects may be
* used by a JNDI application; these objects are meaningful to the application
- * and can be manipulated according to the methods available to the class of
- * the object, such as a printer object. The application uses
- * <code>NamingManager.setObjectFactoryBuilder()</code> to specify its own or
- * its preferred builder to override JNDI default policies; any such builder
+ * and can be manipulated according to the methods available to the class of the
+ * object, such as a printer object. The application uses
+ * <code>NamingManager.setObjectFactoryBuilder()</code> to specify its own or
+ * its preferred builder to override JNDI default policies; any such builder
* must implement the <code>ObjectFactoryBuilder</code> interface.
- *
*/
public interface ObjectFactoryBuilder {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Returns an <code>ObjectFactory</code> customized by the
- * <code>envmt</code> parameter that is capable of creating instances
- * of the object <code>o</code>.
+ * Returns an <code>ObjectFactory</code> customized by the
+ * <code>envmt</code> parameter that is capable of creating instances of
+ * the object <code>o</code>.
*
- * @param o may be null
- * @param envmt may be null
- * @return an <code>ObjectFactory</code> customized by the
- * <code>envmt</code> parameter that is capable of creating
- * instances of the object <code>o</code>.
- * @throws NamingException if an object factory could not be created.
+ * @param o
+ * may be null
+ * @param envmt
+ * may be null
+ * @return an <code>ObjectFactory</code> customized by the
+ * <code>envmt</code> parameter that is capable of creating
+ * instances of the object <code>o</code>.
+ * @throws NamingException
+ * if an object factory could not be created.
*/
ObjectFactory createObjectFactory(Object o, Hashtable<?, ?> envmt)
- throws NamingException;
+ throws NamingException;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ResolveResult.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ResolveResult.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ResolveResult.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/ResolveResult.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import javax.naming.Name;
@@ -23,40 +22,24 @@
import javax.naming.CompositeName;
/**
- * An instance of <code>ResolveResult</code> is produced when a name
+ * An instance of <code>ResolveResult</code> is produced when a name
* resolution operation has completed. The instance must contain the object
- * associated with the successfully resolved name, and any remaining portion
- * of the name yet to be resolved. Where a <code>String</code> parameter is
- * used to specify a name, it should be considered to be a composite name.
+ * associated with the successfully resolved name, and any remaining portion of
+ * the name yet to be resolved. Where a <code>String</code> parameter is used
+ * to specify a name, it should be considered to be a composite name.
* <p>
- * Multithreaded access to a single <code>ResolveResult</code> instance is
- * only safe when client code locks the object first.</p>
- *
+ * Multithreaded access to a single <code>ResolveResult</code> instance is
+ * only safe when client code locks the object first.
+ * </p>
*/
public class ResolveResult implements java.io.Serializable {
- /*
- * -------------------------------------------------------------------
- * Constants
- * -------------------------------------------------------------------
- */
-
- /*
- * This field must have value -4552108072002407559L and should be commented
- * with text "J2SE 1.4.2".
- */
static final long serialVersionUID = -4552108072002407559L;
- /*
- * -------------------------------------------------------------------
- * Instance variables
- * -------------------------------------------------------------------
- */
-
/**
- * This field holds the object associated with the resolved name.
- * It may be null only when a subclass is constructed. It must be
- * initialized to a non-null value by constructors of this class.
+ * This field holds the object associated with the resolved name. It may be
+ * null only when a subclass is constructed. It must be initialized to a
+ * non-null value by constructors of this class.
*
* @serial
*/
@@ -64,24 +47,17 @@
/**
* This field holds the portion of a resolved name that remains to be
- * resolved. It may be null only when a subclass is constructed. It must
- * be initialized to a non-null value by constructors of this class.
+ * resolved. It may be null only when a subclass is constructed. It must be
+ * initialized to a non-null value by constructors of this class.
*
- * @serial
+ * @serial
*/
protected Name remainingName;
-
- /*
- * -------------------------------------------------------------------
- * Constructors
- * -------------------------------------------------------------------
- */
-
/**
* This is the default constructor implicitly invoked by subclass
- * constructors. This constructor set both the resolved object and
- * the remaining name to null.
+ * constructors. This constructor set both the resolved object and the
+ * remaining name to null.
*/
protected ResolveResult() {
this.resolvedObj = null;
@@ -89,13 +65,15 @@
}
/**
- * This constructor creates a instance with the specified resolved
- * object and a specified remaining name of type <code>String</code>. The
- * name argument may not be null, but may be empty. The object argument
- * may not be null.
- *
- * @param o may not be null
- * @param s may not be null, but may be empty
+ * This constructor creates a instance with the specified resolved object
+ * and a specified remaining name of type <code>String</code>. The name
+ * argument may not be null, but may be empty. The object argument may not
+ * be null.
+ *
+ * @param o
+ * may not be null
+ * @param s
+ * may not be null, but may be empty
*/
public ResolveResult(Object o, String s) {
this.resolvedObj = o;
@@ -107,13 +85,14 @@
}
/**
- * This constructor creates a instance with the specified resolved
- * object and a remaining name of type <code>Name</code>. The name
- * argument may not be null, but may be empty. The object argument
- * may not be null.
+ * This constructor creates a instance with the specified resolved object
+ * and a remaining name of type <code>Name</code>. The name argument may
+ * not be null, but may be empty. The object argument may not be null.
*
- * @param o may not be null
- * @param n may not be null
+ * @param o
+ * may not be null
+ * @param n
+ * may not be null
*/
public ResolveResult(Object o, Name n) {
this.resolvedObj = o;
@@ -124,19 +103,14 @@
}
}
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Extends the remaining name (remainingName) with a single
- * specified name component. The name argument may be null, but this
- * leaves the remaining name unmodified.
+ * Extends the remaining name (remainingName) with a single specified name
+ * component. The name argument may be null, but this leaves the remaining
+ * name unmodified.
*
- * @param s the name component to be added to the remaining name.
- * A null leaves the remaining name unmodified.
+ * @param s
+ * the name component to be added to the remaining name. A null
+ * leaves the remaining name unmodified.
*/
public void appendRemainingComponent(String s) {
if (null != s) {
@@ -152,12 +126,13 @@
}
/**
- * Extends the remaining name (remainingName) with all components of
- * the specified name. The name argument may be null, but this leaves the
+ * Extends the remaining name (remainingName) with all components of the
+ * specified name. The name argument may be null, but this leaves the
* remaining name unmodified.
- *
- * @param n the name to be added to the remaining name
- * A null leaves the remaining name unmodified.
+ *
+ * @param n
+ * the name to be added to the remaining name A null leaves the
+ * remaining name unmodified.
*/
public void appendRemainingName(Name n) {
if (null != n) {
@@ -174,12 +149,12 @@
}
/**
- * Returns any unresolved portion of the name that was resolved
- * (the remaining name). The returned <code>Name</code> may be empty,
- * but may not be null.
+ * Returns any unresolved portion of the name that was resolved (the
+ * remaining name). The returned <code>Name</code> may be empty, but may
+ * not be null.
*
- * @return any unresolved portion of the name that was resolved
- * (the remaining name).
+ * @return any unresolved portion of the name that was resolved (the
+ * remaining name).
*/
public Name getRemainingName() {
return this.remainingName;
@@ -187,7 +162,7 @@
/**
* Returns the non-null object that was resolved (resolved object).
- *
+ *
* @return the non-null object that was resolved (resolved object).
*/
public Object getResolvedObj() {
@@ -197,8 +172,9 @@
/**
* Sets the remaining name (remainingName) to a copy of the specified
* <code>Name</code> parameter may be empty, but not null.
- *
- * @param n a name, may be empty, but no null
+ *
+ * @param n
+ * a name, may be empty, but no null
*/
public void setRemainingName(Name n) {
if (null == n) {
@@ -207,15 +183,15 @@
this.remainingName = (Name) n.clone();
}
}
-
+
/**
* Sets the resolved object (resolved object) to o which may not be null.
- *
- * @param o an object, may not be null
+ *
+ * @param o
+ * an object, may not be null
*/
public void setResolvedObj(Object o) {
this.resolvedObj = o;
}
-}
-
+}
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/Resolver.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/Resolver.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/Resolver.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/Resolver.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import javax.naming.Name;
@@ -23,57 +22,52 @@
/**
* The <code>Resolver</code> interface describes an intermediate context which
- * may be used in name resolution. In some context implementations, it is
- * possible that subtypes of <code>Context</code> may not be supported; in such
- * cases, a class implementing the <code>Resolver</code> interface becomes
- * useful to obtain a context which is of a specified subtype of
+ * may be used in name resolution. In some context implementations, it is
+ * possible that subtypes of <code>Context</code> may not be supported; in
+ * such cases, a class implementing the <code>Resolver</code> interface
+ * becomes useful to obtain a context which is of a specified subtype of
* <code>Context</code>.
- *
*/
public interface Resolver {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Partially resolves the name specified by name <code>n</code> stopping
- * at the first context object which is of the <code>Context</code> subtype
- * specified by class <code>c</code>.
+ * Partially resolves the name specified by name <code>n</code> stopping
+ * at the first context object which is of the <code>Context</code>
+ * subtype specified by class <code>c</code>.
*
- * @param n a name
- * @param c a context
- * @return details of the resolved context object and the part of the name
- * remaining to be resolved in a non-null <code>ResolveResult</code>
- * object.
- * @throws javax.naming.NotContextException if no context of the specified subtype is
- * found.
- * @throws NamingException if other naming errors occur
+ * @param n
+ * a name
+ * @param c
+ * a context
+ * @return details of the resolved context object and the part of the name
+ * remaining to be resolved in a non-null <code>ResolveResult</code>
+ * object.
+ * @throws javax.naming.NotContextException
+ * if no context of the specified subtype is found.
+ * @throws NamingException
+ * if other naming errors occur
*/
- ResolveResult resolveToClass(Name n,
- Class<? extends javax.naming.Context> c)
- throws NamingException;
+ ResolveResult resolveToClass(Name n, Class<? extends javax.naming.Context> c)
+ throws NamingException;
/**
- * Partially resolves the name specified by name <code>n</code> stopping
- * at the first context object which is of the <code>Context</code> subtype
- * specified by class <code>c</code>.
+ * Partially resolves the name specified by name <code>n</code> stopping
+ * at the first context object which is of the <code>Context</code>
+ * subtype specified by class <code>c</code>.
*
- * @param n a name in string
- * @param c a context
- * @return details of the resolved context object and the part of the name
- * remaining to be resolved in a non-null <code>ResolveResult</code>
- * object.
- * @throws javax.naming.NotContextException if no context of the specified subtype is
- * found.
- * @throws NamingException if other naming errors occur
+ * @param n
+ * a name in string
+ * @param c
+ * a context
+ * @return details of the resolved context object and the part of the name
+ * remaining to be resolved in a non-null <code>ResolveResult</code>
+ * object.
+ * @throws javax.naming.NotContextException
+ * if no context of the specified subtype is found.
+ * @throws NamingException
+ * if other naming errors occur
*/
ResolveResult resolveToClass(String n,
- Class<? extends javax.naming.Context> c)
- throws NamingException;
+ Class<? extends javax.naming.Context> c) throws NamingException;
}
-
-
Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/StateFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/StateFactory.java?view=diff&rev=549955&r1=549954&r2=549955
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/StateFactory.java (original)
+++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/spi/StateFactory.java Fri Jun 22 13:48:49 2007
@@ -15,7 +15,6 @@
* limitations under the License.
*/
-
package javax.naming.spi;
import java.util.Hashtable;
@@ -24,77 +23,71 @@
import javax.naming.NamingException;
/**
- * The <code>StateFactory</code> interface describes a factory used to get
- * the state of an object to be bound. Using a <code>lookup()</code> on a
- * suitable context, an class may be found representing, say, a printer;
- * an <code>ObjectFactory</code> may be used to create an instance of the
- * printer object class and methods defined by the printer class may be used
- * to inspect and manipulate the printer. There is a reverse mechanism in
- * which a <code>StateFactory</code> is used by the service provider
- * to obtain the state of the (in this case) printer for storing in the
- * naming system. In addition to implementing this interface, a
- * <code>StateFactory</code> class must be public and have a public
- * constructor taking no parameters.
+ * The <code>StateFactory</code> interface describes a factory used to get the
+ * state of an object to be bound. Using a <code>lookup()</code> on a suitable
+ * context, an class may be found representing, say, a printer; an
+ * <code>ObjectFactory</code> may be used to create an instance of the printer
+ * object class and methods defined by the printer class may be used to inspect
+ * and manipulate the printer. There is a reverse mechanism in which a
+ * <code>StateFactory</code> is used by the service provider to obtain the
+ * state of the (in this case) printer for storing in the naming system. In
+ * addition to implementing this interface, a <code>StateFactory</code> class
+ * must be public and have a public constructor taking no parameters.
* <p>
- * Note that while <code>StateFactory</code> is meant to be used in
- * <code>Context</code> service providers, whereas <code>DirStateFactory</code>
- * is meant to be used in <code>DirContext</code> service providers.</p>
- *
+ * Note that while <code>StateFactory</code> is meant to be used in
+ * <code>Context</code> service providers, whereas
+ * <code>DirStateFactory</code> is meant to be used in <code>DirContext</code>
+ * service providers.
+ * </p>
*/
public interface StateFactory {
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
/**
- * Returns a new instance of the specified object <code>o</code>
- * containing the state of the object to be bound, customized by the
- * specified <code>envmt</code> parameter. The name and context
- * parameters optionally specify the name of the object being created.
+ * Returns a new instance of the specified object <code>o</code>
+ * containing the state of the object to be bound, customized by the
+ * specified <code>envmt</code> parameter. The name and context parameters
+ * optionally specify the name of the object being created.
*
- * Object and state factories are specified via environment properties
- * from several sources including provider properties files (see the
- * specification of the <code>Context</code> interface) and may comprise
- * a list of factories. When the service provider looks to obtain the list
- * of state factories, the environment and provider properties files are
- * search for the property name specified by constant
+ * Object and state factories are specified via environment properties from
+ * several sources including provider properties files (see the
+ * specification of the <code>Context</code> interface) and may comprise a
+ * list of factories. When the service provider looks to obtain the list of
+ * state factories, the environment and provider properties files are search
+ * for the property name specified by constant
* <code>Context.STATE_FACTORIES</code>. Each state factory in the
- * resulting list is used by <code>NamingManager.getStateToBind()</code>
- * which invokes this method on each of them until a non-null result is
+ * resulting list is used by <code>NamingManager.getStateToBind()</code>
+ * which invokes this method on each of them until a non-null result is
* achieved or until the list is exhausted. If a <code>StateFactory</code>
- * throws an exception, it should be passed back to the code that
- * invoked <code>NamingManager.getStateToBind()</code> and no further
- * state factories in the list are examined. An exception should only be
- * thrown by a state factory if it is intended that no other state
- * factories be examined. Usually, if an state factory is unable to
- * return the state of an object, then null should be returned.
+ * throws an exception, it should be passed back to the code that invoked
+ * <code>NamingManager.getStateToBind()</code> and no further state
+ * factories in the list are examined. An exception should only be thrown by
+ * a state factory if it is intended that no other state factories be
+ * examined. Usually, if an state factory is unable to return the state of
+ * an object, then null should be returned.
*
- * @param o may be null, or specifies the returning instance
- * @param n may be null, or specifies the name relative to the
- * specified context <code>c</code>. The implementation
- * may clone or copy this object, but will not modify the
- * original.
- * @param c the context to which the name parameter is relative, or
- * may be null when using a name relative the the default
- * initial context. If a factory uses this context object,
- * synchronization should be used as context objects are
- * not thread-safe.
- * @param envmt may be null; the implementation may clone or copy this
- * object, but will not modify the original.
- * @return either a new instance of the specified object
- * <code>o</code> containing the state of the object to be
- * bound, customized by the specified
- * <code>envmt</code> parameter. Or null if no object could
- * be created.
- * @throws NamingException if it is intended that no other state
- * factories be examined.
+ * @param o
+ * may be null, or specifies the returning instance
+ * @param n
+ * may be null, or specifies the name relative to the specified
+ * context <code>c</code>. The implementation may clone or
+ * copy this object, but will not modify the original.
+ * @param c
+ * the context to which the name parameter is relative, or may be
+ * null when using a name relative the the default initial
+ * context. If a factory uses this context object,
+ * synchronization should be used as context objects are not
+ * thread-safe.
+ * @param envmt
+ * may be null; the implementation may clone or copy this object,
+ * but will not modify the original.
+ * @return either a new instance of the specified object <code>o</code>
+ * containing the state of the object to be bound, customized by the
+ * specified <code>envmt</code> parameter. Or null if no object
+ * could be created.
+ * @throws NamingException
+ * if it is intended that no other state factories be examined.
*/
Object getStateToBind(Object o, Name n, Context c, Hashtable<?, ?> envmt)
- throws NamingException;
+ throws NamingException;
}
-
-