geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r280069 - in /geronimo/trunk/modules: j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
Date Sun, 11 Sep 2005 04:32:53 GMT
Author: djencks
Date: Sat Sep 10 21:32:45 2005
New Revision: 280069

URL: http://svn.apache.org/viewcvs?rev=280069&view=rev
Log:
GERONIMO-1002 make it possible to use a pattern for the orb name

Modified:
    geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
    geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java

Modified: geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java?rev=280069&r1=280068&r2=280069&view=diff
==============================================================================
--- geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
(original)
+++ geronimo/trunk/modules/j2ee-builder/src/java/org/apache/geronimo/j2ee/deployment/RefContext.java
Sat Sep 10 21:32:45 2005
@@ -203,7 +203,7 @@
         } catch (MalformedObjectNameException e) {
             throw new DeploymentException("We built this name...");
         }
-        ObjectName mejbName = locateUniqueName(query, "Management EJB");
+        ObjectName mejbName = locateUniqueNameInKernel(query, "Management EJB");
         return mejbName.getCanonicalName();
     }
 
@@ -277,7 +277,6 @@
     }
 
     private GBeanData locateGBeanInContext(String moduleType, String moduleName, String name,
String type, J2eeContext j2eeContext, String queryType, NamingContext context, boolean requireMatch)
throws UnresolvedReferenceException {
-        ObjectName match = null;
         ObjectName query = null;
         //TODO make sure this is reasonable
         if (moduleType == null) {
@@ -288,13 +287,7 @@
         } catch (MalformedObjectNameException e1) {
             throw (UnresolvedReferenceException) new UnresolvedReferenceException("Could
not construct " + queryType + " object name query", false, null).initCause(e1);
         }
-        Set matches = context.listGBeans(query);
-        if (matches.size() > 1) {
-            throw new UnresolvedReferenceException("More than one match for query " + matches,
true, query.getCanonicalName());
-        }
-        if (matches.size() == 1) {
-            match = (ObjectName) matches.iterator().next();
-        }
+        ObjectName match = locateUniqueNameInContext(context, query);
         if (match == null) {
             if (!requireMatch) {
                 return null;
@@ -310,6 +303,18 @@
         }
     }
 
+    private ObjectName locateUniqueNameInContext(NamingContext context, ObjectName query)
throws UnresolvedReferenceException {
+        ObjectName match = null;
+        Set matches = context.listGBeans(query);
+        if (matches.size() > 1) {
+            throw new UnresolvedReferenceException("More than one match for query " + matches,
true, query.getCanonicalName());
+        }
+        if (matches.size() == 1) {
+            match = (ObjectName) matches.iterator().next();
+        }
+        return match;
+    }
+
     private GBeanData locateGBeanInKernel(String name, String type, J2eeContext j2eeContext,
String queryType) throws UnresolvedReferenceException {
         ObjectName query;
         try {
@@ -321,7 +326,7 @@
     }
 
 
-    private ObjectName locateUniqueName(ObjectName query, String type) throws UnresolvedReferenceException
{
+    private ObjectName locateUniqueNameInKernel(ObjectName query, String type) throws UnresolvedReferenceException
{
         Set names = kernel.listGBeans(query);
         if (names.size() != 1) {
             throw new UnresolvedReferenceException(type, names.size() > 1, query.getCanonicalName());
@@ -330,14 +335,21 @@
     }
 
     private GBeanData locateUniqueGBeanData(ObjectName query, String type) throws UnresolvedReferenceException
{
-        ObjectName match = locateUniqueName(query, type);
+        ObjectName match = locateUniqueNameInKernel(query, type);
         try {
             return kernel.getGBeanData(match);
         } catch (GBeanNotFoundException e) {
             throw new IllegalStateException("BUG! kernel listed a gbean but could not get
its gbeanData: " + match);
 
         }
+    }
 
+    public ObjectName locateUniqueName(NamingContext context, ObjectName query) throws UnresolvedReferenceException
{
+        ObjectName match = locateUniqueNameInContext(context, query);
+        if (match == null) {
+            match = locateUniqueNameInKernel(query, "type unknown");
+        }
+        return match;
     }
 
 }

Modified: geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java?rev=280069&r1=280068&r2=280069&view=diff
==============================================================================
--- geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
(original)
+++ geronimo/trunk/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/ENCConfigBuilder.java
Sat Sep 10 21:32:45 2005
@@ -228,7 +228,7 @@
                     ref = refContext.getConnectionFactoryRef(containerId, iface);
                     builder.bind(name, ref);
                 } catch (UnresolvedReferenceException e) {
-                    throw new DeploymentException("Unable to resolve resource reference '"+name+"'
("+(e.isMultiple() ? "found multiple matching resources" : "no matching resources found")+")");
+                    throw new DeploymentException("Unable to resolve resource reference '"
+ name + "' (" + (e.isMultiple() ? "found multiple matching resources" : "no matching resources
found") + ")");
                 }
             }
         }
@@ -286,7 +286,7 @@
 
                 builder.bind(name, ref);
             } catch (UnresolvedReferenceException e) {
-                throw new DeploymentException("Unable to resolve resource env reference '"+name+"'
("+(e.isMultiple() ? "found multiple matching resources" : "no matching resources found")+")");
+                throw new DeploymentException("Unable to resolve resource env reference '"
+ name + "' (" + (e.isMultiple() ? "found multiple matching resources" : "no matching resources
found") + ")");
             }
         }
     }
@@ -344,7 +344,7 @@
                 throw new DeploymentException("could not load class " + type, e);
             }
             URI moduleURI = URI.create("");
-            GerMessageDestinationType destination = (GerMessageDestinationType)refContext.getMessageDestination(linkName);
+            GerMessageDestinationType destination = (GerMessageDestinationType) refContext.getMessageDestination(linkName);
             if (destination != null) {
                 if (destination.isSetAdminObjectLink()) {
                     if (destination.isSetAdminObjectModule()) {
@@ -422,17 +422,17 @@
                             } else {
                                 GerCssType css = remoteRef.getCss();
                                 cssBean = NameFactory.getComponentName(getStringValue(css.getDomain()),
-                                    getStringValue(css.getServer()),
-                                    getStringValue(css.getApplication()),
-                                    getStringValue(css.getModule()),
-                                    getStringValue(css.getName()),
-                                    getStringValue(NameFactory.CORBA_CSS),
-                                    earContext.getJ2eeContext());
+                                        getStringValue(css.getServer()),
+                                        getStringValue(css.getApplication()),
+                                        getStringValue(css.getModule()),
+                                        getStringValue(css.getName()),
+                                        getStringValue(NameFactory.CORBA_CSS),
+                                        earContext.getJ2eeContext());
                             }
                             ejbReference = refContext.getCORBARemoteRef(new URI(getStringValue(remoteRef.getNsCorbaloc())),
-                                                                        getStringValue(remoteRef.getName()),
-                                                                        ObjectName.getInstance(cssBean),
-                                                                        home);
+                                    getStringValue(remoteRef.getName()),
+                                    ObjectName.getInstance(cssBean),
+                                    home);
                         } catch (URISyntaxException e) {
                             throw new DeploymentException("Could not construct CORBA NameServer
URI: " + remoteRef.getNsCorbaloc(), e);
                         } catch (MalformedObjectNameException e) {
@@ -727,6 +727,7 @@
                                             GerServiceRefType[] gerServiceRefs,
                                             ClassLoader cl) throws DeploymentException {
         ComponentContextBuilder builder = new ComponentContextBuilder();
+        RefContext refContext = earContext.getRefContext();
 
         if (userTransaction != null) {
             builder.addUserTransaction(userTransaction);
@@ -734,6 +735,9 @@
 
         ObjectName corbaGBean = earContext.getCORBAGBeanObjectName();
         if (corbaGBean != null) {
+            if (corbaGBean.isPattern()) {
+                corbaGBean = refContext.locateUniqueName(earContext, corbaGBean);
+            }
             builder.addORB(corbaGBean);
         }
 
@@ -750,7 +754,6 @@
             ejbContext = earContext;
         }
 
-        RefContext refContext = earContext.getRefContext();
         // ejb-ref
         addEJBRefs(earContext, ejbContext, refContext, moduleURI, ejbRefs, mapEjbRefs(gerEjbRefs),
cl, builder);
 



Mime
View raw message