openejb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r452600 [1/3] - in /incubator/openejb/trunk/openejb2: ./ modules/ modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/ modules/openejb-core/src/main/java/org/apache/openejb/corba/ modules/openejb-core/src/main...
Date Tue, 03 Oct 2006 19:29:45 GMT
Author: djencks
Date: Tue Oct  3 12:29:42 2006
New Revision: 452600

URL: http://svn.apache.org/viewvc?view=rev&rev=452600
Log:
OPENEJB-266 Add Yoko orb support

Added:
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/pom.xml   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/IORSSLInterceptor.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/MinorCodes.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/OpenEJBEndPointImpl.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/OpenEJBORB.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/OpenEJBPOA.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/OpenEJBSocketFactory.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/ServiceContextInterceptor.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/SunORBConfigAdapter.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/SunORBConfigAdapterGBean.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/main/java/org/apache/openejb/sunorb/SunORBInitializer.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/org/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/org/apache/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/org/apache/openejb/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/org/apache/openejb/sunorb/
    incubator/openejb/trunk/openejb2/modules/openejb-sunorb/src/test/java/org/apache/openejb/sunorb/SunNameServiceTest.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/pom.xml   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/ORBConfigAdapter.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/ORBConfigAdapterGBean.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/ORBInitializer.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/ServiceContextInterceptor.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/main/java/org/apache/openejb/yoko/SocketFactory.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/corba/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/corba/security/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/corba/security/config/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/corba/security/config/tss/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java   (with props)
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/yoko/
    incubator/openejb/trunk/openejb2/modules/openejb-yoko/src/test/java/org/apache/openejb/yoko/NameServiceTest.java   (with props)
Removed:
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/MinorCodes.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/SunNameService.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/SunNameServiceGBean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/sunorb/
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/test/java/org/apache/openejb/corba/SunNameServiceTest.java
Modified:
    incubator/openejb/trunk/openejb2/modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABeanGBean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBeanGBean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/TSSBean.java
    incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapter.java
    incubator/openejb/trunk/openejb2/modules/openejb-pkgen-builder/pom.xml
    incubator/openejb/trunk/openejb2/modules/pom.xml
    incubator/openejb/trunk/openejb2/pom.xml

Modified: incubator/openejb/trunk/openejb2/modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-builder/src/test/java/org/apache/openejb/corba/security/config/tss/TSSConfigEditorTest.java Tue Oct  3 12:29:42 2006
@@ -99,66 +99,4 @@
         }
 
     }
-
-
-    private static final String propString = "\n" +
-                                             "\n" +
-                                             "            org.omg.PortableInterceptor.ORBInitializerClass.org.apache.openejb.corba.transaction.TransactionInitializer\n" +
-                                             "            org.omg.PortableInterceptor.ORBInitializerClass.org.apache.openejb.corba.security.SecurityInitializer\n" +
-                                             "\n" +
-                                             "            Xopenorb.debug.level=HIGH\n" +
-                                             "            Xopenorb.debug.trace=DEBUG\n" +
-                                             "\n" +
-                                             "            iiop.TransportServerInitializerClass=org.openorb.orb.ssl.SSLTransportServerInitializer\n" +
-                                             "\n" +
-                                             "            secure.server.allowUnsecure=false";
-    private static final String TEST_XML4 = "            <tss:tss xmlns:tss=\"http://openejb.apache.org/xml/ns/corba-tss-config-2.1\" xmlns:sec=\"http://geronimo.apache.org/xml/ns/security-1.2\">\n" +
-                                            "                <tss:default-principal>\n" +
-                                            "                    <sec:principal class=\"org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal\" name=\"guest\"/>\n" +
-                                            "                </tss:default-principal>\n" +
-                                            "                <tss:SSL port=\"6685\" hostname=\"localhost\">\n" +
-                                            "                    <tss:supports>Integrity Confidentiality EstablishTrustInTarget EstablishTrustInClient</tss:supports>\n" +
-                                            "                    <tss:requires>Integrity Confidentiality EstablishTrustInClient</tss:requires>\n" +
-                                            "                </tss:SSL>\n" +
-                                            "                <tss:compoundSecMechTypeList>\n" +
-                                            "                    <tss:compoundSecMech>\n" +
-                                            "                        <tss:GSSUP targetName=\"geronimo-properties-realm\"/>\n" +
-                                            "                        <tss:sasMech>\n" +
-                                            "                            <tss:identityTokenTypes><tss:ITTAnonymous/><tss:ITTPrincipalNameGSSUP principal-class=\"org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal\" domain=\"foo\"/><tss:ITTDistinguishedName domain=\"foo\"/><tss:ITTX509CertChain domain=\"foo\"/></tss:identityTokenTypes>\n" +
-                                            "                        </tss:sasMech>\n" +
-                                            "                    </tss:compoundSecMech>\n" +
-                                            "                </tss:compoundSecMechTypeList>\n" +
-                                            "            </tss:tss>";
-
-    public void testCORBABean() throws Exception {
-        ClassLoader classLoader = getClass().getClassLoader();
-        ThreadPool threadPool = new ThreadPool(10, "foo", 1000, classLoader, "test:type=ThreadPool");
-        String configAdapter = "org.apache.openejb.corba.sunorb.SunORBConfigAdapter";
-        CORBABean corbaBean = new CORBABean(configAdapter, classLoader, threadPool, null, null);
-        ArrayList args = new ArrayList();
-        corbaBean.setArgs(args);
-        Properties properties = new Properties();
-        properties.load(new ByteArrayInputStream(propString.getBytes()));
-        corbaBean.setProps(properties);
-        XmlObject xmlObject = getXmlObject(TEST_XML4);
-        TSSConfigEditor editor = new TSSConfigEditor();
-        Object o = editor.getValue(xmlObject, null, classLoader);
-        TSSConfig tss = (TSSConfig) o;
-
-        corbaBean.setTssConfig(tss);
-
-        try {
-            corbaBean.doStart();
-        } catch(SystemException se) {
-            se.printStackTrace();
-            fail(se.getCause().getMessage());
-        } finally {
-            try {
-                corbaBean.doStop();
-            } catch (Throwable e) {
-
-            }
-        }
-    }
-
 }

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABean.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABean.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABean.java Tue Oct  3 12:29:42 2006
@@ -19,6 +19,7 @@
 import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.security.SecurityService;
 import org.omg.CORBA.ORB;
@@ -27,57 +28,159 @@
 import org.apache.openejb.corba.security.config.ConfigAdapter;
 import org.apache.openejb.corba.security.config.ConfigException;
 import org.apache.openejb.corba.security.config.tss.TSSConfig;
+import org.apache.openejb.corba.security.config.tss.TSSSSLTransportConfig;
+import org.apache.openejb.corba.security.config.tss.TSSTransportMechConfig;
+import org.apache.openejb.corba.security.config.ssl.SSLConfig;
 import org.apache.openejb.corba.util.Util;
 
 import javax.ejb.spi.HandleDelegate;
 import java.net.InetSocketAddress;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Properties;
 
 
 /**
+ * A CORBABean is a main CORBA server configuration.  The
+ * CORBABean is the hosting ORB to which additional TSSBeans
+ * attach to export EJBs.  The CORBABean may be configured
+ * to use either plain socket listeners or SSL listeners, based
+ * on the bean specification.  All TSSBean objects attached
+ * to this Bean instance will share the same listener
+ * endpoint and transport-level security.
  * @version $Revision$ $Date$
  */
-public class CORBABean implements GBeanLifecycle, ORBRef {
+public class CORBABean implements GBeanLifecycle, ORBRef, ORBConfiguration {
+    private final int DEFAULT_LISTENER_PORT = 6882;
 
     private final Log log = LogFactory.getLog(CORBABean.class);
 
     private final ClassLoader classLoader;
-    private final Executor threadPool;
     private final ConfigAdapter configAdapter;
+    // the initial listener port
+    private int listenerPort;
+    // the host name we expose in IORs
+    private String host;
     private TSSConfig tssConfig;
+    private SSLConfig sslConfig;
     private ORB orb;
     private POA rootPOA;
-    private ArrayList args = new ArrayList();
-    private Properties props = new Properties();
+    private NameService nameService;
+    private AbstractName abstractName;
 
     public CORBABean() {
         this.classLoader = null;
-        this.threadPool = null;
         this.configAdapter = null;
-    }
-
-    public CORBABean(String configAdapter, ClassLoader classLoader, Executor threadPool, SecurityService securityService, SunNameService nameService) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        this.sslConfig = null;
+        this.listenerPort = -1;
+        this.host = null;
+        this.abstractName = null;
+    }
+
+    /**
+     * Instantiate a CORBABean instance.
+     *
+     * @param abstractName
+     *               The server-created abstract name for this bean instance.
+     * @param configAdapter
+     *               The ORB ConfigAdapter used to interface with the
+     *               JVM-configured ORB instance.
+     * @param host   The hostname we publish ourselves under.
+     * @param listenerPort
+     *               The initial listener port to use.
+     * @param classLoader
+     *               The ClassLoader used for ORB context class loading.
+     * @param securityService
+     *               The security service.  Not used directly, but this is
+     *               here to order dependency reasons.
+     * @param nameService
+     *               The initial name service the created ORB will use
+     *               for object resolution.
+     * @param ssl    The SSL configuration, including the KeystoreManager.
+     *
+     * @exception ClassNotFoundException
+     * @exception IllegalAccessException
+     * @exception InstantiationException
+     */
+    public CORBABean(AbstractName abstractName, ConfigAdapter configAdapter, String host, int listenerPort, ClassLoader classLoader, SecurityService securityService, NameService nameService, SSLConfig ssl) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        this.abstractName = abstractName;
         this.classLoader = classLoader;
-        this.threadPool = threadPool;
-        if (configAdapter != null) {
-            this.configAdapter = (ConfigAdapter) classLoader.loadClass(configAdapter).newInstance();
-        } else {
-            this.configAdapter = null;
-        }
+        this.configAdapter = configAdapter;
+        sslConfig = ssl;
+        this.nameService = nameService;
+        this.listenerPort = listenerPort;
         //security service included to force start order.
-        //name service included to force start order.
     }
 
+    /**
+     * Retrieve the NameService this CORBA server depends upon.
+     *
+     * @return The configured NameService instance.
+     */
+    public NameService getNameService() {
+        return nameService;
+    }
+
+    /**
+     * Setter attribute for the NameService.
+     *
+     * @param s      The new target name service.
+     */
+    public void setNameService(NameService s) {
+        nameService = s;
+    }
+
+    /**
+     * Get the optional TSSConfig object specified for this
+     * CORBABean server.
+     *
+     * @return The TSSConfig object (if any).
+     */
     public TSSConfig getTssConfig() {
         return tssConfig;
     }
 
+    /**
+     * Set a TSSConfig value for this CORBA instance.
+     *
+     * @param config The required TSSConfig information.
+     */
     public void setTssConfig(TSSConfig config) {
         if (config == null) config = new TSSConfig();
         this.tssConfig = config;
     }
 
+    /**
+     * Return the SSLConfig used for this ORB instance.
+     * if one has not been configured, this returns
+     * a default configuration.
+     *
+     * @return The SSLConfig object use to manage transport-level
+     *         security.
+     */
+    public SSLConfig getSslConfig() {
+        if (sslConfig == null) {
+            sslConfig = new SSLConfig();
+        }
+        return sslConfig;
+    }
+
+    /**
+     * Attribute setter for the SSL configuration.
+     *
+     * @param c      The new SSLConfig object used for secure communications.
+     */
+    public void setSslConfing(SSLConfig c) {
+        sslConfig = c;
+    }
+
+
+    /**
+     * Return the ORB instance created for this CORBABean.
+     *
+     * @return The ORB instance backing this bean.
+     */
     public ORB getORB() {
         return orb;
     }
@@ -86,66 +189,55 @@
         return new CORBAHandleDelegate();
     }
 
+    /**
+     * Get the root POA() instance associated with the ORB.
+     *
+     * @return The rootPOA instance obtained from the ORB.
+     */
     public POA getRootPOA() {
         return rootPOA;
     }
 
-    public ArrayList getArgs() {
-        return args;
-    }
-
-    public void setArgs(ArrayList args) {
-        if (args == null) args = new ArrayList();
-        this.args = args;
-    }
-
-    public Properties getProps() {
-        return props;
-    }
-
-    public void setProps(Properties props) {
-        if (props == null) props = new Properties();
-        this.props = props;
-    }
-
-
+    /**
+     * Retrieve the listener address (host/port combo) used
+     * by the ORB.
+     *
+     * @return An InetSocketAddress item identifying the end point
+     *         for the ORB.
+     */
     public InetSocketAddress getListenAddress() {
-        try {
-            if (configAdapter != null) {
-                return configAdapter.getDefaultListenAddress(tssConfig, orb);
-            } else {
-                log.debug("Don't know what default listen address is for an ORB without a configAdapter");
-            }
-        } catch (ConfigException e) {
-            log.debug("Unable to calculate default listen address", e);
-        }
-        return null;
+        return new InetSocketAddress(host, listenerPort);
     }
 
+    /**
+     * Start the ORB associated with this bean instance.
+     *
+     * @exception Exception
+     */
     public void doStart() throws Exception {
 
         ClassLoader savedLoader = Thread.currentThread().getContextClassLoader();
         try {
             Thread.currentThread().setContextClassLoader(classLoader);
 
-            if (configAdapter != null) {
-                orb = ORB.init(configAdapter.translateToArgs(tssConfig, args), configAdapter.translateToProps(tssConfig, props));
-                configAdapter.postProcess(tssConfig, orb);
-            } else {
-                orb = ORB.init((String[]) args.toArray(new String[args.size()]), props);
-            }
+            // make sure we've decided how the listener should be configured.
+            resolveListenerAddress();
+
+            // the config adapter creates the actual ORB instance for us.
+            orb = configAdapter.createServerORB(this);
 
+            // we set this ORB value into the Util.  The Util ORB is used for a lot of utility things, so
+            // we'll cache the first instance created.
             Util.setORB(orb);
 
+            // TSSBeans are going to need our rootPOA instance, so resolve this now.
             org.omg.CORBA.Object obj = orb.resolve_initial_references("RootPOA");
-
             rootPOA = POAHelper.narrow(obj);
-
         } finally {
             Thread.currentThread().setContextClassLoader(savedLoader);
         }
 
-        log.debug("Started CORBABean");
+        log.debug("CORBABean " + getURI() + " creating listener on port " + listenerPort);
     }
 
     public void doStop() throws Exception {
@@ -157,4 +249,64 @@
         log.warn("Failed CORBABean");
     }
 
+    /**
+     * Process the specified host/port information on
+     * both the bean and the TSSConfig to arrive at a
+     * target port.  This must be called prior to creating
+     * the ORB.
+     */
+    private void resolveListenerAddress() {
+        // if we have a config with a TSSSSLTransportConfig defined, the
+        // host and port from the config override bean-configured values.
+        if (tssConfig != null) {
+            TSSTransportMechConfig transportMech = tssConfig.getTransport_mech();
+            if (transportMech != null) {
+                if (transportMech instanceof TSSSSLTransportConfig) {
+                    TSSSSLTransportConfig transportConfig = (TSSSSLTransportConfig) transportMech;
+                    host = transportConfig.getHostname();
+                    listenerPort = transportConfig.getPort();
+                }
+            }
+        }
+        // now provide defaults for anything still needing resolving
+        if (host == null) {
+            try {
+                host = InetAddress.getLocalHost().getHostName();
+            } catch (UnknownHostException e) {
+                // just punt an use localhost as an absolute fallback.
+                host = "localhost";
+            }
+        }
+        if (listenerPort <= 0) {
+            // set this to the default?
+            listenerPort = DEFAULT_LISTENER_PORT;
+        }
+    }
+
+    /**
+     * Return the retrieval URI for this bean.
+     *
+     * @return The URI for the bean AbstractName;
+     */
+    public String getURI() {
+        return abstractName.toString();
+    }
+
+    /**
+     * Get the configured listener port.
+     *
+     * @return The configeration port value.
+     */
+    public int getPort() {
+        return listenerPort;
+    }
+
+    /**
+     * Get the configuration host name.
+     *
+     * @return The configuration host name.  The default is "localhost".
+     */
+    public String getHost() {
+        return host;
+    }
 }

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABeanGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABeanGBean.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABeanGBean.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CORBABeanGBean.java Tue Oct  3 12:29:42 2006
@@ -16,21 +16,20 @@
  */
 package org.apache.openejb.corba;
 
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
 import org.apache.geronimo.security.SecurityService;
-import org.apache.openejb.corba.security.config.tss.TSSConfig;
 import org.omg.CORBA.ORB;
 import org.omg.PortableServer.POA;
+import org.apache.openejb.corba.security.config.ConfigAdapter;
+import org.apache.openejb.corba.security.config.tss.TSSConfig;
+import org.apache.openejb.corba.security.config.ssl.SSLConfig;
 
 import javax.ejb.spi.HandleDelegate;
-import java.util.ArrayList;
-import java.util.Properties;
 import java.net.InetSocketAddress;
 
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-
 /**
  * @version $Revision$ $Date$
  */
@@ -41,10 +40,12 @@
     static {
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(CORBABeanGBean.class, "OpenEJB ORB Adapter", CORBABean.class, NameFactory.CORBA_SERVICE);
 
-        infoBuilder.addAttribute("configAdapter", String.class, true);
+        infoBuilder.addAttribute("abstractName", AbstractName.class, false);
+        infoBuilder.addReference("configAdapter", ConfigAdapter.class, NameFactory.ORB_CONFIG);
+        infoBuilder.addAttribute("host", String.class, true);
+        infoBuilder.addAttribute("port", int.class, true);
         infoBuilder.addAttribute("tssConfig", TSSConfig.class, true);
-        infoBuilder.addAttribute("args", ArrayList.class, true);
-        infoBuilder.addAttribute("props", Properties.class, true);
+        infoBuilder.addReference("nameService", NameService.class, NameFactory.CORBA_NAME_SERVICE);
 
         infoBuilder.addAttribute("listenAddress", InetSocketAddress.class, false);
         infoBuilder.addAttribute("ORB", ORB.class, false);
@@ -53,11 +54,10 @@
         infoBuilder.addAttribute("handleDelegate", HandleDelegate.class, false);
 
         infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
-        infoBuilder.addReference("ThreadPool", Executor.class, NameFactory.GERONIMO_SERVICE);
         infoBuilder.addReference("SecurityService", SecurityService.class, NameFactory.GERONIMO_SERVICE);
-        infoBuilder.addReference("NameService", SunNameService.class, NameFactory.CORBA_SERVICE);
+        infoBuilder.addReference("SSLConfig", SSLConfig.class, NameFactory.CORBA_SSL);
 
-        infoBuilder.setConstructor(new String[]{"configAdapter", "classLoader", "ThreadPool", "SecurityService", "NameService"});
+        infoBuilder.setConstructor(new String[]{"abstractName", "configAdapter", "host", "port", "classLoader", "SecurityService", "nameService", "SSLConfig"});
 
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBean.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBean.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBean.java Tue Oct  3 12:29:42 2006
@@ -19,6 +19,7 @@
 import edu.emory.mathcs.backport.java.util.concurrent.Executor;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.UserException;
@@ -27,9 +28,12 @@
 import org.omg.CosNaming.NamingContextExtHelper;
 import org.apache.openejb.corba.security.config.ConfigAdapter;
 import org.apache.openejb.corba.security.config.css.CSSConfig;
+import org.apache.openejb.corba.security.config.ssl.SSLConfig;
+import org.apache.openejb.corba.security.config.tss.TSSConfig;
 import org.apache.openejb.corba.transaction.ClientTransactionPolicyConfig;
 import org.apache.openejb.corba.transaction.nodistributedtransactions.NoDTxClientTransactionPolicyConfig;
 
+
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Properties;
@@ -37,39 +41,45 @@
 
 
 /**
+ * A CSSBean is an ORB instance configured for
+ * accessing EJBs using a specific security profile.  A single
+ * CSSBean can be referenced by multiple ejb-refs that share a
+ * common security profile.
+ *
+ * For each CSSBean instance, there will be a backing
+ * ORB configured with the appropriate interceptors and
+ * principal information to access the target object.
  * @version $Revision$ $Date$
  */
-public class CSSBean implements GBeanLifecycle {
+public class CSSBean implements GBeanLifecycle, ORBConfiguration {
 
     private final static Log log = LogFactory.getLog(CSSBean.class);
 
     private final ClassLoader classLoader;
-    private final Executor threadPool;
     private final ConfigAdapter configAdapter;
     private final TransactionManager transactionManager;
     private String description;
-    private CSSConfig nssConfig;
     private CSSConfig cssConfig;
-    private ORB nssORB;
+    private SSLConfig sslConfig;
     private ORB cssORB;
-    private ArrayList nssArgs;
-    private ArrayList cssArgs;
-    private Properties nssProps;
-    private Properties cssProps;
     private ClientContext context;
+    private AbstractName abstractName;
 
     public CSSBean() {
         this.classLoader = null;
-        this.threadPool = null;
         this.configAdapter = null;
         this.transactionManager = null;
+        this.abstractName = null;
+        this.sslConfig = null;
+        this.cssConfig = null;
     }
 
-    public CSSBean(String configAdapter, Executor threadPool, TransactionManager transactionManager, ClassLoader classLoader) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+    public CSSBean(AbstractName abstractName, ConfigAdapter configAdapter, TransactionManager transactionManager, SSLConfig ssl, ClassLoader classLoader) throws ClassNotFoundException, IllegalAccessException, InstantiationException {
+        this.abstractName = abstractName;
         this.classLoader = classLoader;
-        this.threadPool = threadPool;
         this.transactionManager = transactionManager;
-        this.configAdapter = (ConfigAdapter) classLoader.loadClass(configAdapter).newInstance();
+        this.configAdapter = configAdapter;
+        this.sslConfig = ssl;
     }
 
     public String getDescription() {
@@ -80,14 +90,6 @@
         this.description = description;
     }
 
-    public CSSConfig getNssConfig() {
-        return nssConfig;
-    }
-
-    public void setNssConfig(CSSConfig nssConfig) {
-        this.nssConfig = nssConfig;
-    }
-
     public CSSConfig getCssConfig() {
         return cssConfig;
     }
@@ -97,42 +99,37 @@
         this.cssConfig = config;
     }
 
-    public ORB getORB() {
-        return cssORB;
-    }
-
-    public ArrayList getNssArgs() {
-        return nssArgs;
-    }
-
-    public void setNssArgs(ArrayList nssArgs) {
-        this.nssArgs = nssArgs;
-    }
-
-    public ArrayList getCssArgs() {
-        return cssArgs;
-    }
-
-    public void setCssArgs(ArrayList cssArgs) {
-        if (cssArgs == null) cssArgs = new ArrayList();
-        this.cssArgs = cssArgs;
-    }
-
-    public Properties getNssProps() {
-        return nssProps;
-    }
-
-    public void setNssProps(Properties nssProps) {
-        this.nssProps = nssProps;
+    public TSSConfig getTssConfig() {
+        // just return a default no security one.
+        return new TSSConfig();
+    }
+
+    /**
+     * Return the SSLConfig used for this ORB instance.
+     * if one has not been configured, this returns
+     * a default configuration.
+     *
+     * @return The SSLConfig object use to manage transport-level
+     *         security.
+     */
+    public SSLConfig getSslConfig() {
+        if (sslConfig == null) {
+            sslConfig = new SSLConfig();
+        }
+        return sslConfig;
     }
 
-    public Properties getCssProps() {
-        return cssProps;
+    public ORB getORB() {
+        return cssORB;
     }
 
-    public void setCssProps(Properties cssProps) {
-        if (cssProps == null) cssProps = new Properties();
-        this.cssProps = cssProps;
+    /**
+     * Return the retrieval URI for this bean.
+     *
+     * @return The URI for the bean AbstractName;
+     */
+    public String getURI() {
+        return abstractName.toString();
     }
 
     public org.omg.CORBA.Object getHome(URI nsURI, String name) {
@@ -141,71 +138,50 @@
             log.debug(description + " - Looking up home from " + nsURI.toString() + " at " + name);
 
         try {
-            org.omg.CORBA.Object ref = nssORB.string_to_object(nsURI.toString());
+            org.omg.CORBA.Object ref = cssORB.string_to_object(nsURI.toString());
             NamingContextExt ic = NamingContextExtHelper.narrow(ref);
 
             NameComponent[] nameComponent = ic.to_name(name);
-            org.omg.CORBA.Object bean = ic.resolve(nameComponent);
-            String beanIOR = nssORB.object_to_string(bean);
 
             ClientContext oldClientContext = ClientContextManager.getClientContext();
             try {
                 ClientContextManager.setClientContext(context);
-                bean = cssORB.string_to_object(beanIOR);
+                return ic.resolve(nameComponent);
             } finally {
                 ClientContextManager.setClientContext(oldClientContext);
             }
-
-            return bean;
         } catch (UserException ue) {
             log.error(description + " - Looking up home", ue);
             throw new RuntimeException(ue);
         }
     }
 
+    /**
+     * Start this GBean instance, which essentially
+     * sets up an ORB and configures a client context
+     * for handling requests.
+     *
+     * @exception Exception
+     */
     public void doStart() throws Exception {
 
+        // we create a dummy CSSConfig if one has not be specified prior to this.
         if (cssConfig == null) {
             cssConfig = new CSSConfig();
         }
-        if (cssArgs == null) {
-            cssArgs = new ArrayList();
-        }
-        if (cssProps == null) {
-            cssProps = new Properties();
-        }
-
-        if (nssConfig == null) {
-            if (log.isDebugEnabled()) log.debug("Defaulting NSS config to be CSS config");
-            nssConfig = cssConfig;
-        }
-        if (nssArgs == null) {
-            if (log.isDebugEnabled()) log.debug("Defaulting NSS args to be CSS args");
-            nssArgs = cssArgs;
-        }
-        if (nssProps == null) {
-            if (log.isDebugEnabled()) log.debug("Defaulting NSS props to be CSS props");
-            nssProps = cssProps;
-        }
 
         ClassLoader savedLoader = Thread.currentThread().getContextClassLoader();
         try {
-            Thread.currentThread().setContextClassLoader(classLoader);
-
-            if (log.isDebugEnabled()) log.debug("Starting NameService ORB");
+            log.debug("Starting CSS ORB " + getURI());
 
-            nssORB = ORB.init(configAdapter.translateToArgs(nssConfig, nssArgs), configAdapter.translateToProps(nssConfig, nssProps));
-            configAdapter.postProcess(nssConfig, nssORB);
-
-            if (log.isDebugEnabled()) log.debug("Starting CSS ORB");
-
-            cssORB = ORB.init(configAdapter.translateToArgs(cssConfig, cssArgs), configAdapter.translateToProps(cssConfig, cssProps));
-            configAdapter.postProcess(cssConfig, cssORB);
+            Thread.currentThread().setContextClassLoader(classLoader);
+            // the configAdapter creates the ORB instance for us.
+            cssORB = configAdapter.createClientORB(this);
 
+            // create a client context with the security and transaction characteristics.
             context = new ClientContext();
             context.setSecurityConfig(cssConfig);
             context.setTransactionConfig(buildClientTransactionPolicyConfig());
-
         } finally {
             Thread.currentThread().setContextClassLoader(savedLoader);
         }
@@ -218,7 +194,6 @@
     }
 
     public void doStop() throws Exception {
-        nssORB.destroy();
         cssORB.destroy();
         log.debug("Stopped CORBA Client Security Server - " + description);
     }

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBeanGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBeanGBean.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBeanGBean.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/CSSBeanGBean.java Tue Oct  3 12:29:42 2006
@@ -19,7 +19,9 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.openejb.corba.security.config.ConfigAdapter;
 import org.apache.openejb.corba.security.config.css.CSSConfig;
+import org.apache.openejb.corba.security.config.ssl.SSLConfig;
 import org.omg.CORBA.ORB;
 
 import java.util.ArrayList;
@@ -28,8 +30,6 @@
 
 import javax.transaction.TransactionManager;
 
-import edu.emory.mathcs.backport.java.util.concurrent.Executor;
-
 /**
  * @version $Revision$ $Date$
  */
@@ -40,22 +40,17 @@
     static {
         GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(CSSBeanGBean.class, CSSBean.class, NameFactory.CORBA_CSS);
 
-        infoFactory.addAttribute("configAdapter", String.class, true);
+        infoFactory.addReference("configAdapter", ConfigAdapter.class, NameFactory.ORB_CONFIG);
         infoFactory.addAttribute("description", String.class, true);
-        infoFactory.addAttribute("nssConfig", CSSConfig.class, true);
         infoFactory.addAttribute("cssConfig", CSSConfig.class, true);
         infoFactory.addAttribute("ORB", ORB.class, false);
-        infoFactory.addAttribute("nssArgs", ArrayList.class, true);
-        infoFactory.addAttribute("cssArgs", ArrayList.class, true);
-        infoFactory.addAttribute("nssProps", Properties.class, true);
-        infoFactory.addAttribute("cssProps", Properties.class, true);
         infoFactory.addOperation("getHome", new Class[]{URI.class, String.class});
 
-        infoFactory.addReference("ThreadPool", Executor.class, NameFactory.GERONIMO_SERVICE);
         infoFactory.addReference("TransactionManager", TransactionManager.class, NameFactory.TRANSACTION_MANAGER);
+        infoFactory.addReference("SSLConfig", SSLConfig.class, NameFactory.CORBA_SSL);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
-        infoFactory.setConstructor(new String[]{"configAdapter", "ThreadPool", "TransactionManager", "classLoader"});
+        infoFactory.setConstructor(new String[]{"configAdapter", "TransactionManager", "SSLConfig", "classLoader"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,186 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+import org.apache.openejb.corba.security.config.ConfigAdapter;
+
+import java.net.InetSocketAddress;
+
+/**
+ * Starts the openejb transient cos naming service.
+ * <p/>
+ * <gbean name="NameServer" class="org.apache.openejb.corba.NameService">
+ * <reference name="ServerInfo">
+ * <reference name="ConfigAdapter">
+ * <attribute name="port">2809</attribute>
+ * <attribute name="host">localhost</attribute>
+ * </gbean>
+ *
+ * @version $Revision$ $Date$
+ */
+public class NameService implements GBeanLifecycle {
+    private static final Log log = LogFactory.getLog(NameService.class);
+
+    // the ORB configurator
+    private final ConfigAdapter config;
+    // the name service instance
+    private Object service;
+    // the name service listening port
+    private final int port;
+    // the published port name (defaults to "localhost").
+    private String host;
+    // indicates whether we start and host this server locally.
+    private boolean localServer;
+
+    protected NameService() {
+        service = null;
+        config = null;
+        port = -1;
+        host = "localhost";
+        localServer = true;
+    }
+
+    /**
+     * GBean constructor to create a NameService instance.
+     *
+     * @param serverInfo The dependent ServerInfo.  This value is not used,
+     *                   but is in the constructor to create an ordering
+     *                   dependency.
+     * @param config     The ORB ConfigAdapter used to create the real
+     *                   NameService instance.
+     * @param host       The advertised host name.
+     * @param port       The listener port.
+     *
+     * @exception Exception
+     */
+    public NameService(ServerInfo serverInfo, ConfigAdapter config, String host, int port) throws Exception {
+        this.host = host;
+        this.port = port;
+        this.config = config;
+        localServer = true;
+        service = null;
+        // if not specified, our default host is "localhost".
+        if (host == null) {
+            host = "localhost";
+        }
+    }
+
+    /**
+     * Retrieve the host name for this NameService instance.
+     *
+     * @return The String host name.
+     */
+    public String getHost() {
+        return host;
+    }
+
+    /**
+     * Get the port information for this NameService instance.
+     *
+     * @return The configured name service listener port.
+     */
+    public int getPort() {
+        return port;
+    }
+
+    /**
+     * Get the "local" value for this server.  If true, an
+     * in-process NameService instance will be created when
+     * the service is started.  If false, this is an
+     * indirect reference to a NameService (possibly located
+     * elsewhere).
+     *
+     * @return The current localServer value.  The default is
+     *         true.
+     */
+    public boolean getLocal() {
+        return localServer;
+    }
+
+    /**
+     * Get the "local" value for this server.  If true, an
+     * in-process NameService instance will be created when
+     * the service is started.  If false, this is an
+     * indirect reference to a NameService (possibly located
+     * elsewhere).
+     *
+     * @param l      The new local setting.
+     */
+    public void setLocal(boolean l) {
+        localServer = l;
+    }
+
+    /**
+     * Get the InetSocketAddress for this NameService.
+     *
+     * @return An InetSocketAddress containing the host and port
+     *         information.
+     */
+    public InetSocketAddress getAddress() {
+        return new InetSocketAddress(host, getPort());
+    }
+
+
+    /**
+     * Return the NameService locator as a URI (generally
+     * using the corbaloc:: protocol);
+     *
+     * @return The URI in String format.
+     */
+    public String getURI() {
+        return "corbaloc::" + host + ":" + port + "/NameService";
+    }
+
+    /**
+     * Start the NameService instance.  If the local
+     * setting is true, will launch an appropriate
+     * in-process name server instance.
+     *
+     * @exception Exception
+     */
+    public void doStart() throws Exception {
+        if (localServer) {
+            service = config.createNameService(host, port);
+            log.debug("Started transient CORBA name service on port " + port);
+        }
+    }
+
+    /**
+     * Stop the name server.  Only has an effect if doStart()
+     * launched an NameServer instance.
+     *
+     * @exception Exception
+     */
+    public void doStop() throws Exception {
+        if (service != null) {
+            config.destroyNameService(service);
+            log.debug("Stopped transient CORBA name service on port " + port);
+        }
+    }
+
+    public void doFail() {
+        if (service != null) {
+            config.destroyNameService(service);
+            log.warn("Failed transient CORBA name service on port " + port);
+        }
+    }
+}

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameService.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,52 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.system.serverinfo.ServerInfo;
+
+import org.apache.openejb.corba.security.config.ConfigAdapter;
+
+import java.net.InetSocketAddress;
+
+/**
+ * @version $Revision$ $Date$
+ */
+public final class NameServiceGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(NameServiceGBean.class, "CORBA Naming Service", NameService.class, NameFactory.CORBA_NAME_SERVICE);
+
+        infoFactory.addReference("ServerInfo", ServerInfo.class, NameFactory.GERONIMO_SERVICE);
+        infoFactory.addReference("configAdapter", ConfigAdapter.class, NameFactory.ORB_CONFIG);
+        infoFactory.addAttribute("host", String.class, true);
+        infoFactory.addAttribute("port", int.class, true);
+        infoFactory.addAttribute("address", InetSocketAddress.class, false);
+        infoFactory.addAttribute("local", boolean.class, true);
+        infoFactory.setConstructor(new String[]{"ServerInfo", "configAdapter", "host", "port"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/NameServiceGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,42 @@
+/**
+ *
+ * Copyright 2006 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.openejb.corba;
+
+import org.apache.openejb.corba.security.config.tss.TSSConfig;
+import org.apache.openejb.corba.security.config.ssl.SSLConfig;
+
+/**
+ * Interface implemented by both CORBABean and CSSBean
+ * to provide common configuration information to
+ * ConfigAdapter instances.
+ * @version $Revision$ $Date$
+ */
+public interface ORBConfiguration {
+    /**
+     * Provide the SSLConfig information to the ConfigAdapter.
+     *
+     * @return A configured SSLConfig GBean.
+     */
+    SSLConfig getSslConfig();
+    /**
+     * Retrieve the TSSConfig settings to a ConfigAdapter instance.
+     *
+     * @return An appropriate TSSConfig object containing transport-level
+     *         security information.
+     */
+    TSSConfig getTssConfig();
+}

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/ORBConfiguration.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/TSSBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/TSSBean.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/TSSBean.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/TSSBean.java Tue Oct  3 12:29:42 2006
@@ -40,9 +40,16 @@
 import java.util.HashMap;
 import java.util.Map;
 
-/**
- * @version $Revision$ $Date$
- */
+ /**
+  * A TSSBean represents a transport-level security profile for exported EJB objects.  An
+  * exported object is attached to a TSSBean-created named POA.  The TSSBean POA
+  * is created in the context of the ORB controlled by a CORBABean instance.
+  * The parent CORBABean controls the transport-level security of the host connection and
+  * defines the endpoint connnection for the object (host and listener port).
+  * TSSBean may then define additional characteristics that
+  * get encoded in the IOR of the connection.
+  * @version $Revision$ $Date$
+  */
 public class TSSBean implements GBeanLifecycle {
 
     private final Log log = LogFactory.getLog(TSSBean.class);

Modified: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapter.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapter.java?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapter.java (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapter.java Tue Oct  3 12:29:42 2006
@@ -22,8 +22,8 @@
 
 import org.omg.CORBA.ORB;
 
-import org.apache.openejb.corba.security.config.css.CSSConfig;
-import org.apache.openejb.corba.security.config.tss.TSSConfig;
+import org.apache.openejb.corba.CORBABean;
+import org.apache.openejb.corba.CSSBean;
 
 
 /**
@@ -33,17 +33,42 @@
  */
 public interface ConfigAdapter {
 
-    public String[] translateToArgs(TSSConfig config, List args) throws ConfigException;
-
-    public Properties translateToProps(TSSConfig config, Properties props) throws ConfigException;
-
-    public void postProcess(TSSConfig config, ORB orb) throws ConfigException;
-
-    public InetSocketAddress getDefaultListenAddress(TSSConfig config, ORB orb) throws ConfigException;
-
-    public String[] translateToArgs(CSSConfig config, List args) throws ConfigException;
-
-    public Properties translateToProps(CSSConfig config, Properties pros) throws ConfigException;
-
-    public void postProcess(CSSConfig config, ORB orb) throws ConfigException;
+    /**
+     * Create an ORB for a CORBABean server context.
+     *
+     * @param server The CORBABean that owns this ORB's configuration.
+     *
+     * @return An ORB instance configured for the CORBABean.
+     * @exception ConfigException
+     */
+    public ORB createServerORB(CORBABean server)  throws ConfigException;
+    /**
+     * Create an ORB for a CSSBean client context.
+     *
+     * @param client The configured CSSBean used for access.
+     *
+     * @return An ORB instance configured for this client access.
+     * @exception ConfigException
+     */
+    public ORB createClientORB(CSSBean client)  throws ConfigException;
+
+    /**
+     * Create a transient name service instance using the
+     * specified host name and port.
+     *
+     * @param host   The String host name.
+     * @param port   The port number of the listener.
+     *
+     * @return An opaque object that represents the name service.
+     * @exception ConfigException
+     */
+    public Object createNameService(String host, int port) throws ConfigException;
+    /**
+     * Destroy a name service instance created by a
+     * prior call to createNameService().
+     *
+     * @param ns     The opaque name service object returned from a
+     *               prior call to createNameService().
+     */
+    public void destroyNameService(Object ns);
 }

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,54 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba.security.config;
+
+import java.util.Properties;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+
+/**
+ * A generic GBean that provides for the configuration of an ORB config adaptor.
+ * @version $Rev$ $Date$
+ */
+public class ConfigAdapterGBean {
+
+    /**
+     * Construct an instance of ConfigAdaptorGBean
+     */
+    public ConfigAdapterGBean() {
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ConfigAdapterGBean.class, ConfigAdapterGBean.class);
+        infoFactory.setConstructor(new String[]{});
+        infoFactory.addInterface(org.apache.openejb.corba.security.config.ConfigAdapter.class);
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}
+

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ConfigAdapterGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,164 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba.security.config.ssl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.omg.CSIIOP.Confidentiality;
+import org.omg.CSIIOP.EstablishTrustInTarget;
+import org.omg.CSIIOP.NoProtection;
+
+
+/**
+ * @version $Revision$ $Date$
+ */
+public final class SSLCipherSuiteDatabase {
+
+    /**
+     * A map for stroing all the cipher suites.
+     */
+    private static final Map SUITES = new HashMap();
+
+    static {
+        // No protection
+        Integer noProt = new Integer(NoProtection.value);
+        SUITES.put("SSL_NULL_WITH_NULL_NULL", noProt);
+        SUITES.put("TLS_NULL_WITH_NULL_NULL", noProt);
+
+        // No authentication
+        Integer noAuth = new Integer(Confidentiality.value);
+        SUITES.put("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA", noAuth);
+        SUITES.put("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5", noAuth);
+        SUITES.put("SSL_DH_anon_WITH_3DES_EDE_CBC_SHA", noAuth);
+        SUITES.put("SSL_DH_anon_WITH_RC4_128_MD5", noAuth);
+        SUITES.put("SSL_DH_anon_WITH_DES_CBC_SHA", noAuth);
+
+        SUITES.put("TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA", noAuth);
+        SUITES.put("TLS_DH_anon_EXPORT_WITH_RC4_40_MD5", noAuth);
+        SUITES.put("TLS_DH_anon_WITH_3DES_EDE_CBC_SHA", noAuth);
+        SUITES.put("TLS_DH_anon_WITH_RC4_128_MD5", noAuth);
+        SUITES.put("TLS_DH_anon_WITH_DES_CBC_SHA", noAuth);
+
+        // No encryption
+        Integer noEnc = new Integer(EstablishTrustInTarget.value);
+        SUITES.put("SSL_RSA_WITH_NULL_MD5", noEnc);
+        SUITES.put("SSL_RSA_WITH_NULL_SHA", noEnc);
+
+        SUITES.put("TLS_RSA_WITH_NULL_MD5", noEnc);
+        SUITES.put("TLS_RSA_WITH_NULL_SHA", noEnc);
+
+        // Auth and encrypt
+        Integer authEnc = new Integer(EstablishTrustInTarget.value | Confidentiality.value);
+        SUITES.put("SSL_DHE_DSS_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("SSL_RSA_WITH_RC4_128_MD5", authEnc);
+        SUITES.put("SSL_RSA_WITH_RC4_128_SHA", authEnc);
+        SUITES.put("SSL_RSA_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("SSL_RSA_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("SSL_RSA_EXPORT_WITH_RC4_40_MD5", authEnc);
+
+        SUITES.put("TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_DHE_DSS_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_DHE_RSA_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_DSS_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_DH_RSA_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_RC2_CBC_40_MD5", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_RC2_CBC_40_SHA", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_RC4_40_MD5", authEnc);
+        SUITES.put("TLS_KRB5_EXPORT_WITH_RC4_40_SHA", authEnc);
+        SUITES.put("TLS_KRB5_WITH_3DES_EDE_CBC_MD5", authEnc);
+        SUITES.put("TLS_KRB5_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_KRB5_WITH_DES_CBC_MD5", authEnc);
+        SUITES.put("TLS_KRB5_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_KRB5_WITH_RC4_128_MD5", authEnc);
+        SUITES.put("TLS_KRB5_WITH_RC4_128_SHA", authEnc);
+        SUITES.put("TLS_RSA_EXPORT_WITH_DES40_CBC_SHA", authEnc);
+        SUITES.put("TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5", authEnc);
+        SUITES.put("TLS_RSA_EXPORT_WITH_RC4_40_MD5", authEnc);
+        SUITES.put("TLS_RSA_WITH_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("TLS_RSA_WITH_DES_CBC_SHA", authEnc);
+        SUITES.put("TLS_RSA_WITH_RC4_128_MD5", authEnc);
+        SUITES.put("TLS_RSA_WITH_RC4_128_SHA", authEnc);
+
+        // RSA supported cipher suite names differ from Sun's
+        SUITES.put("RSA_Export_With_RC2_40_CBC_MD5", authEnc);
+        SUITES.put("RSA_With_DES_CBC_SHA", authEnc);
+        SUITES.put("RSA_Export_With_RC4_40_MD5", authEnc);
+        SUITES.put("RSA_With_RC4_SHA", authEnc);
+        SUITES.put("RSA_With_3DES_EDE_CBC_SHA", authEnc);
+        SUITES.put("RSA_Export_With_DES_40_CBC_SHA", authEnc);
+        SUITES.put("RSA_With_RC4_MD5", authEnc);
+    }
+
+    /**
+     * Do not allow instances of this class.
+     */
+    private SSLCipherSuiteDatabase() {
+    }
+
+    /**
+     * Return an array of cipher suites that match the assocRequires and
+     * assocSupports options.
+     *
+     * @param assocRequires         The required associations.
+     * @param assocSupports         The supported associations.
+     * @param supportedCipherSuites The overall supported cipher suites.
+     * @return The cipher suites that matches the two options.
+     */
+    public static String[] getCipherSuites(int assocRequires, int assocSupports, String[] supportedCipherSuites) {
+
+        assocRequires = assocRequires & (EstablishTrustInTarget.value | Confidentiality.value | NoProtection.value);
+        assocSupports = assocSupports & (EstablishTrustInTarget.value | Confidentiality.value | NoProtection.value);
+
+        ArrayList col = new ArrayList();
+        for (int i = 0; i < supportedCipherSuites.length; ++i) {
+            Integer val = (Integer) SUITES.get(supportedCipherSuites[i]);
+
+            if (val != null && ((assocRequires & ~val.intValue()) == 0 && (val.intValue() & ~assocSupports) == 0)) {
+                col.add(supportedCipherSuites[i]);
+            }
+        }
+
+        String[] ret = new String[col.size()];
+        col.toArray(ret);
+
+        return ret;
+    }
+
+    /**
+     * Return the options values for a cipher suite.
+     *
+     * @param cypherSuite The cipher suite to get the options value for.
+     * @return The int value for the cipher suite.
+     */
+    public static int getAssociaionOptions(String cypherSuite) {
+        return ((Integer) SUITES.get(cypherSuite)).intValue();
+    }
+}
+

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLCipherSuiteDatabase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,259 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba.security.config.ssl;
+
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocketFactory;
+import org.apache.geronimo.management.geronimo.KeyIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
+
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.UnrecoverableKeyException;
+
+import org.apache.openejb.corba.security.config.tss.TSSConfig;
+
+/**
+ * An active SSL configuration.  The SSL configuration
+ * identifies the KeystoreManager instance to be used
+ * for SSL connections, as well as the specifics
+ * of the certificates to be used for the connections.
+ *
+ * The socket factories attached to the CORBA ORBs
+ * used the SSLConfig to retrieve SocketFactory instances
+ * for creating the secure sockets.
+ * @version $Rev$ $Date$
+ */
+public class SSLConfig {
+    private KeystoreManager manager;
+    private String provider;
+    private String keyStore;
+    private String trustStore;
+    private String keyAlias;
+    private String algorithm = "default";
+    private String protocol = "SSL";
+
+    /**
+     * Default GBean constructor.
+     */
+    public SSLConfig() {
+        manager = null;
+    }
+
+    /**
+     * "Normal" constructor for config items.
+     *
+     * @param keystoreManager
+     *               The keystoreManager instance used to create SSL sockets
+     *               for this configuration.
+     */
+    public SSLConfig(KeystoreManager keystoreManager) {
+        manager = keystoreManager;
+    }
+
+
+    /**
+     * Create an SSLServerSocketFactory instance for creating
+     * server-side SSL connections.
+     *
+     * @param loader The class loader used to resolve classes required
+     *               by the KeystoreManager.
+     *
+     * @return An SSLServerSocketFactory instance created with the
+     *         SSLConfig specifices.
+     * @throws KeystoreIsLocked
+     *                Occurs when the requested key keystore cannot
+     *                be used because it has not been unlocked.
+     * @throws KeyIsLocked
+     *                Occurs when the requested private key in the key
+     *                keystore cannot be used because it has not been
+     *                unlocked.
+     * @throws NoSuchAlgorithmException
+     * @throws UnrecoverableKeyException
+     * @throws KeyStoreException
+     * @throws KeyManagementException
+     * @throws NoSuchProviderException
+     */
+    public SSLSocketFactory createSSLFactory(ClassLoader loader) throws KeystoreIsLocked, KeyIsLocked, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException, NoSuchProviderException {
+        if (manager != null) {
+            // the keystore manager does all of the heavy lifting
+            return manager.createSSLFactory(provider, protocol, algorithm, keyStore, keyAlias, trustStore, loader);
+        }
+        else {
+            return (SSLSocketFactory) SSLSocketFactory.getDefault();
+        }
+    }
+
+    /**
+     * Create an SSLSocketFactory instance for creating
+     * client-side SSL connections.
+     *
+     * @param loader The class loader used to resolve classes required
+     *               by the KeystoreManager.
+     *
+     * @return An SSLSocketFactory instance created with the
+     *         SSLConfig specifices.
+     * @throws KeystoreIsLocked
+     *                Occurs when the requested key keystore cannot
+     *                be used because it has not been unlocked.
+     * @throws KeyIsLocked
+     *                Occurs when the requested private key in the key
+     *                keystore cannot be used because it has not been
+     *                unlocked.
+     * @throws NoSuchAlgorithmException
+     * @throws UnrecoverableKeyException
+     * @throws KeyStoreException
+     * @throws KeyManagementException
+     * @throws NoSuchProviderException
+     */
+    public SSLServerSocketFactory createSSLServerFactory(ClassLoader loader) throws KeystoreIsLocked, KeyIsLocked, NoSuchAlgorithmException, UnrecoverableKeyException, KeyStoreException, KeyManagementException, NoSuchProviderException {
+        if (manager != null) {
+            // the keystore manager does all of the heavy lifting
+            return manager.createSSLServerFactory(provider, protocol, algorithm, keyStore, keyAlias, trustStore, loader);
+        }
+        else {
+            return (SSLServerSocketFactory) SSLServerSocketFactory.getDefault();
+        }
+    }
+
+    /**
+     * Get the protocol to be used by this SSL configuration.
+     * Normally, this is just "SSL".
+     *
+     * @return The String name of the configuration protocol.
+     */
+    public String getProtocol() {
+        return protocol;
+    }
+
+    /**
+     * Set the protocol to be used by this configuration.
+     *
+     * @param protocol The new protocol name.
+     */
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+
+    /**
+     * Retrieve the encryption provider to be used for
+     * these connnections.
+     *
+     * @return The current provider name.
+     */
+    public String getProvider() {
+        return provider;
+    }
+
+    /**
+     * Set a new encryption provider for the SSL access.
+     *
+     * @param provider The new provider name.
+     */
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    /**
+     * The encryption algorithm to use.
+     *
+     * @return The current encryption algorithm.
+     */
+    public String getAlgorithm() {
+        return algorithm;
+    }
+
+    /**
+     * Algorithm to use.
+     * As different JVMs have different implementations available, the default algorithm can be used by supplying the value "Default".
+     *
+     * @param algorithm the algorithm to use, or "Default" to use the default from {@link javax.net.ssl.KeyManagerFactory#getDefaultAlgorithm()}
+     */
+    public void setAlgorithm(String algorithm) {
+        // cache the value so the null
+        algorithm = algorithm;
+        if ("default".equalsIgnoreCase(algorithm)) {
+            algorithm = KeyManagerFactory.getDefaultAlgorithm();
+        }
+    }
+
+    /**
+     * Set the name of the keystore to be used for this
+     * connection.  This must be the name of a keystore
+     * stored within the KeystoreManager instance.
+     *
+     * @param keyStore The key store String name.
+     */
+    public void setKeyStore(String keyStore) {
+        this.keyStore = keyStore;
+    }
+
+    /**
+     * Retrieve the name of the keystore.
+     *
+     * @return The String key store name.
+     */
+    public String getKeyStore() {
+        return keyStore;
+    }
+
+    /**
+     * Set the name of the truststore to be used for
+     * connections.  The truststore must map to one
+     * managed by the KeystoreManager instance.
+     *
+     * @param trustStore The new trustStore name.
+     */
+    public void setTrustStore(String trustStore) {
+        this.trustStore = trustStore;
+    }
+
+    /**
+     * Retrieve the in-use truststore name.
+     *
+     * @return The String name of the trust store.
+     */
+    public String getTrustStore() {
+        return trustStore;
+    }
+
+    /**
+     * Set the key alias to be used for the connection.
+     *
+     * @param keyAlias The String name of the key alias.
+     */
+    public void setKeyAlias(String keyAlias) {
+        this.keyAlias = keyAlias;
+    }
+
+    /**
+     * Retrieve the key alias name to use.
+     *
+     * @return The String name of the key alias.
+     */
+    public String getKeyAlias() {
+        return keyAlias;
+    }
+}
+

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfig.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java?view=auto&rev=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java (added)
+++ incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java Tue Oct  3 12:29:42 2006
@@ -0,0 +1,66 @@
+/**
+  * Licensed to the Apache Software Foundation (ASF) under one or more
+  * contributor license agreements.  See the NOTICE file distributed with
+  * this work for additional information regarding copyright ownership.
+  * The ASF licenses this file to You under the Apache License, Version 2.0
+  * (the "License"); you may not use this file except in compliance with
+  * the License.  You may obtain a copy of the License at
+  *
+  *     http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS,
+  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  * See the License for the specific language governing permissions and
+  * limitations under the License.
+  */
+package org.apache.openejb.corba.security.config.ssl;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+import org.apache.geronimo.management.geronimo.KeystoreManager;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLServerSocketFactory;
+import javax.net.ssl.SSLSocketFactory;
+import org.apache.geronimo.management.geronimo.KeyIsLocked;
+import org.apache.geronimo.management.geronimo.KeystoreIsLocked;
+
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.UnrecoverableKeyException;
+
+import org.apache.openejb.corba.security.config.tss.TSSConfig;
+
+/**
+ * Implementation of an SSLConfigGBean
+ *
+ * @version $Rev$ $Date$
+ */
+public class SSLConfigGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(SSLConfigGBean.class, "SSL Configuration Adapater", SSLConfig.class, NameFactory.CORBA_SSL);
+        infoBuilder.addAttribute("provider", String.class, true, true);
+        infoBuilder.addAttribute("protocol", String.class, true, true);
+        infoBuilder.addAttribute("algorithm", String.class, true, true);
+        infoBuilder.addAttribute("keyStore", String.class, true, true);
+        infoBuilder.addAttribute("keyAlias", String.class, true, true);
+        infoBuilder.addAttribute("trustStore", String.class, true, true);
+        infoBuilder.addReference("KeystoreManager", KeystoreManager.class, NameFactory.GERONIMO_SERVICE);
+        infoBuilder.setConstructor(new String[]{"KeystoreManager"});
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}
+

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: incubator/openejb/trunk/openejb2/modules/openejb-core/src/main/java/org/apache/openejb/corba/security/config/ssl/SSLConfigGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: incubator/openejb/trunk/openejb2/modules/openejb-pkgen-builder/pom.xml
URL: http://svn.apache.org/viewvc/incubator/openejb/trunk/openejb2/modules/openejb-pkgen-builder/pom.xml?view=diff&rev=452600&r1=452599&r2=452600
==============================================================================
--- incubator/openejb/trunk/openejb2/modules/openejb-pkgen-builder/pom.xml (original)
+++ incubator/openejb/trunk/openejb2/modules/openejb-pkgen-builder/pom.xml Tue Oct  3 12:29:42 2006
@@ -71,7 +71,7 @@
                 </executions>
             </plugin>
         </plugins>
-        
+
     </build>
 
 </project>



Mime
View raw message