Author: thomas.diesler(a)jboss.com
Date: 2009-11-23 22:32:58 -0500 (Mon, 23 Nov 2009)
New Revision: 96779
Added:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
Removed:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
Log:
[maven-release-plugin] copy for tag jboss-osgi-spi-1.0.3
Copied: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3 (from rev 96776,
projects/jboss-osgi/projects/spi/trunk)
Property changes on: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Deleted: projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/pom.xml 2009-11-24 03:22:19 UTC (rev 96776)
+++ projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml 2009-11-24 03:32:58
UTC (rev 96779)
@@ -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.3-SNAPSHOT</version>
-
- <!-- Parent -->
- <parent>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.4-SNAPSHOT</version>
- </parent>
-
- <!-- Subversion -->
- <scm>
-
<
connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jbo...
-
<
developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projec...
- <
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.3/pom.xml (from rev
96778, projects/jboss-osgi/projects/spi/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml
(rev 0)
+++ projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/pom.xml 2009-11-24 03:32:58
UTC (rev 96779)
@@ -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.3</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/jbo...
+
<
developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projec...
+
<
url>http://fisheye.jboss.com/qsearch/JBossOSGi/tags/jboss-osgi-spi-1.0...
+ </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>
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,175 +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.spi.framework;
-
-//$Id$
-
-import java.io.File;
-import java.io.InputStream;
-import java.util.Dictionary;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.Filter;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A generic BundleContext wrapper that delegates all method calls to the underlying
- * BundleContext implementation.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 16-Oct-2009
- */
-public class BundleContextWrapper implements BundleContext
-{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(BundleContextWrapper.class);
-
- protected BundleContext context;
-
- public BundleContextWrapper(BundleContext context)
- {
- if (context == null)
- throw new IllegalArgumentException("Null framework");
- this.context = context;
- }
-
- public void addBundleListener(BundleListener listener)
- {
- context.addBundleListener(listener);
- }
-
- public void addFrameworkListener(FrameworkListener listener)
- {
- context.addFrameworkListener(listener);
- }
-
- public void addServiceListener(ServiceListener listener, String filter) throws
InvalidSyntaxException
- {
- context.addServiceListener(listener, filter);
- }
-
- public void addServiceListener(ServiceListener listener)
- {
- context.addServiceListener(listener);
- }
-
- public Filter createFilter(String filter) throws InvalidSyntaxException
- {
- return context.createFilter(filter);
- }
-
- public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws
InvalidSyntaxException
- {
- return context.getAllServiceReferences(clazz, filter);
- }
-
- public Bundle getBundle()
- {
- return context.getBundle();
- }
-
- public Bundle getBundle(long id)
- {
- return context.getBundle(id);
- }
-
- public Bundle[] getBundles()
- {
- return context.getBundles();
- }
-
- public File getDataFile(String filename)
- {
- return context.getDataFile(filename);
- }
-
- public String getProperty(String key)
- {
- return context.getProperty(key);
- }
-
- public Object getService(ServiceReference reference)
- {
- return context.getService(reference);
- }
-
- public ServiceReference getServiceReference(String clazz)
- {
- return context.getServiceReference(clazz);
- }
-
- public ServiceReference[] getServiceReferences(String clazz, String filter) throws
InvalidSyntaxException
- {
- return context.getServiceReferences(clazz, filter);
- }
-
- public Bundle installBundle(String location, InputStream input) throws
BundleException
- {
- return context.installBundle(location, input);
- }
-
- public Bundle installBundle(String location) throws BundleException
- {
- return context.installBundle(location);
- }
-
- @SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String clazz, Object service, Dictionary
properties)
- {
- return context.registerService(clazz, service, properties);
- }
-
- @SuppressWarnings("unchecked")
- public ServiceRegistration registerService(String[] clazzes, Object service,
Dictionary properties)
- {
- return context.registerService(clazzes, service, properties);
- }
-
- public void removeBundleListener(BundleListener listener)
- {
- context.removeBundleListener(listener);
- }
-
- public void removeFrameworkListener(FrameworkListener listener)
- {
- context.removeFrameworkListener(listener);
- }
-
- public void removeServiceListener(ServiceListener listener)
- {
- context.removeServiceListener(listener);
- }
-
- public boolean ungetService(ServiceReference reference)
- {
- return context.ungetService(reference);
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleContextWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -0,0 +1,175 @@
+/*
+ * 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.spi.framework;
+
+//$Id$
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A generic BundleContext wrapper that delegates all method calls to the underlying
+ * BundleContext implementation.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 16-Oct-2009
+ */
+public class BundleContextWrapper implements BundleContext
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(BundleContextWrapper.class);
+
+ protected BundleContext context;
+
+ public BundleContextWrapper(BundleContext context)
+ {
+ if (context == null)
+ throw new IllegalArgumentException("Null framework");
+ this.context = context;
+ }
+
+ public void addBundleListener(BundleListener listener)
+ {
+ context.addBundleListener(listener);
+ }
+
+ public void addFrameworkListener(FrameworkListener listener)
+ {
+ context.addFrameworkListener(listener);
+ }
+
+ public void addServiceListener(ServiceListener listener, String filter) throws
InvalidSyntaxException
+ {
+ context.addServiceListener(listener, filter);
+ }
+
+ public void addServiceListener(ServiceListener listener)
+ {
+ context.addServiceListener(listener);
+ }
+
+ public Filter createFilter(String filter) throws InvalidSyntaxException
+ {
+ return context.createFilter(filter);
+ }
+
+ public ServiceReference[] getAllServiceReferences(String clazz, String filter) throws
InvalidSyntaxException
+ {
+ return context.getAllServiceReferences(clazz, filter);
+ }
+
+ public Bundle getBundle()
+ {
+ return context.getBundle();
+ }
+
+ public Bundle getBundle(long id)
+ {
+ return context.getBundle(id);
+ }
+
+ public Bundle[] getBundles()
+ {
+ return context.getBundles();
+ }
+
+ public File getDataFile(String filename)
+ {
+ return context.getDataFile(filename);
+ }
+
+ public String getProperty(String key)
+ {
+ return context.getProperty(key);
+ }
+
+ public Object getService(ServiceReference reference)
+ {
+ return context.getService(reference);
+ }
+
+ public ServiceReference getServiceReference(String clazz)
+ {
+ return context.getServiceReference(clazz);
+ }
+
+ public ServiceReference[] getServiceReferences(String clazz, String filter) throws
InvalidSyntaxException
+ {
+ return context.getServiceReferences(clazz, filter);
+ }
+
+ public Bundle installBundle(String location, InputStream input) throws
BundleException
+ {
+ return context.installBundle(location, input);
+ }
+
+ public Bundle installBundle(String location) throws BundleException
+ {
+ return context.installBundle(location);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ServiceRegistration registerService(String clazz, Object service, Dictionary
properties)
+ {
+ return context.registerService(clazz, service, properties);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public ServiceRegistration registerService(String[] clazzes, Object service,
Dictionary properties)
+ {
+ return context.registerService(clazzes, service, properties);
+ }
+
+ public void removeBundleListener(BundleListener listener)
+ {
+ context.removeBundleListener(listener);
+ }
+
+ public void removeFrameworkListener(FrameworkListener listener)
+ {
+ context.removeFrameworkListener(listener);
+ }
+
+ public void removeServiceListener(ServiceListener listener)
+ {
+ context.removeServiceListener(listener);
+ }
+
+ public boolean ungetService(ServiceReference reference)
+ {
+ return context.ungetService(reference);
+ }
+}
\ No newline at end of file
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,198 +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.spi.framework;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Map;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A generic Bundle wrapper that delegates all method calls to the underlying
- * Bundle implementation.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 16-Oct-2009
- */
-public class BundleWrapper implements Bundle
-{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(BundleWrapper.class);
-
- protected Bundle bundle;
-
- public BundleWrapper(Bundle bundle)
- {
- if (bundle == null)
- throw new IllegalArgumentException("Null bundle");
- this.bundle = bundle;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- return bundle.findEntries(path, filePattern, recurse);
- }
-
- public BundleContext getBundleContext()
- {
- return bundle.getBundleContext();
- }
-
- public long getBundleId()
- {
- return bundle.getBundleId();
- }
-
- public URL getEntry(String path)
- {
- return bundle.getEntry(path);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getEntryPaths(String path)
- {
- return bundle.getEntryPaths(path);
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders()
- {
- return bundle.getHeaders();
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders(String locale)
- {
- return bundle.getHeaders(locale);
- }
-
- public long getLastModified()
- {
- return bundle.getLastModified();
- }
-
- public String getLocation()
- {
- return bundle.getLocation();
- }
-
- public ServiceReference[] getRegisteredServices()
- {
- return bundle.getRegisteredServices();
- }
-
- public URL getResource(String name)
- {
- return bundle.getResource(name);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getResources(String name) throws IOException
- {
- return bundle.getResources(name);
- }
-
- public ServiceReference[] getServicesInUse()
- {
- return bundle.getServicesInUse();
- }
-
- @SuppressWarnings("unchecked")
- public Map getSignerCertificates(int signersType)
- {
- return bundle.getSignerCertificates(signersType);
- }
-
- public int getState()
- {
- return bundle.getState();
- }
-
- public String getSymbolicName()
- {
- return bundle.getSymbolicName();
- }
-
- public Version getVersion()
- {
- return bundle.getVersion();
- }
-
- public boolean hasPermission(Object permission)
- {
- return bundle.hasPermission(permission);
- }
-
- @SuppressWarnings("unchecked")
- public Class loadClass(String name) throws ClassNotFoundException
- {
- return bundle.loadClass(name);
- }
-
- public void start() throws BundleException
- {
- bundle.start();
- }
-
- public void start(int options) throws BundleException
- {
- bundle.start(options);
- }
-
- public void stop() throws BundleException
- {
- bundle.stop();
- }
-
- public void stop(int options) throws BundleException
- {
- bundle.stop(options);
- }
-
- public void uninstall() throws BundleException
- {
- bundle.uninstall();
- }
-
- public void update() throws BundleException
- {
- bundle.update();
- }
-
- public void update(InputStream input) throws BundleException
- {
- bundle.update(input);
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/BundleWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -0,0 +1,198 @@
+/*
+ * 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.spi.framework;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A generic Bundle wrapper that delegates all method calls to the underlying
+ * Bundle implementation.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 16-Oct-2009
+ */
+public class BundleWrapper implements Bundle
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(BundleWrapper.class);
+
+ protected Bundle bundle;
+
+ public BundleWrapper(Bundle bundle)
+ {
+ if (bundle == null)
+ throw new IllegalArgumentException("Null bundle");
+ this.bundle = bundle;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ {
+ return bundle.findEntries(path, filePattern, recurse);
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return bundle.getBundleContext();
+ }
+
+ public long getBundleId()
+ {
+ return bundle.getBundleId();
+ }
+
+ public URL getEntry(String path)
+ {
+ return bundle.getEntry(path);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getEntryPaths(String path)
+ {
+ return bundle.getEntryPaths(path);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary getHeaders()
+ {
+ return bundle.getHeaders();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary getHeaders(String locale)
+ {
+ return bundle.getHeaders(locale);
+ }
+
+ public long getLastModified()
+ {
+ return bundle.getLastModified();
+ }
+
+ public String getLocation()
+ {
+ return bundle.getLocation();
+ }
+
+ public ServiceReference[] getRegisteredServices()
+ {
+ return bundle.getRegisteredServices();
+ }
+
+ public URL getResource(String name)
+ {
+ return bundle.getResource(name);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getResources(String name) throws IOException
+ {
+ return bundle.getResources(name);
+ }
+
+ public ServiceReference[] getServicesInUse()
+ {
+ return bundle.getServicesInUse();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Map getSignerCertificates(int signersType)
+ {
+ return bundle.getSignerCertificates(signersType);
+ }
+
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+
+ public Version getVersion()
+ {
+ return bundle.getVersion();
+ }
+
+ public boolean hasPermission(Object permission)
+ {
+ return bundle.hasPermission(permission);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class loadClass(String name) throws ClassNotFoundException
+ {
+ return bundle.loadClass(name);
+ }
+
+ public void start() throws BundleException
+ {
+ bundle.start();
+ }
+
+ public void start(int options) throws BundleException
+ {
+ bundle.start(options);
+ }
+
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ public void stop(int options) throws BundleException
+ {
+ bundle.stop(options);
+ }
+
+ public void uninstall() throws BundleException
+ {
+ bundle.uninstall();
+ }
+
+ public void update() throws BundleException
+ {
+ bundle.update();
+ }
+
+ public void update(InputStream input) throws BundleException
+ {
+ bundle.update(input);
+ }
+}
\ No newline at end of file
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,210 +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.spi.framework;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Map;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.Version;
-import org.osgi.framework.launch.Framework;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * A generic Framework wrapper that delegates all method calls to the underlying
- * Framework implementation.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 16-Oct-2009
- */
-public class FrameworkWrapper implements Framework
-{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(FrameworkWrapper.class);
-
- protected Framework framework;
-
- public FrameworkWrapper(Framework framework)
- {
- if (framework == null)
- throw new IllegalArgumentException("Null framework");
-
- this.framework = framework;
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration findEntries(String arg0, String arg1, boolean arg2)
- {
- return framework.findEntries(arg0, arg1, arg2);
- }
-
- public BundleContext getBundleContext()
- {
- return framework.getBundleContext();
- }
-
- public long getBundleId()
- {
- return framework.getBundleId();
- }
-
- public URL getEntry(String arg0)
- {
- return framework.getEntry(arg0);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getEntryPaths(String arg0)
- {
- return framework.getEntryPaths(arg0);
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders()
- {
- return framework.getHeaders();
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary getHeaders(String arg0)
- {
- return framework.getHeaders(arg0);
- }
-
- public long getLastModified()
- {
- return framework.getLastModified();
- }
-
- public String getLocation()
- {
- return framework.getLocation();
- }
-
- public ServiceReference[] getRegisteredServices()
- {
- return framework.getRegisteredServices();
- }
-
- public URL getResource(String arg0)
- {
- return framework.getResource(arg0);
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration getResources(String arg0) throws IOException
- {
- return framework.getResources(arg0);
- }
-
- public ServiceReference[] getServicesInUse()
- {
- return framework.getServicesInUse();
- }
-
- @SuppressWarnings("unchecked")
- public Map getSignerCertificates(int arg0)
- {
- return framework.getSignerCertificates(arg0);
- }
-
- public int getState()
- {
- return framework.getState();
- }
-
- public String getSymbolicName()
- {
- return framework.getSymbolicName();
- }
-
- public Version getVersion()
- {
- return framework.getVersion();
- }
-
- public boolean hasPermission(Object arg0)
- {
- return framework.hasPermission(arg0);
- }
-
- public void init() throws BundleException
- {
- framework.init();
- }
-
- @SuppressWarnings("unchecked")
- public Class loadClass(String arg0) throws ClassNotFoundException
- {
- return framework.loadClass(arg0);
- }
-
- public void start() throws BundleException
- {
- framework.start();
- }
-
- public void start(int arg0) throws BundleException
- {
- framework.start(arg0);
- }
-
- public void stop() throws BundleException
- {
- framework.stop();
- }
-
- public void stop(int arg0) throws BundleException
- {
- framework.stop(arg0);
- }
-
- public void uninstall() throws BundleException
- {
- framework.uninstall();
- }
-
- public void update() throws BundleException
- {
- framework.update();
- }
-
- public void update(InputStream arg0) throws BundleException
- {
- framework.update(arg0);
- }
-
- public FrameworkEvent waitForStop(long arg0) throws InterruptedException
- {
- return framework.waitForStop(arg0);
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/framework/FrameworkWrapper.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -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.spi.framework;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Map;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.Version;
+import org.osgi.framework.launch.Framework;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A generic Framework wrapper that delegates all method calls to the underlying
+ * Framework implementation.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 16-Oct-2009
+ */
+public class FrameworkWrapper implements Framework
+{
+ // Provide logging
+ final Logger log = LoggerFactory.getLogger(FrameworkWrapper.class);
+
+ protected Framework framework;
+
+ public FrameworkWrapper(Framework framework)
+ {
+ if (framework == null)
+ throw new IllegalArgumentException("Null framework");
+
+ this.framework = framework;
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration findEntries(String arg0, String arg1, boolean arg2)
+ {
+ return framework.findEntries(arg0, arg1, arg2);
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return framework.getBundleContext();
+ }
+
+ public long getBundleId()
+ {
+ return framework.getBundleId();
+ }
+
+ public URL getEntry(String arg0)
+ {
+ return framework.getEntry(arg0);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getEntryPaths(String arg0)
+ {
+ return framework.getEntryPaths(arg0);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary getHeaders()
+ {
+ return framework.getHeaders();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary getHeaders(String arg0)
+ {
+ return framework.getHeaders(arg0);
+ }
+
+ public long getLastModified()
+ {
+ return framework.getLastModified();
+ }
+
+ public String getLocation()
+ {
+ return framework.getLocation();
+ }
+
+ public ServiceReference[] getRegisteredServices()
+ {
+ return framework.getRegisteredServices();
+ }
+
+ public URL getResource(String arg0)
+ {
+ return framework.getResource(arg0);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getResources(String arg0) throws IOException
+ {
+ return framework.getResources(arg0);
+ }
+
+ public ServiceReference[] getServicesInUse()
+ {
+ return framework.getServicesInUse();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Map getSignerCertificates(int arg0)
+ {
+ return framework.getSignerCertificates(arg0);
+ }
+
+ public int getState()
+ {
+ return framework.getState();
+ }
+
+ public String getSymbolicName()
+ {
+ return framework.getSymbolicName();
+ }
+
+ public Version getVersion()
+ {
+ return framework.getVersion();
+ }
+
+ public boolean hasPermission(Object arg0)
+ {
+ return framework.hasPermission(arg0);
+ }
+
+ public void init() throws BundleException
+ {
+ framework.init();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Class loadClass(String arg0) throws ClassNotFoundException
+ {
+ return framework.loadClass(arg0);
+ }
+
+ public void start() throws BundleException
+ {
+ framework.start();
+ }
+
+ public void start(int arg0) throws BundleException
+ {
+ framework.start(arg0);
+ }
+
+ public void stop() throws BundleException
+ {
+ framework.stop();
+ }
+
+ public void stop(int arg0) throws BundleException
+ {
+ framework.stop(arg0);
+ }
+
+ public void uninstall() throws BundleException
+ {
+ framework.uninstall();
+ }
+
+ public void update() throws BundleException
+ {
+ framework.update();
+ }
+
+ public void update(InputStream arg0) throws BundleException
+ {
+ framework.update(arg0);
+ }
+
+ public FrameworkEvent waitForStop(long arg0) throws InterruptedException
+ {
+ return framework.waitForStop(arg0);
+ }
+}
\ No newline at end of file
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,73 +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.spi.internal;
-
-// $Id$
-
-import java.security.PrivilegedAction;
-import java.security.AccessController;
-
-/**
- * Priviledged actions for the package
- *
- * @author Scott.Stark(a)jboss.org
- */
-@SuppressWarnings("unchecked")
-class SysPropertyActions
-{
- interface SysProps
- {
- SysProps NON_PRIVILEDGED = new SysProps()
- {
- public String getProperty(final String name, final String defaultValue)
- {
- return System.getProperty(name, defaultValue);
- }
- };
- SysProps PRIVILEDGED = new SysProps()
- {
- public String getProperty(final String name, final String defaultValue)
- {
- PrivilegedAction action = new PrivilegedAction()
- {
- public Object run()
- {
- return System.getProperty(name, defaultValue);
- }
- };
- return (String)AccessController.doPrivileged(action);
- }
- };
-
- String getProperty(String name, String defaultValue);
- }
-
- public static String getProperty(String name, String defaultValue)
- {
- String prop;
- if (System.getSecurityManager() == null)
- prop = SysProps.NON_PRIVILEDGED.getProperty(name, defaultValue);
- else
- prop = SysProps.PRIVILEDGED.getProperty(name, defaultValue);
- return prop;
- }
-}
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/internal/SysPropertyActions.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -0,0 +1,74 @@
+/*
+ * 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.spi.internal;
+
+// $Id$
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+/**
+ * Priviledged actions for the package
+ *
+ * @author Scott.Stark(a)jboss.org
+ */
+@SuppressWarnings("rawtypes")
+class SysPropertyActions
+{
+ interface SysProps
+ {
+ SysProps NON_PRIVILEDGED = new SysProps()
+ {
+ public String getProperty(final String name, final String defaultValue)
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ SysProps PRIVILEDGED = new SysProps()
+ {
+ @SuppressWarnings("unchecked")
+ public String getProperty(final String name, final String defaultValue)
+ {
+ PrivilegedAction action = new PrivilegedAction()
+ {
+ public Object run()
+ {
+ return System.getProperty(name, defaultValue);
+ }
+ };
+ return (String)AccessController.doPrivileged(action);
+ }
+ };
+
+ String getProperty(String name, String defaultValue);
+ }
+
+ public static String getProperty(String name, String defaultValue)
+ {
+ String prop;
+ if (System.getSecurityManager() == null)
+ prop = SysProps.NON_PRIVILEDGED.getProperty(name, defaultValue);
+ else
+ prop = SysProps.PRIVILEDGED.getProperty(name, defaultValue);
+ return prop;
+ }
+}
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,395 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, 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.spi.management;
-
-// $Id$
-
-import java.io.Serializable;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.HashMap;
-
-import javax.management.Attribute;
-import javax.management.InstanceNotFoundException;
-import javax.management.MBeanAttributeInfo;
-import javax.management.MBeanException;
-import javax.management.MBeanInfo;
-import javax.management.MBeanOperationInfo;
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.management.ReflectionException;
-import javax.management.RuntimeErrorException;
-import javax.management.RuntimeMBeanException;
-import javax.management.RuntimeOperationsException;
-
-
-/**
- * A simple MBeanProxy
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 24-Feb-2009
- */
-public class MBeanProxy
-{
- @SuppressWarnings( { "unchecked" })
- public static <T> T get(Class<T> interf, ObjectName name,
MBeanServerConnection server) throws MBeanProxyException
- {
- return (T)get(new Class[] { interf }, name, server);
- }
-
- @SuppressWarnings( { "unchecked" })
- public static Object get(Class[] interfaces, ObjectName name, MBeanServerConnection
server) throws MBeanProxyException
- {
- return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
interfaces, new JMXInvocationHandler(server, name));
- }
-
- /**
- * Invocation handler for MBean proxies.
- *
- * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>
- * @author Thomas.Diesler(a)jboss.com
- * @since 24-Feb-2009
- */
- static class JMXInvocationHandler implements InvocationHandler, Serializable
- {
- private static final long serialVersionUID = 3714728148040623702L;
-
- // Attributes -------------------------------------------------
-
- /*
- * Reference to the MBean server this proxy connects to.
- */
- protected MBeanServerConnection server = null;
-
- /*
- * The object name of the MBean this proxy represents.
- */
- protected ObjectName objectName = null;
-
- /*
- * MBean attribute meta data.
- */
- private HashMap<String, MBeanAttributeInfo> attributeMap = new
HashMap<String, MBeanAttributeInfo>();
-
- /*
- * Indicates whether Object.toString() should be delegated to the resource or handled
by the proxy.
- */
- private boolean delegateToStringToResource = false;
-
- /*
- * Indicates whether Object.equals() should be delegated to the resource or handled
by the proxy.
- */
- private boolean delegateEqualsToResource = false;
-
- /*
- * Indicates whether Object.hashCode() should be delegated to the resource or handled
by the proxy.
- */
- private boolean delegateHashCodeToResource = false;
-
- // Constructors -----------------------------------------------
-
- /*
- * Constructs a new JMX MBean Proxy invocation handler.
- * @param server reference to the MBean server this proxy connects to
- * @param name object name of the MBean this proxy represents
- * @throws MBeanProxyCreationException wraps underlying JMX exceptions in case the
proxy creation fails
- */
- public JMXInvocationHandler(MBeanServerConnection server, ObjectName name) throws
MBeanProxyException
- {
- try
- {
- if (server == null)
- throw new MBeanProxyException("null agent reference");
-
- if (name == null)
- throw new MBeanProxyException("null object name");
-
- this.server = server;
- this.objectName = name;
-
- MBeanInfo info = server.getMBeanInfo(objectName);
- MBeanAttributeInfo[] attributes = info.getAttributes();
- MBeanOperationInfo[] operations = info.getOperations();
-
- // collect the MBean attribute metadata for standard mbean proxies
- for (int i = 0; i < attributes.length; ++i)
- attributeMap.put(attributes[i].getName(), attributes[i]);
-
- // Check whether the target resource exposes the common object methods.
- // Dynamic Proxy will delegate these methods automatically to the
- // invoke() implementation.
- for (int i = 0; i < operations.length; ++i)
- {
- if (operations[i].getName().equals("toString") &&
operations[i].getReturnType().equals("java.lang.String") &&
operations[i].getSignature().length == 0)
- {
- delegateToStringToResource = true;
- }
-
- else if (operations[i].getName().equals("equals") &&
operations[i].getReturnType().equals(Boolean.TYPE.getName())
- && operations[i].getSignature().length == 1 &&
operations[i].getSignature()[0].getType().equals("java.lang.Object"))
- {
- delegateEqualsToResource = true;
- }
-
- else if (operations[i].getName().equals("hashCode") &&
operations[i].getReturnType().equals(Integer.TYPE.getName())
- && operations[i].getSignature().length == 0)
- {
- delegateHashCodeToResource = true;
- }
- }
- }
- catch (InstanceNotFoundException e)
- {
- throw new MBeanProxyException("Object name " + name + " not found:
" + e.toString());
- }
- catch (Exception ex)
- {
- throw new MBeanProxyException(ex.toString());
- }
- }
-
- // InvocationHandler implementation ---------------------------
-
- @SuppressWarnings("unchecked")
- public Object invoke(Object proxy, Method method, Object[] args) throws Exception
- {
- Class<?> declaringClass = method.getDeclaringClass();
-
- // Handle methods from Object class. If the target resource exposes
- // operation metadata with same signature then the invocations will be
- // delegated to the target. Otherwise this instance of invocation handler
- // will execute them.
- if (declaringClass == Object.class)
- return handleObjectMethods(method, args);
-
- try
- {
- String methodName = method.getName();
-
- // Assume a get/setAttribute convention on the typed proxy interface.
- // If the MBean metadata exposes a matching attribute then use the
- // MBeanServer attribute accessors to read/modify the value. If not,
- // fallback to MBeanServer.invoke() assuming this is an operation
- // invocation despite the accessor naming convention.
-
- // getter
- if (methodName.startsWith("get") && args == null)
- {
- String attrName = methodName.substring(3, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null)
- {
- String retType = method.getReturnType().getName();
-
- // check for correct return type on the getter
- if (retType.equals(info.getType()))
- {
- return server.getAttribute(objectName, attrName);
- }
- }
- }
-
- // boolean getter
- else if (methodName.startsWith("is") && args == null)
- {
- String attrName = methodName.substring(2, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null && info.isIs())
- {
- Class<?> retType = method.getReturnType();
-
- // check for correct return type on the getter
- if (retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))
- {
- return server.getAttribute(objectName, attrName);
- }
- }
- }
-
- // setter
- else if (methodName.startsWith("set") && args != null
&& args.length == 1)
- {
- String attrName = methodName.substring(3, methodName.length());
-
- // check that the metadata exists
- MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
- if (info != null && method.getReturnType().equals(Void.TYPE))
- {
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
-
- Class<?> signatureClass = null;
- String classType = info.getType();
-
- if (isPrimitive(classType))
- signatureClass = getPrimitiveClass(classType);
- else
- signatureClass = cl.loadClass(info.getType());
-
- if (signatureClass.isAssignableFrom(args[0].getClass()))
- {
- server.setAttribute(objectName, new Attribute(attrName, args[0]));
- return null;
- }
- }
- }
-
- String[] signature = null;
-
- if (args != null)
- {
- signature = new String[args.length];
- Class[] sign = method.getParameterTypes();
-
- for (int i = 0; i < sign.length; ++i)
- signature[i] = sign[i].getName();
- }
-
- return server.invoke(objectName, methodName, args, signature);
- }
- catch (Exception ex)
- {
- throw (Exception)decodeJMXException(ex);
- }
- }
-
- /*
- * Attempt to decode the given Throwable.
- * If it is a container JMX exception, then the target is returned.
- * Otherwise the argument is returned.
- */
- private Throwable decodeJMXException(final Exception ex)
- {
- Throwable result = ex;
-
- while (true)
- {
- if (result instanceof MBeanException)
- result = ((MBeanException)result).getTargetException();
- else if (result instanceof ReflectionException)
- result = ((ReflectionException)result).getTargetException();
- else if (result instanceof RuntimeOperationsException)
- result = ((RuntimeOperationsException)result).getTargetException();
- else if (result instanceof RuntimeMBeanException)
- result = ((RuntimeMBeanException)result).getTargetException();
- else if (result instanceof RuntimeErrorException)
- result = ((RuntimeErrorException)result).getTargetError();
- else
- // can't decode
- break;
- }
-
- return result;
- }
-
- private Object handleObjectMethods(Method method, Object[] args) throws Exception
- {
- if (method.getName().equals("toString"))
- {
- if (delegateToStringToResource)
- return server.invoke(objectName, "toString", null, null);
- else
- return toString();
- }
-
- else if (method.getName().equals("equals"))
- {
- if (delegateEqualsToResource)
- {
- return server.invoke(objectName, "equals", new Object[] { args[0] },
new String[] { "java.lang.Object" });
- }
- else if (Proxy.isProxyClass(args[0].getClass()))
- {
- Proxy prxy = (Proxy)args[0];
- return new Boolean(this.equals(Proxy.getInvocationHandler(prxy)));
- }
- else
- {
- return new Boolean(this.equals(args[0]));
- }
- }
-
- else if (method.getName().equals("hashCode"))
- {
- if (delegateHashCodeToResource)
- return server.invoke(objectName, "hashCode", null, null);
- else
- return new Integer(this.hashCode());
- }
-
- else
- throw new Error("Unexpected method invocation!");
- }
-
- private boolean isPrimitive(String type)
- {
- if (type.equals(Integer.TYPE.getName()))
- return true;
- if (type.equals(Long.TYPE.getName()))
- return true;
- if (type.equals(Boolean.TYPE.getName()))
- return true;
- if (type.equals(Byte.TYPE.getName()))
- return true;
- if (type.equals(Character.TYPE.getName()))
- return true;
- if (type.equals(Short.TYPE.getName()))
- return true;
- if (type.equals(Float.TYPE.getName()))
- return true;
- if (type.equals(Double.TYPE.getName()))
- return true;
- if (type.equals(Void.TYPE.getName()))
- return true;
-
- return false;
- }
-
- private Class<?> getPrimitiveClass(String type)
- {
- if (type.equals(Integer.TYPE.getName()))
- return Integer.TYPE;
- if (type.equals(Long.TYPE.getName()))
- return Long.TYPE;
- if (type.equals(Boolean.TYPE.getName()))
- return Boolean.TYPE;
- if (type.equals(Byte.TYPE.getName()))
- return Byte.TYPE;
- if (type.equals(Character.TYPE.getName()))
- return Character.TYPE;
- if (type.equals(Short.TYPE.getName()))
- return Short.TYPE;
- if (type.equals(Float.TYPE.getName()))
- return Float.TYPE;
- if (type.equals(Double.TYPE.getName()))
- return Double.TYPE;
- if (type.equals(Void.TYPE.getName()))
- return Void.TYPE;
-
- return null;
- }
- }
-}
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/MBeanProxy.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -0,0 +1,395 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, 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.spi.management;
+
+// $Id$
+
+import java.io.Serializable;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.HashMap;
+
+import javax.management.Attribute;
+import javax.management.InstanceNotFoundException;
+import javax.management.MBeanAttributeInfo;
+import javax.management.MBeanException;
+import javax.management.MBeanInfo;
+import javax.management.MBeanOperationInfo;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.ReflectionException;
+import javax.management.RuntimeErrorException;
+import javax.management.RuntimeMBeanException;
+import javax.management.RuntimeOperationsException;
+
+
+/**
+ * A simple MBeanProxy
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 24-Feb-2009
+ */
+public class MBeanProxy
+{
+ @SuppressWarnings( { "unchecked" })
+ public static <T> T get(Class<T> interf, ObjectName name,
MBeanServerConnection server) throws MBeanProxyException
+ {
+ return (T)get(new Class[] { interf }, name, server);
+ }
+
+ @SuppressWarnings( { "rawtypes" })
+ public static Object get(Class[] interfaces, ObjectName name, MBeanServerConnection
server) throws MBeanProxyException
+ {
+ return Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
interfaces, new JMXInvocationHandler(server, name));
+ }
+
+ /**
+ * Invocation handler for MBean proxies.
+ *
+ * @author <a href="mailto:juha@jboss.org">Juha Lindfors</a>
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 24-Feb-2009
+ */
+ static class JMXInvocationHandler implements InvocationHandler, Serializable
+ {
+ private static final long serialVersionUID = 3714728148040623702L;
+
+ // Attributes -------------------------------------------------
+
+ /*
+ * Reference to the MBean server this proxy connects to.
+ */
+ protected MBeanServerConnection server = null;
+
+ /*
+ * The object name of the MBean this proxy represents.
+ */
+ protected ObjectName objectName = null;
+
+ /*
+ * MBean attribute meta data.
+ */
+ private HashMap<String, MBeanAttributeInfo> attributeMap = new
HashMap<String, MBeanAttributeInfo>();
+
+ /*
+ * Indicates whether Object.toString() should be delegated to the resource or handled
by the proxy.
+ */
+ private boolean delegateToStringToResource = false;
+
+ /*
+ * Indicates whether Object.equals() should be delegated to the resource or handled
by the proxy.
+ */
+ private boolean delegateEqualsToResource = false;
+
+ /*
+ * Indicates whether Object.hashCode() should be delegated to the resource or handled
by the proxy.
+ */
+ private boolean delegateHashCodeToResource = false;
+
+ // Constructors -----------------------------------------------
+
+ /*
+ * Constructs a new JMX MBean Proxy invocation handler.
+ * @param server reference to the MBean server this proxy connects to
+ * @param name object name of the MBean this proxy represents
+ * @throws MBeanProxyCreationException wraps underlying JMX exceptions in case the
proxy creation fails
+ */
+ public JMXInvocationHandler(MBeanServerConnection server, ObjectName name) throws
MBeanProxyException
+ {
+ try
+ {
+ if (server == null)
+ throw new MBeanProxyException("null agent reference");
+
+ if (name == null)
+ throw new MBeanProxyException("null object name");
+
+ this.server = server;
+ this.objectName = name;
+
+ MBeanInfo info = server.getMBeanInfo(objectName);
+ MBeanAttributeInfo[] attributes = info.getAttributes();
+ MBeanOperationInfo[] operations = info.getOperations();
+
+ // collect the MBean attribute metadata for standard mbean proxies
+ for (int i = 0; i < attributes.length; ++i)
+ attributeMap.put(attributes[i].getName(), attributes[i]);
+
+ // Check whether the target resource exposes the common object methods.
+ // Dynamic Proxy will delegate these methods automatically to the
+ // invoke() implementation.
+ for (int i = 0; i < operations.length; ++i)
+ {
+ if (operations[i].getName().equals("toString") &&
operations[i].getReturnType().equals("java.lang.String") &&
operations[i].getSignature().length == 0)
+ {
+ delegateToStringToResource = true;
+ }
+
+ else if (operations[i].getName().equals("equals") &&
operations[i].getReturnType().equals(Boolean.TYPE.getName())
+ && operations[i].getSignature().length == 1 &&
operations[i].getSignature()[0].getType().equals("java.lang.Object"))
+ {
+ delegateEqualsToResource = true;
+ }
+
+ else if (operations[i].getName().equals("hashCode") &&
operations[i].getReturnType().equals(Integer.TYPE.getName())
+ && operations[i].getSignature().length == 0)
+ {
+ delegateHashCodeToResource = true;
+ }
+ }
+ }
+ catch (InstanceNotFoundException e)
+ {
+ throw new MBeanProxyException("Object name " + name + " not found:
" + e.toString());
+ }
+ catch (Exception ex)
+ {
+ throw new MBeanProxyException(ex.toString());
+ }
+ }
+
+ // InvocationHandler implementation ---------------------------
+
+ @SuppressWarnings("rawtypes")
+ public Object invoke(Object proxy, Method method, Object[] args) throws Exception
+ {
+ Class<?> declaringClass = method.getDeclaringClass();
+
+ // Handle methods from Object class. If the target resource exposes
+ // operation metadata with same signature then the invocations will be
+ // delegated to the target. Otherwise this instance of invocation handler
+ // will execute them.
+ if (declaringClass == Object.class)
+ return handleObjectMethods(method, args);
+
+ try
+ {
+ String methodName = method.getName();
+
+ // Assume a get/setAttribute convention on the typed proxy interface.
+ // If the MBean metadata exposes a matching attribute then use the
+ // MBeanServer attribute accessors to read/modify the value. If not,
+ // fallback to MBeanServer.invoke() assuming this is an operation
+ // invocation despite the accessor naming convention.
+
+ // getter
+ if (methodName.startsWith("get") && args == null)
+ {
+ String attrName = methodName.substring(3, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null)
+ {
+ String retType = method.getReturnType().getName();
+
+ // check for correct return type on the getter
+ if (retType.equals(info.getType()))
+ {
+ return server.getAttribute(objectName, attrName);
+ }
+ }
+ }
+
+ // boolean getter
+ else if (methodName.startsWith("is") && args == null)
+ {
+ String attrName = methodName.substring(2, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null && info.isIs())
+ {
+ Class<?> retType = method.getReturnType();
+
+ // check for correct return type on the getter
+ if (retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))
+ {
+ return server.getAttribute(objectName, attrName);
+ }
+ }
+ }
+
+ // setter
+ else if (methodName.startsWith("set") && args != null
&& args.length == 1)
+ {
+ String attrName = methodName.substring(3, methodName.length());
+
+ // check that the metadata exists
+ MBeanAttributeInfo info = (MBeanAttributeInfo)attributeMap.get(attrName);
+ if (info != null && method.getReturnType().equals(Void.TYPE))
+ {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+ Class<?> signatureClass = null;
+ String classType = info.getType();
+
+ if (isPrimitive(classType))
+ signatureClass = getPrimitiveClass(classType);
+ else
+ signatureClass = cl.loadClass(info.getType());
+
+ if (signatureClass.isAssignableFrom(args[0].getClass()))
+ {
+ server.setAttribute(objectName, new Attribute(attrName, args[0]));
+ return null;
+ }
+ }
+ }
+
+ String[] signature = null;
+
+ if (args != null)
+ {
+ signature = new String[args.length];
+ Class[] sign = method.getParameterTypes();
+
+ for (int i = 0; i < sign.length; ++i)
+ signature[i] = sign[i].getName();
+ }
+
+ return server.invoke(objectName, methodName, args, signature);
+ }
+ catch (Exception ex)
+ {
+ throw (Exception)decodeJMXException(ex);
+ }
+ }
+
+ /*
+ * Attempt to decode the given Throwable.
+ * If it is a container JMX exception, then the target is returned.
+ * Otherwise the argument is returned.
+ */
+ private Throwable decodeJMXException(final Exception ex)
+ {
+ Throwable result = ex;
+
+ while (true)
+ {
+ if (result instanceof MBeanException)
+ result = ((MBeanException)result).getTargetException();
+ else if (result instanceof ReflectionException)
+ result = ((ReflectionException)result).getTargetException();
+ else if (result instanceof RuntimeOperationsException)
+ result = ((RuntimeOperationsException)result).getTargetException();
+ else if (result instanceof RuntimeMBeanException)
+ result = ((RuntimeMBeanException)result).getTargetException();
+ else if (result instanceof RuntimeErrorException)
+ result = ((RuntimeErrorException)result).getTargetError();
+ else
+ // can't decode
+ break;
+ }
+
+ return result;
+ }
+
+ private Object handleObjectMethods(Method method, Object[] args) throws Exception
+ {
+ if (method.getName().equals("toString"))
+ {
+ if (delegateToStringToResource)
+ return server.invoke(objectName, "toString", null, null);
+ else
+ return toString();
+ }
+
+ else if (method.getName().equals("equals"))
+ {
+ if (delegateEqualsToResource)
+ {
+ return server.invoke(objectName, "equals", new Object[] { args[0] },
new String[] { "java.lang.Object" });
+ }
+ else if (Proxy.isProxyClass(args[0].getClass()))
+ {
+ Proxy prxy = (Proxy)args[0];
+ return new Boolean(this.equals(Proxy.getInvocationHandler(prxy)));
+ }
+ else
+ {
+ return new Boolean(this.equals(args[0]));
+ }
+ }
+
+ else if (method.getName().equals("hashCode"))
+ {
+ if (delegateHashCodeToResource)
+ return server.invoke(objectName, "hashCode", null, null);
+ else
+ return new Integer(this.hashCode());
+ }
+
+ else
+ throw new Error("Unexpected method invocation!");
+ }
+
+ private boolean isPrimitive(String type)
+ {
+ if (type.equals(Integer.TYPE.getName()))
+ return true;
+ if (type.equals(Long.TYPE.getName()))
+ return true;
+ if (type.equals(Boolean.TYPE.getName()))
+ return true;
+ if (type.equals(Byte.TYPE.getName()))
+ return true;
+ if (type.equals(Character.TYPE.getName()))
+ return true;
+ if (type.equals(Short.TYPE.getName()))
+ return true;
+ if (type.equals(Float.TYPE.getName()))
+ return true;
+ if (type.equals(Double.TYPE.getName()))
+ return true;
+ if (type.equals(Void.TYPE.getName()))
+ return true;
+
+ return false;
+ }
+
+ private Class<?> getPrimitiveClass(String type)
+ {
+ if (type.equals(Integer.TYPE.getName()))
+ return Integer.TYPE;
+ if (type.equals(Long.TYPE.getName()))
+ return Long.TYPE;
+ if (type.equals(Boolean.TYPE.getName()))
+ return Boolean.TYPE;
+ if (type.equals(Byte.TYPE.getName()))
+ return Byte.TYPE;
+ if (type.equals(Character.TYPE.getName()))
+ return Character.TYPE;
+ if (type.equals(Short.TYPE.getName()))
+ return Short.TYPE;
+ if (type.equals(Float.TYPE.getName()))
+ return Float.TYPE;
+ if (type.equals(Double.TYPE.getName()))
+ return Double.TYPE;
+ if (type.equals(Void.TYPE.getName()))
+ return Void.TYPE;
+
+ return null;
+ }
+ }
+}
Deleted:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
===================================================================
---
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2009-11-24
03:22:19 UTC (rev 96776)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -1,122 +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.spi.management;
-
-//$Id$
-
-import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.Hashtable;
-
-import javax.management.ObjectName;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Version;
-
-/**
- * The managed view of an OSGi Bundle
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class ManagedBundle implements ManagedBundleMBean
-{
- public static final String PROPERTY_ID = "id";
- public static final String PROPERTY_SYMBOLIC_NAME = "sname";
- public static final String PROPERTY_VERSION = "version";
-
- private Bundle bundle;
- private ObjectName oname;
-
- public ManagedBundle(Bundle bundle)
- {
- this.bundle = bundle;
- this.oname = getObjectName(bundle);
- }
-
- public static ObjectName getObjectName(Bundle bundle)
- {
- long id = bundle.getBundleId();
- String symbolicName = bundle.getSymbolicName();
- Version version = bundle.getVersion();
- return getObjectName(id, symbolicName, version);
- }
-
- public static ObjectName getObjectName(long id, String sname, Version version)
- {
- String oname = DOMAIN_NAME + ":" + PROPERTY_ID + "=" + id +
"," + PROPERTY_SYMBOLIC_NAME + "=" + sname + "," +
PROPERTY_VERSION + "=" + version;
- return ObjectNameFactory.create(oname);
- }
-
- public ObjectName getObjectName()
- {
- return oname;
- }
-
- public String getProperty(String key)
- {
- return bundle.getBundleContext().getProperty(key);
- }
-
- public int getState()
- {
- return bundle.getState();
- }
-
- public long getBundleId()
- {
- return bundle.getBundleId();
- }
-
- public String getSymbolicName()
- {
- return bundle.getSymbolicName();
- }
-
- @SuppressWarnings("unchecked")
- public Dictionary<String, String> getHeaders()
- {
- Hashtable<String, String> retHeaders = new Hashtable<String,
String>();
- Dictionary bundleHeaders = bundle.getHeaders();
- Enumeration keys = bundleHeaders.keys();
- while (keys.hasMoreElements())
- {
- String key = (String)keys.nextElement();
- String value = (String)bundleHeaders.get(key);
- retHeaders.put(key, value);
- }
- return retHeaders;
- }
-
- public void start() throws BundleException
- {
- bundle.start();
- }
-
- public void stop() throws BundleException
- {
- bundle.stop();
- }
-}
\ No newline at end of file
Copied:
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
(from rev 96777,
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java)
===================================================================
---
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java
(rev 0)
+++
projects/jboss-osgi/projects/spi/tags/jboss-osgi-spi-1.0.3/src/main/java/org/jboss/osgi/spi/management/ManagedBundle.java 2009-11-24
03:32:58 UTC (rev 96779)
@@ -0,0 +1,122 @@
+/*
+ * 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.spi.management;
+
+//$Id$
+
+import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.management.ObjectName;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Version;
+
+/**
+ * The managed view of an OSGi Bundle
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class ManagedBundle implements ManagedBundleMBean
+{
+ public static final String PROPERTY_ID = "id";
+ public static final String PROPERTY_SYMBOLIC_NAME = "sname";
+ public static final String PROPERTY_VERSION = "version";
+
+ private Bundle bundle;
+ private ObjectName oname;
+
+ public ManagedBundle(Bundle bundle)
+ {
+ this.bundle = bundle;
+ this.oname = getObjectName(bundle);
+ }
+
+ public static ObjectName getObjectName(Bundle bundle)
+ {
+ long id = bundle.getBundleId();
+ String symbolicName = bundle.getSymbolicName();
+ Version version = bundle.getVersion();
+ return getObjectName(id, symbolicName, version);
+ }
+
+ public static ObjectName getObjectName(long id, String sname, Version version)
+ {
+ String oname = DOMAIN_NAME + ":" + PROPERTY_ID + "=" + id +
"," + PROPERTY_SYMBOLIC_NAME + "=" + sname + "," +
PROPERTY_VERSION + "=" + version;
+ return ObjectNameFactory.create(oname);
+ }
+
+ public ObjectName getObjectName()
+ {
+ return oname;
+ }
+
+ public String getProperty(String key)
+ {
+ return bundle.getBundleContext().getProperty(key);
+ }
+
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ public long getBundleId()
+ {
+ return bundle.getBundleId();
+ }
+
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Dictionary<String, String> getHeaders()
+ {
+ Hashtable<String, String> retHeaders = new Hashtable<String,
String>();
+ Dictionary bundleHeaders = bundle.getHeaders();
+ Enumeration keys = bundleHeaders.keys();
+ while (keys.hasMoreElements())
+ {
+ String key = (String)keys.nextElement();
+ String value = (String)bundleHeaders.get(key);
+ retHeaders.put(key, value);
+ }
+ return retHeaders;
+ }
+
+ public void start() throws BundleException
+ {
+ bundle.start();
+ }
+
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+}
\ No newline at end of file