geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r383682 [5/5] - in /geronimo/branches/1.1/modules: connector/src/test/org/apache/geronimo/connector/ connector/src/test/org/apache/geronimo/connector/outbound/ deployment/src/java/org/apache/geronimo/deployment/ j2ee/src/java/org/apache/ger...
Date Mon, 06 Mar 2006 21:44:37 GMT
Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/configuration/FileConfigurationList.java
Mon Mar  6 13:44:29 2006
@@ -21,11 +21,14 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.config.ConfigurationInfo;
 import org.apache.geronimo.kernel.config.ConfigurationManager;
 import org.apache.geronimo.kernel.config.NoSuchStoreException;
 import org.apache.geronimo.kernel.config.PersistentConfigurationList;
+import org.apache.geronimo.kernel.config.Configuration;
 import org.apache.geronimo.kernel.lifecycle.LifecycleAdapter;
 import org.apache.geronimo.kernel.lifecycle.LifecycleListener;
 import org.apache.geronimo.kernel.management.State;
@@ -99,13 +102,13 @@
         this.serverInfo = serverInfo;
         this.configFile = configDir;
         this.listener = new LifecycleAdapter() {
-            public void stopped(ObjectName objectName) {
+            public void stopped(AbstractName abstractName) {
                 if (kernelFullyStarted && FileConfigurationList.this.kernel.isRunning())
{
                     doSave();
                 }
             }
 
-            public void running(ObjectName objectName) {
+            public void running(AbstractName abstractName) {
                 if (kernelFullyStarted && FileConfigurationList.this.kernel.isRunning())
{
                     doSave();
                 }
@@ -130,7 +133,7 @@
                 throw new IOException("Unable to create directory for list:" + parent);
             }
         }
-        kernel.getLifecycleMonitor().addLifecycleListener(listener, new ObjectName("geronimo.config:*"));
+        kernel.getLifecycleMonitor().addLifecycleListener(listener, new AbstractNameQuery(Configuration.class.getName()));
     }
 
     public void doStop() throws Exception {

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanGBeanBridge.java
Mon Mar  6 13:44:29 2006
@@ -39,6 +39,8 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.geronimo.gbean.GOperationSignature;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.NoSuchAttributeException;
 import org.apache.geronimo.kernel.NoSuchOperationException;
 import org.apache.geronimo.kernel.Kernel;
@@ -59,7 +61,8 @@
     /**
      * The unique name of this service.
      */
-    private final ObjectName objectName;
+    private final AbstractName objectName;
+    private final AbstractNameQuery pattern;
 
     /**
      * The mbean info
@@ -72,15 +75,16 @@
     private final NotificationBroadcasterSupport notificationBroadcaster = new NotificationBroadcasterSupport();
     private final LifecycleBridge lifecycleBridge;
 
-    public MBeanGBeanBridge(Kernel kernel, ObjectName objectName, MBeanInfo mbeanInfo) {
+    public MBeanGBeanBridge(Kernel kernel, AbstractName abstractName, MBeanInfo mbeanInfo)
{
         this.kernel = kernel;
-        this.objectName = objectName;
+        this.objectName = abstractName;
+        this.pattern = new AbstractNameQuery(abstractName);
         this.mbeanInfo = mbeanInfo;
-        lifecycleBridge = new LifecycleBridge(objectName, notificationBroadcaster);
+        lifecycleBridge = new LifecycleBridge(abstractName, notificationBroadcaster);
     }
 
     public ObjectName getObjectName() {
-        return objectName;
+        return objectName.getObjectName();
     }
 
     public ObjectName preRegister(MBeanServer mBeanServer, ObjectName objectName) throws
Exception {
@@ -90,7 +94,7 @@
     public void postRegister(Boolean registrationDone) {
         if (Boolean.TRUE.equals(registrationDone)) {
             // fire the loaded event from the gbeanMBean.. it was already fired from the
GBeanInstance when it was created
-            kernel.getLifecycleMonitor().addLifecycleListener(lifecycleBridge, objectName);
+            kernel.getLifecycleMonitor().addLifecycleListener(lifecycleBridge, pattern);
             lifecycleBridge.loaded(objectName);
         }
     }
@@ -198,57 +202,57 @@
         /**
          * Name of the MBeanGBean
          */
-        private final ObjectName mbeanGBeanName;
+        private final AbstractName mbeanGBeanName;
 
         /**
          * The notification broadcaster to use
          */
         private final NotificationBroadcasterSupport notificationBroadcaster;
 
-        public LifecycleBridge(ObjectName mbeanGBeanName, NotificationBroadcasterSupport
notificationBroadcaster) {
+        public LifecycleBridge(AbstractName mbeanGBeanName, NotificationBroadcasterSupport
notificationBroadcaster) {
             this.mbeanGBeanName = mbeanGBeanName;
             this.notificationBroadcaster = notificationBroadcaster;
         }
 
-        public void loaded(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_CREATED,
objectName, nextSequence()));
+        public void loaded(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_CREATED,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void starting(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STARTING,
objectName, nextSequence()));
+        public void starting(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STARTING,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void running(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_RUNNING,
objectName, nextSequence()));
+        public void running(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_RUNNING,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void stopping(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPING,
objectName, nextSequence()));
+        public void stopping(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPING,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void stopped(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPED,
objectName, nextSequence()));
+        public void stopped(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_STOPPED,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void failed(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_FAILED,
objectName, nextSequence()));
+        public void failed(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.STATE_FAILED,
abstractName.getObjectName(), nextSequence()));
             }
         }
 
-        public void unloaded(ObjectName objectName) {
-            if (mbeanGBeanName.equals(objectName)) {
-                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_DELETED,
objectName, nextSequence()));
+        public void unloaded(AbstractName abstractName) {
+            if (mbeanGBeanName.equals(abstractName)) {
+                notificationBroadcaster.sendNotification(new Notification(NotificationType.OBJECT_DELETED,
abstractName.getObjectName(), nextSequence()));
             }
         }
 

Modified: geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
(original)
+++ geronimo/branches/1.1/modules/system/src/java/org/apache/geronimo/system/jmx/MBeanServerKernelBridge.java
Mon Mar  6 13:44:29 2006
@@ -21,6 +21,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.Collections;
 import javax.management.InstanceAlreadyExistsException;
 import javax.management.InstanceNotFoundException;
 import javax.management.JMException;
@@ -35,6 +36,8 @@
 import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.GBeanNotFoundException;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.kernel.jmx.JMXUtil;
@@ -48,7 +51,7 @@
     private final HashMap registry = new HashMap();
     private final Kernel kernel;
     private final MBeanServer mbeanServer;
-    private static final ObjectName ALL = JMXUtil.getObjectName("*:*");
+    private static final AbstractNameQuery ALL = new AbstractNameQuery(Collections.EMPTY_LIST,
Collections.EMPTY_MAP, Collections.EMPTY_SET);
 
     public MBeanServerKernelBridge(Kernel kernel, String mbeanServerId) throws MBeanServerNotFound
{
         this.kernel = kernel;
@@ -69,21 +72,21 @@
         synchronized (this) {
             Set allNames = kernel.listGBeans(ALL);
             for (Iterator iterator = allNames.iterator(); iterator.hasNext();) {
-                ObjectName objectName = (ObjectName) iterator.next();
-                if (registry.containsKey(objectName)) {
+                AbstractName abstractName = (AbstractName) iterator.next();
+                if (registry.containsKey(abstractName.getObjectName())) {
                     // instance already registered
                     continue;
                 }
-                MBeanInfo mbeanInfo = null;
+                MBeanInfo mbeanInfo;
                 try {
-                    mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(objectName));
+                    mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(abstractName));
                 } catch (GBeanNotFoundException e) {
                     // ignore - gbean already unregistered
                     continue;
                 }
-                MBeanGBeanBridge mbeanGBeanBridge = new MBeanGBeanBridge(kernel, objectName,
mbeanInfo);
-                registry.put(objectName, mbeanGBeanBridge);
-                beans.put(objectName, mbeanGBeanBridge);
+                MBeanGBeanBridge mbeanGBeanBridge = new MBeanGBeanBridge(kernel, abstractName,
mbeanInfo);
+                registry.put(abstractName.getObjectName(), mbeanGBeanBridge);
+                beans.put(abstractName.getObjectName(), mbeanGBeanBridge);
             }
         }
         for (Iterator iterator = beans.entrySet().iterator(); iterator.hasNext();) {
@@ -121,18 +124,18 @@
         }
     }
 
-    private void register(ObjectName objectName) {
+    private void register(AbstractName abstractName) {
         try {
-            MBeanGBeanBridge mbeanGBeanBridge = null;
+            MBeanGBeanBridge mbeanGBeanBridge;
             synchronized (this) {
-                if (registry.containsKey(objectName)) {
+                if (registry.containsKey(abstractName.getObjectName())) {
                     return;
                 }
-                MBeanInfo mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(objectName));
-                mbeanGBeanBridge = new MBeanGBeanBridge(kernel, objectName, mbeanInfo);
-                registry.put(objectName, mbeanGBeanBridge);
+                MBeanInfo mbeanInfo = JMXUtil.toMBeanInfo(kernel.getGBeanInfo(abstractName));
+                mbeanGBeanBridge = new MBeanGBeanBridge(kernel, abstractName, mbeanInfo);
+                registry.put(abstractName.getObjectName(), mbeanGBeanBridge);
             }
-            mbeanServer.registerMBean(mbeanGBeanBridge, objectName);
+            mbeanServer.registerMBean(mbeanGBeanBridge, abstractName.getObjectName());
         } catch (GBeanNotFoundException e) {
             // ignore - gbean already unregistered
         } catch (InstanceAlreadyExistsException e) {
@@ -142,15 +145,15 @@
         }
     }
 
-    private void unregister(ObjectName objectName) {
+    private void unregister(AbstractName abstractName) {
         synchronized (this) {
-            if (registry.remove(objectName) == null) {
+            if (registry.remove(abstractName.getObjectName()) == null) {
                 return;
             }
         }
 
         try {
-            mbeanServer.unregisterMBean(objectName);
+            mbeanServer.unregisterMBean(abstractName.getObjectName());
         } catch (InstanceNotFoundException e) {
             // ignore - something else may have unregistered us
             // if there truely is no GBean then we will catch it below whwn we call the superclass
@@ -167,12 +170,12 @@
     }
 
     private class GBeanRegistrationListener extends LifecycleAdapter {
-        public void loaded(ObjectName objectName) {
-            register(objectName);
+        public void loaded(AbstractName abstractName) {
+            register(abstractName);
         }
 
-        public void unloaded(ObjectName objectName) {
-            unregister(objectName);
+        public void unloaded(AbstractName abstractName) {
+            unregister(abstractName);
         }
     }
 

Modified: geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java?rev=383682&r1=383681&r2=383682&view=diff
==============================================================================
--- geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
(original)
+++ geronimo/branches/1.1/modules/system/src/test/org/apache/geronimo/system/configuration/LocalAttributeManagerTest.java
Mon Mar  6 13:44:29 2006
@@ -22,6 +22,7 @@
 import org.apache.geronimo.gbean.GBeanInfo;
 import org.apache.geronimo.gbean.GBeanInfoBuilder;
 import org.apache.geronimo.gbean.GReferenceInfo;
+import org.apache.geronimo.gbean.AbstractNameQuery;
 import org.apache.geronimo.kernel.repository.Artifact;
 import org.apache.geronimo.system.serverinfo.BasicServerInfo;
 
@@ -146,7 +147,7 @@
 
     public void testAddGBean() throws Exception {
         String attributeValue = "attribute value";
-        ObjectName referencePattern = new ObjectName(":name=referencePattern,*");
+        AbstractNameQuery referencePattern = new AbstractNameQuery(LocalAttributeManagerTest.class.getName());
 
         GBeanData gbeanData = new GBeanData(gbeanName, GBEAN_INFO);
         gbeanData.setAttribute(attributeInfo.getName(), attributeValue);



Mime
View raw message