JBoss-OSGI SVN: r99805 - in projects/jboss-osgi: projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 10:29:53 -0500 (Fri, 22 Jan 2010)
New Revision: 99805
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Add OSGiModuleDeployer
Initialize NativeLibraries when policy is created
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -180,7 +180,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -199,10 +198,18 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiFragmentClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentClassLoadingDeployer">
+ <property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
+ <property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
+ </bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
+ <bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
<incallback method="addModule" state="Configured" />
@@ -214,9 +221,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-01-22 15:29:53 UTC (rev 99805)
@@ -23,11 +23,24 @@
// $Id$
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+import org.jboss.classloader.spi.NativeLibraryProvider;
import org.jboss.classloading.spi.dependency.Module;
import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
-import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.metadata.NativeLibrary;
+import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
/**
@@ -38,31 +51,118 @@
*/
public class OSGiClassLoaderPolicy extends VFSClassLoaderPolicy
{
- public OSGiClassLoaderPolicy(AbstractBundleState bundleState, VirtualFile[] roots)
+ public OSGiClassLoaderPolicy(AbstractBundleState absBundleState, VirtualFile[] roots)
{
super(roots);
- if (bundleState == null)
+ if (absBundleState == null)
throw new IllegalArgumentException("Null bundleState");
- if (bundleState instanceof AbstractDeployedBundleState)
+ if (absBundleState instanceof AbstractDeployedBundleState)
{
- AbstractDeployedBundleState depBundleState = (AbstractDeployedBundleState)bundleState;
+ AbstractDeployedBundleState depBundleState = (AbstractDeployedBundleState)absBundleState;
Module module = depBundleState.getDeploymentUnit().getAttachment(Module.class);
- if (module instanceof VFSDeploymentClassLoaderPolicyModule == false)
- throw new IllegalStateException("Not an instance of VFSDeploymentClassLoaderPolicyModule: " + module);
+ if (module instanceof OSGiModule == false)
+ throw new IllegalStateException("Not an instance of OSGiModule: " + module);
- VFSDeploymentClassLoaderPolicyModule vfsModule = (VFSDeploymentClassLoaderPolicyModule)module;
- String[] packageNames = vfsModule.getPackageNames();
+ OSGiModule osgiModule = (OSGiModule)module;
+ String[] packageNames = osgiModule.getPackageNames();
setExportedPackages(packageNames);
- setIncluded(vfsModule.getIncluded());
- setExcluded(vfsModule.getExcluded());
- setExcludedExport(vfsModule.getExcludedExport());
- setExportAll(vfsModule.getExportAll());
- setImportAll(vfsModule.isImportAll());
- setCacheable(vfsModule.isCacheable());
- setBlackListable(vfsModule.isBlackListable());
- setDelegates(vfsModule.getDelegates());
+ setIncluded(osgiModule.getIncluded());
+ setExcluded(osgiModule.getExcluded());
+ setExcludedExport(osgiModule.getExcludedExport());
+ setExportAll(osgiModule.getExportAll());
+ setImportAll(osgiModule.isImportAll());
+ setCacheable(osgiModule.isCacheable());
+ setBlackListable(osgiModule.isBlackListable());
+ setDelegates(osgiModule.getDelegates());
+
+ // NativeCode-Library handling
+ OSGiClassLoadingMetaData classLoadingMetaData = osgiModule.getClassLoadingMetaData();
+ NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
+ if (libMetaData != null && libMetaData.getNativeLibraries() != null)
+ {
+ OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
+
+ // Add the native library mappings to the OSGiClassLoaderPolicy
+ for (NativeLibrary library : libMetaData.getNativeLibraries())
+ {
+ String libpath = library.getLibraryPath();
+ String libfile = new File(libpath).getName();
+ String libname = libfile.substring(0, libfile.lastIndexOf('.'));
+
+ // Add the library provider to the policy
+ NativeLibraryProvider libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ addNativeLibrary(libProvider);
+
+ // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
+ if (libname.startsWith("lib"))
+ {
+ libname = libname.substring(3);
+ libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ addNativeLibrary(libProvider);
+ }
+ }
+ }
}
}
+
+ static class OSGiNativeLibraryProvider implements NativeLibraryProvider
+ {
+ private OSGiBundleState bundleState;
+ private String libpath;
+ private String libname;
+ private File libraryFile;
+
+ OSGiNativeLibraryProvider(OSGiBundleState bundleState, String libname, String libpath)
+ {
+ this.bundleState = bundleState;
+ this.libpath = libpath;
+ this.libname = libname;
+
+ // If a native code library in a selected native code clause cannot be found
+ // within the bundle then the bundle must fail to resolve
+ URL entryURL = bundleState.getEntry(libpath);
+ if (entryURL == null)
+ throw new IllegalStateException("Cannot find native library: " + libpath);
+ }
+
+ public String getLibraryName()
+ {
+ return libname;
+ }
+
+ public String getLibraryPath()
+ {
+ return libpath;
+ }
+
+ public File getLibraryLocation() throws IOException
+ {
+ if (libraryFile == null)
+ {
+ // Get the virtual file for entry for the library
+ VirtualFile fileSource = bundleState.getRoot().getChild(libpath);
+
+ // Create a unique local file location
+ libraryFile = getUniqueLibraryFile(bundleState, libpath);
+ libraryFile.deleteOnExit();
+
+ // Copy the native library to the bundle storage area
+ FileOutputStream fos = new FileOutputStream(libraryFile);
+ VFSUtils.copyStream(fileSource.openStream(), fos);
+ fos.close();
+ }
+ return libraryFile;
+ }
+
+ private File getUniqueLibraryFile(final OSGiBundleState bundleState, final String libpath)
+ {
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ String timestamp = new SimpleDateFormat("-yyyyMMdd-HHmmssSSS").format(new Date(bundleState.getLastModified()));
+ String uniquePath = new StringBuffer(libpath).insert(libpath.lastIndexOf("."), timestamp).toString();
+ BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
+ return plugin.getDataFile(bundleState, uniquePath);
+ }
+ }
}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-01-22 15:29:53 UTC (rev 99805)
@@ -0,0 +1,56 @@
+/*
+* 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.classloading;
+
+import org.jboss.classloading.spi.dependency.Module;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
+
+/**
+ * The {@link Module} that represents and OSGi bundle deployment.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision$
+ */
+public class OSGiModule extends VFSDeploymentClassLoaderPolicyModule
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 1L;
+
+ private OSGiClassLoadingMetaData metaData;
+
+ public OSGiModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
+ {
+ super(unit);
+
+ if (metaData instanceof OSGiClassLoadingMetaData == false)
+ throw new IllegalStateException("Not an instance of OSGiClassLoadingMetaData: " + metaData);
+
+ this.metaData = (OSGiClassLoadingMetaData)metaData;
+ }
+
+ public OSGiClassLoadingMetaData getClassLoadingMetaData()
+ {
+ return metaData;
+ }
+}
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java 2010-01-22 15:29:53 UTC (rev 99805)
@@ -0,0 +1,44 @@
+/*
+* 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.deployers;
+
+import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer;
+import org.jboss.osgi.framework.classloading.OSGiModule;
+
+/**
+ * The OSGiModuleDeployer creates the {@link OSGiModule}.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision$
+ */
+public class OSGiModuleDeployer extends VFSClassLoaderDescribeDeployer
+{
+ @Override
+ protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
+ {
+ return new OSGiModule(unit, metaData);
+ }
+}
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-22 15:29:53 UTC (rev 99805)
@@ -1,161 +0,0 @@
-/*
-* 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.deployers;
-
-// $Id: $
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.NativeLibraryProvider;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
-import org.jboss.osgi.framework.metadata.NativeLibrary;
-import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
-import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * A deployer that takes care of loading native code libraries.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Dec-2009
- */
-public class OSGiNativeCodePolicyDeployer extends AbstractRealDeployer
-{
- public OSGiNativeCodePolicyDeployer()
- {
- setInput(ClassLoaderFactory.class);
- addInput(ClassLoaderPolicy.class);
- addInput(OSGiBundleState.class);
- setStage(DeploymentStages.CLASSLOADER);
- setTopLevelOnly(true);
- }
-
- @Override
- protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- AbstractBundleState absBundleState = unit.getAttachment(AbstractBundleState.class);
- if (absBundleState == null)
- throw new IllegalStateException("No bundle state");
-
- OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)unit.getAttachment(ClassLoadingMetaData.class);
- NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
- if (libMetaData == null || libMetaData.getNativeLibraries() == null)
- return;
-
- // Add the native library mappings to the OSGiClassLoaderPolicy
- OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
- ClassLoaderPolicy policy = (ClassLoaderPolicy)unit.getAttachment(ClassLoaderPolicy.class);
- for (NativeLibrary library : libMetaData.getNativeLibraries())
- {
- String libpath = library.getLibraryPath();
- String libfile = new File(libpath).getName();
- String libname = libfile.substring(0, libfile.lastIndexOf('.'));
-
- // Add the library provider to the policy
- NativeLibraryProvider libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
- policy.addNativeLibrary(libProvider);
-
- // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
- if (libname.startsWith("lib"))
- {
- libname = libname.substring(3);
- libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
- policy.addNativeLibrary(libProvider);
- }
- }
- }
-
- static class OSGiNativeLibraryProvider implements NativeLibraryProvider
- {
- private OSGiBundleState bundleState;
- private String libpath;
- private String libname;
- private File libraryFile;
-
- OSGiNativeLibraryProvider(OSGiBundleState bundleState, String libname, String libpath)
- {
- this.bundleState = bundleState;
- this.libpath = libpath;
- this.libname = libname;
-
- // If a native code library in a selected native code clause cannot be found
- // within the bundle then the bundle must fail to resolve
- URL entryURL = bundleState.getEntry(libpath);
- if (entryURL == null)
- throw new IllegalStateException("Cannot find native library: " + libpath);
- }
-
- public String getLibraryName()
- {
- return libname;
- }
-
- public String getLibraryPath()
- {
- return libpath;
- }
-
- public File getLibraryLocation() throws IOException
- {
- if (libraryFile == null)
- {
- // Get the virtual file for entry for the library
- VirtualFile fileSource = bundleState.getRoot().getChild(libpath);
-
- // Create a unique local file location
- libraryFile = getUniqueLibraryFile(bundleState, libpath);
- libraryFile.deleteOnExit();
-
- // Copy the native library to the bundle storage area
- FileOutputStream fos = new FileOutputStream(libraryFile);
- VFSUtils.copyStream(fileSource.openStream(), fos);
- fos.close();
- }
- return libraryFile;
- }
-
- private File getUniqueLibraryFile(final OSGiBundleState bundleState, final String libpath)
- {
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- String timestamp = new SimpleDateFormat("-yyyyMMdd-HHmmssSSS").format(new Date(bundleState.getLastModified()));
- String uniquePath = new StringBuffer(libpath).insert(libpath.lastIndexOf("."), timestamp).toString();
- BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
- return plugin.getDataFile(bundleState, uniquePath);
- }
- }
-}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java 2010-01-22 15:29:53 UTC (rev 99805)
@@ -26,8 +26,8 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.testing.OSGiTest;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -41,32 +41,31 @@
*/
public class NativeCodeTestCase extends OSGiTest
{
- private Framework framework;
- private BundleContext context;
+ private static Framework framework;
- @Before
- public void setUp() throws Exception
+ @BeforeClass
+ public static void beforeClass() throws Exception
{
OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
framework = bootProvider.getFramework();
framework.start();
-
- context = framework.getBundleContext();
}
- @After
- public void tearDown() throws Exception
+ @AfterClass
+ public static void afterClass() throws Exception
{
if (framework != null)
{
framework.stop();
- framework.waitForStop(5000);
+ framework = null;
}
}
@Test
public void testNativeCode() throws Exception
{
+ BundleContext context = framework.getBundleContext();
+
Bundle bundleA = context.installBundle(getTestArchivePath("simple-nativecode.jar"));
assertBundleState(Bundle.INSTALLED, bundleA.getState());
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/bootstrap/jboss-osgi-bootstrap.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -153,7 +153,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -172,13 +171,17 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
<bean name="OSGiFragmentClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
+ <property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
@@ -191,9 +194,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -189,7 +189,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -199,15 +198,16 @@
********************************
-->
+ <bean name="OSGiClassLoaderSystem" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderSystem" />
<bean name="OSGiClassLoaderDomain" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderDomain" >
<constructor><parameter>OSGiClassLoaderDomain</parameter></constructor>
- <property name="classLoaderSystem"><inject bean="ClassLoaderSystem"/></property>
+ <property name="classLoaderSystem"><inject bean="OSGiClassLoaderSystem"/></property>
<property name="bundleManager"><inject bean="OSGiBundleManager" /></property>
</bean>
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
- <property name="system"><inject bean="ClassLoaderSystem"/></property>
+ <property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
@@ -215,6 +215,24 @@
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
+
+ <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
+ <incallback method="addModule" state="Configured" />
+ <uncallback method="removeModule" state="Configured" />
+ </bean>
+ <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
+ <property name="defaultMetaData">
+ <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true" />
+ </property>
+ </bean>
+ <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
+ <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ <property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
+ </bean>
</deployment>
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/runtime/server/conf/jboss-osgi-bootstrap.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -209,7 +209,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -228,7 +227,7 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
@@ -236,6 +235,9 @@
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
@@ -248,9 +250,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -192,7 +192,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -211,7 +210,7 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
@@ -219,6 +218,9 @@
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
@@ -231,9 +233,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:25 UTC (rev 99804)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-01-22 15:29:53 UTC (rev 99805)
@@ -81,7 +81,7 @@
<bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.framework.plugins.internal.FrameworkEventsPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
- <bean name="OSGiServiceManager" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
+ <bean name="OSGiServiceManagerPlugin" class="org.jboss.osgi.framework.bundle.ServiceManagerPluginImpl">
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
<bean name="OSGiStoragePlugin" class="org.jboss.osgi.framework.plugins.internal.BundleStoragePluginImpl">
@@ -179,7 +179,6 @@
<bean name="OSGiContextTrackerDeployer" class="org.jboss.osgi.framework.deployers.OSGiContextTrackerDeployer" />
<bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.framework.deployers.OSGiManifestParsingDeployer" />
<bean name="OSGiNativeCodeMetaDataDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodeMetaDataDeployer" />
- <bean name="OSGiNativeCodePolicyDeployer" class="org.jboss.osgi.framework.deployers.OSGiNativeCodePolicyDeployer" />
<!--
********************************
@@ -198,7 +197,7 @@
<bean name="OSGiClassLoaderFactory" class="org.jboss.osgi.framework.classloading.OSGiClassLoaderFactory" >
<property name="system"><inject bean="OSGiClassLoaderSystem"/></property>
</bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
+ <bean name="OSGiClassLoadingDeployer" class="org.jboss.osgi.framework.deployers.OSGiBundleClassLoadingDeployer">
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
@@ -206,6 +205,9 @@
<property name="domain"><inject bean="OSGiClassLoaderDomain"/></property>
<property name="factory"><inject bean="OSGiClassLoaderFactory"/></property>
</bean>
+ <bean name="OSGiModuleDeployer" class="org.jboss.osgi.framework.deployers.OSGiModuleDeployer">
+ <property name="classLoading"><inject bean="ClassLoading" /></property>
+ </bean>
<bean name="OSGiFragmentAttachmentDeployer" class="org.jboss.osgi.framework.deployers.OSGiFragmentAttachmentDeployer"/>
<bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
@@ -218,9 +220,6 @@
</property>
</bean>
<bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer" />
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading" /></property>
- </bean>
<bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
<property name="classLoading"><inject bean="ClassLoading" /></property>
<property name="system"><inject bean="OSGiClassLoaderSystem" /></property>
16 years, 4 months
JBoss-OSGI SVN: r99799 - projects/jboss-osgi/trunk/reactor/jbossmc-javadoc.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 05:49:36 -0500 (Fri, 22 Jan 2010)
New Revision: 99799
Modified:
projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
Log:
Use SNAPSHOTS for all subprojects
Modified: projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml 2010-01-22 10:34:31 UTC (rev 99798)
+++ projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml 2010-01-22 10:49:36 UTC (rev 99799)
@@ -32,8 +32,8 @@
<!-- Properties -->
<properties>
<version.jboss.classloading>2.2.0-SNAPSHOT</version.jboss.classloading>
- <version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
- <version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
+ <version.jboss.deployers>2.2.0-SNAPSHOT</version.jboss.deployers>
+ <version.jboss.kernel>2.2.0-SNAPSHOT</version.jboss.kernel>
</properties>
<!-- Dependencies -->
16 years, 4 months
JBoss-OSGI SVN: r99798 - in projects/jboss-osgi/trunk/reactor: jbossmc-javadoc and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 05:34:31 -0500 (Fri, 22 Jan 2010)
New Revision: 99798
Added:
projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/
Modified:
projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/scripts/assembly-javadoc-src.xml
projects/jboss-osgi/trunk/reactor/pom.xml
Log:
Add jbossmc-javadoc
Copied: projects/jboss-osgi/trunk/reactor/jbossmc-javadoc (from rev 99792, projects/jboss-osgi/trunk/distribution/javadoc)
Modified: projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/javadoc/pom.xml 2010-01-22 06:08:10 UTC (rev 99792)
+++ projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/pom.xml 2010-01-22 10:34:31 UTC (rev 99798)
@@ -14,20 +14,153 @@
<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 Distribution - Javadoc</name>
+ <name>JBossMC Javadoc</name>
- <groupId>org.jboss.osgi.distribution</groupId>
- <artifactId>jboss-osgi-javadoc</artifactId>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-microcontainer-javadoc</artifactId>
<packaging>jar</packaging>
+ <version>2.2.0-SNAPSHOT</version>
+
<!-- Parent -->
<parent>
- <groupId>org.jboss.osgi.distribution</groupId>
- <artifactId>jboss-osgi-distribution</artifactId>
- <version>1.0.0.Beta6</version>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-parent</artifactId>
+ <version>1.0.4</version>
</parent>
+
+ <!-- Properties -->
+ <properties>
+ <version.jboss.classloading>2.2.0-SNAPSHOT</version.jboss.classloading>
+ <version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
+ <version.jboss.kernel>2.2.0.Alpha2</version.jboss.kernel>
+ </properties>
-
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ <version>${version.jboss.classloading}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ <version>${version.jboss.classloading}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ <version>${version.jboss.classloading}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ <classifier>sources</classifier>
+ </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-kernel</artifactId>
+ <version>${version.jboss.kernel}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.kernel}</version>
+ <classifier>sources</classifier>
+ </dependency>
+ </dependencies>
+
<!-- Plugins -->
<build>
<plugins>
@@ -56,7 +189,7 @@
<configuration>
<quiet>true</quiet>
<sourcepath>target/javadoc-src</sourcepath>
- <excludePackageNames>*.internal:*.integration:org.jboss.osgi.blueprint:org.osgi.framework</excludePackageNames>
+ <excludePackageNames>*.internal:*.integration</excludePackageNames>
</configuration>
<executions>
<execution>
Modified: projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/scripts/assembly-javadoc-src.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/javadoc/scripts/assembly-javadoc-src.xml 2010-01-22 06:08:10 UTC (rev 99792)
+++ projects/jboss-osgi/trunk/reactor/jbossmc-javadoc/scripts/assembly-javadoc-src.xml 2010-01-22 10:34:31 UTC (rev 99798)
@@ -12,19 +12,17 @@
<outputDirectory>/</outputDirectory>
<useStrictFiltering>true</useStrictFiltering>
<includes>
- <include>*:jboss-osgi-apache-xerces:jar:sources</include>
- <include>*:jboss-osgi-blueprint:jar:sources</include>
- <include>*:jboss-osgi-common:jar:sources</include>
- <include>*:jboss-osgi-deployment:jar:sources</include>
- <include>*:jboss-osgi-hotdeploy:jar:sources</include>
- <include>*:jboss-osgi-husky:jar:sources</include>
- <include>*:jboss-osgi-jaxb:jar:sources</include>
- <include>*:jboss-osgi-jmx:jar:sources</include>
- <include>*:jboss-osgi-jndi:jar:sources</include>
- <include>*:jboss-osgi-jta:jar:sources</include>
- <include>*:jboss-osgi-spi:jar:sources</include>
- <include>*:jboss-osgi-webapp:jar:sources</include>
- <include>*:jboss-osgi-xml-binding:jar:sources</include>
+ <include>*:jboss-classloader:jar:sources</include>
+ <include>*:jboss-classloading:jar:sources</include>
+ <include>*:jboss-classloading-vfs:jar:sources</include>
+ <include>*:jboss-dependency:jar:sources</include>
+ <include>*:jboss-deployers-client-spi:jar:sources</include>
+ <include>*:jboss-deployers-core-spi:jar:sources</include>
+ <include>*:jboss-deployers-spi:jar:sources</include>
+ <include>*:jboss-deployers-structure-spi:jar:sources</include>
+ <include>*:jboss-deployers-vfs:jar:sources</include>
+ <include>*:jboss-deployers-vfs-spi:jar:sources</include>
+ <include>*:jboss-kernel:jar:sources</include>
</includes>
<unpack>true</unpack>
</dependencySet>
Modified: projects/jboss-osgi/trunk/reactor/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/pom.xml 2010-01-22 09:51:36 UTC (rev 99797)
+++ projects/jboss-osgi/trunk/reactor/pom.xml 2010-01-22 10:34:31 UTC (rev 99798)
@@ -59,6 +59,22 @@
</modules>
</profile>
+ <!--
+ Name: jbossmc-javadoc
+ Descr: Build the jbossmc javadocs
+ -->
+ <profile>
+ <id>jbossmc-javadoc</id>
+ <activation>
+ <property>
+ <name>distro</name>
+ </property>
+ </activation>
+ <modules>
+ <module>jbossmc-javadoc</module>
+ </modules>
+ </profile>
+
</profiles>
</project>
16 years, 4 months
JBoss-OSGI SVN: r99797 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 04:51:36 -0500 (Fri, 22 Jan 2010)
New Revision: 99797
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
Log:
Fix issue with getServices related to uninstalled bundles
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-22 08:32:34 UTC (rev 99796)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-01-22 09:51:36 UTC (rev 99797)
@@ -648,18 +648,6 @@
}
/**
- * Get the source of a class for ServiceReference.isAssignable()
- *
- * @param className the class name
- * @return the source or null if no source
- */
- public Object getSource(String className)
- {
- // [TODO] some more efficient way than using the class?
- return getBundleManager().loadClassFailsafe(this, className);
- }
-
- /**
* Change the state of the bundle
*
* @param state the new state
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-22 08:32:34 UTC (rev 99796)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/MDRUtils.java 2010-01-22 09:51:36 UTC (rev 99797)
@@ -162,11 +162,11 @@
*/
private static boolean isAssignableTo(AbstractBundleState bundleState, AbstractBundleState other, String className)
{
- Object source = bundleState.getSource(className);
+ Object source = getSource(bundleState, className);
if (source == null)
throw new IllegalStateException("Cannot load '" + className + "' from: " + bundleState);
- Object otherSource = other.getSource(className);
+ Object otherSource = getSource(other, className);
if (otherSource == null)
{
log.debug("Cannot load '" + className + "' from: " + other);
@@ -187,6 +187,22 @@
}
/**
+ * Get the source of a class for ServiceReference.isAssignable()
+ *
+ * @param className the class name
+ * @return the source or null if no source
+ */
+ private static Object getSource(AbstractBundleState bundleState, String className)
+ {
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ return null;
+
+ // [TODO] some more efficient way than using the class?
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ return bundleManager.loadClassFailsafe(bundleState, className);
+ }
+
+ /**
* Get classloader.
*
* @param instance the instance
16 years, 4 months
JBoss-OSGI SVN: r99794 - projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 02:27:45 -0500 (Fri, 22 Jan 2010)
New Revision: 99794
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
Log:
Remove dependency on capability bundle install order
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2010-01-22 07:21:15 UTC (rev 99793)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/src/main/java/org/jboss/osgi/testing/internal/OSGiRuntimeImpl.java 2010-01-22 07:27:45 UTC (rev 99794)
@@ -95,6 +95,7 @@
log.debug("Add capability: " + capability);
// Install the capability bundles
+ List<OSGiBundle> installed = new ArrayList<OSGiBundle>();
for (BundleInfo info : capability.getBundles())
{
String location = info.getLocation();
@@ -103,13 +104,18 @@
if (bundles.get(location) == null && getBundle(symName, version) == null)
{
OSGiBundle bundle = installBundle(location);
- bundle.start();
+ installed.add(bundle);
}
else
{
log.debug("Skip bundle: " + location);
}
}
+ // Start the capability bundles
+ for (OSGiBundle bundle : installed)
+ {
+ bundle.start();
+ }
capabilities.add(capability);
}
else
16 years, 4 months
JBoss-OSGI SVN: r99793 - projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-22 02:21:15 -0500 (Fri, 22 Jan 2010)
New Revision: 99793
Modified:
projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java
Log:
Fix dependecy on BP API
Modified: projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java 2010-01-22 06:08:10 UTC (rev 99792)
+++ projects/jboss-osgi/projects/bundles/blueprint/trunk/src/main/java/org/jboss/osgi/blueprint/BlueprintCapability.java 2010-01-22 07:21:15 UTC (rev 99793)
@@ -42,8 +42,8 @@
{
super(BlueprintService.class.getName());
- addBundle("bundles/jboss-osgi-blueprint.jar");
addBundle("bundles/org.apache.aries.util.jar");
addBundle("bundles/org.apache.aries.blueprint.jar");
+ addBundle("bundles/jboss-osgi-blueprint.jar");
}
}
\ No newline at end of file
16 years, 4 months
JBoss-OSGI SVN: r99785 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-21 16:56:03 -0500 (Thu, 21 Jan 2010)
New Revision: 99785
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
Log:
Add milliseconds to the generated libfile name
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:54:48 UTC (rev 99784)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:56:03 UTC (rev 99785)
@@ -152,10 +152,9 @@
private File getUniqueLibraryFile(final OSGiBundleState bundleState, final String libpath)
{
OSGiBundleManager bundleManager = bundleState.getBundleManager();
- BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
- Date lmdate = new Date(bundleState.getLastModified());
- String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmssSSS").format(lmdate);
+ String timestamp = new SimpleDateFormat("-yyyyMMdd-HHmmssSSS").format(new Date(bundleState.getLastModified()));
String uniquePath = new StringBuffer(libpath).insert(libpath.lastIndexOf("."), timestamp).toString();
+ BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
return plugin.getDataFile(bundleState, uniquePath);
}
}
16 years, 4 months
JBoss-OSGI SVN: r99784 - projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-21 16:54:48 -0500 (Thu, 21 Jan 2010)
New Revision: 99784
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
Log:
Add milliseconds to the generated libfile name
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:52:56 UTC (rev 99783)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:54:48 UTC (rev 99784)
@@ -154,7 +154,7 @@
OSGiBundleManager bundleManager = bundleState.getBundleManager();
BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
Date lmdate = new Date(bundleState.getLastModified());
- String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(lmdate);
+ String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmssSSS").format(lmdate);
String uniquePath = new StringBuffer(libpath).insert(libpath.lastIndexOf("."), timestamp).toString();
return plugin.getDataFile(bundleState, uniquePath);
}
16 years, 4 months
JBoss-OSGI SVN: r99783 - in projects: jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-21 16:52:56 -0500 (Thu, 21 Jan 2010)
New Revision: 99783
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java
Removed:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java
Modified:
projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
Log:
[JBCL-136] Add a notion of native library mapping
Move NativeLibraryMetaData to the OSGi layer
Modified: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/ClassLoadingMetaData.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -47,7 +47,7 @@
public class ClassLoadingMetaData extends NameAndVersionSupport
{
/** The serialVersionUID */
- private static final long serialVersionUID = 8525659521747922713L;
+ private static final long serialVersionUID = 8574522599537469347L;
/** The classloading domain */
private String domain;
@@ -100,9 +100,6 @@
/** The capabilities */
private CapabilitiesMetaData capabilities = new CapabilitiesMetaData();
- /** The native code libraries */
- private NativeLibraryMetaData libraries = new NativeLibraryMetaData();
-
/**
* Get the domain.
*
@@ -515,29 +512,6 @@
}
/**
- * Get the native libraries.
- *
- * @return the native libraries.
- */
- public NativeLibraryMetaData getNativeLibraries()
- {
- return libraries;
- }
-
- /**
- * Set the native libraries.
- *
- * @param nativeLibraries libraries the native libraries.
- * @throws IllegalArgumentException for null native libraries
- */
- public void setNativeLibraries(NativeLibraryMetaData nativeLibraries)
- {
- if (nativeLibraries == null)
- throw new IllegalArgumentException("Null libraries");
- this.libraries = nativeLibraries;
- }
-
- /**
* Set the requirements.
*
* @param requirements the requirements.
@@ -595,9 +569,6 @@
List<Requirement> requirements = getRequirements().getRequirements();
if (requirements != null)
builder.append(" requirements=").append(requirements);
- List<NativeLibrary> libraries = getNativeLibraries().getNativeLibraries();
- if (libraries != null)
- builder.append(" libraries=").append(libraries);
}
@Override
@@ -630,8 +601,6 @@
return false;
if (equals(this.getRequirements().getRequirements(), other.getRequirements().getRequirements()) == false)
return false;
- if (equals(this.getNativeLibraries().getNativeLibraries(), other.getNativeLibraries().getNativeLibraries()) == false)
- return false;
return true;
}
@@ -655,7 +624,6 @@
ClassLoadingMetaData clone = (ClassLoadingMetaData) super.clone();
requirements = clone.requirements.clone();
capabilities = clone.capabilities.clone();
- libraries = clone.libraries.clone();
return clone;
}
}
Deleted: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -1,141 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.classloading.spi.metadata;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.classloading.spi.version.VersionRange;
-
-/**
- * Meta data for native code libraries as defined by OSGi R4V42.
- *
- * 3.9 Loading Native Code Libraries
- * http://www.osgi.org/Download/File?url=/download/r4v42/r4.core.pdf
- *
- * @author thomas.diesler(a)jboss.com
- * @version $Revision$
- * @since 21-Jan-2010
- */
-public class NativeLibrary implements Serializable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 5059911178465658041L;
-
- private List<String> osNames = new ArrayList<String>();
- private String librarySource;
- private String libraryPath;
- private List<String> processors = new ArrayList<String>();
- private List<VersionRange> osVersions = new ArrayList<VersionRange>();
- private List<String> languages = new ArrayList<String>();
- private String selectionFilter;
- private boolean optional;
-
- /**
- * Create a NativeCode instance with mandatory properties.
- * @param osNames The set of OS names
- * @param libraryPath The library path
- * @param librarySource An interface from which to retrieve the actual library location
- */
- public NativeLibrary(List<String> osNames, String libraryPath, String librarySource)
- {
- if (libraryPath == null)
- throw new IllegalArgumentException("Null library path: " + libraryPath);
- if (osNames == null || osNames.isEmpty())
- throw new IllegalArgumentException("Illegal OS names: " + osNames);
- if (librarySource == null)
- throw new IllegalArgumentException("Null file privider: " + librarySource);
-
- this.osNames = osNames;
- this.libraryPath = libraryPath;
- this.librarySource = librarySource;
- }
-
- public String getLibrarySource()
- {
- return librarySource;
- }
-
- public String getLibraryPath()
- {
- return libraryPath;
- }
-
- public List<String> getOsNames()
- {
- return Collections.unmodifiableList(osNames);
- }
-
- public List<VersionRange> getOsVersions()
- {
- return Collections.unmodifiableList(osVersions);
- }
-
- public void setOsVersions(List<VersionRange> osVersions)
- {
- this.osVersions = osVersions;
- }
-
- public List<String> getProcessors()
- {
- return Collections.unmodifiableList(processors);
- }
-
- public void setProcessors(List<String> processors)
- {
- this.processors = processors;
- }
-
- public void setLanguages(List<String> languages)
- {
- this.languages = languages;
- }
-
- public List<String> getLanguages()
- {
- return Collections.unmodifiableList(languages);
- }
-
- public String getSelectionFilter()
- {
- return selectionFilter;
- }
-
- public void setSelectionFilter(String selectionFilter)
- {
- this.selectionFilter = selectionFilter;
- }
-
- public boolean isOptional()
- {
- return optional;
- }
-
- public void setOptional(boolean optional)
- {
- this.optional = optional;
- }
-}
Deleted: projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java
===================================================================
--- projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -1,100 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2008, 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.classloading.spi.metadata;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-
-/**
- * Meta data for native code libraries as defined by OSGi R4V42.
- *
- * 3.9 Loading Native Code Libraries
- * http://www.osgi.org/Download/File?url=/download/r4v42/r4.core.pdf
- *
- * @author thomas.diesler(a)jboss.com
- * @version $Revision$
- * @since 21-Jan-2010
- */
-// [TODO] @XmlType(name="nativeLibraries", propOrder={"nativeLibraries"})
-public class NativeLibraryMetaData implements Serializable, Cloneable
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 8341019167903636599L;
-
- /** The nativeLibraries */
- private List<NativeLibrary> nativeLibraries;
-
- public List<NativeLibrary> getNativeLibraries()
- {
- return nativeLibraries;
- }
-
- public void setNativeLibraries(List<NativeLibrary> nativeLibraries)
- {
- this.nativeLibraries = nativeLibraries;
- }
-
- public void addNativeLibrary(NativeLibrary nativeLibrary)
- {
- if (nativeLibrary == null)
- throw new IllegalArgumentException("Null library");
-
- if (nativeLibraries == null)
- nativeLibraries = new CopyOnWriteArrayList<NativeLibrary>();
-
- nativeLibraries.add(nativeLibrary);
- }
-
- public void removeNativeLibrary(NativeLibrary nativeLibrary)
- {
- if (nativeLibrary == null)
- throw new IllegalArgumentException("Null library");
-
- if (nativeLibraries == null)
- return;
-
- nativeLibraries.remove(nativeLibrary);
- }
-
- @Override
- public NativeLibraryMetaData clone()
- {
- try
- {
- NativeLibraryMetaData clone = (NativeLibraryMetaData) super.clone();
- if (nativeLibraries != null)
- {
- List<NativeLibrary> clonedNativeCodes = new CopyOnWriteArrayList<NativeLibrary>(nativeLibraries);
- clone.setNativeLibraries(clonedNativeCodes);
- }
- return clone;
- }
- catch (CloneNotSupportedException e)
- {
- throw new RuntimeException("Unexpected", e);
- }
- }
-}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -28,6 +28,7 @@
import java.util.List;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
import org.osgi.framework.Version;
/**
@@ -43,9 +44,13 @@
// The optional fragment host
private FragmentHostMetaData fragmentHost;
+
// The list of attached fragment classloading metadata
private List<OSGiClassLoadingMetaData> attachedFragments = new ArrayList<OSGiClassLoadingMetaData>();
+ // The native code libraries
+ private NativeLibraryMetaData libraries = new NativeLibraryMetaData();
+
public FragmentHostMetaData getFragmentHost()
{
return fragmentHost;
@@ -74,6 +79,29 @@
}
/**
+ * Get the native libraries.
+ *
+ * @return the native libraries.
+ */
+ public NativeLibraryMetaData getNativeLibraries()
+ {
+ return libraries;
+ }
+
+ /**
+ * Set the native libraries.
+ *
+ * @param nativeLibraries libraries the native libraries.
+ * @throws IllegalArgumentException for null native libraries
+ */
+ public void setNativeLibraries(NativeLibraryMetaData nativeLibraries)
+ {
+ if (nativeLibraries == null)
+ throw new IllegalArgumentException("Null libraries");
+ this.libraries = nativeLibraries;
+ }
+
+ /**
* Fragment-Host metadata.
*/
public static class FragmentHostMetaData
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -30,8 +30,6 @@
import java.util.Map;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.NativeLibrary;
-import org.jboss.classloading.spi.metadata.NativeLibraryMetaData;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
@@ -39,6 +37,9 @@
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
+import org.jboss.osgi.framework.metadata.NativeLibrary;
+import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.Parameter;
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
@@ -113,7 +114,7 @@
@Override
protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
{
- ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+ OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)unit.getAttachment(ClassLoadingMetaData.class);
if (classLoadingMetaData == null)
throw new IllegalStateException("No ClassLoadingMetaData");
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:35:15 UTC (rev 99782)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -33,8 +33,6 @@
import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.NativeLibraryProvider;
import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.NativeLibrary;
-import org.jboss.classloading.spi.metadata.NativeLibraryMetaData;
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer;
@@ -43,6 +41,9 @@
import org.jboss.osgi.framework.bundle.AbstractBundleState;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
+import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
+import org.jboss.osgi.framework.metadata.NativeLibrary;
+import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
@@ -71,7 +72,7 @@
if (absBundleState == null)
throw new IllegalStateException("No bundle state");
- ClassLoadingMetaData classLoadingMetaData = unit.getAttachment(ClassLoadingMetaData.class);
+ OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)unit.getAttachment(ClassLoadingMetaData.class);
NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
if (libMetaData == null || libMetaData.getNativeLibraries() == null)
return;
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java (from rev 99763, projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibrary.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -0,0 +1,141 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.framework.metadata;
+
+// $Id$
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.classloading.spi.version.VersionRange;
+
+/**
+ * Meta data for native code libraries as defined by OSGi R4V42.
+ *
+ * 3.9 Loading Native Code Libraries
+ * http://www.osgi.org/Download/File?url=/download/r4v42/r4.core.pdf
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @version $Revision$
+ * @since 21-Jan-2010
+ */
+public class NativeLibrary implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -1637806718398794304L;
+
+ private List<String> osNames = new ArrayList<String>();
+ private String librarySource;
+ private String libraryPath;
+ private List<String> processors = new ArrayList<String>();
+ private List<VersionRange> osVersions = new ArrayList<VersionRange>();
+ private List<String> languages = new ArrayList<String>();
+ private String selectionFilter;
+ private boolean optional;
+
+ /**
+ * Create a NativeCode instance with mandatory properties.
+ * @param osNames The set of OS names
+ * @param libraryPath The library path
+ * @param librarySource An interface from which to retrieve the actual library location
+ */
+ public NativeLibrary(List<String> osNames, String libraryPath, String librarySource)
+ {
+ if (libraryPath == null)
+ throw new IllegalArgumentException("Null library path: " + libraryPath);
+ if (osNames == null || osNames.isEmpty())
+ throw new IllegalArgumentException("Illegal OS names: " + osNames);
+ if (librarySource == null)
+ throw new IllegalArgumentException("Null file privider: " + librarySource);
+
+ this.osNames = osNames;
+ this.libraryPath = libraryPath;
+ this.librarySource = librarySource;
+ }
+
+ public String getLibrarySource()
+ {
+ return librarySource;
+ }
+
+ public String getLibraryPath()
+ {
+ return libraryPath;
+ }
+
+ public List<String> getOsNames()
+ {
+ return Collections.unmodifiableList(osNames);
+ }
+
+ public List<VersionRange> getOsVersions()
+ {
+ return Collections.unmodifiableList(osVersions);
+ }
+
+ public void setOsVersions(List<VersionRange> osVersions)
+ {
+ this.osVersions = osVersions;
+ }
+
+ public List<String> getProcessors()
+ {
+ return Collections.unmodifiableList(processors);
+ }
+
+ public void setProcessors(List<String> processors)
+ {
+ this.processors = processors;
+ }
+
+ public void setLanguages(List<String> languages)
+ {
+ this.languages = languages;
+ }
+
+ public List<String> getLanguages()
+ {
+ return Collections.unmodifiableList(languages);
+ }
+
+ public String getSelectionFilter()
+ {
+ return selectionFilter;
+ }
+
+ public void setSelectionFilter(String selectionFilter)
+ {
+ this.selectionFilter = selectionFilter;
+ }
+
+ public boolean isOptional()
+ {
+ return optional;
+ }
+
+ public void setOptional(boolean optional)
+ {
+ this.optional = optional;
+ }
+}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java (from rev 99763, projects/jboss-cl/trunk/classloading/src/main/java/org/jboss/classloading/spi/metadata/NativeLibraryMetaData.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java 2010-01-21 21:52:56 UTC (rev 99783)
@@ -0,0 +1,81 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2008, 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.framework.metadata;
+
+// $Id$
+
+import java.io.Serializable;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+
+
+/**
+ * Meta data for native code libraries as defined by OSGi R4V42.
+ *
+ * 3.9 Loading Native Code Libraries
+ * http://www.osgi.org/Download/File?url=/download/r4v42/r4.core.pdf
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @version $Revision$
+ * @since 21-Jan-2010
+ */
+public class NativeLibraryMetaData implements Serializable
+{
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 7650641261993316609L;
+
+ /** The nativeLibraries */
+ private List<NativeLibrary> nativeLibraries;
+
+ public List<NativeLibrary> getNativeLibraries()
+ {
+ return nativeLibraries;
+ }
+
+ public void setNativeLibraries(List<NativeLibrary> nativeLibraries)
+ {
+ this.nativeLibraries = nativeLibraries;
+ }
+
+ public void addNativeLibrary(NativeLibrary nativeLibrary)
+ {
+ if (nativeLibrary == null)
+ throw new IllegalArgumentException("Null library");
+
+ if (nativeLibraries == null)
+ nativeLibraries = new CopyOnWriteArrayList<NativeLibrary>();
+
+ nativeLibraries.add(nativeLibrary);
+ }
+
+ public void removeNativeLibrary(NativeLibrary nativeLibrary)
+ {
+ if (nativeLibrary == null)
+ throw new IllegalArgumentException("Null library");
+
+ if (nativeLibraries == null)
+ return;
+
+ nativeLibraries.remove(nativeLibrary);
+ }
+}
16 years, 4 months
JBoss-OSGI SVN: r99782 - in projects: jboss-osgi/projects/runtime/framework/trunk/scripts and 9 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-01-21 16:35:15 -0500 (Thu, 21 Jan 2010)
New Revision: 99782
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeActivatorA.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeClassLoader.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86-64/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86-64/libNative.so
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86/libNative.so
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/simple-nativecode.bnd
Modified:
projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java
projects/jboss-osgi/projects/runtime/framework/trunk/scripts/antrun-test-jars.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
Log:
[JBCL-136] Add a notion of native library mapping
Remove public getters
Add getLibraryName() to NativeLibraryProvider
Use the libname as key to the map
Add simple nativecode test case
Modified: projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java
===================================================================
--- projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java 2010-01-21 21:34:36 UTC (rev 99781)
+++ projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/ClassLoaderPolicy.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -50,6 +50,7 @@
* ClassLoader policy.
*
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author thomas.diesler(a)jboss.com
* @version $Revision: 1.1 $
*/
public abstract class ClassLoaderPolicy extends BaseClassLoaderPolicy implements ClassNotFoundHandler, ClassFoundHandler
@@ -70,58 +71,19 @@
private volatile Map<String, NativeLibraryProvider> libraryMap;
/**
- * Get the set of registered native library names.
- *
- * @return Null if there are no native libraries registered.
- */
- public Set<String> getNativeLibraryNames()
- {
- Map<String, NativeLibraryProvider> map = libraryMap;
-
- if (map == null)
- return Collections.emptySet();
-
- return Collections.unmodifiableSet(libraryMap.keySet());
- }
-
- /**
- * Get the native library provider for the given name.
- *
- * @param libname The library name
- * @return Null if there is no library with that name.
- */
- public NativeLibraryProvider getNativeLibrary(String libname)
- {
- Map<String, NativeLibraryProvider> map = libraryMap;
-
- return (map != null ? map.get(libname) : null);
- }
-
- /**
* Add a native library provider.
* @param libname The library name
* @param provider The library file provider
*/
- public void addNativeLibrary(String libname, NativeLibraryProvider provider)
+ public void addNativeLibrary(NativeLibraryProvider provider)
{
if (libraryMap == null)
libraryMap = new ConcurrentHashMap<String, NativeLibraryProvider>();
- libraryMap.put(libname, provider);
+ libraryMap.put(provider.getLibraryName(), provider);
}
/**
- * Remove the native library provider for the given name.
- *
- * @param libname The library name
- * @return Null if there is no library with that name.
- */
- public NativeLibraryProvider removeNativeLibrary(String libname)
- {
- return (libraryMap != null ? libraryMap.remove(libname) : null);
- }
-
- /**
* Returns the absolute path name of a native library.
*
* @param libname The library name
@@ -134,12 +96,7 @@
return null;
NativeLibraryProvider libProvider = map.get(libname);
-
- // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
if (libProvider == null)
- libProvider = map.get("lib" + libname);
-
- if (libProvider == null)
return null;
File libfile;
@@ -496,6 +453,44 @@
}
/**
+ * Get the set of registered native library names.
+ *
+ * @return Null if there are no native libraries registered.
+ */
+ Set<String> getNativeLibraryNames()
+ {
+ Map<String, NativeLibraryProvider> map = libraryMap;
+ if (map == null)
+ return Collections.emptySet();
+
+ return Collections.unmodifiableSet(map.keySet());
+ }
+
+ /**
+ * Get the native library provider for the given name.
+ *
+ * @param libname The library name
+ * @return Null if there is no library with that name.
+ */
+ NativeLibraryProvider getNativeLibrary(String libname)
+ {
+ Map<String, NativeLibraryProvider> map = libraryMap;
+ return (map != null ? map.get(libname) : null);
+ }
+
+ /**
+ * Remove the native library provider for the given name.
+ *
+ * @param libname The library name
+ * @return Null if there is no library with that name.
+ */
+ NativeLibraryProvider removeNativeLibrary(String libname)
+ {
+ Map<String, NativeLibraryProvider> map = libraryMap;
+ return (map != null ? map.remove(libname) : null);
+ }
+
+ /**
* Get the system classloader
*
* @return the classloader
Modified: projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java
===================================================================
--- projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java 2010-01-21 21:34:36 UTC (rev 99781)
+++ projects/jboss-cl/trunk/classloader/src/main/java/org/jboss/classloader/spi/NativeLibraryProvider.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -25,7 +25,7 @@
import java.io.IOException;
/**
- * NativeLibraryProvider.
+ * Provides the local file location for a native library.
*
* @author thomas.diesler(a)jboss.com
* @author <a href="adrian(a)jboss.com">Adrian Brock</a>
@@ -34,16 +34,29 @@
public interface NativeLibraryProvider
{
/**
- * Get the library path
+ * Get the library name.
*
+ * As it is used in the call to {@link System#loadLibrary(String)}
+ *
* @return the library path
*/
+ String getLibraryName();
+
+ /**
+ * Get the library path.
+ *
+ * Relative to the deployment root.
+ *
+ * @return the library path
+ */
String getLibraryPath();
/**
- * Get the local library file location. This may be proved lazily.
+ * Get the local library file location.
*
- * @return the file
+ * This may be proved lazily.
+ *
+ * @return The native library file
* @throws IOException for any error
*/
File getLibraryLocation() throws IOException;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/scripts/antrun-test-jars.xml 2010-01-21 21:34:36 UTC (rev 99781)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/scripts/antrun-test-jars.xml 2010-01-21 21:35:15 UTC (rev 99782)
@@ -62,6 +62,9 @@
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/fragments-simple-fragB.jar" files="${tests.resources.dir}/fragments/simple-fragB.bnd" />
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/fragments-simple-fragC.jar" files="${tests.resources.dir}/fragments/simple-fragC.bnd" />
+ <!-- nativecode -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-nativecode.jar" files="${tests.resources.dir}/nativecode/simple-nativecode.bnd" />
+
<!-- simple -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-bundle.jar" files="${tests.resources.dir}/integration/simple/simple.bnd" />
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-logservice-bundle.jar" files="${tests.resources.dir}/integration/simple/simple-logservice.bnd" />
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:34:36 UTC (rev 99781)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodePolicyDeployer.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -27,6 +27,8 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.net.URL;
+import java.text.SimpleDateFormat;
+import java.util.Date;
import org.jboss.classloader.spi.ClassLoaderPolicy;
import org.jboss.classloader.spi.NativeLibraryProvider;
@@ -73,52 +75,87 @@
NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
if (libMetaData == null || libMetaData.getNativeLibraries() == null)
return;
-
- final OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
- final OSGiBundleManager bundleManager = bundleState.getBundleManager();
// Add the native library mappings to the OSGiClassLoaderPolicy
- ClassLoaderPolicy policy = unit.getAttachment(ClassLoaderPolicy.class);
+ OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
+ ClassLoaderPolicy policy = (ClassLoaderPolicy)unit.getAttachment(ClassLoaderPolicy.class);
for (NativeLibrary library : libMetaData.getNativeLibraries())
{
- final String libpath = library.getLibraryPath();
+ String libpath = library.getLibraryPath();
+ String libfile = new File(libpath).getName();
+ String libname = libfile.substring(0, libfile.lastIndexOf('.'));
+
+ // Add the library provider to the policy
+ NativeLibraryProvider libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ policy.addNativeLibrary(libProvider);
+
+ // [TODO] why does the TCK use 'Native' to mean 'libNative' ?
+ if (libname.startsWith("lib"))
+ {
+ libname = libname.substring(3);
+ libProvider = new OSGiNativeLibraryProvider(bundleState, libname, libpath);
+ policy.addNativeLibrary(libProvider);
+ }
+ }
+ }
+
+ static class OSGiNativeLibraryProvider implements NativeLibraryProvider
+ {
+ private OSGiBundleState bundleState;
+ private String libpath;
+ private String libname;
+ private File libraryFile;
+
+ OSGiNativeLibraryProvider(OSGiBundleState bundleState, String libname, String libpath)
+ {
+ this.bundleState = bundleState;
+ this.libpath = libpath;
+ this.libname = libname;
+
+ // If a native code library in a selected native code clause cannot be found
+ // within the bundle then the bundle must fail to resolve
+ URL entryURL = bundleState.getEntry(libpath);
+ if (entryURL == null)
+ throw new IllegalStateException("Cannot find native library: " + libpath);
+ }
+
+ public String getLibraryName()
+ {
+ return libname;
+ }
- NativeLibraryProvider provider = new NativeLibraryProvider()
+ public String getLibraryPath()
+ {
+ return libpath;
+ }
+
+ public File getLibraryLocation() throws IOException
+ {
+ if (libraryFile == null)
{
- private File libraryFile;
+ // Get the virtual file for entry for the library
+ VirtualFile fileSource = bundleState.getRoot().getChild(libpath);
- public String getLibraryPath()
- {
- return libpath;
- }
+ // Create a unique local file location
+ libraryFile = getUniqueLibraryFile(bundleState, libpath);
+ libraryFile.deleteOnExit();
- public File getLibraryLocation() throws IOException
- {
- if (libraryFile == null)
- {
- URL entryURL = bundleState.getEntry(libpath);
+ // Copy the native library to the bundle storage area
+ FileOutputStream fos = new FileOutputStream(libraryFile);
+ VFSUtils.copyStream(fileSource.openStream(), fos);
+ fos.close();
+ }
+ return libraryFile;
+ }
- // If a native code library in a selected native code clause cannot be found
- // within the bundle then the bundle must fail to resolve
- if (entryURL == null)
- throw new IOException("Cannot find native library: " + libpath);
-
- // Copy the native library to the bundle storage area
- VirtualFile nativeVirtualFile = bundleState.getRoot().getChild(libpath);
- BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
- libraryFile = plugin.getDataFile(bundleState, libpath);
- FileOutputStream fos = new FileOutputStream(libraryFile);
- VFSUtils.copyStream(nativeVirtualFile.openStream(), fos);
- fos.close();
- }
- return libraryFile;
- }
- };
-
- // Add the library provider to the policy
- String libfile = new File(libpath).getName();
- String libname = libfile.substring(0, libfile.lastIndexOf('.'));
- policy.addNativeLibrary(libname, provider);
+ private File getUniqueLibraryFile(final OSGiBundleState bundleState, final String libpath)
+ {
+ OSGiBundleManager bundleManager = bundleState.getBundleManager();
+ BundleStoragePlugin plugin = bundleManager.getPlugin(BundleStoragePlugin.class);
+ Date lmdate = new Date(bundleState.getLastModified());
+ String timestamp = new SimpleDateFormat("yyyyMMdd-HHmmss").format(lmdate);
+ String uniquePath = new StringBuffer(libpath).insert(libpath.lastIndexOf("."), timestamp).toString();
+ return plugin.getDataFile(bundleState, uniquePath);
}
}
}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/NativeCodeTestCase.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1,79 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.nativecode;
+
+//$Id: FragmentTestCase.java 99648 2010-01-20 09:27:43Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.testing.OSGiTest;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * Test NativeCode-Library functionality
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 21-Jan-2010
+ */
+public class NativeCodeTestCase extends OSGiTest
+{
+ private Framework framework;
+ private BundleContext context;
+
+ @Before
+ public void setUp() throws Exception
+ {
+ OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+ framework = bootProvider.getFramework();
+ framework.start();
+
+ context = framework.getBundleContext();
+ }
+
+ @After
+ public void tearDown() throws Exception
+ {
+ if (framework != null)
+ {
+ framework.stop();
+ framework.waitForStop(5000);
+ }
+ }
+
+ @Test
+ public void testNativeCode() throws Exception
+ {
+ Bundle bundleA = context.installBundle(getTestArchivePath("simple-nativecode.jar"));
+ assertBundleState(Bundle.INSTALLED, bundleA.getState());
+
+ bundleA.start();
+ assertBundleState(Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ assertBundleState(Bundle.UNINSTALLED, bundleA.getState());
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeActivatorA.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeActivatorA.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeActivatorA.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.nativecode.bundleA;
+
+//$Id: HostAActivator.java 99304 2010-01-12 17:29:06Z thomas.diesler(a)jboss.com $
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+public class NativeCodeActivatorA implements BundleActivator
+{
+ public void start(BundleContext context) throws BundleException
+ {
+ Bundle bundle = context.getBundle();
+ try
+ {
+ System.loadLibrary("Native");
+ throw new IllegalStateException("UnsatisfiedLinkError expected");
+ }
+ catch (UnsatisfiedLinkError ex)
+ {
+ String exmsg = ex.getMessage();
+ long bundleid = bundle.getBundleId();
+ String substr = "osgi-store/bundle-" + bundleid + "/linux_x86";
+ if (exmsg.indexOf(substr) < 0)
+ throw new UnsatisfiedLinkError("Cannot find '" + substr + "' in '" + exmsg + "'");
+ }
+ }
+
+ public void stop(BundleContext context)
+ {
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeClassLoader.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/nativecode/bundleA/NativeCodeClassLoader.java 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1,39 @@
+/*
+ * 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.test.osgi.nativecode.bundleA;
+
+// $Id: $
+
+public class NativeCodeClassLoader extends ClassLoader
+{
+ public NativeCodeClassLoader(ClassLoader parent)
+ {
+ super(parent);
+ }
+
+ @Override
+ public String findLibrary(String libname)
+ {
+ String libPath = super.findLibrary(libname);
+ return libPath;
+ }
+}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86/libNative.so
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86/libNative.so (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86/libNative.so 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1 @@
+This is not really a native code library. We dont test linking. Instead we test that the file was extracted correctly.
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86-64/libNative.so
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86-64/libNative.so (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/libs/linux_x86-64/libNative.so 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1 @@
+This is not really a native code library. We dont test linking. Instead we test that the file was extracted correctly.
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/simple-nativecode.bnd
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/simple-nativecode.bnd (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/resources/nativecode/simple-nativecode.bnd 2010-01-21 21:35:15 UTC (rev 99782)
@@ -0,0 +1,12 @@
+Bundle-Version: 2.0
+Bundle-Activator: org.jboss.test.osgi.nativecode.bundleA.NativeCodeActivatorA
+Private-Package: org.jboss.test.osgi.nativecode.bundleA
+Bundle-NativeCode: \
+ linux_x86/libNative.so; osname=Linux; processor=x86, \
+ linux_x86-64/libNative.so; osname=Linux; processor=x86-64
+Include-Resource: libs
+
+-removeheaders: Include-Resource
+
+
+
16 years, 4 months