geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: rev 47115 - geronimo/trunk/modules/client/src/java/org/apache/geronimo/client
Date Thu, 23 Sep 2004 18:23:26 GMT
Author: dblevins
Date: Thu Sep 23 11:23:25 2004
New Revision: 47115

Added:
   geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
      - copied, changed from rev 47113, geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientJNDIProvider.java
Removed:
   geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientJNDIProvider.java
Modified:
   geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
Log:
AppClient updated to have a collection of plugins



Modified: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
==============================================================================
--- geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
(original)
+++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
Thu Sep 23 11:23:25 2004
@@ -18,11 +18,13 @@
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Iterator;
 
 import javax.management.ObjectName;
 
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoFactory;
+import org.apache.geronimo.gbean.ReferenceCollection;
 
 /**
  * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
@@ -31,13 +33,13 @@
     private static final Class[] MAIN_ARGS = {String[].class};
 
     private final String mainClassName;
-    private final AppClientJNDIProvider jndiProvider;
+    private final ReferenceCollection plugins;
     private final ObjectName appClientModuleName;
     private final Method mainMethod;
 
-    public AppClientContainer(String mainClassName,  ObjectName appClientModuleName, AppClientJNDIProvider
jndiProvider,ClassLoader classLoader) throws Exception {
+    public AppClientContainer(String mainClassName,  ObjectName appClientModuleName, ReferenceCollection
plugins ,ClassLoader classLoader) throws Exception {
         this.mainClassName = mainClassName;
-        this.jndiProvider = jndiProvider;
+        this.plugins = plugins;
         this.appClientModuleName = appClientModuleName;
 
         try {
@@ -61,7 +63,10 @@
     public void main(String[] args) throws Exception {
         Throwable throwable = null;
         try {
-            jndiProvider.startClient(null);
+            for (Iterator iterator = plugins.iterator(); iterator.hasNext();) {
+                AppClientPlugin plugin = (AppClientPlugin) iterator.next();
+                plugin.startClient(appClientModuleName);
+            }
 
             mainMethod.invoke(null, args);
 
@@ -74,7 +79,10 @@
             }
             throwable = e;
         } finally {
-            jndiProvider.stopClient(null);
+            for (Iterator iterator = plugins.iterator(); iterator.hasNext();) {
+                AppClientPlugin plugin = (AppClientPlugin) iterator.next();
+                plugin.stopClient(appClientModuleName);
+            }
 
             if (throwable instanceof Exception) {
                 throw (Exception) throwable;
@@ -92,10 +100,10 @@
         infoFactory.addOperation("main", new Class[]{String[].class});
         infoFactory.addAttribute("mainClassName", String.class, true);
         infoFactory.addAttribute("appClientModuleObjectName", ObjectName.class, true);
-        infoFactory.addReference("JNDIProvider", AppClientJNDIProvider.class);
+        infoFactory.addReference("plugins", AppClientPlugin.class);
         infoFactory.addAttribute("classLoader", ClassLoader.class, false);
 
-        infoFactory.setConstructor(new String[]{"mainClassName", "appClientModuleName", "JNDIProvider",
"classLoader"});
+        infoFactory.setConstructor(new String[]{"mainClassName", "appClientModuleName", "plugins",
"classLoader"});
 
         GBEAN_INFO = infoFactory.getBeanInfo();
     }

Copied: geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
(from rev 47113, geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientJNDIProvider.java)
==============================================================================
--- geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientJNDIProvider.java
(original)
+++ geronimo/trunk/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
Thu Sep 23 11:23:25 2004
@@ -18,46 +18,12 @@
 
 import javax.management.ObjectName;
 
-import org.apache.geronimo.gbean.GBeanInfo;
-import org.apache.geronimo.gbean.GBeanInfoFactory;
-
 /**
  * @version $Revision$ $Date$
  */
-public class AppClientJNDIProvider {
-    private final String protocol;
-    private final String host;
-    private final int port;
-
-    public AppClientJNDIProvider(String protocol, String host, int port) {
-        this.protocol = protocol;
-        this.host = host;
-        this.port = port;
-    }
-
-    public void startClient(ObjectName appClientModuleName) throws Exception {
-    }
-    
-    public void stopClient(ObjectName appClientModuleName) throws Exception {
-    }
-
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoFactory infoFactory = new GBeanInfoFactory(AppClientJNDIProvider.class);
-
-        infoFactory.addOperation("startClient", new Class[]{ObjectName.class});
-        infoFactory.addOperation("stopClient", new Class[]{ObjectName.class});
-        infoFactory.addAttribute("protocol", String.class, true);
-        infoFactory.addAttribute("host", String.class, true);
-        infoFactory.addAttribute("port", int.class, true);
-
-        infoFactory.setConstructor(new String[]{"protocol", "host", "port"});
+public interface AppClientPlugin {
+    public void startClient(ObjectName appClientModuleName) throws Exception;
 
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
+    public void stopClient(ObjectName appClientModuleName) throws Exception;
 
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
-    }
 }

Mime
View raw message