You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by ad...@apache.org on 2007/01/12 08:31:44 UTC

svn commit: r495506 - in /incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb: assembler/classic/ core/ivm/naming/

Author: adc
Date: Thu Jan 11 23:31:43 2007
New Revision: 495506

URL: http://svn.apache.org/viewvc?view=rev&rev=495506
Log:
Trivial reformating

Modified:
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InfoObject.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncInfo.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/EncReference.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java
    incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/Reference.java

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InfoObject.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InfoObject.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InfoObject.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/InfoObject.java Thu Jan 11 23:31:43 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.openejb.assembler.classic;
 
-public abstract class InfoObject implements java.io.Serializable {
+import java.io.Serializable;
+
+
+public abstract class InfoObject implements Serializable {
 
 }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiBuilder.java Thu Jan 11 23:31:43 2007
@@ -16,16 +16,20 @@
  */
 package org.apache.openejb.assembler.classic;
 
-import org.apache.openejb.DeploymentInfo;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
 import org.apache.openejb.BeanType;
+import org.apache.openejb.DeploymentInfo;
 import org.apache.openejb.core.CoreDeploymentInfo;
+import org.apache.openejb.core.entity.EntityEncReference;
 import org.apache.openejb.core.ivm.naming.BusinessLocalReference;
+import org.apache.openejb.core.ivm.naming.BusinessRemoteReference;
 import org.apache.openejb.core.ivm.naming.ObjectReference;
 import org.apache.openejb.core.ivm.naming.Reference;
-import org.apache.openejb.core.ivm.naming.BusinessRemoteReference;
+import org.apache.openejb.core.stateful.StatefulEncReference;
+import org.apache.openejb.core.stateless.StatelessEncReference;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
 
 /**
  * @version $Rev$ $Date$
@@ -40,7 +44,9 @@
     }
 
     public static interface JndiNameStrategy {
+
         public static enum Interface {
+
             REMOTE_HOME, LOCAL_HOME, BUSINESS_LOCAL, BUSINESS_REMOTE, SERVICE_ENDPOINT
         }
 
@@ -49,6 +55,7 @@
 
     // TODO: put these into the classpath and get them with xbean-finder
     public static class LegacyAddedSuffixStrategy implements JndiNameStrategy {
+
         public String getName(DeploymentInfo deploymentInfo, Class interfce, Interface type) {
             String id = deploymentInfo.getDeploymentID() + "";
             if (id.charAt(0) == '/') {
@@ -70,6 +77,7 @@
     }
 
     public static class AddedSuffixStrategy implements JndiNameStrategy {
+
         public String getName(DeploymentInfo deploymentInfo, Class interfce, Interface type) {
             String id = deploymentInfo.getDeploymentID() + "";
             if (id.charAt(0) == '/') {
@@ -92,6 +100,7 @@
 
 
     public static class CommonPrefixStrategy implements JndiNameStrategy {
+
         public String getName(DeploymentInfo deploymentInfo, Class interfce, Interface type) {
             String id = deploymentInfo.getDeploymentID() + "";
             if (id.charAt(0) == '/') {
@@ -113,6 +122,7 @@
     }
 
     public static class InterfaceSimpleNameStrategy implements JndiNameStrategy {
+
         public String getName(DeploymentInfo deploymentInfo, Class interfce, Interface type) {
             return interfce.getSimpleName();
         }
@@ -129,7 +139,7 @@
                 context.bind("openejb/ejb/" + name, getReference(deployment.getEJBHome(), deployment));
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind home interface for deployment "+id, e);
+            throw new RuntimeException("Unable to bind home interface for deployment " + id, e);
         }
 
         try {
@@ -139,7 +149,7 @@
                 context.bind("openejb/ejb/" + name, getReference(deployment.getEJBLocalHome(), deployment));
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind local interface for deployment "+id, e);
+            throw new RuntimeException("Unable to bind local interface for deployment " + id, e);
         }
 
         try {
@@ -150,7 +160,7 @@
                 context.bind("openejb/ejb/" + name, new BusinessLocalReference(businessLocalHome));
             }
         } catch (NamingException e) {
-            throw new RuntimeException("Unable to bind business local interface for deployment "+id, e);
+            throw new RuntimeException("Unable to bind business local interface for deployment " + id, e);
         }
 
         try {
@@ -169,11 +179,11 @@
         Reference ref = new ObjectReference(proxy);
 
         if (deployment.getComponentType() == BeanType.STATEFUL) {
-            ref = new org.apache.openejb.core.stateful.StatefulEncReference(ref);
+            ref = new StatefulEncReference(ref);
         } else if (deployment.getComponentType() == BeanType.STATELESS) {
-            ref = new org.apache.openejb.core.stateless.StatelessEncReference(ref);
+            ref = new StatelessEncReference(ref);
         } else {
-            ref = new org.apache.openejb.core.entity.EntityEncReference(ref);
+            ref = new EntityEncReference(ref);
         }
         return ref;
     }

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncInfo.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncInfo.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncInfo.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/JndiEncInfo.java Thu Jan 11 23:31:43 2007
@@ -16,8 +16,9 @@
  */
 package org.apache.openejb.assembler.classic;
 
-import java.util.List;
 import java.util.ArrayList;
+import java.util.List;
+
 
 public class JndiEncInfo extends InfoObject {
 

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/EncReference.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/EncReference.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/EncReference.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/EncReference.java Thu Jan 11 23:31:43 2007
@@ -21,15 +21,17 @@
 import org.apache.openejb.core.ThreadContext;
 import org.apache.openejb.core.Operation;
 
-/*
-  This class is a wrapper for an Intra-VM EJB or Connector references in the 
-  JNDI ENC of a entity, stateful and stateless beans.  When the getObject( ) method is invoked the 
-  Operation is checked to ensure that its is allowed for the bean's current state.
-
-  This class is subclassed by EncReference in the entity, stateful and stateless packages
-  of org.apache.openejb.core.
-*/
 
+/**
+ * This class is a wrapper for an Intra-VM EJB or Connector references in the
+ * JNDI ENC of a entity, stateful and stateless beans.  When the getObject( ) method is invoked the
+ * Operation is checked to ensure that its is allowed for the bean's current state.
+ * <p/>
+ * This class is subclassed by EncReference in the entity, stateful and stateless packages
+ * of org.apache.openejb.core.
+ *
+ * @version $Rev: 493626 $ $Date: 2007-01-06 17:09:34 -0800 (Sat, 06 Jan 2007) $
+ */
 public abstract class EncReference implements Reference {
 
     protected Reference ref = null;

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java Thu Jan 11 23:31:43 2007
@@ -16,23 +16,24 @@
  */
 package org.apache.openejb.core.ivm.naming;
 
-import java.io.ObjectStreamException;
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.FileInputStream;
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.NotSerializableException;
+import java.io.ObjectStreamException;
 import java.io.Serializable;
+import java.net.URL;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Map;
+import java.util.Properties;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.Vector;
-import java.util.Properties;
-import java.net.URL;
-
 import javax.naming.Binding;
 import javax.naming.CompositeName;
 import javax.naming.Context;
@@ -42,9 +43,11 @@
 import javax.naming.NameParser;
 import javax.naming.NamingEnumeration;
 import javax.naming.NamingException;
+import javax.naming.OperationNotSupportedException;
 import javax.naming.spi.ObjectFactory;
 
 import org.apache.openejb.ClassLoaderUtil;
+import org.apache.openejb.core.ivm.IntraVmCopyMonitor;
 
 /*
 * This class wrappers a specific NameNode which is the data model for the JNDI
@@ -56,10 +59,11 @@
  * @org.apache.xbean.XBean element="ivmContext"
  */
 public class IvmContext implements Context, Serializable {
+
     private static final long serialVersionUID = -626353930051783641L;
-    Hashtable myEnv;
+    Hashtable<String, Object> myEnv;
     boolean readOnly = false;
-    HashMap fastCache = new HashMap();
+    Map<String, Object> fastCache = new HashMap<String, Object>();
     public NameNode mynode;
 
     public static IvmContext createRootContext() {
@@ -78,12 +82,12 @@
         mynode = node;
     }
 
-    public IvmContext(Hashtable environment) throws NamingException {
+    public IvmContext(Hashtable<String, Object> environment) throws NamingException {
         this();
         if (environment == null)
             throw new NamingException("Invalid Argument");
         else
-            myEnv = (Hashtable) environment.clone();
+            myEnv = (Hashtable<String, Object>) environment.clone();
 
     }
 
@@ -92,7 +96,7 @@
             return this;
         }
 
-        String compoundName = null;
+        String compoundName;
         int indx = compositName.indexOf(":");
         if (indx > -1) {
             /*
@@ -128,14 +132,14 @@
         if (obj.getClass() == IvmContext.class)
             ((IvmContext) obj).myEnv = myEnv;
         else if (obj instanceof Reference) {
-            /*
-             EJB references and resource references are wrapped in special
-             org.apache.openejb.core.ivm.naming.Reference types that check to
-             see if the current operation is allowed access to the entry (See EJB 1.1/2.0 Allowed Operations)
-             If the operation is not allowed, a javax.naming.NameNotFoundException is thrown.
-
-             A Reference type can also carry out dynamic resolution of references if necessary.
-            */
+            /**
+             * EJB references and resource references are wrapped in special
+             * org.apache.openejb.core.ivm.naming.Reference types that check to
+             * see if the current operation is allowed access to the entry (See EJB 1.1/2.0 Allowed Operations)
+             * If the operation is not allowed, a javax.naming.NameNotFoundException is thrown.
+             *
+             * A Reference type can also carry out dynamic resolution of references if necessary.
+             */
             obj = ((Reference) obj).getObject();
         }
         return obj;
@@ -143,17 +147,16 @@
 
     protected Object federate(String compositName) throws NamingException {
         ObjectFactory factories [] = getFederatedFactories();
-        for (int i = 0; i < factories.length; i++) {
+        for (ObjectFactory factory : factories) {
             try {
-                javax.naming.CompositeName name = new javax.naming.CompositeName(compositName);
-                Object obj = factories[i].getObjectInstance(null, name, null, null);
+                CompositeName name = new CompositeName(compositName);
+                Object obj = factory.getObjectInstance(null, name, null, null);
 
                 if (obj instanceof Context)
                     return ((Context) obj).lookup(compositName);
                 else if (obj != null)
                     return obj;
-            } catch (Exception nnfe) {
-
+            } catch (Exception doNothing) {
             }
         }
 
@@ -281,18 +284,15 @@
         unbind(name.toString());
     }
 
-    public void rename(String oldname, String newname)
-            throws NamingException {
+    public void rename(String oldname, String newname) throws NamingException {
         throw new javax.naming.OperationNotSupportedException();
     }
 
-    public void rename(Name oldname, Name newname)
-            throws NamingException {
+    public void rename(Name oldname, Name newname) throws NamingException {
         rename(oldname.toString(), newname.toString());
     }
 
-    public NamingEnumeration<NameClassPair> list(String name)
-            throws NamingException {
+    public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
         Object obj = lookup(name);
         if (obj.getClass() == IvmContext.class)
             return new MyListEnumeration(((IvmContext) obj).mynode);
@@ -301,13 +301,11 @@
         }
     }
 
-    public NamingEnumeration<NameClassPair> list(Name name)
-            throws NamingException {
+    public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
         return list(name.toString());
     }
 
-    public NamingEnumeration<Binding> listBindings(String name)
-            throws NamingException {
+    public NamingEnumeration<Binding> listBindings(String name) throws NamingException {
         Object obj = lookup(name);
         if (obj.getClass() == IvmContext.class)
             return new MyBindingEnumeration(((IvmContext) obj).mynode);
@@ -316,8 +314,7 @@
         }
     }
 
-    public NamingEnumeration<Binding> listBindings(Name name)
-            throws NamingException {
+    public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
         return listBindings(name.toString());
     }
 
@@ -357,8 +354,7 @@
         return lookupLink(name.toString());
     }
 
-    public NameParser getNameParser(String name)
-            throws NamingException {
+    public NameParser getNameParser(String name) throws NamingException {
         throw new javax.naming.OperationNotSupportedException();
     }
 
@@ -366,30 +362,26 @@
         return getNameParser(name.toString());
     }
 
-    public String composeName(String name, String prefix)
-            throws NamingException {
+    public String composeName(String name, String prefix) throws NamingException {
         Name result = composeName(new CompositeName(name),
-                new CompositeName(prefix));
+                                  new CompositeName(prefix));
         return result.toString();
     }
 
-    public Name composeName(Name name, Name prefix)
-            throws NamingException {
+    public Name composeName(Name name, Name prefix) throws NamingException {
         Name result = (Name) (prefix.clone());
         result.addAll(name);
         return result;
     }
 
-    public Object addToEnvironment(String propName, Object propVal)
-            throws NamingException {
+    public Object addToEnvironment(String propName, Object propVal) throws NamingException {
         if (myEnv == null) {
-            myEnv = new Hashtable(5, 0.75f);
+            myEnv = new Hashtable<String, Object>(5);
         }
         return myEnv.put(propName, propVal);
     }
 
-    public Object removeFromEnvironment(String propName)
-            throws NamingException {
+    public Object removeFromEnvironment(String propName) throws NamingException {
         if (myEnv == null)
             return null;
         return myEnv.remove(propName);
@@ -398,7 +390,7 @@
     public Hashtable getEnvironment() throws NamingException {
         if (myEnv == null) {
 
-            return new Hashtable(3, 0.75f);
+            return new Hashtable(3);
         } else {
             return (Hashtable) myEnv.clone();
         }
@@ -411,11 +403,12 @@
     public void close() throws NamingException {
     }
 
-    protected void checkReadOnly() throws javax.naming.OperationNotSupportedException {
-        if (readOnly) throw new javax.naming.OperationNotSupportedException();
+    protected void checkReadOnly() throws OperationNotSupportedException {
+        if (readOnly) throw new OperationNotSupportedException();
     }
 
     protected class MyBindingEnumeration extends MyNamingEnumeration {
+
         public MyBindingEnumeration(NameNode parentNode) {
             super(parentNode);
         }
@@ -432,6 +425,7 @@
     }
 
     protected class MyListEnumeration extends MyNamingEnumeration {
+
         public MyListEnumeration(NameNode parentNode) {
             super(parentNode);
         }
@@ -447,7 +441,8 @@
 
     }
 
-    protected abstract class MyNamingEnumeration implements javax.naming.NamingEnumeration {
+    protected abstract class MyNamingEnumeration implements NamingEnumeration {
+
         Enumeration myEnum;
 
         public MyNamingEnumeration(NameNode parentNode) {
@@ -466,7 +461,7 @@
             buildEnumeration(vect);
         }
 
-        abstract protected void buildEnumeration(Vector vect);
+        abstract protected void buildEnumeration(Vector<NameNode> vect);
 
         protected void gatherNodes(NameNode node, Vector vect) {
             if (node.lessTree != null) {
@@ -501,12 +496,12 @@
     }
 
     protected Object writeReplace() throws ObjectStreamException {
-        if (org.apache.openejb.core.ivm.IntraVmCopyMonitor.isStatefulPassivationOperation()) {
+        if (IntraVmCopyMonitor.isStatefulPassivationOperation()) {
 
             return new JndiEncArtifact(this);
         }
 
-        throw new java.io.NotSerializableException("IntraVM java.naming.Context objects can not be passed as arguments");
+        throw new NotSerializableException("IntraVM java.naming.Context objects can not be passed as arguments");
     }
 
     /* for testing only*/

Modified: incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/Reference.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/Reference.java?view=diff&rev=495506&r1=495505&r2=495506
==============================================================================
--- incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/Reference.java (original)
+++ incubator/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/Reference.java Thu Jan 11 23:31:43 2007
@@ -17,16 +17,19 @@
 package org.apache.openejb.core.ivm.naming;
 
 import javax.naming.NamingException;
-/*
-  This interface is implemented by special wrappers for EJB references and
-  resource references. When the getObject( ) method is invoked the Operation
-  is checked to ensure that its is allowed for the bean's current state.
 
-  In addition, dynamic resolution and special conditions can be encapsulated
-  in the implementation object.
-
-*/
 
+/**
+ * This interface is implemented by special wrappers for EJB references and
+ * resource references. When the getObject( ) method is invoked the Operation
+ * is checked to ensure that its is allowed for the bean's current state.
+ * <p/>
+ * In addition, dynamic resolution and special conditions can be encapsulated
+ * in the implementation object.
+ *
+ * @version $Rev$ $Date$
+ */
 public interface Reference {
+
     public Object getObject() throws NamingException;
 }