JBoss-OSGI SVN: r100487 - in projects/jboss-osgi/projects/spi/tags: jboss-osgi-spi-1.0.4 and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 08:34:38 -0500 (Fri, 05 Feb 2010)
New Revision: 100487
Added:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml
Removed:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml
Log:
[maven-release-plugin] copy for tag jboss-osgi-spi-1.0.4
Copied: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4 (from rev 100470, projects/jboss-osgi/projects/spi/trunk)
Property changes on: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Deleted: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/pom.xml 2010-02-05 08:33:18 UTC (rev 100470)
+++ projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml 2010-02-05 13:34:38 UTC (rev 100487)
@@ -1,131 +0,0 @@
-<?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 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>
-
- <name>JBossOSGi SPI</name>
-
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <packaging>jar</packaging>
-
- <version>1.0.4-SNAPSHOT</version>
-
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.4</version>
- </parent>
-
- <!-- Subversion -->
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
- <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
- </scm>
-
- <!-- Properties -->
- <properties>
- <version.args4j>2.0.12</version.args4j>
- <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
- <version.osgi>4.2.0</version.osgi>
- </properties>
-
- <!-- Dependencies -->
- <dependencies>
-
- <!-- Compile Dependencies -->
- <dependency>
- <groupId>args4j</groupId>
- <artifactId>args4j</artifactId>
- <version>${version.args4j}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>${version.jboss.vfs}</version>
- </dependency>
-
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${version.osgi}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <!-- Build -->
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>build-helper-maven-plugin</artifactId>
- <executions>
- <execution>
- <id>attach-artifacts</id>
- <phase>package</phase>
- <goals>
- <goal>attach-artifact</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>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
-
- <!-- Repositories -->
- <repositories>
- <repository>
- <id>repository.jboss.org</id>
- <name>JBoss Repository</name>
- <url>http://repository.jboss.org/maven2/</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>snapshots.jboss.org</id>
- <name>JBoss Snapshots Repository</name>
- <url>http://snapshots.jboss.org/maven2/</url>
- <releases>
- <enabled>false</enabled>
- </releases>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-</project>
Copied: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml (from rev 100486, projects/jboss-osgi/projects/spi/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.4/pom.xml 2010-02-05 13:34:38 UTC (rev 100487)
@@ -0,0 +1,131 @@
+<?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 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>
+
+ <name>JBossOSGi SPI</name>
+
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <packaging>jar</packaging>
+
+ <version>1.0.4</version>
+
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-parent</artifactId>
+ <version>1.0.4</version>
+ </parent>
+
+ <!-- Subversion -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
+ <url>http://fisheye.jboss.com/qsearch/JBossOSGi/tags/jboss-osgi-spi-1.0.4</url>
+ </scm>
+
+ <!-- Properties -->
+ <properties>
+ <version.args4j>2.0.12</version.args4j>
+ <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
+ <version.osgi>4.2.0</version.osgi>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+
+ <!-- Compile Dependencies -->
+ <dependency>
+ <groupId>args4j</groupId>
+ <artifactId>args4j</artifactId>
+ <version>${version.args4j}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <!-- Build -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>attach-artifacts</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attach-artifact</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>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- Repositories -->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <url>http://snapshots.jboss.org/maven2/</url>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+</project>
14 years, 5 months
JBoss-OSGI SVN: r100484 - in projects/jboss-osgi/projects/runtime/framework/trunk: src/main/java/org/jboss/osgi/framework/bundle and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: alesj
Date: 2010-02-05 08:25:00 -0500 (Fri, 05 Feb 2010)
New Revision: 100484
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDictionaryFactory.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/JMXDictionaryFactory.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
Log:
[JBOSGI-141]; add JMX based dictionary factory.
Remove enableMDR usage flag.
Depend on Kernel 2.2.x snapshot for JMX bug fix.
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-05 13:25:00 UTC (rev 100484)
@@ -137,24 +137,26 @@
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-jmx</artifactId>
<version>${version.jboss.deployers}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.kernel</groupId>
<artifactId>jboss-kernel</artifactId>
<version>${version.jboss.kernel}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-jmx-mc-int</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
<dependency>
<groupId>org.jboss.kernel</groupId>
<artifactId>jboss-jmx-aop-mc-int</artifactId>
<version>${version.jboss.kernel}</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-mc-int</artifactId>
- <version>${version.jboss.kernel}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
<artifactId>jboss-dependency</artifactId>
<version>${version.jboss.kernel}</version>
</dependency>
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDictionaryFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDictionaryFactory.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDictionaryFactory.java 2010-02-05 13:25:00 UTC (rev 100484)
@@ -0,0 +1,167 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.framework.bundle;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.reflect.spi.ClassInfo;
+import org.jboss.system.microcontainer.ServiceControllerContext;
+import org.jboss.util.collection.Iterators;
+import org.osgi.framework.Constants;
+
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Abstract dictionary factory.
+ *
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ */
+public abstract class AbstractDictionaryFactory<T extends ControllerContext> implements DictionaryFactory<T>
+{
+ protected static final String NAME = "bean.name";
+ protected static final String[] EMPTY = new String[0];
+ private KernelConfigurator configurator;
+ private final ClassInfo OBJECT;
+
+ public AbstractDictionaryFactory(KernelConfigurator configurator)
+ {
+ if (configurator == null)
+ throw new IllegalArgumentException("Null configurator");
+
+ this.configurator = configurator;
+ OBJECT = getClassInfo(Object.class);
+ }
+
+ protected ClassInfo getClassInfo(Class<?> clazz)
+ {
+ try
+ {
+ return configurator.getClassInfo(clazz);
+ }
+ catch (Throwable t)
+ {
+ throw new RuntimeException(t);
+ }
+ }
+
+ protected abstract class AbstractDictionary extends Dictionary<String, Object>
+ {
+ private Map<Object, Object> map;
+ private ControllerContext context;
+
+ protected AbstractDictionary(ControllerContext context)
+ {
+ this.context = context;
+ this.map = new ConcurrentHashMap<Object, Object>(2);
+ map.put(NAME, getName(context));
+ map.put(Constants.OBJECTCLASS, EMPTY);
+ }
+
+ protected abstract Object getName(ControllerContext context);
+
+ public int size()
+ {
+ return map.size();
+ }
+
+ public boolean isEmpty()
+ {
+ return size() == 0;
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Enumeration<String> keys()
+ {
+ return Iterators.toEnumeration(map.keySet().iterator());
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public Enumeration<Object> elements()
+ {
+ return Iterators.toEnumeration(map.values().iterator());
+ }
+
+ public Object get(Object key)
+ {
+ Object value = map.get(key);
+ if (value != EMPTY)
+ return value;
+
+ ClassInfo clazz;
+ Object target = context.getTarget();
+ if (target != null)
+ {
+ clazz = getClassInfo(target.getClass());
+ }
+ else
+ clazz = getFromNullTarget(context);
+
+ String[] classes = EMPTY;
+ if (clazz != null)
+ {
+ Set<String> clazzes = new HashSet<String>();
+ traverseClass(clazz, clazzes);
+ classes = clazzes.toArray(new String[clazzes.size()]);
+ map.put(Constants.OBJECTCLASS, classes);
+ }
+ return classes;
+ }
+
+ protected ClassInfo getFromNullTarget(ControllerContext context)
+ {
+ return null;
+ }
+
+ public Object put(String key, Object value)
+ {
+ return map.put(key, value);
+ }
+
+ public Object remove(Object key)
+ {
+ return map.remove(key);
+ }
+
+ protected void traverseClass(ClassInfo clazz, Set<String> classes)
+ {
+ if (clazz == null || clazz == OBJECT)
+ {
+ return;
+ }
+
+ classes.add(clazz.getName());
+
+ // traverse superclass
+ traverseClass(clazz.getSuperclass(), classes);
+ ClassInfo[] interfaces = clazz.getInterfaces();
+ if (interfaces != null)
+ {
+ // traverse interfaces
+ for(ClassInfo intface : interfaces)
+ {
+ traverseClass(intface, classes);
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/JMXDictionaryFactory.java (from rev 100475, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/JMXDictionaryFactory.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/JMXDictionaryFactory.java 2010-02-05 13:25:00 UTC (rev 100484)
@@ -0,0 +1,65 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.framework.bundle;
+
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.kernel.spi.config.KernelConfigurator;
+import org.jboss.system.microcontainer.ServiceControllerContext;
+
+import java.util.Dictionary;
+
+/**
+ * JMX dictionary factory.
+ * TODO - expose all classes, or just explicit target class and its mbean interface?
+ *
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ */
+public class JMXDictionaryFactory extends AbstractDictionaryFactory<ServiceControllerContext>
+{
+ public JMXDictionaryFactory(KernelConfigurator configurator)
+ {
+ super(configurator);
+ }
+
+ public Class<ServiceControllerContext> getContextType()
+ {
+ return ServiceControllerContext.class;
+ }
+
+ public Dictionary<String, Object> getDictionary(ServiceControllerContext context)
+ {
+ return null;
+ }
+
+ private class JMXDictionary extends AbstractDictionary
+ {
+ private JMXDictionary(ServiceControllerContext context)
+ {
+ super(context);
+ }
+
+ protected Object getName(ControllerContext context)
+ {
+ return ServiceControllerContext.class.cast(context).getObjectName().getCanonicalName();
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2010-02-05 13:11:03 UTC (rev 100483)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/KernelDictionaryFactory.java 2010-02-05 13:25:00 UTC (rev 100484)
@@ -29,6 +29,7 @@
import java.util.concurrent.ConcurrentHashMap;
import org.jboss.beans.info.spi.BeanInfo;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.config.KernelConfigurator;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.reflect.spi.ClassInfo;
@@ -40,34 +41,13 @@
*
* @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
*/
-public class KernelDictionaryFactory implements DictionaryFactory<KernelControllerContext>
+public class KernelDictionaryFactory extends AbstractDictionaryFactory<KernelControllerContext>
{
- private static final String NAME = "bean.name";
- private static final String[] EMPTY = new String[0];
- private KernelConfigurator configurator;
- private final ClassInfo OBJECT;
-
public KernelDictionaryFactory(KernelConfigurator configurator)
{
- if (configurator == null)
- throw new IllegalArgumentException("Null configurator");
-
- this.configurator = configurator;
- OBJECT = getClassInfo(Object.class);
+ super(configurator);
}
- private ClassInfo getClassInfo(Class<?> clazz)
- {
- try
- {
- return configurator.getClassInfo(clazz);
- }
- catch (Throwable t)
- {
- throw new RuntimeException(t);
- }
- }
-
public Class<KernelControllerContext> getContextType()
{
return KernelControllerContext.class;
@@ -78,100 +58,24 @@
return new KernelDictionary(context);
}
- private class KernelDictionary extends Dictionary<String, Object>
+ private class KernelDictionary extends AbstractDictionary
{
- private Map<Object, Object> map;
- private KernelControllerContext context;
-
private KernelDictionary(KernelControllerContext context)
{
- this.context = context;
- this.map = new ConcurrentHashMap<Object, Object>(2);
- map.put(NAME, context.getName());
- map.put(Constants.OBJECTCLASS, EMPTY);
+ super(context);
}
- public int size()
+ protected Object getName(ControllerContext context)
{
- return map.size();
+ return KernelControllerContext.class.cast(context).getName();
}
- public boolean isEmpty()
+ @Override
+ protected ClassInfo getFromNullTarget(ControllerContext context)
{
- return size() == 0;
+ KernelControllerContext kcc = KernelControllerContext.class.cast(context);
+ BeanInfo beanInfo = kcc.getBeanInfo();
+ return beanInfo != null ? beanInfo.getClassInfo() : null;
}
-
- @SuppressWarnings({"unchecked"})
- public Enumeration<String> keys()
- {
- return Iterators.toEnumeration(map.keySet().iterator());
- }
-
- @SuppressWarnings({"unchecked"})
- public Enumeration<Object> elements()
- {
- return Iterators.toEnumeration(map.values().iterator());
- }
-
- public Object get(Object key)
- {
- Object value = map.get(key);
- if (value != EMPTY)
- return value;
-
- ClassInfo clazz = null;
- Object target = context.getTarget();
- BeanInfo info = context.getBeanInfo();
- if (target != null)
- {
- clazz = getClassInfo(target.getClass());
- }
- else if (info != null)
- {
- clazz = info.getClassInfo();
- }
-
- String[] classes = EMPTY;
- if (clazz != null)
- {
- Set<String> clazzes = new HashSet<String>();
- traverseClass(clazz, clazzes);
- classes = clazzes.toArray(new String[clazzes.size()]);
- map.put(Constants.OBJECTCLASS, classes);
- }
- return classes;
- }
-
- public Object put(String key, Object value)
- {
- return map.put(key, value);
- }
-
- public Object remove(Object key)
- {
- return map.remove(key);
- }
-
- protected void traverseClass(ClassInfo clazz, Set<String> classes)
- {
- if (clazz == null || clazz == OBJECT)
- {
- return;
- }
-
- classes.add(clazz.getName());
-
- // traverse superclass
- traverseClass(clazz.getSuperclass(), classes);
- ClassInfo[] interfaces = clazz.getInterfaces();
- if (interfaces != null)
- {
- // traverse interfaces
- for(ClassInfo intface : interfaces)
- {
- traverseClass(intface, classes);
- }
- }
- }
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-02-05 13:11:03 UTC (rev 100483)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/ServiceManagerPluginImpl.java 2010-02-05 13:25:00 UTC (rev 100484)
@@ -72,36 +72,35 @@
public class ServiceManagerPluginImpl extends AbstractPlugin implements ServiceManagerPlugin
{
// Provide logging
- final Logger log = Logger.getLogger(ServiceManagerPluginImpl.class);
+ private final Logger log = Logger.getLogger(ServiceManagerPluginImpl.class);
/** The kernel */
private Kernel kernel;
+ /** The mdr factory */
+ private MetaDataRetrievalFactory factory;
/** The previous context tracker */
private ContextTracker previousTracker;
- /** Enable MDR usage */
- private boolean enableMDRUsage = true;
-
+
public ServiceManagerPluginImpl(OSGiBundleManager bundleManager)
{
super(bundleManager);
}
+ @Deprecated
public void setEnableMDRUsage(boolean mdrUsage)
{
- this.enableMDRUsage = mdrUsage;
+ log.warn("This flag is no longer supported.");
}
public void start()
{
kernel = getBundleManager().getKernel();
- if (enableMDRUsage == true)
- applyMDRUsage(true);
+ applyMDRUsage(true);
}
public void stop()
{
- if (enableMDRUsage == true)
- applyMDRUsage(false);
+ applyMDRUsage(false);
}
public ServiceReference[] getRegisteredServices(AbstractBundleState bundleState)
@@ -312,12 +311,15 @@
private MetaDataRetrievalFactory getMetaDataRetrievalFactory()
{
- MetaDataRetrievalFactory mdrFactory;
- InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(kernel);
- imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
- imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
- // TODO - JMX?
- mdrFactory = imdrf;
+ MetaDataRetrievalFactory mdrFactory = factory;
+ if (mdrFactory == null)
+ {
+ InstanceMetaDataRetrievalFactory imdrf = new InstanceMetaDataRetrievalFactory(kernel);
+ imdrf.addFactory(new OSGiServiceStateDictionaryFactory());
+ imdrf.addFactory(new KernelDictionaryFactory(kernel.getConfigurator()));
+ // add JMX via configuration, as we don't wanna depend on JMX code
+ mdrFactory = imdrf;
+ }
return mdrFactory;
}
@@ -402,7 +404,7 @@
*/
private boolean hasPermission(ControllerContext context)
{
- // TODO - make thisa generic, w/o casting
+ // TODO - make this generic, w/o casting
if (context instanceof OSGiServiceState)
{
OSGiServiceState serviceState = (OSGiServiceState)context;
@@ -410,4 +412,14 @@
}
return true;
}
+
+ /**
+ * Set mdr factory.
+ *
+ * @param factory the factory
+ */
+ public void setFactory(MetaDataRetrievalFactory factory)
+ {
+ this.factory = factory;
+ }
}
\ No newline at end of file
14 years, 5 months
JBoss-OSGI SVN: r100483 - in projects/jboss-osgi/trunk: distribution and 8 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 08:11:03 -0500 (Fri, 05 Feb 2010)
New Revision: 100483
Modified:
projects/jboss-osgi/trunk/distribution/docbook/pom.xml
projects/jboss-osgi/trunk/distribution/installer/pom.xml
projects/jboss-osgi/trunk/distribution/javadoc/pom.xml
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/reactor/pom.xml
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/pom.xml
projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
Log:
Update to Beta7
Modified: projects/jboss-osgi/trunk/distribution/docbook/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/docbook/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/distribution/docbook/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.jboss.osgi.distribution</groupId>
<artifactId>jboss-osgi-distribution</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Properties -->
Modified: projects/jboss-osgi/trunk/distribution/installer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/distribution/installer/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jboss.osgi.distribution</groupId>
<artifactId>jboss-osgi-distribution</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Dependencies -->
Modified: projects/jboss-osgi/trunk/distribution/javadoc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/javadoc/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/distribution/javadoc/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -24,7 +24,7 @@
<parent>
<groupId>org.jboss.osgi.distribution</groupId>
<artifactId>jboss-osgi-distribution</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -37,7 +37,7 @@
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Modules -->
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -20,7 +20,7 @@
<artifactId>jboss-osgi</artifactId>
<packaging>pom</packaging>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -58,7 +58,7 @@
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
<version.jboss.osgi.deployment>1.0.1-SNAPSHOT</version.jboss.osgi.deployment>
- <version.jboss.osgi.framework>1.0.0.Alpha3-SNAPSHOT</version.jboss.osgi.framework>
+ <version.jboss.osgi.framework>1.0.0.Alpha4-SNAPSHOT</version.jboss.osgi.framework>
<version.jboss.osgi.hotdeploy>1.0.4-SNAPSHOT</version.jboss.osgi.hotdeploy>
<version.jboss.osgi.husky>1.0.3-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
Modified: projects/jboss-osgi/trunk/reactor/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/reactor/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -37,7 +37,7 @@
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Profiles -->
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.jboss.osgi.testsuite</groupId>
<artifactId>jboss-osgi-testsuite</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Properties -->
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -31,7 +31,7 @@
<parent>
<groupId>org.jboss.osgi.testsuite</groupId>
<artifactId>jboss-osgi-testsuite</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Properties -->
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -26,7 +26,7 @@
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<modules>
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml 2010-02-05 13:08:31 UTC (rev 100482)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/pom.xml 2010-02-05 13:11:03 UTC (rev 100483)
@@ -23,7 +23,7 @@
<parent>
<groupId>org.jboss.osgi.testsuite</groupId>
<artifactId>jboss-osgi-testsuite</artifactId>
- <version>1.0.0.Beta6</version>
+ <version>1.0.0.Beta7</version>
</parent>
<!-- Properties -->
14 years, 5 months
JBoss-OSGI SVN: r100481 - projects/jboss-osgi/projects/runtime/framework/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 08:04:52 -0500 (Fri, 05 Feb 2010)
New Revision: 100481
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
Log:
Update to 1.0.0.Alpha4
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-05 13:04:12 UTC (rev 100480)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-02-05 13:04:52 UTC (rev 100481)
@@ -26,7 +26,7 @@
<artifactId>jboss-osgi-framework</artifactId>
<packaging>bundle</packaging>
- <version>1.0.0.Alpha3-SNAPSHOT</version>
+ <version>1.0.0.Alpha4-SNAPSHOT</version>
<parent>
<groupId>org.jboss.osgi</groupId>
14 years, 5 months
JBoss-OSGI SVN: r100480 - projects/jboss-osgi/projects/runtime/framework/branches.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 08:04:12 -0500 (Fri, 05 Feb 2010)
New Revision: 100480
Added:
projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha3/
Log:
create QA branch
Copied: projects/jboss-osgi/projects/runtime/framework/branches/1.0.0.Alpha3 (from rev 100479, projects/jboss-osgi/projects/runtime/framework/trunk)
14 years, 5 months
JBoss-OSGI SVN: r100479 - projects/jboss-osgi/branches.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 07:54:41 -0500 (Fri, 05 Feb 2010)
New Revision: 100479
Added:
projects/jboss-osgi/branches/1.0.0.Beta6/
Log:
create qa branch
Copied: projects/jboss-osgi/branches/1.0.0.Beta6 (from rev 100478, projects/jboss-osgi/trunk)
14 years, 5 months
JBoss-OSGI SVN: r100478 - in projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing: internal and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-02-05 07:47:00 -0500 (Fri, 05 Feb 2010)
New Revision: 100478
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
Log:
Prevent NPE on RemoteBundle.getState()
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java 2010-02-05 12:46:56 UTC (rev 100477)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java 2010-02-05 12:47:00 UTC (rev 100478)
@@ -196,11 +196,11 @@
}
/**
- * Delegates to {@link OSGiTestHelper#getFramework()}
+ * Delegates to {@link OSGiTestHelper#getFrameworkName()}
*/
- public String getFramework()
+ public String getFrameworkName()
{
- return getTestHelper().getFramework();
+ return getTestHelper().getFrameworkName();
}
public VirtualFile assembleBundle(String name, String resource, Class<?>... packages) throws Exception
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-02-05 12:46:56 UTC (rev 100477)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-02-05 12:47:00 UTC (rev 100478)
@@ -204,7 +204,7 @@
return targetContainer;
}
- public String getFramework()
+ public String getFrameworkName()
{
String framework = System.getProperty("framework");
if (framework == null || framework.length() == 0 || framework.equals("${framework}"))
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-02-05 12:46:56 UTC (rev 100477)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/RemoteBundle.java 2010-02-05 12:47:00 UTC (rev 100478)
@@ -32,7 +32,6 @@
import java.util.Dictionary;
import javax.management.InstanceNotFoundException;
-import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import org.jboss.osgi.spi.management.ManagedBundle;
@@ -87,7 +86,7 @@
symbolicName = bundle.getSymbolicName();
objectName = bundle.getObjectName();
location = bundle.getLocation();
-
+
defaultHeaders = bundle.getHeaders(null);
rawHeaders = bundle.getHeaders("");
@@ -100,25 +99,17 @@
{
if (uninstalled == true)
return Bundle.UNINSTALLED;
-
+
try
{
- MBeanServerConnection server = getRuntime().getMBeanServer();
- if (server.isRegistered(objectName))
- {
- return bundle.getState();
- }
+ return bundle.getState();
}
catch (RuntimeException rte)
{
- Throwable cause = rte.getCause() != null ? rte.getCause() : null;
+ Throwable cause = rte.getCause() != null ? rte.getCause() : rte;
if (cause instanceof InstanceNotFoundException == false)
log.warn("Cannot get state for: " + objectName, cause);
}
- catch (IOException ex)
- {
- log.warn("Cannot get state for: " + objectName, ex);
- }
return Bundle.UNINSTALLED;
}
@@ -198,6 +189,9 @@
{
assertNotUninstalled();
ObjectName providerBundle = bundle.loadClass(name);
+ if (providerBundle == null)
+ return null;
+
String bundleId = providerBundle.getKeyProperty(ManagedBundle.PROPERTY_ID);
return getRuntime().getBundle(new Long(bundleId));
}
14 years, 5 months