Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 67815 invoked from network); 22 Jun 2007 20:50:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Jun 2007 20:50:26 -0000 Received: (qmail 57873 invoked by uid 500); 22 Jun 2007 20:50:16 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 57854 invoked by uid 500); 22 Jun 2007 20:50:16 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 57835 invoked by uid 99); 22 Jun 2007 20:50:16 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2007 13:50:16 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Jun 2007 13:50:10 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 54CC71A9877; Fri, 22 Jun 2007 13:49:03 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r549955 [16/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... Date: Fri, 22 Jun 2007 20:48:56 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070622204903.54CC71A9877@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContext.java Fri Jun 22 13:48:49 2007 @@ -20,6 +20,7 @@ * @author Vasily Zakharov * @version $Revision: 1.1.2.4 $ */ + package org.apache.harmony.jndi.provider.rmi.registry; import java.rmi.AccessException; @@ -67,12 +68,8 @@ import org.apache.harmony.jndi.internal.nls.Messages; - /** * RMI Registry context implementation. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.4 $ */ public class RegistryContext implements Context, Referenceable { @@ -80,15 +77,13 @@ * System property used to state whether the RMI security manager should be * installed. */ - public static final String SECURITY_MANAGER = - "java.naming.rmi.security.manager"; //$NON-NLS-1$ + public static final String SECURITY_MANAGER = "java.naming.rmi.security.manager"; //$NON-NLS-1$ /** * System property used to supply the name of the * {@link RMIClientSocketFactory} to use. */ - public static final String CLIENT_SOCKET_FACTORY = - "org.apache.harmony.jndi.provider.rmi.registry.clientSocketFactory"; //$NON-NLS-1$ + public static final String CLIENT_SOCKET_FACTORY = "org.apache.harmony.jndi.provider.rmi.registry.clientSocketFactory"; //$NON-NLS-1$ /** * Prefix for RMI URLs. @@ -137,62 +132,63 @@ protected Reference reference; /** - * Creates RMI registry context bound to RMI Registry - * operating on the specified host and port. - * - * @param host - * Host. If null, localhost is assumed. - * - * @param port - * Port. If 0, default registry port - * (1099) is assumed. - * - * @param environment - * Context environment, may be null - * which denotes empty environment. - * - * @throws NamingException - * If some naming error occurs. + * Creates RMI registry context bound to RMI Registry operating on the + * specified host and port. + * + * @param host + * Host. If null, localhost is assumed. + * + * @param port + * Port. If 0, default registry port (1099) + * is assumed. + * + * @param environment + * Context environment, may be null which denotes + * empty environment. + * + * @throws NamingException + * If some naming error occurs. */ - @SuppressWarnings("unchecked") //$NON-NLS-1$ + @SuppressWarnings("unchecked") public RegistryContext(String host, int port, Hashtable environment) throws NamingException { this.host = host; this.port = port; - this.environment = ((environment != null) - ? (Hashtable) environment.clone() + this.environment = ((environment != null) ? (Hashtable) environment + .clone() : new Hashtable()); if (this.environment.get(SECURITY_MANAGER) != null) { installSecurityManager(); } - String clientSocketFactoryName = (String) - this.environment.get(CLIENT_SOCKET_FACTORY); + String clientSocketFactoryName = (String) this.environment + .get(CLIENT_SOCKET_FACTORY); if (clientSocketFactoryName == null) { csf = null; } else { try { csf = (RMIClientSocketFactory) Class.forName( - clientSocketFactoryName, true, Thread.currentThread() - .getContextClassLoader()).newInstance(); + clientSocketFactoryName, true, + Thread.currentThread().getContextClassLoader()) + .newInstance(); } catch (ClassNotFoundException e) { // jndi.79=RMI Client Socket Factory cannot be instantiated throw (ConfigurationException) new ConfigurationException( Messages.getString("jndi.79")) //$NON-NLS-1$ - .initCause(e); + .initCause(e); } catch (InstantiationException e) { // jndi.79=RMI Client Socket Factory cannot be instantiated throw (ConfigurationException) new ConfigurationException( Messages.getString("jndi.79")) //$NON-NLS-1$ - .initCause(e); + .initCause(e); } catch (IllegalAccessException e) { // jndi.79=RMI Client Socket Factory cannot be instantiated throw (NoPermissionException) new NoPermissionException( Messages.getString("jndi.79")) //$NON-NLS-1$ - .initCause(e); + .initCause(e); } } registry = getRegistry(host, port, csf); @@ -201,11 +197,11 @@ /** * Creates RMI registry context by copying the specified context. - * - * @param context - * Context to copy. + * + * @param context + * Context to copy. */ - @SuppressWarnings("unchecked") //$NON-NLS-1$ + @SuppressWarnings("unchecked") protected RegistryContext(RegistryContext context) { host = context.host; port = context.port; @@ -228,8 +224,8 @@ return getObjectInstance(stringName, registry.lookup(stringName)); } catch (NotBoundException e) { // jndi.7A=Name is not bound: {0} - throw (NameNotFoundException) new NameNotFoundException( - Messages.getString("jndi.7A", stringName)).initCause(e); //$NON-NLS-1$ + throw (NameNotFoundException) new NameNotFoundException(Messages + .getString("jndi.7A", stringName)).initCause(e); //$NON-NLS-1$ } catch (RemoteException e) { throw (NamingException) newNamingException(e).fillInStackTrace(); } @@ -339,7 +335,8 @@ */ public Context createSubcontext(Name name) throws OperationNotSupportedException { - // jndi.7F=RMI Registry is a flat context and doesn't support subcontexts + // jndi.7F=RMI Registry is a flat context and doesn't support + // subcontexts throw new OperationNotSupportedException(Messages.getString("jndi.7F")); //$NON-NLS-1$ } @@ -355,7 +352,8 @@ */ public void destroySubcontext(Name name) throws OperationNotSupportedException { - // jndi.7F=RMI Registry is a flat context and doesn't support subcontexts + // jndi.7F=RMI Registry is a flat context and doesn't support + // subcontexts throw new OperationNotSupportedException(Messages.getString("jndi.7F")); //$NON-NLS-1$ } @@ -384,13 +382,14 @@ /** * {@inheritDoc} */ - public NamingEnumeration list(Name name) throws NamingException { + public NamingEnumeration list(Name name) + throws NamingException { if (name.isEmpty()) { try { return new NameClassPairEnumeration(registry.list()); } catch (RemoteException e) { - throw (NamingException) - newNamingException(e).fillInStackTrace(); + throw (NamingException) newNamingException(e) + .fillInStackTrace(); } } Object obj = lookup(name); @@ -403,27 +402,28 @@ } } // jndi.80=Name specifies an object that is not a context: {0} - throw new NotContextException( - Messages.getString("jndi.80", name)); //$NON-NLS-1$ + throw new NotContextException(Messages.getString("jndi.80", name)); //$NON-NLS-1$ } /** * {@inheritDoc} */ - public NamingEnumeration list(String name) throws NamingException { + public NamingEnumeration list(String name) + throws NamingException { return list(new CompositeName(name)); } /** * {@inheritDoc} */ - public NamingEnumeration listBindings(Name name) throws NamingException { + public NamingEnumeration listBindings(Name name) + throws NamingException { if (name.isEmpty()) { try { return new BindingEnumeration(registry.list(), this); } catch (RemoteException e) { - throw (NamingException) - newNamingException(e).fillInStackTrace(); + throw (NamingException) newNamingException(e) + .fillInStackTrace(); } } Object obj = lookup(name); @@ -436,14 +436,14 @@ } } // jndi.80=Name specifies an object that is not a context: {0} - throw new NotContextException( - Messages.getString("jndi.80", name)); //$NON-NLS-1$ + throw new NotContextException(Messages.getString("jndi.80", name)); //$NON-NLS-1$ } /** * {@inheritDoc} */ - public NamingEnumeration listBindings(String name) throws NamingException { + public NamingEnumeration listBindings(String name) + throws NamingException { return listBindings(new CompositeName(name)); } @@ -473,8 +473,8 @@ */ public String composeName(String name, String prefix) throws NamingException { - return composeName( - new CompositeName(name), new CompositeName(prefix)).toString(); + return composeName(new CompositeName(name), new CompositeName(prefix)) + .toString(); } /** @@ -523,12 +523,11 @@ public Reference getReference() throws NamingException { if (reference == null) { if ((host == null) || (host.equals("localhost"))) { //$NON-NLS-1$ - // jndi.81=Cannot create reference for RMI registry that is being accessed using localhost - throw new ConfigurationException( - Messages.getString("jndi.81")); //$NON-NLS-1$ + // jndi.81=Cannot create reference for RMI registry that is + // being accessed using localhost + throw new ConfigurationException(Messages.getString("jndi.81")); //$NON-NLS-1$ } - reference = new Reference( - RegistryContext.class.getName(), + reference = new Reference(RegistryContext.class.getName(), new StringRefAddr(ADDRESS_TYPE, RMI_URL_PREFIX + "//" //$NON-NLS-1$ + host + ((port > 0) ? (":" + port) : "")), //$NON-NLS-1$ //$NON-NLS-2$ RegistryContextFactory.class.getName(), null); @@ -539,9 +538,9 @@ /** * Initializes reference for this context instance. Called by * {@link RegistryContextFactory#getObjectInstance(Object, Name, Context, Hashtable)}. - * - * @param reference - * Reference for this context instance. + * + * @param reference + * Reference for this context instance. */ protected void setReference(Reference reference) { this.reference = reference; @@ -549,26 +548,26 @@ /** * Returns a clone of this context. - * - * @return Clone of this context. + * + * @return Clone of this context. */ protected RegistryContext cloneContext() { return new RegistryContext(this); } /** - * Verifies that the specified name is valid for this context - * and returns string representation of that name for this provider. - * - * Returns returns first component of a {@link CompositeName} - * or a string representation of a name otherwise. - * - * @param name - * Name to verify. - * - * @return {@link CompositeName#get(int) CompositeName#get(0)} - * if name is a {@link CompositeName}, - * {@link Object#toString() name.toString()} otherwise. + * Verifies that the specified name is valid for this context and returns + * string representation of that name for this provider. + * + * Returns returns first component of a {@link CompositeName} or a string + * representation of a name otherwise. + * + * @param name + * Name to verify. + * + * @return {@link CompositeName#get(int) CompositeName#get(0)} if + * name is a {@link CompositeName}, + * {@link Object#toString() name.toString()} otherwise. */ protected String getMyComponents(Name name) { if (name instanceof CompositeName) { @@ -582,25 +581,25 @@ * {@link NamingManager#getStateToBind(Object, Name, Context, Hashtable)} * and makes the resulting object {@link Remote} by wrapping it into * {@link RemoteReferenceWrapper}. - * - * @param name - * Object name. - * - * @param obj - * Object to prepare for binding. - * - * @return Object ready for binding. - * - * @throws NamingException - * If some naming error occurs. - * - * @throws RemoteException - * If remote exception occurs. + * + * @param name + * Object name. + * + * @param obj + * Object to prepare for binding. + * + * @return Object ready for binding. + * + * @throws NamingException + * If some naming error occurs. + * + * @throws RemoteException + * If remote exception occurs. */ protected Remote getStateToBind(String name, Object obj) throws NamingException, RemoteException { - obj = NamingManager.getStateToBind( - obj, new CompositeName().add(name), this, environment); + obj = NamingManager.getStateToBind(obj, new CompositeName().add(name), + this, environment); if (obj instanceof Remote) { return (Remote) obj; @@ -611,51 +610,51 @@ } if (obj instanceof Referenceable) { - return new RemoteReferenceWrapper( - ((Referenceable) obj).getReference()); + return new RemoteReferenceWrapper(((Referenceable) obj) + .getReference()); } - // jndi.82=Cannot bind to RMI Registry object that is neither Remote nor Reference nor Referenceable + // jndi.82=Cannot bind to RMI Registry object that is neither Remote nor + // Reference nor Referenceable throw new IllegalArgumentException(Messages.getString("jndi.82")); //$NON-NLS-1$ } /** - * Processes object returned from {@linkplain Registry RMI registry}. - * It unwraps {@link RemoteReference} if necessary and calls + * Processes object returned from {@linkplain Registry RMI registry}. It + * unwraps {@link RemoteReference} if necessary and calls * {@link NamingManager#getObjectInstance(Object, Name, Context, Hashtable)}. - * - * @param name - * Object name. - * - * @param remote - * Returned object. - * - * @return Processed object. - * - * @throws NamingException - * If some naming error occurs. - * - * @throws RemoteException - * If remote exception occurs. + * + * @param name + * Object name. + * + * @param remote + * Returned object. + * + * @return Processed object. + * + * @throws NamingException + * If some naming error occurs. + * + * @throws RemoteException + * If remote exception occurs. */ protected Object getObjectInstance(String name, Remote remote) throws NamingException, RemoteException { Object obj; - obj = ((remote instanceof RemoteReference) - ? ((RemoteReference) remote).getReference() - : (Object) remote); + obj = ((remote instanceof RemoteReference) ? ((RemoteReference) remote) + .getReference() : (Object) remote); try { - return NamingManager.getObjectInstance( - obj, new CompositeName().add(name), this, environment); + return NamingManager.getObjectInstance(obj, new CompositeName() + .add(name), this, environment); } catch (NamingException e) { throw e; } catch (RemoteException e) { throw e; } catch (Exception e) { // jndi.83=NamingManager.getObjectInstance() failed - throw (NamingException) new NamingException( - Messages.getString("jndi.83")).initCause(e); //$NON-NLS-1$ + throw (NamingException) new NamingException(Messages + .getString("jndi.83")).initCause(e); //$NON-NLS-1$ } } @@ -663,53 +662,48 @@ * Prepares a new {@link NamingException} wrapping the specified * {@link RemoteException} source exception. Source exception becomes a * {@linkplain NamingException#getCause() cause} of the generated exception. - * - * The particular subclass of {@link NamingException} returned depends - * on the particular subclass of source {@link RemoteException}. - * - * If source exception is not of a specific class or is not - * a {@link RemoteException} or is null, - * then plain {@link NamingException} is returned. - * + * + * The particular subclass of {@link NamingException} returned depends on + * the particular subclass of source {@link RemoteException}. + * + * If source exception is not of a specific class or is not a + * {@link RemoteException} or is null, then plain + * {@link NamingException} is returned. + * * Note: {@link Throwable#fillInStackTrace()} should be called before - * throwing the generated exception, to provide the proper - * (not including this method) stack trace for the exception. - * + * throwing the generated exception, to provide the proper (not including + * this method) stack trace for the exception. + * * Example of use: - * + * * try { * ... * } catch (RemoteException e) { * throw (NamingException) newNamingException(e).fillInStackTrace(); * } - * - * @param e - * Source {@link RemoteException}. - * - * @return Generated {@link NamingException} exception. + * + * @param e + * Source {@link RemoteException}. + * + * @return Generated {@link NamingException} exception. */ - @SuppressWarnings("deprecation") //$NON-NLS-1$ + @SuppressWarnings("deprecation") protected NamingException newNamingException(Throwable e) { - NamingException ret = - (e instanceof AccessException) - ? new NoPermissionException() - : (e instanceof ConnectException) - ? new ServiceUnavailableException() - : (e instanceof ConnectIOException) - || (e instanceof ExportException) - || (e instanceof MarshalException) - || (e instanceof UnmarshalException) - ? new CommunicationException() - : (e instanceof ActivateFailedException) - || (e instanceof NoSuchObjectException) - || (e instanceof java.rmi.server.SkeletonMismatchException) - || (e instanceof java.rmi.server.SkeletonNotFoundException) - || (e instanceof StubNotFoundException) - || (e instanceof UnknownHostException) - ? new ConfigurationException() - : (e instanceof ServerException) - ? newNamingException(e.getCause()) - : new NamingException(); + NamingException ret = (e instanceof AccessException) ? new NoPermissionException() + : (e instanceof ConnectException) ? new ServiceUnavailableException() + : (e instanceof ConnectIOException) + || (e instanceof ExportException) + || (e instanceof MarshalException) + || (e instanceof UnmarshalException) ? new CommunicationException() + : (e instanceof ActivateFailedException) + || (e instanceof NoSuchObjectException) + || (e instanceof java.rmi.server.SkeletonMismatchException) + || (e instanceof java.rmi.server.SkeletonNotFoundException) + || (e instanceof StubNotFoundException) + || (e instanceof UnknownHostException) ? new ConfigurationException() + : (e instanceof ServerException) ? newNamingException(e + .getCause()) + : new NamingException(); if (ret.getCause() == null) { ret.initCause(e); @@ -719,13 +713,13 @@ /** * Installs {@link RMISecurityManager} if it is not already installed. - * - * @throws NoPermissionException - * If security manager other than {@link RMISecurityManager} - * is installed and prohibits installing a new security manager. + * + * @throws NoPermissionException + * If security manager other than {@link RMISecurityManager} is + * installed and prohibits installing a new security manager. */ protected void installSecurityManager() throws NoPermissionException { - if (! (System.getSecurityManager() instanceof RMISecurityManager)) { + if (!(System.getSecurityManager() instanceof RMISecurityManager)) { try { System.setSecurityManager(new RMISecurityManager()); } catch (SecurityException e) { @@ -737,42 +731,41 @@ } /** - * Creates reference to the {@linkplain Registry RMI registry} - * located on the specified host and port. - * - * @param host - * Host. If null, localhost is assumed. - * May not be null - * if csf is not null. - * - * @param port - * Port. If 0, default registry port - * (1099) is assumed. - * May not be 0 - * if csf is not null. - * - * @param csf - * RMIClientSocketFactory that is used to create socket connections to the - * registry. If null, default socket factory is used. - * See - * {@link LocateRegistry#getRegistry(String, int, RMIClientSocketFactory)}. - * - * @return Registry reference. - * - * @throws NamingException - * If getting registry failed. + * Creates reference to the {@linkplain Registry RMI registry} located on + * the specified host and port. + * + * @param host + * Host. If null, localhost is assumed. May not + * be null if csf is not + * null. + * + * @param port + * Port. If 0, default registry port (1099) + * is assumed. May not be 0 if csf + * is not null. + * + * @param csf + * RMIClientSocketFactory that is used to create socket + * connections to the registry. If null, default + * socket factory is used. See + * {@link LocateRegistry#getRegistry(String, int, RMIClientSocketFactory)}. + * + * @return Registry reference. + * + * @throws NamingException + * If getting registry failed. */ protected Registry getRegistry(String host, int port, RMIClientSocketFactory csf) throws NamingException { try { return ((csf != null) ? LocateRegistry.getRegistry(host, port, csf) - : ((host != null) - ? ((port != 0) ? LocateRegistry.getRegistry(host, port) - : LocateRegistry.getRegistry(host)) - : ((port != 0) ? LocateRegistry.getRegistry(port) - : LocateRegistry.getRegistry()))); + : ((host != null) ? ((port != 0) ? LocateRegistry + .getRegistry(host, port) : LocateRegistry + .getRegistry(host)) : ((port != 0) ? LocateRegistry + .getRegistry(port) : LocateRegistry.getRegistry()))); } catch (RemoteException e) { throw (NamingException) new NamingException().initCause(e); } } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RegistryContextFactory.java Fri Jun 22 13:48:49 2007 @@ -20,6 +20,7 @@ * @author Vasily Zakharov * @version $Revision: 1.1.2.3 $ */ + package org.apache.harmony.jndi.provider.rmi.registry; import java.util.Enumeration; @@ -40,20 +41,17 @@ import org.apache.harmony.jndi.internal.nls.Messages; import org.apache.harmony.jndi.provider.rmi.rmiURLContextFactory; - /** * Initial context and object factory for {@link RegistryContext}. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.3 $ */ -public class RegistryContextFactory - implements InitialContextFactory, ObjectFactory { +public class RegistryContextFactory implements InitialContextFactory, + ObjectFactory { /** * Default constructor. */ - public RegistryContextFactory() {} + public RegistryContextFactory() { + } /** * {@inheritDoc} @@ -70,13 +68,14 @@ url = RegistryContext.RMI_URL_PREFIX; } - Object obj = new rmiURLContextFactory().getObjectInstance( - url, null, null, environment); + Object obj = new rmiURLContextFactory().getObjectInstance(url, null, + null, environment); if (obj instanceof Context) { return (Context) obj; } - // jndi.76=Object instantiated using the URL specified in environment is not a context: {0} + // jndi.76=Object instantiated using the URL specified in environment is + // not a context: {0} throw new NotContextException(Messages.getString("jndi.76", url)); //$NON-NLS-1$ } @@ -90,8 +89,8 @@ } Reference reference = (Reference) obj; - if (!reference.getFactoryClassName() - .equals(RegistryContextFactory.class.getName())) { + if (!reference.getFactoryClassName().equals( + RegistryContextFactory.class.getName())) { return null; } int size = reference.size(); @@ -102,7 +101,7 @@ } Vector urls = new Vector(size); - for (Enumeration e = reference.getAll(); e.hasMoreElements(); ) { + for (Enumeration e = reference.getAll(); e.hasMoreElements();) { RefAddr refAddr = e.nextElement(); if ((refAddr instanceof StringRefAddr) @@ -116,12 +115,13 @@ // jndi.78=Reference contains no valid addresses throw new ConfigurationException(Messages.getString("jndi.78")); //$NON-NLS-1$ } - Object ret = new rmiURLContextFactory().getObjectInstance( - urls.toArray(new String[size]), name, nameCtx, environment); + Object ret = new rmiURLContextFactory().getObjectInstance(urls + .toArray(new String[size]), name, nameCtx, environment); if (ret instanceof RegistryContext) { ((RegistryContext) ret).setReference(reference); } return ret; } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReference.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReference.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReference.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReference.java Fri Jun 22 13:48:49 2007 @@ -20,6 +20,7 @@ * @author Vasily Zakharov * @version $Revision: 1.1.2.2 $ */ + package org.apache.harmony.jndi.provider.rmi.registry; import java.rmi.Remote; @@ -28,25 +29,22 @@ import javax.naming.NamingException; import javax.naming.Reference; - /** * This interface provides access to a remote reference. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.2 $ */ public interface RemoteReference extends Remote { /** * Returns the remote reference. - * - * @return Remote reference. - * - * @throws NamingException - * If naming exception occurs. - * - * @throws RemoteException - * If RMI remote exception occurs. + * + * @return Remote reference. + * + * @throws NamingException + * If naming exception occurs. + * + * @throws RemoteException + * If RMI remote exception occurs. */ public Reference getReference() throws NamingException, RemoteException; + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper.java Fri Jun 22 13:48:49 2007 @@ -20,25 +20,21 @@ * @author Vasily Zakharov * @version $Revision: 1.1.2.2 $ */ + package org.apache.harmony.jndi.provider.rmi.registry; import java.rmi.Remote; import java.rmi.RemoteException; - import java.rmi.server.UnicastRemoteObject; import javax.naming.Reference; - /** - * This class stores a {@link Reference} - * and provides {@link Remote} access to it. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.2 $ + * This class stores a {@link Reference} and provides {@link Remote} access to + * it. */ -public class RemoteReferenceWrapper extends UnicastRemoteObject - implements RemoteReference { +public class RemoteReferenceWrapper extends UnicastRemoteObject implements + RemoteReference { /** * serialVersionUID @@ -52,12 +48,12 @@ /** * Creates wrapper for the specified reference. - * - * @param reference - * Reference to wrap. - * - * @throws RemoteException - * If object export failed. + * + * @param reference + * Reference to wrap. + * + * @throws RemoteException + * If object export failed. */ public RemoteReferenceWrapper(Reference reference) throws RemoteException { this.reference = reference; @@ -65,10 +61,11 @@ /** * Returns the wrapped reference. - * - * @return Wrapped reference. + * + * @return Wrapped reference. */ public Reference getReference() { return reference; } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Skel.java Fri Jun 22 13:48:49 2007 @@ -26,36 +26,40 @@ * DO NOT EDIT!!! * Contents subject to change without notice! */ + package org.apache.harmony.jndi.provider.rmi.registry; import org.apache.harmony.jndi.internal.nls.Messages; -@SuppressWarnings("deprecation") //$NON-NLS-1$ -public final class RemoteReferenceWrapper_Skel implements java.rmi.server.Skeleton { +@SuppressWarnings("deprecation") +public final class RemoteReferenceWrapper_Skel implements + java.rmi.server.Skeleton { private static final long interfaceHash = 2534274963554139942L; - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("javax.naming.Reference getReference()") //$NON-NLS-1$ + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation( + "javax.naming.Reference getReference()") //$NON-NLS-1$ }; public java.rmi.server.Operation[] getOperations() { return operations.clone(); } - public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, int opnum, long hash) throws java.lang.Exception { + public void dispatch(java.rmi.Remote obj, java.rmi.server.RemoteCall call, + int opnum, long hash) throws java.lang.Exception { if (opnum < 0) { if (hash == 3529874867989176284L) { opnum = 0; } else { // jndi.87=Invalid method hash: {0} - throw new java.rmi.UnmarshalException(Messages.getString("jndi.87", hash)); //$NON-NLS-1$ + throw new java.rmi.UnmarshalException(Messages.getString( + "jndi.87", hash)); //$NON-NLS-1$ } } else { if (hash != interfaceHash) { // jndi.88=Interface hash mismatch, expected: {0}, received: {1} - throw new java.rmi.server.SkeletonMismatchException( - Messages.getString("jndi.88", interfaceHash , hash)); //$NON-NLS-1$ + throw new java.rmi.server.SkeletonMismatchException(Messages + .getString("jndi.88", interfaceHash, hash)); //$NON-NLS-1$ } } @@ -63,26 +67,29 @@ switch (opnum) { - case 0: { // getReference() + case 0: { // getReference() - call.releaseInputStream(); + call.releaseInputStream(); - javax.naming.Reference $result = server.getReference(); + javax.naming.Reference $result = server.getReference(); - try { - java.io.ObjectOutput out = call.getResultStream(true); - out.writeObject($result); - } catch (java.io.IOException e) { - // jndi.89=Error marshalling return - throw new java.rmi.MarshalException(Messages.getString("jndi.89"), e); //$NON-NLS-1$ - } + try { + java.io.ObjectOutput out = call.getResultStream(true); + out.writeObject($result); + } catch (java.io.IOException e) { + // jndi.89=Error marshalling return + throw new java.rmi.MarshalException(Messages + .getString("jndi.89"), e); //$NON-NLS-1$ + } - break; - } + break; + } - default: - // jndi.8A=Invalid method number: {0} - throw new java.rmi.UnmarshalException(Messages.getString("jndi.8A", opnum)); //$NON-NLS-1$ + default: + // jndi.8A=Invalid method number: {0} + throw new java.rmi.UnmarshalException(Messages.getString( + "jndi.8A", opnum)); //$NON-NLS-1$ } } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/registry/RemoteReferenceWrapper_Stub.java Fri Jun 22 13:48:49 2007 @@ -26,13 +26,16 @@ * DO NOT EDIT!!! * Contents subject to change without notice! */ + package org.apache.harmony.jndi.provider.rmi.registry; import org.apache.harmony.jndi.internal.nls.Messages; -@SuppressWarnings("deprecation") //$NON-NLS-1$ -public final class RemoteReferenceWrapper_Stub extends java.rmi.server.RemoteStub - implements org.apache.harmony.jndi.provider.rmi.registry.RemoteReference, java.rmi.Remote { +@SuppressWarnings("deprecation") +public final class RemoteReferenceWrapper_Stub extends + java.rmi.server.RemoteStub implements + org.apache.harmony.jndi.provider.rmi.registry.RemoteReference, + java.rmi.Remote { private static final long serialVersionUID = 2; @@ -40,17 +43,20 @@ private static boolean useNewInvoke; - private static final java.rmi.server.Operation[] operations = { - new java.rmi.server.Operation("javax.naming.Reference getReference()") //$NON-NLS-1$ + private static final java.rmi.server.Operation[] operations = { new java.rmi.server.Operation( + "javax.naming.Reference getReference()") //$NON-NLS-1$ }; private static java.lang.reflect.Method $method_getReference_0; static { try { - java.rmi.server.RemoteRef.class.getMethod("invoke", new java.lang.Class[] {java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class}); //$NON-NLS-1$ + java.rmi.server.RemoteRef.class + .getMethod( + "invoke", new java.lang.Class[] { java.rmi.Remote.class, java.lang.reflect.Method.class, java.lang.Object[].class, long.class }); //$NON-NLS-1$ - $method_getReference_0 = org.apache.harmony.jndi.provider.rmi.registry.RemoteReference.class.getMethod("getReference", new java.lang.Class[] {}); //$NON-NLS-1$ + $method_getReference_0 = org.apache.harmony.jndi.provider.rmi.registry.RemoteReference.class + .getMethod("getReference", new java.lang.Class[] {}); //$NON-NLS-1$ useNewInvoke = true; } catch (java.lang.NoSuchMethodException e) { @@ -71,10 +77,12 @@ throws javax.naming.NamingException, java.rmi.RemoteException { try { if (useNewInvoke) { - java.lang.Object $result = ref.invoke(this, $method_getReference_0, null, 3529874867989176284L); + java.lang.Object $result = ref.invoke(this, + $method_getReference_0, null, 3529874867989176284L); return ((javax.naming.Reference) $result); } - java.rmi.server.RemoteCall call = ref.newCall(this, operations, 0, interfaceHash); + java.rmi.server.RemoteCall call = ref.newCall(this, operations, 0, + interfaceHash); ref.invoke(call); @@ -85,10 +93,12 @@ $result = (javax.naming.Reference) in.readObject(); } catch (java.io.IOException e) { // jndi.85=Error unmarshalling return value - throw new java.rmi.UnmarshalException(Messages.getString("jndi.85"), e); //$NON-NLS-1$ + throw new java.rmi.UnmarshalException(Messages + .getString("jndi.85"), e); //$NON-NLS-1$ } catch (java.lang.ClassNotFoundException e) { // jndi.85=Error unmarshalling return value - throw new java.rmi.UnmarshalException(Messages.getString("jndi.85"), e); //$NON-NLS-1$ + throw new java.rmi.UnmarshalException(Messages + .getString("jndi.85"), e); //$NON-NLS-1$ } finally { ref.done(call); } @@ -102,7 +112,9 @@ throw e; } catch (java.lang.Exception e) { // jndi.86=Undeclared checked exception - throw new java.rmi.UnexpectedException(Messages.getString("jndi.86"), e); //$NON-NLS-1$ + throw new java.rmi.UnexpectedException(Messages + .getString("jndi.86"), e); //$NON-NLS-1$ } } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContext.java Fri Jun 22 13:48:49 2007 @@ -20,6 +20,7 @@ * @author Vasily Zakharov * @version $Revision: 1.1.2.3 $ */ + package org.apache.harmony.jndi.provider.rmi; import java.util.Hashtable; @@ -34,12 +35,8 @@ import org.apache.harmony.jndi.provider.rmi.registry.RegistryContext; - /** * RMI URL context implementation. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.3 $ */ public class rmiURLContext extends GenericURLContext { @@ -52,38 +49,38 @@ /** * Creates instance of this context with specified environment. - * - * @param environment - * Environment to copy. + * + * @param environment + * Environment to copy. */ public rmiURLContext(Hashtable environment) { super(environment); } /** - * Determines the proper {@link RegistryContext} from the specified URL - * and returns the {@link ResolveResult} object with that context - * as resolved object and the rest of the URL as remaining name. - * - * @param url - * URL. - * - * @param environment - * Environment. - * - * @return {@link ResolveResult} object with resolved context - * as resolved object the rest of the URL as remaining name. - * - * @throws NamingException - * If some naming error occurs. + * Determines the proper {@link RegistryContext} from the specified URL and + * returns the {@link ResolveResult} object with that context as resolved + * object and the rest of the URL as remaining name. + * + * @param url + * URL. + * + * @param environment + * Environment. + * + * @return {@link ResolveResult} object with resolved context as resolved + * object the rest of the URL as remaining name. + * + * @throws NamingException + * If some naming error occurs. */ @Override - protected ResolveResult getRootURLContext( - String url, Hashtable environment) throws NamingException { + protected ResolveResult getRootURLContext(String url, + Hashtable environment) throws NamingException { if (!url.startsWith(RegistryContext.RMI_URL_PREFIX)) { // jndi.74=Not an RMI URL, incorrect prefix: {0} - throw new IllegalArgumentException( - Messages.getString("jndi.74", url)); //$NON-NLS-1$ + throw new IllegalArgumentException(Messages.getString( + "jndi.74", url)); //$NON-NLS-1$ } int length = url.length(); int start = RegistryContext.RMI_URL_PREFIX.length(); @@ -120,9 +117,9 @@ port = Integer.parseInt(url.substring(portStart, end)); } catch (NumberFormatException e) { // jndi.75=Invalid port number in URL: {0} - throw (IllegalArgumentException) - new IllegalArgumentException(Messages.getString("jndi.75", //$NON-NLS-1$ - url)).initCause(e); + throw (IllegalArgumentException) new IllegalArgumentException( + Messages.getString("jndi.75", //$NON-NLS-1$ + url)).initCause(e); } } @@ -137,7 +134,8 @@ name.add(url.substring(start)); } - return new ResolveResult( - new RegistryContext(hostName, port, environment), name); + return new ResolveResult(new RegistryContext(hostName, port, + environment), name); } + } Modified: harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContextFactory.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContextFactory.java?view=diff&rev=549955&r1=549954&r2=549955 ============================================================================== --- harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContextFactory.java (original) +++ harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/org/apache/harmony/jndi/provider/rmi/rmiURLContextFactory.java Fri Jun 22 13:48:49 2007 @@ -29,12 +29,8 @@ import org.apache.harmony.jndi.provider.GenericURLContextFactory; - /** * URL context factory for {@link rmiURLContext}. - * - * @author Vasily Zakharov - * @version $Revision: 1.1.2.2 $ */ public class rmiURLContextFactory extends GenericURLContextFactory { @@ -48,14 +44,15 @@ /** * Returns new {@link rmiURLContext}. Used by * {@link GenericURLContextFactory#getObjectInstance(Object, Name, Context, Hashtable)}. - * - * @param environment - * Environment. - * - * @return New {@link rmiURLContext}. + * + * @param environment + * Environment. + * + * @return New {@link rmiURLContext}. */ @Override protected Context createURLContext(Hashtable environment) { return new rmiURLContext(environment); } + }