geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: rev 54718 - in geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming: . java jmx
Date Wed, 13 Oct 2004 01:08:01 GMT
Author: adc
Date: Tue Oct 12 18:08:00 2004
New Revision: 54718

Modified:
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/ReferenceFactory.java
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
   geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
Log:
Added <resource-link> to the DD <resource-ref>

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/ReferenceFactory.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/ReferenceFactory.java
(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/ReferenceFactory.java
Tue Oct 12 18:08:00 2004
@@ -26,6 +26,8 @@
  * @version $Revision$ $Date$
  */
 public interface ReferenceFactory {
+    Reference buildResourceLinkReference(GerLocalRefType localRef, Class iface) throws MalformedObjectNameException;
+
     Reference buildConnectionFactoryReference(GerLocalRefType localRef, Class iface) throws
MalformedObjectNameException;
 
     Reference buildAdminObjectReference(GerLocalRefType localRef, Class iface) throws MalformedObjectNameException;

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/java/ComponentContextBuilder.java
Tue Oct 12 18:08:00 2004
@@ -101,13 +101,19 @@
     }
 
     public void addResourceRef(String name, Class iface, GerLocalRefType localRef) throws
NamingException {
-        if (iface == URL.class) {
+        if (localRef.isSetExternalUri()) {
             try {
                 context.internalBind(ENV + name, new URL(localRef.getExternalUri()));
             } catch (MalformedURLException e) {
                 throw (NamingException) new NamingException("Could not convert " + localRef
+ " to URL").initCause(e);
             }
-        } else {
+        } else if (localRef.isSetResourceLink()) {
+            try {
+                bind(name, referenceFactory.buildResourceLinkReference(localRef, iface));
+            } catch (MalformedObjectNameException e) {
+                throw (NamingException) new NamingException("invalid object name").initCause(e);
+            }
+        } else if (localRef.isSetTargetName()) {
             try {
                 bind(name, referenceFactory.buildConnectionFactoryReference(localRef, iface));
             } catch (MalformedObjectNameException e) {

Modified: geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
==============================================================================
--- geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
(original)
+++ geronimo/trunk/modules/naming/src/java/org/apache/geronimo/naming/jmx/JMXReferenceFactory.java
Tue Oct 12 18:08:00 2004
@@ -43,6 +43,13 @@
         baseName = domainName + ":J2EEServer=" + serverName;
     }
 
+    public Reference buildResourceLinkReference(GerLocalRefType localRef, Class iface) throws
MalformedObjectNameException {
+        Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null);
+
+        ref.add(new JMXRefAddr(null, localRef.getKernelName(), ObjectName.getInstance(localRef.getResourceLink()),
iface));
+        return ref;
+    }
+
     public Reference buildConnectionFactoryReference(GerLocalRefType localRef, Class iface)
throws MalformedObjectNameException {
         Reference ref = new Reference(null, JMXObjectFactory.class.getName(), null);
 
@@ -52,7 +59,11 @@
     }
 
     public ObjectName createManagedConnectionFactoryObjectName(String targetName) throws
MalformedObjectNameException {
-        return ObjectName.getInstance(baseName + BASE_MANAGED_CONNECTION_FACTORY_NAME + targetName);
+        if (targetName.indexOf(':') < 0) {
+            return ObjectName.getInstance(baseName + BASE_MANAGED_CONNECTION_FACTORY_NAME
+ targetName);
+        } else {
+            return ObjectName.getInstance(targetName);
+        }
     }
 
     public Reference buildAdminObjectReference(GerLocalRefType localRef, Class iface) throws
MalformedObjectNameException {

Mime
View raw message