[jboss-svn-commits] JBL Code SVN: r29459 - in labs/jbossrules/trunk: drools-api/src/main/java/org/drools and 13 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Sep 24 15:59:35 EDT 2009


Author: tirelli
Date: 2009-09-24 15:59:34 -0400 (Thu, 24 Sep 2009)
New Revision: 29459

Added:
   labs/jbossrules/trunk/drools-rhq-plugin/
   labs/jbossrules/trunk/drools-rhq-plugin/.classpath
   labs/jbossrules/trunk/drools-rhq-plugin/.project
   labs/jbossrules/trunk/drools-rhq-plugin/.settings/
   labs/jbossrules/trunk/drools-rhq-plugin/.settings/org.eclipse.jdt.core.prefs
   labs/jbossrules/trunk/drools-rhq-plugin/pom.xml
   labs/jbossrules/trunk/drools-rhq-plugin/src/
   labs/jbossrules/trunk/drools-rhq-plugin/src/main/
   labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/
   labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/META-INF/
   labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/META-INF/rhq-plugin.xml
Modified:
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseProvider.java
   labs/jbossrules/trunk/drools-api/src/main/java/org/drools/management/KnowledgeBaseMonitoringMBean.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExternalExecutorService.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/KnowledgeBaseProviderImpl.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/DroolsManagementAgent.java
   labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/KnowledgeBaseMonitoring.java
   labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Broker.java
   labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Main.java
   labs/jbossrules/trunk/drools-vsm/src/main/java/org/drools/vsm/KnowledgeBaseProviderClient.java
Log:
JBRULES-2247: improving JMX monitoring and adding initial implementation of the JOPR/RHQ plugin

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseFactory.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -47,6 +47,22 @@
     }
 
     /**
+     * Create a new KnowledgeBase using the default KnowledgeBaseConfiguration and
+     * the given KnowledgeBase ID.
+     * 
+     * @param kbaseId 
+     *     A string Identifier for the knowledge base. Specially useful when enabling
+     *     JMX monitoring and management, as that ID will be used to compose the
+     *     JMX ObjectName for all related MBeans. The application must ensure all kbase 
+     *     IDs are unique. 
+     * @return
+     *     The KnowledgeBase
+     */
+    public static KnowledgeBase newKnowledgeBase(String kbaseId) {
+        return getKnowledgeBaseProvider().newKnowledgeBase(kbaseId);
+    }
+
+    /**
      * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration
      * @return
      *     The KnowledgeBase
@@ -56,6 +72,23 @@
     }
 
     /**
+     * Create a new KnowledgeBase using the given KnowledgeBaseConfiguration and
+     * the given KnowledgeBase ID.
+     * 
+     * @param kbaseId 
+     *     A string Identifier for the knowledge base. Specially useful when enabling
+     *     JMX monitoring and management, as that ID will be used to compose the
+     *     JMX ObjectName for all related MBeans. The application must ensure all kbase 
+     *     IDs are unique. 
+     * @return
+     *     The KnowledgeBase
+     */
+    public static KnowledgeBase newKnowledgeBase(String kbaseId,
+                                                 KnowledgeBaseConfiguration conf) {
+        return getKnowledgeBaseProvider().newKnowledgeBase( kbaseId, conf );
+    }
+
+    /**
      * Create a KnowledgeBaseConfiguration on which properties can be set.
      * @return
      *     The KnowledgeBaseConfiguration.

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseProvider.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/KnowledgeBaseProvider.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -64,6 +64,20 @@
     KnowledgeBase newKnowledgeBase();
 
     /**
+     * Instantiate and return a KnowledgeBase using a default KnowledgeBaseConfiguration
+     * and the given KnowledgeBase ID.
+     * 
+     * @param kbaseId 
+     *     A string Identifier for the knowledge base. Specially useful when enabling
+     *     JMX monitoring and management, as that ID will be used to compose the
+     *     JMX ObjectName for all related MBeans. The application must ensure all kbase 
+     *     IDs are unique. 
+     * @return
+     *      The KnowledgeBase
+     */
+    KnowledgeBase newKnowledgeBase( String kbaseId );
+
+    /**
      * Instantiate and return a KnowledgeBase using the given KnowledgeBaseConfiguration
      * 
      * @param conf
@@ -74,6 +88,22 @@
     KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf);
 
     /**
+     * Instantiate and return a KnowledgeBase using the given KnowledgeBaseConfiguration and
+     * the given KnowledgeBase ID.
+     * 
+     * @param kbaseId 
+     *     A string Identifier for the knowledge base. Specially useful when enabling
+     *     JMX monitoring and management, as that ID will be used to compose the
+     *     JMX ObjectName for all related MBeans. The application must ensure all kbase 
+     *     IDs are unique. 
+     * @param conf
+     *     The KnowledgeBaseConfiguration to be used
+     * @return
+     *     The KnowledgeBase
+     */
+    KnowledgeBase newKnowledgeBase(String kbaseId, KnowledgeBaseConfiguration conf);
+
+    /**
      * Instantiate and return an Environment
      * 
      * @return

Modified: labs/jbossrules/trunk/drools-api/src/main/java/org/drools/management/KnowledgeBaseMonitoringMBean.java
===================================================================
--- labs/jbossrules/trunk/drools-api/src/main/java/org/drools/management/KnowledgeBaseMonitoringMBean.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-api/src/main/java/org/drools/management/KnowledgeBaseMonitoringMBean.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -33,5 +33,18 @@
     public String getPackages();
     
     public String getEntryPoints();     
+    
+    /**
+     * This operation creates, registers and starts
+     * all the dependent MBeans that allow monitor all the details
+     * in this KnowledgeBase. These mbeans are not started by default.
+     */
+    public void startInternalMBeans();
 
+    /**
+     * This operation will stop and dispose
+     * all the dependent MBeans that allow monitor all the details
+     * in this KnowledgeBase. These mbeans are not started by default.
+     */
+    public void stopInternalMBeans();
 }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/RuleBaseFactory.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -38,12 +38,32 @@
         return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
                                             null );
     }
-    
+
+    public static RuleBase newRuleBase( final String rulebaseId ) {
+        return RuleBaseFactory.newRuleBase( rulebaseId,
+                                            RuleBase.RETEOO,
+                                            null );
+    }
+
     public static RuleBase newRuleBase(final RuleBaseConfiguration config) {
         return RuleBaseFactory.newRuleBase( RuleBase.RETEOO,
                                             config );
-    }    
+    }
 
+    public static RuleBase newRuleBase(final String rulebaseId,
+                                       final RuleBaseConfiguration config) {
+        return RuleBaseFactory.newRuleBase( rulebaseId,
+                                            RuleBase.RETEOO,
+                                            config );
+    }
+
+    public static RuleBase newRuleBase(final String rulebaseId,
+                                       final int type) {
+        return RuleBaseFactory.newRuleBase( rulebaseId,
+                                            type,
+                                            null );
+    }
+
     public static RuleBase newRuleBase(final int type) {
         return RuleBaseFactory.newRuleBase( type,
                                             null );
@@ -52,10 +72,19 @@
     /** Create a new RuleBase of the appropriate type */
     public static RuleBase newRuleBase(final int type,
                                        final RuleBaseConfiguration config) {
+        return RuleBaseFactory.newRuleBase( UUID.randomUUID().toString(),
+                                            type,
+                                            config );
+    }
+
+    /** Create a new RuleBase of the appropriate type */
+    public static RuleBase newRuleBase(final String rulebaseId,
+                                       final int type,
+                                       final RuleBaseConfiguration config) {
         switch ( type ) {
             case RuleBase.RETEOO :
-                
-                return new org.drools.reteoo.ReteooRuleBase( UUID.randomUUID().toString(),
+
+                return new org.drools.reteoo.ReteooRuleBase( rulebaseId,
                                                              config );
             default :
                 throw new IllegalArgumentException( "Unknown engine type: " + type );

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExternalExecutorService.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExternalExecutorService.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/concurrent/ExternalExecutorService.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -28,7 +28,7 @@
  *  
  * @author etirelli
  */
-public class ExternalExecutorService
+public class ExternalExecutorService 
     implements
     java.util.concurrent.ExecutorService {
 
@@ -84,7 +84,7 @@
         }
         throw new RejectedExecutionException( "Execution service is terminated. No more tasks can be executed." );
     }
-
+ 
     /**
      * {@inheritDoc}
      */

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/KnowledgeBaseProviderImpl.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/KnowledgeBaseProviderImpl.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/impl/KnowledgeBaseProviderImpl.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -29,14 +29,24 @@
         return new SessionConfiguration(properties);
     }        
     
-	public KnowledgeBase newKnowledgeBase() {		
-		return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase() );		
-	}	
-	
+    public KnowledgeBase newKnowledgeBase() {       
+        return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase() );      
+    }   
+    
+    public KnowledgeBase newKnowledgeBase( String kbaseId ) {       
+        return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase(kbaseId) );      
+    }   
+    
     public KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) {
         return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase( ( RuleBaseConfiguration ) conf ) );
     }
 
+    public KnowledgeBase newKnowledgeBase(String kbaseId, 
+                                          KnowledgeBaseConfiguration conf) {
+        return new KnowledgeBaseImpl( RuleBaseFactory.newRuleBase( kbaseId, 
+                                                                   ( RuleBaseConfiguration ) conf ) );
+    }
+
 	public Environment newEnvironment() {
 		return new EnvironmentImpl(); //EnvironmentFactory.newEnvironment();
 	}

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/DroolsManagementAgent.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/DroolsManagementAgent.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/DroolsManagementAgent.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -39,15 +39,15 @@
     implements
     DroolsManagementAgentMBean {
 
-    private static final String          MBEAN_NAME = "org.drools:type=DroolsManagementAgent";
+    private static final String           MBEAN_NAME = "org.drools:type=DroolsManagementAgent";
 
-    private static DroolsManagementAgent INSTANCE;
-    private static MBeanServer           mbs;
-    
-    private long                         kbases;
-    private long                         ksessions;
-    private Map<Object, List<ObjectName>>    mbeans;
+    private static DroolsManagementAgent  INSTANCE;
+    private static MBeanServer            mbs;
 
+    private long                          kbases;
+    private long                          ksessions;
+    private Map<Object, List<ObjectName>> mbeans;
+
     private DroolsManagementAgent() {
         kbases = 0;
         ksessions = 0;
@@ -110,9 +110,10 @@
                 mbs.registerMBean( mbean,
                                    name );
                 List<ObjectName> mbl = mbeans.get( owner );
-                if( mbl == null ) {
+                if ( mbl == null ) {
                     mbl = new LinkedList<ObjectName>();
-                    mbeans.put( owner, mbl );
+                    mbeans.put( owner,
+                                mbl );
                 }
                 mbl.add( name );
             }
@@ -121,28 +122,44 @@
             e.printStackTrace();
         }
     }
-    
-    public void unregisterMBeansFromOwner( Object owner ) {
+
+    public void unregisterMBeansFromOwner(Object owner) {
         List<ObjectName> mbl = mbeans.remove( owner );
-        if( mbl != null ) {
+        if ( mbl != null ) {
             MBeanServer mbs = getMBeanServer();
-            for( ObjectName name : mbl ) {
+            for ( ObjectName name : mbl ) {
                 try {
                     mbs.unregisterMBean( name );
                 } catch ( Exception e ) {
-                    System.err.println("Exception unregistering mbean: "+name);
+                    System.err.println( "Exception unregistering mbean: " + name );
                     e.printStackTrace();
                 }
             }
         }
     }
-    
-    public static ObjectName createObjectName( String name ) {
+
+    public void unregisterDependentsMBeansFromOwner(Object owner) {
+        List<ObjectName> mbl = mbeans.get( owner );
+        if ( mbl != null ) {
+            MBeanServer mbs = getMBeanServer();
+            for ( ObjectName name : mbl.subList( 1, mbl.size() ) ) {
+                try {
+                    mbs.unregisterMBean( name );
+                } catch ( Exception e ) {
+                    System.err.println( "Exception unregistering mbean: " + name );
+                    e.printStackTrace();
+                }
+            }
+            mbl.subList( 1, mbl.size() ).clear();
+        }
+    }
+
+    public static ObjectName createObjectName(String name) {
         try {
             return new ObjectName( name );
         } catch ( Exception e ) {
-            System.err.println("This is a bug. Error creating ObjectName for MBean: "+name);
-            System.err.println("Please contact the development team and provide the following stack trace: "+e.getMessage() );
+            System.err.println( "This is a bug. Error creating ObjectName for MBean: " + name );
+            System.err.println( "Please contact the development team and provide the following stack trace: " + e.getMessage() );
             e.printStackTrace();
             return null;
         }

Modified: labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/KnowledgeBaseMonitoring.java
===================================================================
--- labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/KnowledgeBaseMonitoring.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-core/src/main/java/org/drools/management/KnowledgeBaseMonitoring.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -77,11 +77,10 @@
     public String getEntryPoints() {
         // the dependent mbeans are created here in order to delay their creating 
         // until the this kbase is actually inspected 
-        createDependentMBeans();
         return kbase.getRete().getEntryPointNodes().keySet().toString();
     }
 
-    private void createDependentMBeans() {
+    public void startInternalMBeans() {
         for( EntryPointNode epn : kbase.getRete().getEntryPointNodes().values() ) {
             for( ObjectTypeNode otn : epn.getObjectTypeNodes().values() ) {
                 ObjectTypeNodeMonitor otnm = new ObjectTypeNodeMonitor( otn );
@@ -93,5 +92,9 @@
         ObjectName name = DroolsManagementAgent.createObjectName( this.name.getCanonicalName() + ",type=Configuration" );
         DroolsManagementAgent.getInstance().registerMBean( kbase, kbcm, name );
     }
+
+    public void stopInternalMBeans() {
+        DroolsManagementAgent.getInstance().unregisterDependentsMBeansFromOwner( kbase );
+    }
     
 }

Modified: labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Broker.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Broker.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Broker.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -106,7 +106,7 @@
         KnowledgeBaseConfiguration conf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
         conf.setOption( EventProcessingOption.STREAM );
         conf.setOption( MBeansOption.ENABLED );
-        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( conf );
+        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( "Stock Broker", conf ); 
         kbase.addKnowledgePackages( builder.getKnowledgePackages() );
         return kbase;
     }

Modified: labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Main.java
===================================================================
--- labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Main.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-examples/drools-examples-fusion/src/main/java/org/drools/examples/broker/Main.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -47,7 +47,7 @@
         CompanyRegistry registry = new CompanyRegistry();
         BrokerWindow window = new BrokerWindow( registry.getCompanies() );
         window.show();
-        //Thread.sleep( 10000 );
+        Thread.sleep( 10000 );
         Broker broker = new Broker( window, registry );
         
         TimerService clock = new JDKTimerService(1);

Added: labs/jbossrules/trunk/drools-rhq-plugin/.classpath
===================================================================
--- labs/jbossrules/trunk/drools-rhq-plugin/.classpath	                        (rev 0)
+++ labs/jbossrules/trunk/drools-rhq-plugin/.classpath	2009-09-24 19:59:34 UTC (rev 29459)
@@ -0,0 +1,12 @@
+<classpath>
+  <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+  <classpathentry kind="output" path="target/classes"/>
+  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+  <classpathentry kind="var" path="M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar" sourcepath="M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1-sources.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/jmock/jmock-legacy/2.5.1/jmock-legacy-2.5.1.jar"/>
+  <classpathentry kind="var" path="M2_REPO/junit/junit/4.6/junit-4.6.jar"/>
+  <classpathentry kind="var" path="M2_REPO/org/objenesis/objenesis/1.0/objenesis-1.0.jar"/>
+</classpath>
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-rhq-plugin/.project
===================================================================
--- labs/jbossrules/trunk/drools-rhq-plugin/.project	                        (rev 0)
+++ labs/jbossrules/trunk/drools-rhq-plugin/.project	2009-09-24 19:59:34 UTC (rev 29459)
@@ -0,0 +1,13 @@
+<projectDescription>
+  <name>drools-rhq-plugin</name>
+  <comment>RHQ/JOPR plugin that monitors Drools defined MBeans</comment>
+  <projects/>
+  <buildSpec>
+    <buildCommand>
+      <name>org.eclipse.jdt.core.javabuilder</name>
+    </buildCommand>
+  </buildSpec>
+  <natures>
+    <nature>org.eclipse.jdt.core.javanature</nature>
+  </natures>
+</projectDescription>
\ No newline at end of file

Added: labs/jbossrules/trunk/drools-rhq-plugin/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- labs/jbossrules/trunk/drools-rhq-plugin/.settings/org.eclipse.jdt.core.prefs	                        (rev 0)
+++ labs/jbossrules/trunk/drools-rhq-plugin/.settings/org.eclipse.jdt.core.prefs	2009-09-24 19:59:34 UTC (rev 29459)
@@ -0,0 +1,5 @@
+#Tue Sep 22 12:23:23 EDT 2009
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5

Added: labs/jbossrules/trunk/drools-rhq-plugin/pom.xml
===================================================================
--- labs/jbossrules/trunk/drools-rhq-plugin/pom.xml	                        (rev 0)
+++ labs/jbossrules/trunk/drools-rhq-plugin/pom.xml	2009-09-24 19:59:34 UTC (rev 29459)
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+   <modelVersion>4.0.0</modelVersion>
+   <parent>
+       <artifactId>drools</artifactId>
+       <groupId>org.drools</groupId>
+       <version>5.1.0.SNAPSHOT</version>
+   </parent>
+
+   <artifactId>drools-rhq-plugin</artifactId>
+   <packaging>jar</packaging>
+   <name>Drools :: RHQ JMX Plugin</name>
+   <description>RHQ/JOPR plugin that monitors Drools defined MBeans</description>
+
+</project>

Added: labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/META-INF/rhq-plugin.xml	                        (rev 0)
+++ labs/jbossrules/trunk/drools-rhq-plugin/src/main/resources/META-INF/rhq-plugin.xml	2009-09-24 19:59:34 UTC (rev 29459)
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<plugin name="DroolsRHQPlugin"
+        displayName="Drools RHQ JMX Plugin"
+        description="Provides monitoring of Drools Knowledge Bases and Sessions"
+        version="1.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+        xmlns="urn:xmlns:rhq-plugin"
+        xmlns:c="urn:xmlns:rhq-configuration">
+
+   <depends plugin="JMX" useClasses="true"/>
+
+   <service name="Drools Service"
+            description="Drools service"
+            discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
+            class="org.rhq.plugins.jmx.MBeanResourceComponent">
+
+      <runs-inside>
+         <parent-resource-type name="JMX Server" plugin="JMX"/>
+      </runs-inside>
+
+      <plugin-configuration>
+         <c:simple-property name="objectName" readOnly="true" default="org.drools:type=DroolsManagementAgent"/>
+      </plugin-configuration>
+   </service>
+
+   <service name="Drools Knowledge Bases"
+            description="The Drools Knowledge Base monitoring service."
+            discovery="org.rhq.plugins.jmx.MBeanResourceDiscoveryComponent"
+            class="org.rhq.plugins.jmx.MBeanResourceComponent">
+
+      <runs-inside>
+         <parent-resource-type name="JMX Server" plugin="JMX"/>
+      </runs-inside>
+
+      <plugin-configuration>
+         <c:simple-property name="objectName" readOnly="true" default="org.drools.kbases:id=%kbaseId%"/>
+         <c:simple-property name="nameTemplate" default="KBase '{kbaseId}'"/>
+         <c:simple-property name="descriptionTemplate" default="A JMX bean for Knowledge Base '{kbaseId}'"/>
+         <c:simple-property name="kbaseId" type="string" description="The Knowledge Base Id"/>
+      </plugin-configuration>
+
+      <operation name="startInternalMBeans"
+                 displayName="Start Internal MBeans"
+                 description="Starts all the internal dependent MBeans.">
+      </operation>
+
+      <operation name="stopInternalMBeans"
+                 displayName="Stop Internal MBeans"
+                 description="Stops all the internal dependent MBeans.">
+      </operation>
+
+   </service>
+
+</plugin>

Modified: labs/jbossrules/trunk/drools-vsm/src/main/java/org/drools/vsm/KnowledgeBaseProviderClient.java
===================================================================
--- labs/jbossrules/trunk/drools-vsm/src/main/java/org/drools/vsm/KnowledgeBaseProviderClient.java	2009-09-24 17:02:50 UTC (rev 29458)
+++ labs/jbossrules/trunk/drools-vsm/src/main/java/org/drools/vsm/KnowledgeBaseProviderClient.java	2009-09-24 19:59:34 UTC (rev 29459)
@@ -9,7 +9,6 @@
 import org.drools.KnowledgeBaseProvider;
 import org.drools.command.NewKnowledgeBaseCommand;
 import org.drools.command.SetVariableCommand;
-import org.drools.command.builder.NewKnowledgeBuilderCommand;
 import org.drools.runtime.Environment;
 import org.drools.runtime.KnowledgeSessionConfiguration;
 
@@ -28,7 +27,7 @@
     }
 
     public KnowledgeBase newKnowledgeBase() {
-        return newKnowledgeBase( null );
+        return newKnowledgeBase( (KnowledgeBaseConfiguration) null );
     }
 
     public KnowledgeBase newKnowledgeBase(KnowledgeBaseConfiguration conf) {
@@ -83,4 +82,15 @@
         return null;
     }
 
+    public KnowledgeBase newKnowledgeBase(String kbaseId) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    public KnowledgeBase newKnowledgeBase(String kbaseId,
+                                          KnowledgeBaseConfiguration conf) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
 }



More information about the jboss-svn-commits mailing list