[jboss-cvs] JBossAS SVN: r66908 - in trunk: messaging/src/etc/deploy/clustered and 7 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Nov 9 05:43:15 EST 2007


Author: dimitris at jboss.org
Date: 2007-11-09 05:43:15 -0500 (Fri, 09 Nov 2007)
New Revision: 66908

Added:
   trunk/messaging/src/main/org/jboss/jms/
   trunk/messaging/src/main/org/jboss/jms/server/
   trunk/messaging/src/main/org/jboss/jms/server/destination/
   trunk/messaging/src/main/org/jboss/jms/server/destination/QueueServiceMO.java
   trunk/messaging/src/main/org/jboss/jms/server/destination/TopicServiceMO.java
   trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ManagementObjectClass.java
Modified:
   trunk/jbossas/jmx-remoting/
   trunk/messaging/src/etc/deploy/clustered/destinations-service.xml
   trunk/messaging/src/etc/deploy/non-clustered/destinations-service.xml
   trunk/system-jmx/
   trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
Log:
JBAS-4658, handle @org.jboss.system.deployers.managed.ManagementObjectClass in -service.xml deployments


Property changes on: trunk/jbossas/jmx-remoting
___________________________________________________________________
Name: svn:ignore
   - output

   + output
build.log


Modified: trunk/messaging/src/etc/deploy/clustered/destinations-service.xml
===================================================================
--- trunk/messaging/src/etc/deploy/clustered/destinations-service.xml	2007-11-09 10:22:33 UTC (rev 66907)
+++ trunk/messaging/src/etc/deploy/clustered/destinations-service.xml	2007-11-09 10:43:15 UTC (rev 66908)
@@ -15,6 +15,7 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=DLQ"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>
@@ -26,6 +27,7 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>   

Modified: trunk/messaging/src/etc/deploy/non-clustered/destinations-service.xml
===================================================================
--- trunk/messaging/src/etc/deploy/non-clustered/destinations-service.xml	2007-11-09 10:22:33 UTC (rev 66907)
+++ trunk/messaging/src/etc/deploy/non-clustered/destinations-service.xml	2007-11-09 10:43:15 UTC (rev 66908)
@@ -15,6 +15,7 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=DLQ"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>
@@ -26,6 +27,7 @@
    <mbean code="org.jboss.jms.server.destination.QueueService"
       name="jboss.messaging.destination:service=Queue,name=ExpiryQueue"
       xmbean-dd="xmdesc/Queue-xmbean.xml">
+      <annotation>@org.jboss.system.deployers.managed.ManagementObjectClass(code=org.jboss.jms.server.destination.QueueServiceMO)</annotation>      
       <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
       <depends>jboss.messaging:service=PostOffice</depends>
    </mbean>   

Added: trunk/messaging/src/main/org/jboss/jms/server/destination/QueueServiceMO.java
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/QueueServiceMO.java	                        (rev 0)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/QueueServiceMO.java	2007-11-09 10:43:15 UTC (rev 66908)
@@ -0,0 +1,181 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.server.destination;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.jms.server.messagecounter.MessageCounter;
+import org.jboss.jms.server.messagecounter.MessageStatistics;
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.w3c.dom.Element;
+
+/**
+ * Empty class to provide the management metadata for JBoss Messaging
+ * org.jboss.jms.server.destination.QueueService, when deployed in AS5.
+ * 
+ * @see {@linkplain org.jboss.jms.server.destination.QueueService}
+ * 
+ * @author Dimitris.Andreadis at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(
+      componentType = @ManagementComponent(type = "JMSDestination", subtype = "Queue"),
+      properties = ManagementProperties.EXPLICIT)
+public class QueueServiceMO implements Serializable
+{
+   private static final long serialVersionUID = 8483702123881698540L;
+
+// Management Properties
+   
+   @ManagementProperty(use={ViewUse.RUNTIME}, description="The destination name")
+   public String getName() { return null; }   
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The destination's JNDI name")
+   public String getJNDIName() { return null; }
+   public void setJNDIName(String arg0) throws Exception { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The ObjectName of the server peer this destination was deployed on")
+   public ObjectName getServerPeer() { return null; }
+   public void setServerPeer(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The DLQ for this queue, overrides the default DLQ on the server peer")   
+   public ObjectName getDLQ() { return null; }
+   public void setDLQ(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The expiry queue for this queue, overrides the default expiry queue on the server peer")   
+   public ObjectName getExpiryQueue() { return null; }
+   public void setExpiryQueue(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The delay before redelivering")   
+   public long getRedeliveryDelay() { return 0; }
+   public void setRedeliveryDelay(long arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The destination's security configuration")     
+   public Element getSecurityConfig() { return null; }
+   public void setSecurityConfig(Element arg0) { }
+   
+   @ManagementProperty(use={ViewUse.RUNTIME}, description="True if this destination was created programmatically")
+   public boolean isCreatedProgrammatically() { return false; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The number of messages in the queue")
+   public int getMessageCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The number of messages currently being delivered")
+   public int getDeliveringCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The number of scheduled messages in the queue")
+   public int getScheduledMessageCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The maximum number of messages this queue can hold before they are dropped")     
+   public int getMaxSize() { return 0; }
+   public void setMaxSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The in-memory message limit, can only be set when queue is stopped")
+   public int getFullSize() { return 0; }
+   public void setFullSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The paging size, can only be set when queue is stopped")
+   public int getPageSize() { return 0; }
+   public void setPageSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The write-cache size, can only be set when queue is stopped")
+   public int getDownCacheSize() { return 0; }
+   public void setDownCacheSize(int arg0) { }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Is this a clustered destination?")
+   public boolean isClustered() { return false; }
+   public void setClustered(boolean arg0) { }
+
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="Get the message counter for the queue")
+   public MessageCounter getMessageCounter() { return null; }
+
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="Get the message statistics for the queue")
+   public MessageStatistics getMessageStatistics() { return null; }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The day limit for the message counter")
+   public int getMessageCounterHistoryDayLimit() { return 0; }
+   public void setMessageCounterHistoryDayLimit(int arg0) { }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The maximum delivery attempts to the queue")
+   public int getMaxDeliveryAttempts() { return 0; }
+   public void setMaxDeliveryAttempts(int arg0) { }
+
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The number of consumers on the queue")
+   public int getConsumerCount() { return 0; }
+   
+   // Management Operations
+   
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void create() throws Exception { }
+
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void start() throws Exception { }
+
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void stop() { }
+   
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void destroy() { }
+
+   @ManagementOperation(description = "Remove all messages in the queue", impact = Impact.WriteOnly)
+   public void removeAllMessages() throws Exception { }
+
+   @ManagementOperation(description = "List all messages", impact = Impact.ReadOnly)
+   public List listAllMessages() throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all messages with selector", impact = Impact.ReadOnly)
+   public List listAllMessages(String selector) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all durable mesages", impact = Impact.ReadOnly)
+   public List listDurableMessages() throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all durable mesages using a selector", impact = Impact.ReadOnly)
+   public List listDurableMessages(String selector) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all non durable mesages", impact = Impact.ReadOnly)
+   public List listNonDurableMessages() throws Exception { return null; }
+
+   @ManagementOperation(description = "List all non durable mesages using a selector", impact = Impact.ReadOnly)
+   public List listNonDurableMessages(String selector) throws Exception { return null; }
+    
+   @ManagementOperation(description = "Reset the message counter", impact = Impact.WriteOnly)
+   public void resetMessageCounter() throws Exception { }
+
+   @ManagementOperation(description = "Reset the message counter history", impact = Impact.WriteOnly)
+   public void resetMessageCounterHistory() throws Exception { }
+
+   @ManagementOperation(description = "Get the message counter as HTML", impact = Impact.ReadOnly)
+   public String listMessageCounterAsHTML() throws Exception { return null; }
+
+   @ManagementOperation(description = "Get the message counter history as HTML", impact = Impact.ReadOnly)
+   public String listMessageCounterHistoryAsHTML() throws Exception { return null; }
+   
+}
\ No newline at end of file

Added: trunk/messaging/src/main/org/jboss/jms/server/destination/TopicServiceMO.java
===================================================================
--- trunk/messaging/src/main/org/jboss/jms/server/destination/TopicServiceMO.java	                        (rev 0)
+++ trunk/messaging/src/main/org/jboss/jms/server/destination/TopicServiceMO.java	2007-11-09 10:43:15 UTC (rev 66908)
@@ -0,0 +1,188 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.jms.server.destination;
+
+import java.io.Serializable;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.managed.api.ManagedOperation.Impact;
+import org.jboss.managed.api.annotation.ManagementComponent;
+import org.jboss.managed.api.annotation.ManagementObject;
+import org.jboss.managed.api.annotation.ManagementOperation;
+import org.jboss.managed.api.annotation.ManagementProperties;
+import org.jboss.managed.api.annotation.ManagementProperty;
+import org.jboss.managed.api.annotation.ViewUse;
+import org.w3c.dom.Element;
+
+/**
+ * Empty class to provide the management metadata for JBoss Messaging
+ * org.jboss.jms.server.destination.TopicService, when deployed in AS5.
+ * 
+ * @see {@linkplain org.jboss.jms.server.destination.TopicService}
+ * 
+ * @author Dimitris.Andreadis at jboss.org
+ * @version $Revision:$
+ */
+ at ManagementObject(
+      componentType = @ManagementComponent(type = "JMSDestination", subtype = "Topic"),
+      properties = ManagementProperties.EXPLICIT)
+public class TopicServiceMO implements Serializable
+{
+   private static final long serialVersionUID = -2972719964517681496L;
+   
+   // Management Properties
+   
+   @ManagementProperty(use={ViewUse.RUNTIME}, description="The destination name")
+   public String getName() { return null; }   
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The destination's JNDI name")
+   public String getJNDIName() { return null; }
+   public void setJNDIName(String arg0) throws Exception { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The ObjectName of the server peer this destination was deployed on")
+   public ObjectName getServerPeer() { return null; }
+   public void setServerPeer(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The DLQ for this topic, overrides the default DLQ on the server peer")   
+   public ObjectName getDLQ() { return null; }
+   public void setDLQ(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The expiry queue for this topic, overrides the default expiry queue on the server peer")   
+   public ObjectName getExpiryQueue() { return null; }
+   public void setExpiryQueue(ObjectName arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The delay before redelivering")   
+   public long getRedeliveryDelay() { return 0; }
+   public void setRedeliveryDelay(long arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The destination's security configuration")     
+   public Element getSecurityConfig() { return null; }
+   public void setSecurityConfig(Element arg0) { }
+   
+   @ManagementProperty(use={ViewUse.RUNTIME}, description="True if this destination was created programmatically")
+   public boolean isCreatedProgrammatically() { return false; }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The maximum number of messages this topic can hold before they are dropped")     
+   public int getMaxSize() { return 0; }
+   public void setMaxSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The in-memory message limit, can only be set when topic is stopped")
+   public int getFullSize() { return 0; }
+   public void setFullSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The paging size, can only be set when topic is stopped")
+   public int getPageSize() { return 0; }
+   public void setPageSize(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The write-cache size, can only be set when topic is stopped")
+   public int getDownCacheSize() { return 0; }
+   public void setDownCacheSize(int arg0) { }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="Is this a clustered destination?")
+   public boolean isClustered() { return false; }
+   public void setClustered(boolean arg0) { }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The day limit for the message counter")
+   public int getMessageCounterHistoryDayLimit() { return 0; }
+   public void setMessageCounterHistoryDayLimit(int arg0) { }
+
+   @ManagementProperty(use={ViewUse.CONFIGURATION}, description="The maximum delivery attempts to the topic")
+   public int getMaxDeliveryAttempts() { return 0; }
+   public void setMaxDeliveryAttempts(int arg0) { }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The message counters for the topic")
+   public List getMessageCounters() { return null; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all messages in all subscriptions of this topic")
+   public int getAllMessageCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all messages in all durable subscriptions of this topic")
+   public int getDurableMessageCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all messages in all non durable subscriptions of this topic")
+   public int getNonDurableMessageCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all subscriptions of this topic")
+   public int getAllSubscriptionsCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all durable subscriptions of this topic")
+   public int getDurableSubscriptionsCount() { return 0; }
+   
+   @ManagementProperty(use={ViewUse.STATISTIC}, description="The count of all non durable subscriptions of this topic")
+   public int getNonDurableSubscriptionsCount() { return 0; }
+   
+   // Management Operations
+   
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void create() throws Exception { }
+
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void start() throws Exception { }
+
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void stop() { }
+   
+   @ManagementOperation(description = "Service lifecycle operation", impact = Impact.WriteOnly)
+   public void destroy() { }
+
+   @ManagementOperation(description = "Remove all messages", impact = Impact.WriteOnly)
+   public void removeAllMessages() throws Exception { }
+   
+   @ManagementOperation(description = "Return all subscriptions for the topic", impact = Impact.ReadOnly)
+   public List listAllSubscriptions() throws Exception { return null; }
+   
+   @ManagementOperation(description = "Return all durable subscriptions for the topic", impact = Impact.ReadOnly)
+   public List listDurableSubscriptions() throws Exception { return null; }
+   
+   @ManagementOperation(description = "Return all non durable subscriptions for the topic", impact = Impact.ReadOnly)
+   public List listNonDurableSubscriptions() throws Exception { return null; }
+   
+   @ManagementOperation(description = "Return all subscriptions for the topic in HTML", impact = Impact.ReadOnly)
+   public String listAllSubscriptionsAsHTML() throws Exception { return null; }
+   
+   @ManagementOperation(description = "Return all durable subscriptions for the topic in HTML", impact = Impact.ReadOnly)
+   public String listDurableSubscriptionsAsHTML() throws Exception { return null; }
+   
+   @ManagementOperation(description = "Return all non durable subscriptions for the topic in HTML", impact = Impact.ReadOnly)
+   public String listNonDurableSubscriptionsAsHTML() throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all messages for the specified subscription", impact = Impact.ReadOnly)
+   public List listAllMessages(String subscriptionID) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all messages for the specified subscription with the specified selector", impact = Impact.ReadOnly)
+   public List listAllMessages(String subscriptionID, String selector) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all durable messages for the specified subscription", impact = Impact.ReadOnly)
+   public List listDurableMessages(String subscriptionID) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all durable messages for the specified subscription with the specified selector", impact = Impact.ReadOnly)
+   public List listDurableMessages(String subscriptionID, String selector) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all non durable messages for the specified subscription", impact = Impact.ReadOnly)
+   public List listNonDurableMessages(String subscriptionID) throws Exception { return null; }
+   
+   @ManagementOperation(description = "List all non durable messages for the specified subscription with the specified selector", impact = Impact.ReadOnly)
+   public List listNonDurableMessages(String subscriptionID, String selector) throws Exception { return null; }
+   
+}
\ No newline at end of file


Property changes on: trunk/system-jmx
___________________________________________________________________
Name: svn:ignore
   - output
target

   + output
target
build.log


Added: trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ManagementObjectClass.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ManagementObjectClass.java	                        (rev 0)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ManagementObjectClass.java	2007-11-09 10:43:15 UTC (rev 66908)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2007, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.system.deployers.managed;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * ManagementObjectClass annotation for describing the actual class
+ * annotated with org.jboss.managed.api.annotation.ManagementObject.
+ * 
+ * @see {@linkplain org.jboss.managed.api.annotation.ManagementObject}
+ * 
+ * @author <a href="dimitris at jboss.org">Dimitris Andreadis</a>
+ * @version $Revision: 1.1 $
+ */
+ at Target({ElementType.TYPE})
+ at Retention(RetentionPolicy.RUNTIME)
+public @interface ManagementObjectClass
+{
+   /** The class annotated with ManagementObject */
+   Class code();
+}
\ No newline at end of file

Modified: trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java
===================================================================
--- trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2007-11-09 10:22:33 UTC (rev 66907)
+++ trunk/system-jmx/src/main/org/jboss/system/deployers/managed/ServiceMetaDataICF.java	2007-11-09 10:43:15 UTC (rev 66908)
@@ -22,6 +22,7 @@
 package org.jboss.system.deployers.managed;
 
 import java.io.Serializable;
+import java.util.List;
 
 import javax.management.InstanceNotFoundException;
 import javax.management.MBeanServer;
@@ -34,6 +35,7 @@
 import org.jboss.managed.spi.factory.InstanceClassFactory;
 import org.jboss.metatype.api.values.MetaValue;
 import org.jboss.metatype.api.values.MetaValueFactory;
+import org.jboss.system.metadata.ServiceAnnotationMetaData;
 import org.jboss.system.metadata.ServiceAttributeMetaData;
 import org.jboss.system.metadata.ServiceDependencyValueMetaData;
 import org.jboss.system.metadata.ServiceMetaData;
@@ -44,13 +46,17 @@
  * The InstanceClassFactory implementation for ServiceMetaData.
  * 
  * @author Scott.Stark at jboss.org
+ * @author Dimitris.Andreadis at jboss.org
  * @version $Revision$
  */
 public class ServiceMetaDataICF implements InstanceClassFactory<ServiceMetaData>
 {
    private static final Logger log = Logger.getLogger(ServiceMetaDataICF.class);
 
+   private static final String MOCLASS_ANNOTATION = '@' + ManagementObjectClass.class.getName();
+   
    private MBeanServer mbeanServer;
+   
    /** The meta value factory */
    private MetaValueFactory metaValueFactory = MetaValueFactory.getInstance(); 
 
@@ -71,6 +77,24 @@
       {
          ClassLoader loader = mbeanServer.getClassLoader(md.getClassLoaderName());
          Class moClass = loader.loadClass(md.getCode());
+
+         // Looks for a ManagementObjectClass annotation that defines
+         // an alternate class to scan for management annotations
+         List<ServiceAnnotationMetaData> samlist = md.getAnnotations();
+         for (ServiceAnnotationMetaData sam : samlist)
+         {
+            // Annotations are not yet introduced to the actual mbean
+            // so just look for the annotation string
+            String anString = sam.getAnnotation();
+            if (anString.startsWith(MOCLASS_ANNOTATION))
+            {
+               Class originalClass = moClass;
+               ManagementObjectClass moc = (ManagementObjectClass)sam.getAnnotationInstance(loader);
+               moClass = moc.code();
+               log.debug("Using alternate class '" + moClass + "' for class " + originalClass);
+               break;
+            }  
+         }
          return moClass;
       }
       catch(InstanceNotFoundException e)




More information about the jboss-cvs-commits mailing list