geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r784009 - in /geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config: ConfigurationData.java GBeanState.java SerializedGBeanState.java xstream/XStreamGBeanState.java
Date Fri, 12 Jun 2009 07:11:56 GMT
Author: djencks
Date: Fri Jun 12 07:11:56 2009
New Revision: 784009

URL: http://svn.apache.org/viewvc?rev=784009&view=rev
Log:
Handy way to add gbeans defined by annotations, from Gianny's classloader work

Modified:
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/GBeanState.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
    geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java?rev=784009&r1=784008&r2=784009&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationData.java
Fri Jun 12 07:11:56 2009
@@ -192,6 +192,12 @@
         return gbeanState.addGBean(name, gbeanInfo, naming, environment);
     }
 
+    public GBeanData addGBean(String name, Class gbeanClass) {
+        if (name == null) throw new NullPointerException("name is null");
+        if (gbeanClass == null) throw new NullPointerException("gbeanInfo is null");
+        return gbeanState.addGBean(name, gbeanClass, naming, environment);
+    }
+
     public GBeanState getGbeanState() {
         return gbeanState;
     }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/GBeanState.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/GBeanState.java?rev=784009&r1=784008&r2=784009&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/GBeanState.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/GBeanState.java
Fri Jun 12 07:11:56 2009
@@ -32,4 +32,5 @@
     void addGBean(GBeanData gbeanData);
 
     GBeanData addGBean(String name, GBeanInfo gbeanInfo, Naming naming, Environment environment);
+    GBeanData addGBean(String name, Class gbeanClass, Naming naming, Environment environment);
 }

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java?rev=784009&r1=784008&r2=784009&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SerializedGBeanState.java
Fri Jun 12 07:11:56 2009
@@ -86,6 +86,20 @@
         return gBeanData;
     }
 
+    public GBeanData addGBean(String name, Class gbeanClass, Naming naming, Environment environment)
{
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans
can be added");
+        }
+        GBeanData gBeanData = new GBeanData(gbeanClass);
+
+        String j2eeType = gBeanData.getGBeanInfo().getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name,
j2eeType);
+        gBeanData.setAbstractName(abstractName);
+        addGBean(gBeanData);
+        return gBeanData;
+    }
+
     private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
         if (gbeanState == null) {
             gbeanState = storeGBeans(gbeans);

Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java?rev=784009&r1=784008&r2=784009&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
(original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/xstream/XStreamGBeanState.java
Fri Jun 12 07:11:56 2009
@@ -101,6 +101,20 @@
         return gBeanData;
     }
 
+    public GBeanData addGBean(String name, Class gbeanClass, Naming naming, Environment environment)
{
+        if (gbeanState != null) {
+            throw new IllegalStateException("GBeans have been serialized, so no more GBeans
can be added");
+        }
+        GBeanData gBeanData = new GBeanData(gbeanClass);
+
+        String j2eeType = gBeanData.getGBeanInfo().getJ2eeType();
+        if (j2eeType == null) j2eeType = "GBean";
+        AbstractName abstractName = naming.createRootName(environment.getConfigId(), name,
j2eeType);
+        gBeanData.setAbstractName(abstractName);
+        addGBean(gBeanData);
+        return gBeanData;
+    }
+
     private static List<GBeanData> loadGBeans(Element element, ClassLoader classLoader)
throws InvalidConfigException {
         if (element != null) {
             // Set the thread context classloader so deserializing classes can grab the cl
from the thread



Mime
View raw message