[jboss-osgi-commits] JBoss-OSGI SVN: r101329 - in projects/jboss-osgi/projects/bundles/jmx/trunk: jmx-api/src/main/java/org/jboss/osgi/jmx and 12 other directories.

jboss-osgi-commits at lists.jboss.org jboss-osgi-commits at lists.jboss.org
Tue Feb 23 09:01:26 EST 2010


Author: thomas.diesler at jboss.com
Date: 2010-02-23 09:01:24 -0500 (Tue, 23 Feb 2010)
New Revision: 101329

Added:
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/FrameworkMBeanExt.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/JMXConstantsExt.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ServiceStateMBeanExt.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/assembly-bundles.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/FrameworkImpl.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ServiceStateImpl.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateMBeanTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkMBeanTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateMBeanTestCase.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/log4j.xml
Removed:
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/Constants.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Modified:
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml
   projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
   projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
Log:
Add project test coverage.
Provide FrameworkMBeanExt, ServiceStateMBeanExt

Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/Constants.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/Constants.java	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/Constants.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -1,40 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.osgi.jmx;
-
-//$Id$
-
-/**
- * The JMX service contants
- * 
- * @author thomas.diesler at jboss.com
- * @since 24-Apr-2009
- */
-public interface Constants
-{
-   /** The property that sets the host that the RMIAdaptor binds to: org.jboss.osgi.jmx.host */
-   String REMOTE_JMX_HOST = "org.jboss.osgi.jmx.host";
-   /** The property that sets the port that the RMIAdaptor binds to: org.jboss.osgi.jmx.port */
-   String REMOTE_JMX_RMI_PORT = "org.jboss.osgi.jmx.rmi.port";
-   /** The property that sets the JNDI name the RMIAdaptor binds to: org.jboss.osgi.jmx.rmi.adaptor */
-   String REMOTE_JMX_RMI_ADAPTOR = "org.jboss.osgi.jmx.rmi.adaptor";
-}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/FrameworkMBeanExt.java (from rev 101322, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/FrameworkMBeanExt.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/FrameworkMBeanExt.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.osgi.jmx;
+
+import org.osgi.jmx.framework.FrameworkMBean;
+
+//$Id$
+
+
+/**
+ * An extension to {@link FrameworkMBean}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public interface FrameworkMBeanExt extends FrameworkMBean
+{
+   /** The default object name: jboss.osgi:service=jmx,type=Framework */
+   String OBJECTNAME = "jboss.osgi:service=jmx,type=Framework";
+
+   /**
+    * Refresh packages through the PackageAdmin service
+    * 
+    * JMX FrameworkMBean does not allow to resolve/refresh all bundles
+    * https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+    */
+   void refreshAllPackages();
+
+   /**
+    * Resolve bundles through the PackageAdmin service
+    * 
+    * JMX FrameworkMBean does not allow to resolve/refresh all bundles
+    * https://www.osgi.org/members/bugzilla/show_bug.cgi?id=1586
+    */
+   boolean resolveAllBundles();
+}
\ No newline at end of file

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/JMXConstantsExt.java (from rev 101168, projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/Constants.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/JMXConstantsExt.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/JMXConstantsExt.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.osgi.jmx;
+
+//$Id$
+
+/**
+ * The JMX service contants
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 24-Apr-2009
+ */
+public interface JMXConstantsExt
+{
+   /** The property that sets the host that the RMIAdaptor binds to: org.jboss.osgi.jmx.host */
+   String REMOTE_JMX_HOST = "org.jboss.osgi.jmx.host";
+   /** The property that sets the port that the RMIAdaptor binds to: org.jboss.osgi.jmx.port */
+   String REMOTE_JMX_RMI_PORT = "org.jboss.osgi.jmx.rmi.port";
+   /** The property that sets the JNDI name the RMIAdaptor binds to: org.jboss.osgi.jmx.rmi.adaptor */
+   String REMOTE_JMX_RMI_ADAPTOR = "org.jboss.osgi.jmx.rmi.adaptor";
+}
\ No newline at end of file

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ServiceStateMBeanExt.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ServiceStateMBeanExt.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ServiceStateMBeanExt.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.osgi.jmx;
+
+//$Id$
+
+import java.io.IOException;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+
+/**
+ * An extension to {@link ServiceStateMBean}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 04-Mar-2009
+ */
+public interface ServiceStateMBeanExt extends ServiceStateMBean
+{
+   /** The default object name: jboss.osgi:service=jmx,type=ServiceState */
+   String OBJECTNAME = "jboss.osgi:service=jmx,type=ServiceState";
+
+   /**
+    * Returns a ServiceReference object for a service that implements and was registered 
+    * under the specified class.
+    */
+   CompositeData getService(String clazz) throws IOException;
+   
+   /**
+    * Returns an array of ManagedServiceReference objects. 
+    * The returned array of ManagedServiceReference objects contains services 
+    * that were registered under the specified class, match the specified filter criteria, 
+    * and the packages for the class names under which the services were registered.
+    */
+   TabularData getServices(String clazz, String filter) throws IOException;
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-api/src/main/java/org/jboss/osgi/jmx/ServiceStateMBeanExt.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/.classpath	2010-02-23 14:01:24 UTC (rev 101329)
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/resources"/>
+	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="output" path="target/classes"/>

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/pom.xml	2010-02-23 14:01:24 UTC (rev 101329)
@@ -48,6 +48,38 @@
       <artifactId>org.apache.aries.jmx.api</artifactId>
     </dependency>
     
+    <!-- Provided Dependencies -->
+    <dependency>
+      <groupId>org.jboss.osgi.bundles</groupId>
+      <artifactId>jboss-osgi-common</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.osgi.jndi</groupId>
+      <artifactId>jboss-osgi-jndi</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.aries.jmx</groupId>
+      <artifactId>org.apache.aries.jmx</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.felix</groupId>
+      <artifactId>org.apache.felix.log</artifactId>
+      <scope>provided</scope>
+      <exclusions>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.core</artifactId>
+        </exclusion>
+        <exclusion>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>org.osgi.compendium</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    
     <!-- OSGi Dependencies -->
     <dependency>
       <groupId>org.osgi</groupId>
@@ -59,6 +91,23 @@
       <artifactId>org.osgi.compendium</artifactId>
       <scope>provided</scope>
     </dependency>
+    
+    <!-- Test Dependencies -->
+    <dependency>
+      <groupId>org.jboss.osgi.runtime</groupId>
+      <artifactId>jboss-osgi-runtime-felix</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
   <build>
@@ -91,6 +140,7 @@
               
               <!-- osgi --> 
               org.osgi.framework;version="[1.5,2.0)",
+              org.osgi.jmx.framework;version="[1.0,2.0)", 
               org.osgi.service.packageadmin;version="[1.2,2.0)",
               org.osgi.util.tracker;version="[1.4,2.0)",
               
@@ -114,29 +164,101 @@
         </configuration>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>build-helper-maven-plugin</artifactId>
+        <artifactId>maven-assembly-plugin</artifactId>
         <executions>
           <execution>
-            <id>attach-artifacts</id>
-            <phase>package</phase>
+            <id>bundles</id>
+            <phase>test-compile</phase>
             <goals>
-              <goal>attach-artifact</goal>
+              <goal>directory-single</goal>
             </goals>
             <configuration>
-              <artifacts>
-                <artifact>
-                  <!-- For some reason the distribution javadoc module needs this -->
-                  <file>target/${artifactId}-${version}-sources.jar</file>
-                  <classifier>sources</classifier>
-                  <type>jar</type>
-                </artifact>
-              </artifacts>
+              <finalName>test-libs</finalName>
+              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-bundles.xml</descriptor>
+              </descriptors>
             </configuration>
           </execution>
         </executions>
       </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>build-test-jars</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+            <configuration>
+              <tasks>
+                <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+                <property name="artifactId" value="${artifactId}" />
+                <property name="tests.output.dir" value="${project.build.directory}" />
+                <property name="build.artifact" value="${project.build.finalName}" />
+                <ant antfile="scripts/antrun-test-jars.xml" />
+              </tasks>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <skip>true</skip>
+        </configuration>
+        <executions>
+          <execution>
+            <id>surefire-integration-tests</id>
+            <phase>integration-test</phase>
+            <goals>
+              <goal>test</goal>
+            </goals>
+            <configuration>
+              <skip>false</skip>
+              <argLine>${surefire.jpda.args}</argLine>
+              <systemProperties>
+                <property>
+                  <name>java.protocol.handler.pkgs</name>
+                  <value>org.jboss.net.protocol|org.jboss.virtual.protocol</value>
+                </property>
+                <property>
+                  <name>log4j.output.dir</name>
+                  <value>${project.build.directory}</value>
+                </property>
+                <property>
+                  <name>test.archive.directory</name>
+                  <value>${project.build.directory}/test-libs</value>
+                </property>
+              </systemProperties>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
   
+  <!-- Profiles -->
+  <profiles>
+
+    <!--
+      Name: jpda
+      Descr: Enable JPDA remote debuging
+    -->
+    <profile>
+      <id>jpda</id>
+      <activation>
+        <property>
+          <name>jpda</name>
+        </property>
+      </activation>
+      <properties>
+        <surefire.jpda.args>-Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</surefire.jpda.args>
+      </properties>
+    </profile>
+
+  </profiles>
+
 </project>

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!--  JBoss, the OpenSource J2EE webOS                            -->
+<!--  Distributable under LGPL license.                           -->
+<!--  See terms of license at http://www.gnu.org.                 -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project default="build-test-jars">
+
+  <description>OSGi test archive builder</description>
+
+  <!-- ================================================================== -->
+  <!-- Init                                                               -->
+  <!-- ================================================================== -->
+
+  <target name="init">
+
+    <!-- Property override when not called from maven -->
+    <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+    <property name="tests.output.dir" value="${basedir}/../target" />
+
+    <mkdir dir="${tests.output.dir}/test-libs" />
+    <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+    <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+    <taskdef resource="aQute/bnd/ant/taskdef.properties">
+      <classpath>
+        <pathelement path="${maven.runtime.classpath}" />
+      </classpath>
+    </taskdef>
+  	
+  	<!-- Copy build artifact to test-libs/bundles -->
+  	<copy file="${tests.output.dir}/${build.artifact}.jar" tofile="${tests.output.dir}/test-libs/bundles/${artifactId}.jar" overwrite="true"/>
+
+  </target>
+
+  <!-- ================================================================== -->
+  <!-- Building                                                           -->
+  <!-- ================================================================== -->
+
+  <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+    <!-- Please add alphabetically -->
+
+    <!-- Please add alphabetically -->
+
+  </target>
+
+</project>


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/assembly-bundles.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/assembly-bundles.xml	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,40 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+  <id>deploy-artifacts</id>
+  <formats>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+
+  <!-- Dependency Sets -->
+  <dependencySets>
+  
+    <!-- bundle -->
+    <dependencySet>
+      <outputDirectory>bundles</outputDirectory>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <includes>
+        <include>*:jboss-osgi-common-core:jar</include>
+      </includes>
+      <useStrictFiltering>true</useStrictFiltering>
+      <scope>compile</scope>
+      <unpack>false</unpack>
+    </dependencySet>
+    <dependencySet>
+      <outputDirectory>bundles</outputDirectory>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <includes>
+        <include>*:jboss-osgi-common:jar</include>
+        <include>*:jboss-osgi-jndi:jar</include>
+        <include>*:org.apache.aries.jmx:jar</include>
+        <include>*:org.apache.felix.log:jar</include>
+        <include>*:org.osgi.compendium:jar</include>
+      </includes>
+      <useStrictFiltering>true</useStrictFiltering>
+      <scope>provided</scope>
+      <unpack>false</unpack>
+    </dependencySet>
+    
+  </dependencySets>
+</assembly>


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Copied: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/FrameworkImpl.java (from rev 101160, projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/FrameworkImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/FrameworkImpl.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,266 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.osgi.jmx.internal;
+
+//$Id$
+
+import java.io.IOException;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+import javax.management.openmbean.CompositeData;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jmx.FrameworkMBeanExt;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.jmx.framework.FrameworkMBean;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An extension to {@link FrameworkMBean}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2009
+ */
+public class FrameworkImpl implements FrameworkMBeanExt
+{
+   // Provide logging
+   private static final Logger log = Logger.getLogger(FrameworkImpl.class);
+
+   private MBeanServer mbeanServer;
+   private BundleContext context;
+   private FrameworkMBean delegate;
+
+   public FrameworkImpl(BundleContext context, MBeanServer mbeanServer)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null BundleContext");
+      if (mbeanServer == null)
+         throw new IllegalArgumentException("Null MBeanServer");
+
+      if (context.getBundle().getBundleId() != 0)
+         throw new IllegalArgumentException("Not the system bundle context: " + context);
+
+      this.context = context;
+      this.mbeanServer = mbeanServer;
+   }
+
+   @Override
+   public void refreshAllPackages()
+   {
+      if (log.isTraceEnabled())
+         log.trace("refreshPackages(null)");
+
+      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+      PackageAdmin service = (PackageAdmin)context.getService(sref);
+      service.refreshPackages(null);
+   }
+
+   @Override
+   public boolean resolveAllBundles()
+   {
+      if (log.isTraceEnabled())
+         log.trace("resolveBundles(null)");
+
+      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+      PackageAdmin service = (PackageAdmin)context.getService(sref);
+      return service.resolveBundles(null);
+   }
+
+   void start()
+   {
+      try
+      {
+         ObjectName objectName = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
+         StandardMBean mbean = new StandardMBean(this, FrameworkMBeanExt.class);
+         mbeanServer.registerMBean(mbean, objectName);
+      }
+      catch (JMException ex)
+      {
+         log.warn("Cannot register: " + FrameworkMBeanExt.OBJECTNAME);
+      }
+   }
+
+   void stop()
+   {
+      try
+      {
+         ObjectName objectName = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
+         if (mbeanServer.isRegistered(objectName))
+            mbeanServer.unregisterMBean(objectName);
+      }
+      catch (JMException ex)
+      {
+         log.warn("Cannot register: " + FrameworkMBeanExt.OBJECTNAME);
+      }
+   }
+
+   public int getFrameworkStartLevel() throws IOException
+   {
+      return getFrameworkMBean().getFrameworkStartLevel();
+   }
+
+   public int getInitialBundleStartLevel() throws IOException
+   {
+      return getFrameworkMBean().getInitialBundleStartLevel();
+   }
+
+   public long installBundle(String arg0, String arg1) throws IOException
+   {
+      return getFrameworkMBean().installBundle(arg0, arg1);
+   }
+
+   public long installBundle(String arg0) throws IOException
+   {
+      return getFrameworkMBean().installBundle(arg0);
+   }
+
+   public CompositeData installBundles(String[] arg0, String[] arg1) throws IOException
+   {
+      return getFrameworkMBean().installBundles(arg0, arg1);
+   }
+
+   public CompositeData installBundles(String[] arg0) throws IOException
+   {
+      return getFrameworkMBean().installBundles(arg0);
+   }
+
+   public void refreshPackages(long arg0) throws IOException
+   {
+      getFrameworkMBean().refreshPackages(arg0);
+   }
+
+   public CompositeData refreshPackages(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().refreshPackages(arg0);
+   }
+
+   public boolean resolveBundle(long arg0) throws IOException
+   {
+      return getFrameworkMBean().resolveBundle(arg0);
+   }
+
+   public boolean resolveBundles(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().resolveBundles(arg0);
+   }
+
+   public void restartFramework() throws IOException
+   {
+      getFrameworkMBean().restartFramework();
+   }
+
+   public void setBundleStartLevel(long arg0, int arg1) throws IOException
+   {
+      getFrameworkMBean().setBundleStartLevel(arg0, arg1);
+   }
+
+   public CompositeData setBundleStartLevels(long[] arg0, int[] arg1) throws IOException
+   {
+      return getFrameworkMBean().setBundleStartLevels(arg0, arg1);
+   }
+
+   public void setFrameworkStartLevel(int arg0) throws IOException
+   {
+      getFrameworkMBean().setFrameworkStartLevel(arg0);
+   }
+
+   public void setInitialBundleStartLevel(int arg0) throws IOException
+   {
+      getFrameworkMBean().setInitialBundleStartLevel(arg0);
+   }
+
+   public void shutdownFramework() throws IOException
+   {
+      getFrameworkMBean().shutdownFramework();
+   }
+
+   public void startBundle(long arg0) throws IOException
+   {
+      getFrameworkMBean().startBundle(arg0);
+   }
+
+   public CompositeData startBundles(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().startBundles(arg0);
+   }
+
+   public void stopBundle(long arg0) throws IOException
+   {
+      getFrameworkMBean().stopBundle(arg0);
+   }
+
+   public CompositeData stopBundles(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().stopBundles(arg0);
+   }
+
+   public void uninstallBundle(long arg0) throws IOException
+   {
+      getFrameworkMBean().uninstallBundle(arg0);
+   }
+
+   public CompositeData uninstallBundles(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().uninstallBundles(arg0);
+   }
+
+   public void updateBundle(long arg0, String arg1) throws IOException
+   {
+      getFrameworkMBean().updateBundle(arg0, arg1);
+   }
+
+   public void updateBundle(long arg0) throws IOException
+   {
+      getFrameworkMBean().updateBundle(arg0);
+   }
+
+   public CompositeData updateBundles(long[] arg0, String[] arg1) throws IOException
+   {
+      return getFrameworkMBean().updateBundles(arg0, arg1);
+   }
+
+   public CompositeData updateBundles(long[] arg0) throws IOException
+   {
+      return getFrameworkMBean().updateBundles(arg0);
+   }
+
+   public void updateFramework() throws IOException
+   {
+      getFrameworkMBean().updateFramework();
+   }
+
+   private FrameworkMBean getFrameworkMBean()
+   {
+      if (delegate == null)
+      {
+         ObjectName objectName = ObjectNameFactory.create(FrameworkMBean.OBJECTNAME);
+         delegate = MBeanProxy.get(mbeanServer, objectName, FrameworkMBean.class);
+      }
+      return delegate;
+   }
+}
\ No newline at end of file

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/JMXServiceActivator.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -23,10 +23,6 @@
 
 //$Id$
 
-import static org.jboss.osgi.jmx.Constants.REMOTE_JMX_HOST;
-import static org.jboss.osgi.jmx.Constants.REMOTE_JMX_RMI_ADAPTOR;
-import static org.jboss.osgi.jmx.Constants.REMOTE_JMX_RMI_PORT;
-
 import java.io.IOException;
 
 import javax.management.MBeanServer;
@@ -38,7 +34,7 @@
 import javax.naming.StringRefAddr;
 
 import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.management.ManagedFramework;
+import org.jboss.osgi.jmx.JMXConstantsExt;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
@@ -60,7 +56,9 @@
    private String jmxRmiPort;
    private String rmiAdaptorPath;
    private MBeanServer mbeanServer;
-   private ManagedFrameworkImpl managedFramework;
+   private FrameworkImpl framework;
+   private ServiceStateImpl serviceState;
+   private ManagedBundleTracker bundleTracker;
 
    public void start(BundleContext context)
    {
@@ -71,20 +69,27 @@
       // Get the system BundleContext
       BundleContext sysContext = context.getBundle(0).getBundleContext();
 
-      // Register the ManagedFramework 
-      managedFramework = new ManagedFrameworkImpl(sysContext, mbeanServer);
-      context.registerService(ManagedFramework.class.getName(), managedFramework, null);
-      managedFramework.start();
+      // Register the FrameworkMBean
+      framework = new FrameworkImpl(sysContext, mbeanServer);
+      framework.start();
 
-      jmxHost = context.getProperty(REMOTE_JMX_HOST);
+      // Register the ServiceStateMBean 
+      serviceState = new ServiceStateImpl(sysContext, mbeanServer);
+      serviceState.start();
+      
+      // Start tracking the bundles
+      bundleTracker = new ManagedBundleTracker(sysContext, mbeanServer);
+      bundleTracker.open();
+
+      jmxHost = context.getProperty(JMXConstantsExt.REMOTE_JMX_HOST);
       if (jmxHost == null)
          jmxHost = "localhost";
 
-      jmxRmiPort = context.getProperty(REMOTE_JMX_RMI_PORT);
+      jmxRmiPort = context.getProperty(JMXConstantsExt.REMOTE_JMX_RMI_PORT);
       if (jmxRmiPort == null)
          jmxRmiPort = "1098";
 
-      rmiAdaptorPath = context.getProperty(REMOTE_JMX_RMI_ADAPTOR);
+      rmiAdaptorPath = context.getProperty(JMXConstantsExt.REMOTE_JMX_RMI_ADAPTOR);
       if (rmiAdaptorPath == null)
          rmiAdaptorPath = "jmx/invoker/RMIAdaptor";
 
@@ -95,9 +100,15 @@
 
    public void stop(BundleContext context)
    {
-      // Unregister the managed framework
-      managedFramework.stop();
+      // Unregister the FrameworkMBean
+      framework.stop();
 
+      // Unregister the ServiceStateMBean
+      serviceState.stop();
+
+      // Stop tracking the bundles
+      bundleTracker.close();
+
       if (jmxConnector != null)
       {
          jmxConnector.stop();

Deleted: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -1,183 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, 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.osgi.jmx.internal;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.JMException;
-import javax.management.MBeanServer;
-import javax.management.StandardMBean;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.osgi.spi.management.ManagedServiceReference;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * The managed view of an OSGi Framework
- * 
- * @author thomas.diesler at jboss.com
- * @since 04-Mar-2009
- */
-public class ManagedFrameworkImpl implements ManagedFrameworkMBean
-{
-   // Provide logging
-   private static final Logger log = Logger.getLogger(ManagedFrameworkImpl.class);
-
-   private MBeanServer mbeanServer;
-   private BundleContext context;
-   private ManagedBundleTracker bundleTracker;
-
-   public ManagedFrameworkImpl(BundleContext context, MBeanServer mbeanServer)
-   {
-      if (context == null)
-         throw new IllegalArgumentException("Null BundleContext");
-      if (mbeanServer == null)
-         throw new IllegalArgumentException("Null MBeanServer");
-
-      if (context.getBundle().getBundleId() != 0)
-         throw new IllegalArgumentException("Not the system bundle context: " + context);
-
-      this.context = context;
-      this.mbeanServer = mbeanServer;
-      this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
-   }
-
-   @Override
-   public ManagedServiceReference getServiceReference(String clazz)
-   {
-      ServiceReference sref = context.getServiceReference(clazz);
-      if (sref == null)
-         return null;
-
-      Map<String, Object> props = new HashMap<String, Object>();
-      for (String key : sref.getPropertyKeys())
-      {
-         props.put(key, sref.getProperty(key));
-      }
-
-      ManagedServiceReference msref = new ManagedServiceReference(props);
-      if (log.isTraceEnabled())
-         log.trace("getServiceReference(" + clazz + ") => " + msref);
-      
-      return msref;
-   }
-
-   @Override
-   public ManagedServiceReference[] getServiceReferences(String clazz, String filter)
-   {
-      List<ManagedServiceReference> foundRefs = new ArrayList<ManagedServiceReference>();
-
-      ServiceReference[] srefs;
-      try
-      {
-         srefs = context.getServiceReferences(clazz, filter);
-      }
-      catch (InvalidSyntaxException e)
-      {
-         throw new IllegalArgumentException("Invalid filter syntax: " + filter);
-      }
-
-      if (srefs != null)
-      {
-         for (ServiceReference sref : srefs)
-         {
-            Map<String, Object> props = new HashMap<String, Object>();
-            for (String key : sref.getPropertyKeys())
-               props.put(key, sref.getProperty(key));
-
-            foundRefs.add(new ManagedServiceReference(props));
-         }
-      }
-
-      ManagedServiceReference[] msrefs = null;
-      if (foundRefs.size() > 0)
-         msrefs = foundRefs.toArray(new ManagedServiceReference[foundRefs.size()]);
-
-      if (log.isTraceEnabled())
-         log.trace("getServiceReferences(" + clazz + "," + filter +") => " + msrefs);
-      
-      return msrefs;
-   }
-
-   @Override
-   public void refreshAllPackages()
-   {
-      if (log.isTraceEnabled())
-         log.trace("refreshPackages(null)");
-      
-      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
-      PackageAdmin service = (PackageAdmin)context.getService(sref);
-      service.refreshPackages(null);
-   }
-
-   @Override
-   public boolean resolveAllBundles()
-   {
-      if (log.isTraceEnabled())
-         log.trace("resolveBundles(null)");
-      
-      ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
-      PackageAdmin service = (PackageAdmin)context.getService(sref);
-      return service.resolveBundles(null);
-   }
-
-   void start()
-   {
-      // Start tracking the bundles
-      bundleTracker.open();
-
-      try
-      {
-         if (mbeanServer != null)
-         {
-            StandardMBean mbean = new StandardMBean(this, ManagedFrameworkMBean.class);
-            mbeanServer.registerMBean(mbean, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
-         }
-      }
-      catch (JMException ex)
-      {
-         log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
-      }
-   }
-
-   void stop()
-   {
-      try
-      {
-         if (mbeanServer != null && mbeanServer.isRegistered(MBEAN_MANAGED_FRAMEWORK))
-            mbeanServer.unregisterMBean(ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
-      }
-      catch (JMException ex)
-      {
-         log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
-      }
-   }
-}
\ No newline at end of file

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ServiceStateImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ServiceStateImpl.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ServiceStateImpl.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,210 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.osgi.jmx.internal;
+
+//$Id$
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.jmx.FrameworkMBeanExt;
+import org.jboss.osgi.jmx.ServiceStateMBeanExt;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.jmx.framework.ServiceStateMBean;
+
+/**
+ * An extension to {@link ServiceStateMBean}.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public class ServiceStateImpl implements ServiceStateMBeanExt
+{
+   // Provide logging
+   private static final Logger log = Logger.getLogger(ServiceStateImpl.class);
+
+   private MBeanServer mbeanServer;
+   private BundleContext context;
+   private ServiceStateMBean delegate;
+
+   public ServiceStateImpl(BundleContext context, MBeanServer mbeanServer)
+   {
+      if (context == null)
+         throw new IllegalArgumentException("Null BundleContext");
+      if (mbeanServer == null)
+         throw new IllegalArgumentException("Null MBeanServer");
+
+      if (context.getBundle().getBundleId() != 0)
+         throw new IllegalArgumentException("Not the system bundle context: " + context);
+
+      this.context = context;
+      this.mbeanServer = mbeanServer;
+   }
+
+   @Override
+   public CompositeData getService(String clazz) throws IOException
+   {
+      ServiceReference sref = context.getServiceReference(clazz);
+      if (sref == null)
+         return null;
+
+      return getCompositeData(sref);
+   }
+
+   @Override
+   public TabularData getServices(String clazz, String filter) throws IOException
+   {
+      ServiceReference[] srefs;
+      try
+      {
+         srefs = context.getServiceReferences(clazz, filter);
+      }
+      catch (InvalidSyntaxException e)
+      {
+         throw new IllegalArgumentException("Invalid filter syntax: " + filter);
+      }
+
+      if (srefs == null)
+         return null;
+
+      TabularDataSupport tabularData = new TabularDataSupport(SERVICES_TYPE);
+      for (ServiceReference sref : srefs)
+      {
+         CompositeDataSupport compData = getCompositeData(sref);
+         tabularData.put(compData.get(IDENTIFIER), compData);
+      }
+
+      return tabularData;
+   }
+
+   private CompositeDataSupport getCompositeData(ServiceReference sref) throws IOException
+   {
+      Long serviceId = (Long)sref.getProperty(Constants.SERVICE_ID);
+      
+      List<Long> usingBundles = new ArrayList<Long>();
+      for (Bundle aux : sref.getUsingBundles())
+         usingBundles.add(aux.getBundleId());
+
+      Map<String, Object> items = new HashMap<String, Object>();
+      items.put(BUNDLE_IDENTIFIER, sref.getBundle().getBundleId());
+      items.put(IDENTIFIER, serviceId);
+      items.put(OBJECT_CLASS, sref.getProperty(Constants.OBJECTCLASS));
+      items.put(USING_BUNDLES, usingBundles.toArray(new Long[usingBundles.size()]));
+      
+      // [TODO] Remove once ServiceType does not require this item any more
+      items.put(PROPERTIES, getProperties(serviceId));
+
+      CompositeDataSupport compData;
+      try
+      {
+         compData = new CompositeDataSupport(SERVICE_TYPE, items);
+      }
+      catch (OpenDataException ex)
+      {
+         throw new IllegalStateException(ex);
+      }
+      return compData;
+   }
+
+   void start()
+   {
+      try
+      {
+         ObjectName objectName = ObjectNameFactory.create(ServiceStateMBeanExt.OBJECTNAME);
+         StandardMBean mbean = new StandardMBean(this, ServiceStateMBeanExt.class);
+         mbeanServer.registerMBean(mbean, objectName);
+      }
+      catch (JMException ex)
+      {
+         log.warn("Cannot register: " + FrameworkMBeanExt.OBJECTNAME);
+      }
+   }
+
+   void stop()
+   {
+      try
+      {
+         ObjectName objectName = ObjectNameFactory.create(ServiceStateMBeanExt.OBJECTNAME);
+         if (mbeanServer.isRegistered(objectName))
+            mbeanServer.unregisterMBean(objectName);
+      }
+      catch (JMException ex)
+      {
+         log.warn("Cannot register: " + FrameworkMBeanExt.OBJECTNAME);
+      }
+   }
+
+   public long getBundleIdentifier(long arg0) throws IOException
+   {
+      return getServiceStateMBean().getBundleIdentifier(arg0);
+   }
+
+   public String[] getObjectClass(long arg0) throws IOException
+   {
+      return getServiceStateMBean().getObjectClass(arg0);
+   }
+
+   public TabularData getProperties(long arg0) throws IOException
+   {
+      return getServiceStateMBean().getProperties(arg0);
+   }
+
+   public long[] getUsingBundles(long arg0) throws IOException
+   {
+      return getServiceStateMBean().getUsingBundles(arg0);
+   }
+
+   public TabularData listServices() throws IOException
+   {
+      return getServiceStateMBean().listServices();
+   }
+
+   private ServiceStateMBean getServiceStateMBean()
+   {
+      if (delegate == null)
+      {
+         ObjectName objectName = ObjectNameFactory.create(ServiceStateMBean.OBJECTNAME);
+         delegate = MBeanProxy.get(mbeanServer, objectName, ServiceStateMBean.class);
+      }
+      return delegate;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/main/java/org/jboss/osgi/jmx/internal/ServiceStateImpl.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.test.osgi.jmx;
+
+//$Id$
+
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.jmx.FrameworkMBeanExt;
+import org.jboss.osgi.jmx.ServiceStateMBeanExt;
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.osgi.framework.launch.Framework;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * An abstract JMX test case.
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public abstract class AbstractJMXTestCase
+{
+   private static Framework framework;
+   private MBeanServer server;
+   
+   @BeforeClass
+   public static void setUpClass() throws Exception
+   {
+      OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+      framework = bootProvider.getFramework();
+      framework.start();
+   }
+
+   @AfterClass
+   public static void tearDownClass() throws Exception
+   {
+      if (framework != null)
+      {
+         framework.stop();
+         framework.waitForStop(3000);
+      }
+   }
+
+   public FrameworkMBeanExt getFramework() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, FrameworkMBeanExt.class);
+   }
+   
+   public BundleStateMBean getBundleState() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, BundleStateMBean.class);
+   }
+   
+   public ServiceStateMBeanExt getServiceState() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(ServiceStateMBeanExt.OBJECTNAME);
+      return MBeanProxy.get(getMBeanServer(), oname, ServiceStateMBeanExt.class);
+   }
+   
+   protected MBeanServer getMBeanServer()
+   {
+      if (server == null)
+      {
+         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+         if (serverArr.size() > 1)
+            throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+         if (serverArr.size() == 1)
+            server = serverArr.get(0);
+
+         if (server == null)
+            server = MBeanServerFactory.createMBeanServer();
+      }
+      return server;
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/AbstractJMXTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateMBeanTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateMBeanTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateMBeanTestCase.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.test.osgi.jmx;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import javax.management.ObjectName;
+import javax.management.openmbean.TabularData;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.junit.Test;
+import org.osgi.jmx.framework.BundleStateMBean;
+
+/**
+ * A test that excercises the BundleStateMBean
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public class BundleStateMBeanTestCase extends AbstractJMXTestCase
+{
+   @Test
+   public void testMBeanAccess() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(BundleStateMBean.OBJECTNAME);
+      assertTrue("Registerd " + oname, getMBeanServer().isRegistered(oname));
+   }
+   
+   @Test
+   public void listBundles() throws Exception
+   {
+      BundleStateMBean bundleState = getBundleState();
+      TabularData data = bundleState.listBundles();
+      assertEquals("Number of bundles", 8, data.size());
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/BundleStateMBeanTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkMBeanTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkMBeanTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkMBeanTestCase.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,52 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.test.osgi.jmx;
+
+//$Id$
+
+import static org.junit.Assert.assertTrue;
+
+import javax.management.ObjectName;
+
+import org.jboss.osgi.jmx.FrameworkMBeanExt;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+import org.junit.Test;
+import org.osgi.jmx.framework.FrameworkMBean;
+
+/**
+ * A test that excercises the FramworkMBean
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public class FrameworkMBeanTestCase extends AbstractJMXTestCase
+{
+   @Test
+   public void testMBeanAccess() throws Exception
+   {
+      ObjectName oname = ObjectNameFactory.create(FrameworkMBean.OBJECTNAME);
+      assertTrue("Registerd " + oname, getMBeanServer().isRegistered(oname));
+      
+      oname = ObjectNameFactory.create(FrameworkMBeanExt.OBJECTNAME);
+      assertTrue("Registerd " + oname, getMBeanServer().isRegistered(oname));
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/FrameworkMBeanTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateMBeanTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateMBeanTestCase.java	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateMBeanTestCase.java	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,67 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, 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.test.osgi.jmx;
+
+//$Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import javax.management.MBeanServer;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.TabularData;
+
+import org.jboss.osgi.jmx.ServiceStateMBeanExt;
+import org.junit.Test;
+
+/**
+ * A test that excercises the ServiceStateMBean
+ * 
+ * @author thomas.diesler at jboss.com
+ * @since 23-Feb-2010
+ */
+public class ServiceStateMBeanTestCase extends AbstractJMXTestCase
+{
+   @Test
+   public void listBundles() throws Exception
+   {
+      ServiceStateMBeanExt serviceState = getServiceState();
+      TabularData data = serviceState.listServices();
+      assertEquals("Number of services", 7, data.size());
+   }
+
+   @Test
+   public void getService() throws Exception
+   {
+      ServiceStateMBeanExt serviceState = getServiceState();
+      CompositeData data = serviceState.getService(MBeanServer.class.getName());
+      assertNotNull("MBeanServer service not null", data);
+   }
+
+   @Test
+   public void getServices() throws Exception
+   {
+      ServiceStateMBeanExt serviceState = getServiceState();
+      TabularData data = serviceState.getServices(MBeanServer.class.getName(), null);
+      assertEquals("MBeanServer service not null", 1, data.size());
+   }
+}
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/java/org/jboss/test/osgi/jmx/ServiceStateMBeanTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,38 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+# 
+# $Id$
+#
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${test.archive.directory}/../osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+    org.apache.log4j;version=1.2, \
+  	org.jboss.logging;version=2.1, \
+    org.jboss.osgi.deployment.deployer;version=1.0, \
+    org.jboss.osgi.deployment.interceptor;version=1.0, \
+  	org.jboss.osgi.spi;version=1.0, \
+  	org.jboss.osgi.spi.capability;version=1.0, \
+  	org.jboss.osgi.spi.framework;version=1.0, \
+  	org.jboss.osgi.spi.management;version=1.0, \
+  	org.jboss.osgi.spi.service;version=1.0, \
+  	org.jboss.osgi.spi.util;version=1.0, \
+  	org.jboss.osgi.testing;version=1.0, \
+  	org.jboss.virtual;version=2.1, \
+  	org.osgi.framework;version=1.5
+
+# Bundles that need to be installed with the Framework automatically 
+org.jboss.osgi.spi.framework.autoInstall=\
+	file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically 
+org.jboss.osgi.spi.framework.autoStart=\
+	file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-common-core.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-jndi.jar \
+	file://${test.archive.directory}/bundles/org.apache.aries.jmx.jar \
+	file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar	
\ No newline at end of file


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/log4j.xml	                        (rev 0)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/log4j.xml	2010-02-23 14:01:24 UTC (rev 101329)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <appender name="FILE" class="org.apache.log4j.FileAppender">
+    <param name="File" value="${log4j.output.dir}/test.log"/>
+    <param name="Append" value="false"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>
+  </appender>
+  
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <param name="Threshold" value="INFO" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+    </layout>
+  </appender>
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Show jboss deployer traces 
+  <category name="org.jboss.deployers">
+    <priority value="TRACE" />
+  </category>
+  -->
+
+  <!-- Show jboss deployer traces 
+  <category name="org.jboss.xb">
+    <priority value="TRACE" />
+  </category>
+  --> 
+
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <!--appender-ref ref="CONSOLE"/-->
+    <appender-ref ref="FILE"/>
+  </root>
+
+</log4j:configuration>


Property changes on: projects/jboss-osgi/projects/bundles/jmx/trunk/jmx-bundle/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml	2010-02-23 13:24:49 UTC (rev 101328)
+++ projects/jboss-osgi/projects/bundles/jmx/trunk/pom.xml	2010-02-23 14:01:24 UTC (rev 101329)
@@ -40,8 +40,11 @@
   <!-- Properties -->
   <properties>
     <version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
+    <version.apache.felix.log>1.0.0</version.apache.felix.log>
+    <version.jboss.osgi.common>1.0.4-SNAPSHOT</version.jboss.osgi.common>
     <version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
     <version.jboss.osgi.jndi>1.0.3-SNAPSHOT</version.jboss.osgi.jndi>
+    <version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
     <version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
     <version.osgi>4.2.0</version.osgi>
   </properties>
@@ -61,19 +64,44 @@
       </dependency>
       <dependency>
         <groupId>org.jboss.osgi.bundles</groupId>
+        <artifactId>jboss-osgi-common</artifactId>
+        <version>${version.jboss.osgi.common}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.bundles</groupId>
         <artifactId>jboss-osgi-common-core</artifactId>
         <version>${version.jboss.osgi.common.core}</version>
       </dependency>
       <dependency>
         <groupId>org.jboss.osgi.jndi</groupId>
+        <artifactId>jboss-osgi-jndi</artifactId>
+        <version>${version.jboss.osgi.jndi}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.jndi</groupId>
         <artifactId>jboss-osgi-jndi-api</artifactId>
         <version>${version.jboss.osgi.jndi}</version>
       </dependency>
       <dependency>
         <groupId>org.apache.aries.jmx</groupId>
+        <artifactId>org.apache.aries.jmx</artifactId>
+        <version>${version.apache.aries.jmx}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.aries.jmx</groupId>
         <artifactId>org.apache.aries.jmx.api</artifactId>
         <version>${version.apache.aries.jmx}</version>
       </dependency>
+      <dependency>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>org.apache.felix.log</artifactId>
+        <version>${version.apache.felix.log}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.osgi.runtime</groupId>
+        <artifactId>jboss-osgi-runtime-felix</artifactId>
+        <version>${version.jboss.osgi.runtime.felix}</version>
+      </dependency>
       
       <!-- OSGi Dependencies -->
       <dependency>



More information about the jboss-osgi-commits mailing list