geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickmcgu...@apache.org
Subject svn commit: r527288 - in /geronimo/server/trunk: configs/client-corba-yoko/ configs/client-corba-yoko/src/plan/ modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/ modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/ mod...
Date Tue, 10 Apr 2007 20:37:59 GMT
Author: rickmcguire
Date: Tue Apr 10 13:37:58 2007
New Revision: 527288

URL: http://svn.apache.org/viewvc?view=rev&rev=527288
Log:
Fix client ORB configuration problems that would not allow tssconfig information to be specified
on the client ORB. Also propagate the TSSCONFIG information to IORs for objects published
on the rootPOA. 


Modified:
    geronimo/server/trunk/configs/client-corba-yoko/pom.xml
    geronimo/server/trunk/configs/client-corba-yoko/src/plan/plan.xml
    geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CORBABean.java
    geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CSSBean.java
    geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/IORSecurityInterceptor.java
    geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/SecurityInitializer.java
    geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/util/Util.java
    geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java
    geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/SocketFactory.java

Modified: geronimo/server/trunk/configs/client-corba-yoko/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/client-corba-yoko/pom.xml?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/configs/client-corba-yoko/pom.xml (original)
+++ geronimo/server/trunk/configs/client-corba-yoko/pom.xml Tue Apr 10 13:37:58 2007
@@ -128,7 +128,7 @@
                         <deploymentConfig>${gbeanDeployer}</deploymentConfig>
                         <!--<deploymentConfig>${j2eeDeployer}</deploymentConfig>-->
                         <!--<deploymentConfig>${openejbDeployer}</deploymentConfig>-->
-                        <!--<deploymentConfig>${openejbcorbaDeployer}</deploymentConfig>-->
+                        <deploymentConfig>${openejbcorbaDeployer}</deploymentConfig>
                     </deploymentConfigs>
                 </configuration>
             </plugin>

Modified: geronimo/server/trunk/configs/client-corba-yoko/src/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/configs/client-corba-yoko/src/plan/plan.xml?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/configs/client-corba-yoko/src/plan/plan.xml (original)
+++ geronimo/server/trunk/configs/client-corba-yoko/src/plan/plan.xml Tue Apr 10 13:37:58
2007
@@ -48,7 +48,6 @@
 
     </gbean>
 
-
     <gbean name="Server" class="org.apache.geronimo.corba.CORBABeanGBean">
         <reference name="ConfigAdapter">
             <name>ORBConfigAdapter</name>
@@ -56,7 +55,9 @@
         <reference name="NameService">
             <name>NameServerRef</name>
         </reference>
+        <reference name="SSLConfig">
+            <name>CORBASSLConfig</name>
+        </reference>
     </gbean>
-
 
 </module>

Modified: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CORBABean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CORBABean.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CORBABean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CORBABean.java
Tue Apr 10 13:37:58 2007
@@ -27,6 +27,8 @@
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.InvalidConfigurationException; 
+import org.apache.geronimo.corba.security.ServerPolicy;
+import org.apache.geronimo.corba.security.ServerPolicyFactory;
 import org.apache.geronimo.corba.security.config.ConfigAdapter;
 import org.apache.geronimo.corba.security.config.ssl.SSLConfig;
 import org.apache.geronimo.corba.security.config.tss.TSSConfig;
@@ -34,6 +36,7 @@
 import org.apache.geronimo.corba.security.config.tss.TSSTransportMechConfig;
 import org.apache.geronimo.corba.util.Util;
 import org.apache.geronimo.openejb.OpenEjbSystem; 
+import org.omg.CORBA.Any;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.Policy;
 import org.omg.PortableServer.POA;
@@ -225,6 +228,8 @@
 
             // make sure we've decided how the listener should be configured.
             resolveListenerAddress();
+            // register this so we can retrieve this in the interceptors 
+            Util.registerORB(getURI(), this); 
 
             log.debug("CORBABean " + getURI() + " creating listener on port " + listenerPort);
             // the config adapter creates the actual ORB instance for us.
@@ -233,7 +238,7 @@
             // 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);
@@ -253,6 +258,8 @@
 
     public void doStop() throws Exception {
         orb.destroy();
+        // remove this from the registry 
+        Util.unregisterORB(getURI()); 
         log.debug("Stopped CORBABean");
     }
 

Modified: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CSSBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CSSBean.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CSSBean.java
(original)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/CSSBean.java
Tue Apr 10 13:37:58 2007
@@ -33,6 +33,7 @@
 import org.apache.geronimo.corba.transaction.ClientTransactionPolicyConfig;
 import org.apache.geronimo.corba.transaction.ClientTransactionPolicy;
 import org.apache.geronimo.corba.transaction.nodistributedtransactions.NoDTxClientTransactionPolicyConfig;
+import org.apache.geronimo.corba.util.Util;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.UserException;
 import org.omg.CORBA.PolicyManager;
@@ -190,6 +191,8 @@
             log.debug("Starting CSS ORB " + getURI());
 
             Thread.currentThread().setContextClassLoader(classLoader);
+            // register this so we can retrieve this in the interceptors 
+            Util.registerORB(getURI(), this); 
 
             // create an ORB using the name service.
             nssORB = configAdapter.createNameServiceClientORB(this);
@@ -212,6 +215,8 @@
     public void doStop() throws Exception {
         cssORB.destroy();
         nssORB.destroy();
+        // remove this from the registry 
+        Util.unregisterORB(getURI()); 
         cssORB = null;
         nssORB = null;
         log.debug("Stopped CORBA Client Security Server - " + description);

Modified: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/IORSecurityInterceptor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/IORSecurityInterceptor.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/IORSecurityInterceptor.java
(original)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/IORSecurityInterceptor.java
Tue Apr 10 13:37:58 2007
@@ -24,6 +24,7 @@
 import org.omg.PortableInterceptor.IORInfo;
 import org.omg.PortableInterceptor.IORInterceptor;
 
+import org.apache.geronimo.corba.security.config.tss.TSSConfig;
 import org.apache.geronimo.corba.util.Util;
 
 
@@ -33,15 +34,34 @@
 final class IORSecurityInterceptor extends LocalObject implements IORInterceptor {
 
     private final Log log = LogFactory.getLog(IORSecurityInterceptor.class);
+    
+    private final TSSConfig defaultConfig; 
+    
+    public IORSecurityInterceptor(TSSConfig defaultConfig) {
+        this.defaultConfig = defaultConfig; 
+    }
 
     public void establish_components(IORInfo info) {
 
         try {
             ServerPolicy policy = (ServerPolicy) info.get_effective_policy(ServerPolicyFactory.POLICY_TYPE);
+            // try to get a config from the policy, and fall back on the default 
+            TSSConfig config; 
+            if (policy == null) {
+                config = defaultConfig; 
+            }
+            else {
+                config = policy.getConfig(); 
+                if (config == null) {
+                    config = defaultConfig; 
+                }
+            }
+            // nothing to work with, just return 
+            if (config == null) {
+                return;
+            }
 
-            if (policy == null || policy.getConfig() == null) return;
-
-            info.add_ior_component_to_profile(policy.getConfig().generateIOR(Util.getORB(),
Util.getCodec()), TAG_INTERNET_IOP.value);
+            info.add_ior_component_to_profile(config.generateIOR(Util.getORB(), Util.getCodec()),
TAG_INTERNET_IOP.value);
         } catch (INV_POLICY e) {
             // do nothing
         } catch (Exception e) {

Modified: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/SecurityInitializer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/SecurityInitializer.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/SecurityInitializer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/security/SecurityInitializer.java
Tue Apr 10 13:37:58 2007
@@ -28,6 +28,9 @@
 
 import org.apache.geronimo.common.DeploymentException;
 import org.apache.geronimo.common.GeronimoSecurityException;
+import org.apache.geronimo.corba.ORBConfiguration;
+import org.apache.geronimo.corba.security.config.tss.TSSConfig;
+import org.apache.geronimo.corba.util.Util;
 import org.apache.geronimo.security.DomainPrincipal;
 import org.apache.geronimo.security.PrimaryDomainPrincipal;
 import org.apache.geronimo.security.PrimaryPrincipal;
@@ -106,11 +109,13 @@
             }
 
             if (log.isDebugEnabled()) log.debug("Default subject: " + defaultSubject);
+            
+            ORBConfiguration config = Util.getRegisteredORB(info.orb_id()); 
 
             try {
                 info.add_client_request_interceptor(new ClientSecurityInterceptor());
                 info.add_server_request_interceptor(new ServerSecurityInterceptor(info.allocate_slot_id(),
info.allocate_slot_id(), defaultSubject));
-                info.add_ior_interceptor(new IORSecurityInterceptor());
+                info.add_ior_interceptor(new IORSecurityInterceptor(config.getTssConfig()));
             } catch (DuplicateName dn) {
                 log.error("Error registering interceptor", dn);
             }

Modified: geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/util/Util.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/util/Util.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/util/Util.java
(original)
+++ geronimo/server/trunk/modules/geronimo-corba/src/main/java/org/apache/geronimo/corba/util/Util.java
Tue Apr 10 13:37:58 2007
@@ -43,6 +43,7 @@
 import javax.naming.NamingException;
 import javax.rmi.PortableRemoteObject;
 
+import org.apache.geronimo.corba.ORBConfiguration;
 import org.apache.geronimo.util.asn1.DERInputStream;
 import org.apache.geronimo.util.asn1.DERObjectIdentifier;
 import org.apache.geronimo.util.asn1.DEROutputStream;
@@ -89,10 +90,25 @@
     private static Codec codec;
     private static HandleDelegate handleDelegate;
     private static CorbaApplicationServer corbaApplicationServer = new CorbaApplicationServer();
+    private static HashMap<String,ORBConfiguration> configuredOrbs = new HashMap<String,ORBConfiguration>();

+    
     public static ORB getORB() {
         assert orb != null;
         return orb;
     }
+    
+    public static void registerORB(String id, ORBConfiguration orb) {
+        configuredOrbs.put(id, orb); 
+    }
+    
+    public static ORBConfiguration getRegisteredORB(String id) {
+        return configuredOrbs.get(id); 
+    }
+    
+    public static void unregisterORB(String id) {
+        configuredOrbs.remove(id); 
+    }
+    
 
     public static void setORB(ORB orb) throws UserException {
         if (Util.orb == null) {

Modified: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java
(original)
+++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/ORBConfigAdapter.java
Tue Apr 10 13:37:58 2007
@@ -34,6 +34,7 @@
 import org.apache.geronimo.corba.security.config.tss.TSSConfig;
 import org.apache.geronimo.corba.security.config.tss.TSSSSLTransportConfig;
 import org.apache.geronimo.corba.security.config.tss.TSSTransportMechConfig;
+import org.apache.geronimo.corba.util.Util;
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.security.deploy.DefaultDomainPrincipal;
 import org.apache.geronimo.security.deploy.DefaultPrincipal;
@@ -55,9 +56,6 @@
 
     private final Log log = LogFactory.getLog(ORBConfigAdapter.class);
 
-    // static registry used to hook up bean instances with
-    private static final HashMap registry = new HashMap();
-
     public ORBConfigAdapter() {
     }
 
@@ -200,22 +198,6 @@
     }
 
     /**
-     * Static method used by SocketFactory instances to
-     * retrieve the CORBABean or CSSBean that holds its
-     * configuration information.  The String name has
-     * been passed to the SocketFactory as part of its
-     * initialization parameters.
-     *
-     * @param name   The name of the bean holding the configuration
-     *               information.
-     *
-     * @return The bean mapping for this SocketFactory instance.
-     */
-    public static ORBConfiguration getConfiguration(String name) {
-        return (ORBConfiguration)registry.get(name);
-    }
-
-    /**
      * Create an ORB instance using the configured argument
      * and property bundles.
      *
@@ -229,17 +211,7 @@
      * @return An ORB constructed from the provided args and properties.
      */
     private ORB createORB(String name, ORBConfiguration config, String[] args, Properties
props) {
-        try {
-            // we need to stuff this reference in the registry so that the SocketFactory
can find it
-            // when it initializes.
-            registry.put(name, config);
-            return ORB.init(args, props);
-
-        } finally {
-            // remove the configuration object from the registry now that the ORB has initialized.
 We
-            // don't want to create a memory leak on the GBean.
-            registry.remove(name);
-        }
+        return ORB.init(args, props);
     }
 
     /**
@@ -309,6 +281,10 @@
         else {
             result.put("yoko.orb.oa.endpoint", "iiop --host " + server.getHost());
         }
+        
+        // this gives us a connection we can use to retrieve the ORB configuration in the

+        // interceptors. 
+        result.put("yoko.orb.id", server.getURI()); 
 
         // check the tss config for a transport mech definition.  If we have one, then 
         // the port information will be passed in that config, and the port in the IIOP profile

@@ -391,6 +367,10 @@
         result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.transaction.TransactionInitializer",
"");
         result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.corba.security.SecurityInitializer",
"");
         result.put("org.omg.PortableInterceptor.ORBInitializerClass.org.apache.geronimo.yoko.ORBInitializer",
"");
+
+        // this gives us a connection we can use to retrieve the ORB configuration in the

+        // interceptors. 
+        result.put("yoko.orb.id", client.getURI()); 
 
         if (log.isDebugEnabled()) {
             log.debug("translateToProps(CSSConfig)");

Modified: geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/SocketFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/SocketFactory.java?view=diff&rev=527288&r1=527287&r2=527288
==============================================================================
--- geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/SocketFactory.java
(original)
+++ geronimo/server/trunk/modules/geronimo-yoko/src/main/java/org/apache/geronimo/yoko/SocketFactory.java
Tue Apr 10 13:37:58 2007
@@ -102,13 +102,14 @@
         clientAuthRequired = false;
 
         // retrieve the configuration from the config adapter registry.
-        ORBConfiguration config = ORBConfigAdapter.getConfiguration(configName);
+        ORBConfiguration config = Util.getRegisteredORB(configName);
         if (config == null) {
             throw new RuntimeException("Unable to resolve ORB configuration " + configName);
         }
         // get the configuration from the hosting bean and decode what needs to be implemented.
         sslConfig = config.getSslConfig();
         TSSConfig tssConfig = config.getTssConfig();
+
         TSSTransportMechConfig transportMech = tssConfig.getTransport_mech();
         // if we have a transport mech defined, this is the configuration for any listeners
we end up
         // creating.



Mime
View raw message