geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r394047 - in /geronimo/branches/1.1/modules: client/src/java/org/apache/geronimo/client/ system/src/java/org/apache/geronimo/system/main/
Date Fri, 14 Apr 2006 08:24:47 GMT
Author: djencks
Date: Fri Apr 14 01:24:43 2006
New Revision: 394047

URL: http://svn.apache.org/viewcvs?rev=394047&view=rev
Log:
closer to a working app client

Modified:
    geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
    geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
    geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
    geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java

Modified: geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java?rev=394047&r1=394046&r2=394047&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
(original)
+++ geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientContainer.java
Fri Apr 14 01:24:43 2006
@@ -16,25 +16,26 @@
  */
 package org.apache.geronimo.client;
 
+import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
 import java.security.PrivilegedAction;
-import javax.management.ObjectName;
+
 import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
-import javax.security.auth.callback.CallbackHandler;
 
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
-import org.apache.geronimo.transaction.context.TransactionContext;
-import org.apache.geronimo.transaction.context.TransactionContextManager;
-import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.security.ContextManager;
 import org.apache.geronimo.security.deploy.DefaultPrincipal;
 import org.apache.geronimo.security.util.ConfigurationUtil;
-import org.apache.geronimo.security.ContextManager;
+import org.apache.geronimo.transaction.context.TransactionContext;
+import org.apache.geronimo.transaction.context.TransactionContextManager;
 
 /**
  * @version $Rev$ $Date$
@@ -44,7 +45,7 @@
 
     private final String mainClassName;
     private final AppClientPlugin jndiContext;
-    private final ObjectName appClientModuleName;
+    private final AbstractName appClientModuleName;
     private final String realmName;
     private final Class callbackHandlerClass;
     private final Subject defaultSubject;
@@ -54,7 +55,7 @@
     private final TransactionContextManager transactionContextManager;
 
     public AppClientContainer(String mainClassName,
-                              ObjectName appClientModuleName,
+                              AbstractName appClientModuleName,
                               String realmName,
                               String callbackHandlerClassName,
                               DefaultPrincipal defaultPrincipal,
@@ -98,7 +99,7 @@
         }
     }
 
-    public ObjectName getAppClientModuleName() {
+    public AbstractName getAppClientModuleName() {
         return appClientModuleName;
     }
 
@@ -186,7 +187,7 @@
         infoFactory.addOperation("main", new Class[]{String[].class});
 
         infoFactory.addAttribute("mainClassName", String.class, true);
-        infoFactory.addAttribute("appClientModuleName", ObjectName.class, true);
+        infoFactory.addAttribute("appClientModuleName", AbstractName.class, true);
         infoFactory.addAttribute("realmName", String.class, true);
         infoFactory.addAttribute("callbackHandlerClassName", String.class, true);
         infoFactory.addAttribute("defaultPrincipal", DefaultPrincipal.class, true);

Modified: geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java?rev=394047&r1=394046&r2=394047&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
(original)
+++ geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/AppClientPlugin.java
Fri Apr 14 01:24:43 2006
@@ -16,16 +16,15 @@
  */
 package org.apache.geronimo.client;
 
-import javax.management.ObjectName;
-
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Kernel;
 
 /**
  * @version $Revision$ $Date$
  */
 public interface AppClientPlugin {
-    public void startClient(ObjectName appClientModuleName, Kernel kernel, ClassLoader classLoader)
throws Exception;
+    public void startClient(AbstractName appClientModuleName, Kernel kernel, ClassLoader
classLoader) throws Exception;
 
-    public void stopClient(ObjectName appClientModuleName) throws Exception;
+    public void stopClient(AbstractName appClientModuleName) throws Exception;
 
 }

Modified: geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/StaticJndiContextPlugin.java?rev=394047&r1=394046&r2=394047&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
(original)
+++ geronimo/branches/1.1/modules/client/src/java/org/apache/geronimo/client/StaticJndiContextPlugin.java
Fri Apr 14 01:24:43 2006
@@ -18,7 +18,6 @@
 
 import java.util.Iterator;
 import java.util.Map;
-import javax.management.ObjectName;
 import javax.naming.InitialContext;
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -29,6 +28,7 @@
 import org.apache.geronimo.naming.enc.EnterpriseNamingContext;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.kernel.Kernel;
 
 /**
@@ -51,7 +51,7 @@
         this.context = EnterpriseNamingContext.createEnterpriseNamingContext(context);
     }
 
-    public void startClient(ObjectName appClientModuleName, Kernel kernel, ClassLoader classLoader)
throws Exception {
+    public void startClient(AbstractName appClientModuleName, Kernel kernel, ClassLoader
classLoader) throws Exception {
         RootContext.setComponentContext(context);
         System.setProperty("java.naming.factory.initial", "com.sun.jndi.rmi.registry.RegistryContextFactory");
         System.setProperty("java.naming.factory.url.pkgs", "org.apache.geronimo.naming");
@@ -59,7 +59,7 @@
         new InitialContext().lookup("java:comp/env");
     }
 
-    public void stopClient(ObjectName appClientModuleName) throws Exception {
+    public void stopClient(AbstractName appClientModuleName) throws Exception {
         RootContext.setComponentContext(null);
     }
 

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java?rev=394047&r1=394046&r2=394047&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/ClientCommandLine.java
Fri Apr 14 01:24:43 2006
@@ -21,6 +21,8 @@
 import javax.management.ObjectName;
 
 import org.apache.geronimo.kernel.repository.Artifact;
+import org.apache.geronimo.kernel.Jsr77Naming;
+import org.apache.geronimo.gbean.AbstractName;
 
 /**
  * @version $Revision$ $Date$
@@ -70,6 +72,10 @@
 
 
     public ClientCommandLine(Artifact configuration, String[] args) throws Exception {
-        invokeMainGBean(Collections.singletonList(configuration), new ObjectName("geronimo.client:type=ClientContainer"),
"main", args);
+        Jsr77Naming naming = new Jsr77Naming();
+        AbstractName baseName = naming.createRootName(configuration, configuration.toString(),
"AppClientModule");
+        AbstractName clientContainerName = naming.createChildName(baseName, "ClientContainer",
"ClientContainer");
+
+        invokeMainGBean(Collections.singletonList(configuration), clientContainerName, "main",
args);
     }
 }

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java?rev=394047&r1=394046&r2=394047&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/main/CommandLine.java
Fri Apr 14 01:24:43 2006
@@ -78,7 +78,33 @@
     private Kernel kernel;
     private AbstractName configurationName;
 
+    /**
+     * @deprecated use the next one with AbstractName
+     *
+     * @param configurations
+     * @param mainGBean
+     * @param mainMethod
+     * @param args
+     * @throws Exception
+     */
     public void invokeMainGBean(List configurations, ObjectName mainGBean, String mainMethod,
String[] args) throws Exception {
+        startKernel(configurations);
+
+        log.info("Server startup completed");
+
+        // invoke the main method
+        kernel.invoke(
+                mainGBean,
+                mainMethod,
+                new Object[]{args},
+                new String[]{String[].class.getName()});
+
+        log.info("Server shutdown begun");
+
+        stopKernel();
+    }
+
+    public void invokeMainGBean(List configurations, AbstractName mainGBean, String mainMethod,
String[] args) throws Exception {
         startKernel(configurations);
 
         log.info("Server startup completed");



Mime
View raw message