[jboss-cvs] JBossAS SVN: r90742 - in projects/jboss-osgi/trunk: distribution/src/main/resources/installer and 1 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Jul 1 06:51:48 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-07-01 06:51:48 -0400 (Wed, 01 Jul 2009)
New Revision: 90742
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/distribution/src/main/resources/installer/user-input-spec.xml
Log:
Support BP tests in jbossas
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-07-01 10:50:45 UTC (rev 90741)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-07-01 10:51:48 UTC (rev 90742)
@@ -96,6 +96,7 @@
String clazz = compMetadata.getClassName();
BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder(key, clazz);
+ builder.setClassLoader(((BlueprintContainerImpl)container).getClassLoader());
mcBeanMetadata = builder.getBeanMetaData();
for (BeanProperty prop : bpBeanMetadata.getProperties())
Modified: projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
===================================================================
--- projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-07-01 10:50:45 UTC (rev 90741)
+++ projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-07-01 10:51:48 UTC (rev 90742)
@@ -37,6 +37,7 @@
import org.jboss.osgi.blueprint.BlueprintContext;
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
+import org.jboss.osgi.spi.BundleClassLoader;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -73,6 +74,7 @@
public static final String PROPERTY_BLUEPRINT_BUNDLE_SYMBOLIC_NAME = "osgi.blueprint.container.symbolicname";
public static final String PROPERTY_BLUEPRINT_BUNDLE_VERSION = "osgi.blueprint.container.version";
+ private BundleClassLoader classLoader;
private BlueprintContext context;
private Bundle bundle;
@@ -82,6 +84,8 @@
{
this.context = context;
this.bundle = bundle;
+
+ this.classLoader = BundleClassLoader.createClassLoader(bundle);
}
public void initialize()
@@ -112,6 +116,11 @@
for (AbstractManager manager : list)
manager.shutdown();
}
+
+ public ClassLoader getClassLoader()
+ {
+ return classLoader;
+ }
public BundleContext getBundleContext()
{
Modified: projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-07-01 10:50:45 UTC (rev 90741)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/install-definition.xml 2009-07-01 10:51:48 UTC (rev 90742)
@@ -259,12 +259,12 @@
<!--
********************************
* *
- * JBoss Integration *
+ * JBossAS Integration *
* *
********************************
-->
- <pack name="JBossOSGi Integration" required="no" preselected="yes">
+ <pack name="JBossAS Integration" required="no" preselected="yes">
<description>Integration with an existing JBossAS instance</description>
Modified: projects/jboss-osgi/trunk/distribution/src/main/resources/installer/user-input-spec.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/src/main/resources/installer/user-input-spec.xml 2009-07-01 10:50:45 UTC (rev 90741)
+++ projects/jboss-osgi/trunk/distribution/src/main/resources/installer/user-input-spec.xml 2009-07-01 10:51:48 UTC (rev 90742)
@@ -10,7 +10,7 @@
</field>
</panel>
<panel order="1">
- <createForPack name="JBossOSGi Integration" />
+ <createForPack name="JBossAS Integration" />
<field type="radio" variable="jbossSelection">
<description align="left" txt="Please choose your target container" />
<spec>
@@ -25,7 +25,7 @@
</field>
</panel>
<panel order="2">
- <createForPack name="JBossOSGi Integration" />
+ <createForPack name="JBossAS Integration" />
<field type="dir" align="left" variable="jbossInstallPath">
<spec txt="JBoss Home:" size="25" set="${jboss.home}" />
</field>
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java (from rev 90698, projects/jboss-osgi/projects/integration/deployers/trunk/src/main/java/org/jboss/osgi/deployer/helpers/BundleClassLoader.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/BundleClassLoader.java 2009-07-01 10:51:48 UTC (rev 90742)
@@ -0,0 +1,115 @@
+/*
+ * 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;
+
+// $Id: $
+
+import java.io.IOException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Constants;
+
+/**
+ * A BundleClassLoader delegates all classloading concerns to the underlying Bundle.
+ *
+ * @author Ales.Justin at jboss.org
+ * @author thomas.Diesler at jboss.org
+ * @since 03-Feb-2009
+ */
+public class BundleClassLoader extends ClassLoader
+{
+ private final Bundle bundle;
+
+ public static BundleClassLoader createClassLoader(final Bundle bundle)
+ {
+ if (bundle == null)
+ throw new IllegalArgumentException("Null bundle");
+
+ return AccessController.doPrivileged(new PrivilegedAction<BundleClassLoader>()
+ {
+ public BundleClassLoader run()
+ {
+ return new BundleClassLoader(bundle);
+ }
+ });
+ }
+
+ private BundleClassLoader(Bundle bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ protected Class<?> findClass(String name) throws ClassNotFoundException
+ {
+ return bundle.loadClass(name);
+ }
+
+ protected URL findResource(String name)
+ {
+ return bundle.getResource(name);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Enumeration<URL> findResources(String name) throws IOException
+ {
+ return bundle.getResources(name);
+ }
+
+ public URL getResource(String name)
+ {
+ return findResource(name);
+ }
+
+ public Class<?> loadClass(String name) throws ClassNotFoundException
+ {
+ return findClass(name);
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ return true;
+
+ if (obj instanceof BundleClassLoader == false)
+ return false;
+
+ final BundleClassLoader bundleClassLoader = (BundleClassLoader)obj;
+ return bundle.equals(bundleClassLoader.bundle);
+ }
+
+ public int hashCode()
+ {
+ return bundle.hashCode();
+ }
+
+ public String toString()
+ {
+ Dictionary<?, ?> headers = bundle.getHeaders();
+ String bundleId = bundle.getSymbolicName() + ":" + headers.get(Constants.BUNDLE_VERSION);
+ return "BundleClassLoader for [" + bundleId + "]";
+ }
+}
More information about the jboss-cvs-commits
mailing list