JBoss-OSGI SVN: r101776 - in projects/jboss-osgi/projects/runtime/framework/trunk: vfs21/src/main/java/org/jboss/osgi/framework/classloading and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 09:59:36 -0500 (Wed, 03 Mar 2010)
New Revision: 101776
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/AbstractDeployment.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor21.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
Log:
Add Deployment abstraction
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/AbstractDeployment.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/AbstractDeployment.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/AbstractDeployment.java 2010-03-03 14:59:36 UTC (rev 101776)
@@ -0,0 +1,69 @@
+/*
+* 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: AbstractOSGiClassLoadingDeployer.java 101391 2010-02-24 12:58:50Z thomas.diesler(a)jboss.com $
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.vfs.VirtualFile;
+
+/**
+ * The AbstractDeployment delegates to the jboss-vfs specific {@link DeploymentAdaptor}.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 03-Mar-2010
+ */
+public abstract class AbstractDeployment
+{
+ private static DeploymentAdaptor adaptor;
+
+ public static Deployment createDeployment(VirtualFile root)
+ {
+ return getDeploymentAdaptor().createDeployment(root);
+ }
+
+ public static VirtualFile getRoot(DeploymentUnit unit)
+ {
+ return getDeploymentAdaptor().getRoot(unit);
+ }
+
+ @SuppressWarnings("unchecked")
+ private static DeploymentAdaptor getDeploymentAdaptor()
+ {
+ if (adaptor == null)
+ {
+ try
+ {
+ String classname = "org.jboss.osgi.framework.deployers.DeploymentAdaptor21";
+ ClassLoader classLoader = AbstractDeployment.class.getClassLoader();
+ Class<DeploymentAdaptor> clazz = (Class<DeploymentAdaptor>)classLoader.loadClass(classname);
+ adaptor = clazz.newInstance();
+ }
+ catch (Exception e)
+ {
+ throw new IllegalStateException("Cannot load DeploymentAdaptor");
+ }
+ }
+ return adaptor;
+ }
+}
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor.java 2010-03-03 14:59:36 UTC (rev 101776)
@@ -0,0 +1,41 @@
+/*
+* 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: AbstractOSGiClassLoadingDeployer.java 101391 2010-02-24 12:58:50Z thomas.diesler(a)jboss.com $
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.osgi.vfs.VirtualFile;
+
+/**
+ * An abstraction of the VFSDeploymentFactory.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 03-Mar-2010
+ */
+public interface DeploymentAdaptor
+{
+ Deployment createDeployment(VirtualFile root);
+
+ VirtualFile getRoot(DeploymentUnit unit);
+}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 14:45:40 UTC (rev 101775)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 14:59:36 UTC (rev 101776)
@@ -45,6 +45,7 @@
import org.jboss.osgi.framework.metadata.NativeLibrary;
import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
@@ -251,7 +252,8 @@
if (libraryFile == null)
{
// Get the virtual file for entry for the library
- VirtualFile fileSource = bundleState.getRoot().getChild(libpath);
+ VirtualFile root = (VirtualFile)AbstractVFS.adapt(bundleState.getRoot());
+ VirtualFile fileSource = root.getChild(libpath);
// Create a unique local file location
libraryFile = getUniqueLibraryFile(bundleState, libpath);
Added: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor21.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/DeploymentAdaptor21.java 2010-03-03 14:59:36 UTC (rev 101776)
@@ -0,0 +1,52 @@
+/*
+* 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: AbstractOSGiClassLoadingDeployer.java 101391 2010-02-24 12:58:50Z thomas.diesler(a)jboss.com $
+
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VirtualFile;
+
+/**
+ * An abstraction of the VFSDeploymentFactory for jboss-vfs-2.1.x
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 03-Mar-2010
+ */
+public class DeploymentAdaptor21 implements DeploymentAdaptor
+{
+ public Deployment createDeployment(VirtualFile root)
+ {
+ VFSDeploymentFactory factory = VFSDeploymentFactory.getInstance();
+ return factory.createVFSDeployment((org.jboss.virtual.VirtualFile)AbstractVFS.adapt(root));
+ }
+
+ public VirtualFile getRoot(DeploymentUnit unit)
+ {
+ VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
+ return AbstractVFS.adapt(vfsUnit.getRoot());
+ }
+}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 14:59:36 UTC (rev 101776)
@@ -34,6 +34,8 @@
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.bundle.OSGiFragmentState;
import org.jboss.osgi.framework.classloading.OSGiClassLoaderPolicy;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
/**
@@ -94,7 +96,7 @@
OSGiBundleState hostState = fragState.getFragmentHost();
DeploymentUnit hostUnit = hostState.getDeploymentUnit();
OSGiClassLoaderPolicy hostPolicy = (OSGiClassLoaderPolicy)hostUnit.getAttachment(ClassLoaderPolicy.class);
- hostPolicy.attachFragment(fragState.getRoot());
+ hostPolicy.attachFragment((VirtualFile)AbstractVFS.adapt(fragState.getRoot()));
}
}
}
14 years, 4 months
JBoss-OSGI SVN: r101775 - in projects/jboss-osgi/projects/runtime/framework/trunk: core and 17 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 09:45:40 -0500 (Wed, 03 Mar 2010)
New Revision: 101775
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/core/scripts/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/etc/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/main/
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/scripts/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/etc/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/bundle/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoading.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiCoreClassFilter.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateResolveDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiContextTrackerDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/launch/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/metadata/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/packageadmin/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/plugins/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/resolver/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/service/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/util/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/vfs/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/resources/
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/test/
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/core/.project
projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/.classpath
Log:
Remove all dependencies on jboss-vfs from framework-core
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 14:45:40 UTC (rev 101775)
@@ -2,8 +2,6 @@
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/.project
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.project 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.project 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>jboss-osgi-framework</name>
+ <name>jboss-osgi-framework-core</name>
<comment></comment>
<projects>
</projects>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -18,7 +18,7 @@
<name>JBossOSGi Framework - Core</name>
<groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
+ <artifactId>jboss-osgi-framework-core</artifactId>
<packaging>bundle</packaging>
<parent>
@@ -48,6 +48,12 @@
<dependency>
<groupId>org.jboss.cl</groupId>
<artifactId>jboss-classloading-vfs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
@@ -68,6 +74,12 @@
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-impl</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
@@ -76,10 +88,22 @@
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-vfs-spi</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-vfs</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>org.jboss.deployers</groupId>
@@ -132,199 +156,11 @@
<artifactId>org.osgi.compendium</artifactId>
</dependency>
- <!-- Test bundles dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-apache-xerces</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jmx</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jndi</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-reflect</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.web</groupId>
- <artifactId>pax-web-jetty-bundle</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testing</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.vfs</groupId>
- <artifactId>jboss-osgi-vfs21</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>scripts/assembly-all.xml</descriptor>
- </descriptors>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
@@ -344,33 +180,6 @@
</instructions>
</configuration>
</plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Xmx512m</argLine>
- <systemProperties>
- <property>
- <name>log4j.output.dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
- <value>bootstrap/jboss-osgi-bootstrap.xml</value>
- </property>
- <property>
- <name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
- </property>
- <property>
- <name>test.archive.directory</name>
- <value>${project.build.directory}/test-libs</value>
- </property>
- </systemProperties>
- <excludes>
- <!-- excludes listed here need to have a jira issue associated <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude> -->
- </excludes>
- </configuration>
- </plugin>
</plugins>
</build>
</project>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -34,9 +34,9 @@
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.framework.deployers.AbstractDeployment;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
@@ -83,7 +83,7 @@
// The framework is expected to preserve the location passed into installBundle(String)
Deployment dep = unit.getAttachment(Deployment.class);
location = (dep != null ? dep.getLocation() : unit.getName());
- rootFile = (dep != null ? dep.getRoot() : AbstractVFS.adapt(((VFSDeploymentUnit)unit).getRoot()));
+ rootFile = (dep != null ? dep.getRoot() : AbstractDeployment.getRoot(unit));
bundleId = bundleIDGenerator.incrementAndGet();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -55,12 +55,11 @@
import org.jboss.deployers.spi.deployer.DeploymentStages;
import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.kernel.Kernel;
import org.jboss.logging.Logger;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.framework.deployers.AbstractDeployment;
import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
@@ -532,8 +531,7 @@
// Create the deployment and deploy it
try
{
- org.jboss.virtual.VirtualFile root = (org.jboss.virtual.VirtualFile)AbstractVFS.adapt(dep.getRoot());
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+ org.jboss.deployers.client.spi.Deployment deployment = AbstractDeployment.createDeployment(dep.getRoot());
MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
att.addAttachment(Deployment.class, dep);
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleClassLoader.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,47 +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.classloading;
-
-// $Id: OSGiClassLoaderFactory.java 95177 2009-10-20 15:14:31Z thomas.diesler(a)jboss.com $
-
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.base.BaseClassLoader;
-
-/**
- * An OSGi bundle class loader.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Dec-2009
- */
-public class OSGiBundleClassLoader extends BaseClassLoader
-{
- @SuppressWarnings("unused")
- private OSGiClassLoaderPolicy osgiPolicy;
-
- public OSGiBundleClassLoader(ClassLoaderPolicy policy)
- {
- super(policy);
-
- if (policy instanceof OSGiClassLoaderPolicy)
- osgiPolicy = (OSGiClassLoaderPolicy)policy;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderDomain.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,130 +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.classloading;
-
-// $Id: $
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.classloader.plugins.filter.CombiningClassFilter;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloader.spi.ParentPolicy;
-import org.jboss.classloader.spi.base.BaseClassLoader;
-import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloader.spi.filter.ClassFilterUtils;
-import org.jboss.classloader.spi.filter.PackageClassFilter;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
-import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * OSGiClassLoaderDomain.<p>
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 03-Sep-2009
- */
-public class OSGiClassLoaderDomain extends ClassLoaderDomain
-{
- private ClassLoaderSystem classLoaderSystem;
- private OSGiBundleManager bundleManager;
- private List<URL> classPath = new ArrayList<URL>();
-
- /**
- * Create a new OSGiClassLoaderDomain.
- * @param domainName the domain name
- * @throws IllegalArgumentException for a null bundle manager
- */
- public OSGiClassLoaderDomain(String domainName)
- {
- super(domainName);
- }
-
- public void setClassLoaderSystem(ClassLoaderSystem classLoaderSystem)
- {
- this.classLoaderSystem = classLoaderSystem;
- }
-
- public void setBundleManager(OSGiBundleManager bundleManager)
- {
- this.bundleManager = bundleManager;
- }
-
- public void setClassPath(List<URL> classPath)
- {
- this.classPath = classPath;
- }
-
- @Override
- protected Class<?> loadClass(BaseClassLoader classLoader, String name, boolean allExports) throws ClassNotFoundException
- {
- return super.loadClass(classLoader, name, allExports);
- }
-
- public void start() throws IOException
- {
- if (classLoaderSystem == null)
- throw new IllegalArgumentException("Null classLoaderSystem");
- if (bundleManager == null)
- throw new IllegalArgumentException("Null bundleManager");
- if (classPath == null)
- throw new IllegalArgumentException("Null classPath");
-
- // Register the domain with the ClassLoaderSystem
- classLoaderSystem.registerDomain(this);
-
- // Initialize the configured system packages
- ClassFilter systemFilter = PackageClassFilter.createPackageClassFilterFromString(getSystemPackagesAsString());
- ClassFilter javaFilter = RecursivePackageClassFilter.createRecursivePackageClassFilter("java");
- ClassFilter filter = CombiningClassFilter.create(javaFilter, OSGiCoreClassFilter.INSTANCE, systemFilter);
-
- // Setup the domain's parent policy
- setParentPolicy(new ParentPolicy(filter, ClassFilterUtils.NOTHING));
-
- // Initialize the configured policy roots
- VirtualFile[] roots = new VirtualFile[classPath.size()];
- for (int i = 0; i < classPath.size(); i++)
- roots[i] = VFS.createNewRoot(classPath.get(i));
-
- // Create and register the ClassLoaderPolicy
- ClassLoaderPolicy systemPolicy = new VFSClassLoaderPolicy("OSGiSystemPolicy", roots);
- classLoaderSystem.registerClassLoaderPolicy(getName(), systemPolicy);
- }
-
- private String getSystemPackagesAsString()
- {
- SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
- List<String> sysPackages = syspackPlugin.getSystemPackages(false);
- StringBuffer sysPackageString = new StringBuffer();
- for (String name : sysPackages)
- sysPackageString.append(name + ",");
-
- return sysPackageString.toString();
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderFactory.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,108 +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.classloading;
-
-// $Id$
-
-import java.util.List;
-
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.ClassLoaderPolicyFactory;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.plugins.classloader.VFSDeploymentClassLoaderPolicyModule;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * OSGiClassLoaderFactory
- *
- * Creates the OSGiClassLoader
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 11-Sep-2209
- */
-public class OSGiClassLoaderFactory implements ClassLoaderFactory
-{
- /** The classloader system */
- private ClassLoaderSystem system;
-
- public void setSystem(ClassLoaderSystem system)
- {
- this.system = system;
- }
-
- public ClassLoader createClassLoader(final DeploymentUnit unit) throws Exception
- {
- if (unit instanceof VFSDeploymentUnit == false)
- throw new IllegalStateException("Not an instance of VFSDeploymentUnit: " + unit);
-
- Module module = unit.getAttachment(Module.class);
- if (module instanceof VFSDeploymentClassLoaderPolicyModule == false)
- throw new IllegalStateException("Not an instance of VFSDeploymentClassLoaderPolicyModule: " + module);
-
- VFSDeploymentClassLoaderPolicyModule vfsModule = (VFSDeploymentClassLoaderPolicyModule)module;
- vfsModule.setPolicyFactory(new ClassLoaderPolicyFactory()
- {
- public ClassLoaderPolicy createClassLoaderPolicy()
- {
- VFSDeploymentUnit vfsUnit = (VFSDeploymentUnit)unit;
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- VirtualFile[] roots = getClassLoaderPolicyRoots(bundleState, vfsUnit);
- ClassLoaderPolicy policy = new OSGiClassLoaderPolicy(bundleState, roots);
- unit.addAttachment(ClassLoaderPolicy.class, policy);
- return policy;
- }
-
- private VirtualFile[] getClassLoaderPolicyRoots(AbstractBundleState bundleState, VFSDeploymentUnit vfsUnit)
- {
- // The classpath is initialised by the bundle structure deployer
- List<VirtualFile> classPaths = vfsUnit.getClassPath();
- VirtualFile[] policyRoots = new VirtualFile[classPaths.size()];
- classPaths.toArray(policyRoots);
- return policyRoots;
- }
- });
- return vfsModule.registerClassLoaderPolicy(system);
- }
-
- public void removeClassLoader(DeploymentUnit unit) throws Exception
- {
- Module module = unit.getAttachment(Module.class);
- if (module == null)
- return;
-
- ClassLoader classLoader = unit.getClassLoader();
- try
- {
- // Remove the classloader
- system.unregisterClassLoader(classLoader);
- }
- finally
- {
- module.reset();
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,278 +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.classloading;
-
-// $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 java.util.List;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.classloader.spi.NativeLibraryProvider;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.vfs.policy.VFSClassLoaderPolicy;
-import org.jboss.classloading.spi.vfs.policy.VirtualFileInfo;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-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.osgi.vfs.AbstractVFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * The ClassLoaderPolicy for OSGi bundles.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 11-Sep-2009
- */
-public class OSGiClassLoaderPolicy extends VFSClassLoaderPolicy
-{
- /** The associated bundle state */
- private AbstractBundleState bundleState;
- /** The fragment roots */
- private List<VirtualFile> fragments;
-
- public OSGiClassLoaderPolicy(AbstractBundleState bundleState, VirtualFile[] roots)
- {
- super(roots);
-
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundleState");
- this.bundleState = bundleState;
-
- if (bundleState instanceof AbstractDeployedBundleState)
- {
- AbstractDeployedBundleState depBundleState = (AbstractDeployedBundleState)bundleState;
- DeploymentUnit unit = depBundleState.getDeploymentUnit();
- Module module = unit.getAttachment(Module.class);
- if (module instanceof OSGiModule == false)
- throw new IllegalStateException("Not an instance of OSGiModule: " + module);
-
- OSGiModule osgiModule = (OSGiModule)module;
- String[] packageNames = osgiModule.getPackageNames();
- setExportedPackages(packageNames);
- setIncluded(osgiModule.getIncluded());
- setExcluded(osgiModule.getExcluded());
- setExcludedExport(osgiModule.getExcludedExport());
- setExportAll(osgiModule.getExportAll());
- setImportAll(osgiModule.isImportAll());
- setCacheable(osgiModule.isCacheable());
- setBlackListable(osgiModule.isBlackListable());
- setDelegates(osgiModule.getDelegates());
-
- // Bundle-NativeCode handling
- processNativeLibraryMetaData(depBundleState);
- }
- }
-
-
- @Override
- public String getName()
- {
- return bundleState.getCanonicalName();
- }
-
- /**
- * Processes the NativeLibraryMetaData that is part of the OSGiClassLoadingMetaData
- * and adds the NativeLibraryProviders to the ClassLoaderPolicy
- */
- private void processNativeLibraryMetaData(AbstractBundleState absBundleState)
- {
- if (absBundleState instanceof OSGiBundleState == false)
- return;
-
- OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- ClassLoadingMetaData clMetaData = unit.getAttachment(ClassLoadingMetaData.class);
- if (clMetaData instanceof OSGiClassLoadingMetaData == false)
- return;
-
- OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)clMetaData;
- NativeLibraryMetaData libMetaData = classLoadingMetaData.getNativeLibraries();
- if (libMetaData == null || libMetaData.getNativeLibraries() == null)
- return;
-
- // 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);
- }
- }
- }
-
- /**
- * Attach a new fragment root to the policy.
- * @param fragRoot The fragment root file
- */
- public void attachFragment(VirtualFile fragRoot)
- {
- if (fragRoot == null)
- throw new IllegalArgumentException("Null fragment file");
-
- if (fragments == null)
- fragments = new CopyOnWriteArrayList<VirtualFile>();
-
- fragments.add(fragRoot);
- }
-
- /**
- * Detach a fragment root from the policy.
- * @param fragRoot The fragment root file
- * @return true if the fragment could be detached
- */
- public boolean detachFragment(VirtualFile fragRoot)
- {
- if (fragRoot == null)
- throw new IllegalArgumentException("Null fragment file");
-
- if (fragments == null)
- return false;
-
- return fragments.remove(fragRoot);
- }
-
- /**
- * Get the array of attached fragment root files.
- * @return The array of attached fragment root files or null.
- */
- public VirtualFile[] getFragmentRoots()
- {
- if (fragments == null)
- return null;
-
- VirtualFile[] retarr = new VirtualFile[fragments.size()];
- fragments.toArray(retarr);
- return retarr;
- }
-
- @Override
- protected VirtualFileInfo findVirtualFileInfo(String path)
- {
- VirtualFileInfo result = super.findVirtualFileInfo(path);
- if (result == null && fragments != null)
- {
- for (VirtualFile root : fragments)
- {
- try
- {
- VirtualFile file = root.getChild(path);
- if (file != null)
- {
- result = new VirtualFileInfo(file, root);
- return result;
- }
- }
- catch (Exception ignored)
- {
- }
- }
- }
- return result;
- }
-
- /**
- * An implementation of NativeLibraryProvider that provides the native library file
- * location from the bundle that contains the library.
- */
- 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 = (VirtualFile)AbstractVFS.adapt(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);
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderSystem.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,73 +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.classloading;
-
-
-import org.jboss.classloader.plugins.filter.CombiningClassFilter;
-import org.jboss.classloader.plugins.jdk.AbstractJDKChecker;
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloader.spi.ClassLoaderPolicy;
-import org.jboss.classloader.spi.ClassLoaderSystem;
-import org.jboss.classloader.spi.ParentPolicy;
-import org.jboss.classloader.spi.base.BaseClassLoader;
-import org.jboss.classloader.spi.filter.ClassFilter;
-import org.jboss.classloader.spi.filter.ClassFilterUtils;
-import org.jboss.classloader.spi.filter.RecursivePackageClassFilter;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-
-/**
- * The OSGi ClassLoaderSystem.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiClassLoaderSystem extends ClassLoaderSystem
-{
- /**
- * Create a new OSGiClassLoaderSystem.
- */
- public OSGiClassLoaderSystem()
- {
- ClassLoaderDomain domain = getDefaultDomain();
-
- ClassFilter javaFilter = RecursivePackageClassFilter.createRecursivePackageClassFilter("java");
- ClassFilter filter = CombiningClassFilter.create(javaFilter, OSGiCoreClassFilter.INSTANCE);
- domain.setParentPolicy(new ParentPolicy(filter, ClassFilterUtils.NOTHING));
-
- AbstractJDKChecker.getExcluded().add(AbstractBundleState.class);
- AbstractJDKChecker.getExcluded().add(OSGiBundleState.class);
- }
-
- @Override
- protected ClassLoaderDomain createDomain(String name)
- {
- return new OSGiClassLoaderDomain(name);
- }
-
- @Override
- protected BaseClassLoader createClassLoader(ClassLoaderPolicy policy)
- {
- return new OSGiBundleClassLoader(policy);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,102 +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 org.jboss.classloader.spi.ClassLoaderPolicy;
-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.AbstractSimpleRealDeployer;
-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.bundle.OSGiFragmentState;
-import org.jboss.osgi.framework.classloading.OSGiClassLoaderPolicy;
-import org.jboss.osgi.vfs.AbstractVFS;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * A deployer, that handles OSGi fragment attachments.
- *
- * Fragments are bundles that can be attached to one or more host bundles by the
- * Framework. Attaching is done as part of resolving: the Framework appends
- * the relevant definitions of the fragment bundles to the host’s definitions
- * before the host is resolved.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 08-Jan-2010
- */
-public class OSGiFragmentAttachmentDeployer extends AbstractSimpleRealDeployer<ClassLoadingMetaData>
-{
- // The relative order at which the fragments get attached
- static final int RELATIVE_ORDER = 100;
-
- public OSGiFragmentAttachmentDeployer()
- {
- super(ClassLoadingMetaData.class);
- setStage(DeploymentStages.CLASSLOADER);
- setRelativeOrder(RELATIVE_ORDER);
- setTopLevelOnly(true);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, ClassLoadingMetaData classLoadingMetaData) throws DeploymentException
- {
- // Return if this is not a real bundle (i.e. a fragment)
- AbstractBundleState absBundleState = unit.getAttachment(AbstractBundleState.class);
- if (absBundleState == null)
- return;
-
- OSGiBundleManager bundleManager = absBundleState.getBundleManager();
-
- // Iterate over all installed fragments and attach to host when appropriate
- if (absBundleState.isFragment() == false)
- {
- OSGiBundleState hostState = (OSGiBundleState)absBundleState;
- for (AbstractBundleState auxBundle : bundleManager.getBundles(Bundle.INSTALLED))
- {
- if (auxBundle.isFragment())
- {
- OSGiFragmentState auxState = (OSGiFragmentState)auxBundle;
- if (hostState.isFragmentAttachable(auxState))
- {
- hostState.attachFragment(auxState);
- }
- }
- }
- }
-
- // Add the fragment's DelegateLoader to the host's ClassLoaderPolicy
- if (absBundleState.isFragment() == true)
- {
- OSGiFragmentState fragState = (OSGiFragmentState)absBundleState;
- OSGiBundleState hostState = fragState.getFragmentHost();
- DeploymentUnit hostUnit = hostState.getDeploymentUnit();
- OSGiClassLoaderPolicy hostPolicy = (OSGiClassLoaderPolicy)hostUnit.getAttachment(ClassLoaderPolicy.class);
- hostPolicy.attachFragment((VirtualFile)AbstractVFS.adapt(fragState.getRoot()));
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiManifestParsingDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,75 +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;
-
-import java.util.jar.Manifest;
-
-import org.jboss.deployers.vfs.spi.deployer.ManifestDeployer;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.internal.AbstractOSGiMetaData;
-import org.jboss.osgi.spi.OSGiConstants;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
-
-/**
- * OSGiManifestParsingDeployer.<p>
- *
- * This deployer attaches OSGiMetaData to the deployment.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiManifestParsingDeployer extends ManifestDeployer<OSGiMetaData>
-{
- public OSGiManifestParsingDeployer()
- {
- super(OSGiMetaData.class);
- setTopLevelOnly(true);
- }
-
- @Override
- protected OSGiMetaData createMetaData(Manifest manifest) throws Exception
- {
- int manifestVersion = BundleInfo.getBundleManifestVersion(manifest);
- if (manifestVersion < 0 || manifestVersion > 2)
- return null;
-
- AbstractOSGiMetaData osgiMetaData = new AbstractOSGiMetaData(manifest);
- return osgiMetaData;
- }
-
- @Override
- protected void init(VFSDeploymentUnit unit, OSGiMetaData osgiMetaData, VirtualFile file) throws Exception
- {
- super.init(unit, osgiMetaData, file);
-
- String symbolicName = osgiMetaData.getBundleSymbolicName();
- if (symbolicName != null)
- {
- // Add a marker that this is an R4 OSGi deployment
- log.debug("Bundle-SymbolicName: " + symbolicName);
- unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);
- }
- }
-}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/plugins/internal/SystemPackagesPluginImpl.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -92,8 +92,6 @@
allPackages.add("org.jboss.osgi.deployment.interceptor");
allPackages.add("org.jboss.osgi.microcontainer");
- allPackages.add("org.jboss.virtual");
-
String[] corePackages = OSGiCoreClassFilter.getCorePackages();
allPackageNames.addAll(Arrays.asList(corePackages));
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -23,7 +23,7 @@
//$Id$
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
import org.jboss.logging.Logger;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
import org.jboss.osgi.deployment.interceptor.InvocationContext;
@@ -34,7 +34,6 @@
import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
-import org.jboss.osgi.vfs.AbstractVFS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -71,13 +70,13 @@
if (bundleState == null)
throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
- VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
InvocationContext inv = unit.getAttachment(InvocationContext.class);
if (inv == null)
{
BundleContext context = bundleState.getBundleManager().getSystemContext();
DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
- inv = new InvocationContextImpl(context, bundle, AbstractVFS.adapt(unit.getRoot()), att);
+ inv = new InvocationContextImpl(context, bundle, bundleState.getRoot(), att);
unit.addAttachment(InvocationContext.class, inv);
}
return inv;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 14:09:33 UTC (rev 101774)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -69,6 +69,8 @@
<modules>
<module>core</module>
<module>metadata</module>
+ <module>vfs21</module>
+ <module>testsuite</module>
</modules>
<!-- Dependency Management -->
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite (from rev 101768, projects/jboss-osgi/projects/runtime/framework/trunk/core)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/.classpath 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,371 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
-
-<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 Framework - Core</name>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
- <packaging>bundle</packaging>
-
- <parent>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework-parent</artifactId>
- <version>1.0.0.Alpha4-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework-metadata</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-structure-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-jmx</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-aop-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployers</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployment</artifactId>
- </dependency>
-
- <!-- OSGi Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
-
- <!-- Test bundles dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-apache-xerces</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jmx</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jndi</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-reflect</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.web</groupId>
- <artifactId>pax-web-jetty-bundle</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testing</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>scripts/assembly-all.xml</descriptor>
- </descriptors>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
- <Bundle-Name>JBossOSGi Framework</Bundle-Name>
- <Bundle-Version>${version}</Bundle-Version>
- <Export-Package>
- org.osgi.framework;version="1.5",
- org.osgi.framework.launch;version="1.0",
- org.osgi.framework.hooks.service;version="1.0",
- org.osgi.service.packageadmin;version="1.2",
- org.osgi.service.startlevel;version="1.1",
- org.osgi.util.tracker;version="1.4"
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Xmx512m</argLine>
- <systemProperties>
- <property>
- <name>log4j.output.dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
- <value>bootstrap/jboss-osgi-bootstrap.xml</value>
- </property>
- <property>
- <name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
- </property>
- <property>
- <name>test.archive.directory</name>
- <value>${project.build.directory}/test-libs</value>
- </property>
- </systemProperties>
- <excludes>
- <!-- excludes listed here need to have a jira issue associated <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude> -->
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
+
+<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 Framework - Testsuite</name>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-testsuite</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-parent</artifactId>
+ <version>1.0.0.Alpha4-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-core</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-metadata</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-vfs21</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+
+ <!-- Test bundles dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-apache-xerces</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jaxb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jndi</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-reflect</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-xml-binding</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-jetty-bundle</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
+ <Bundle-Name>JBossOSGi Framework</Bundle-Name>
+ <Bundle-Version>${version}</Bundle-Version>
+ <Export-Package>
+ org.osgi.framework;version="1.5",
+ org.osgi.framework.launch;version="1.0",
+ org.osgi.framework.hooks.service;version="1.0",
+ org.osgi.service.packageadmin;version="1.2",
+ org.osgi.service.startlevel;version="1.1",
+ org.osgi.util.tracker;version="1.4"
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Xmx512m</argLine>
+ <systemProperties>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${project.build.directory}</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
+ <value>bootstrap/jboss-osgi-bootstrap.xml</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ </systemProperties>
+ <excludes>
+ <!-- excludes listed here need to have a jira issue associated <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude> -->
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,647 +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.test.osgi;
-
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.classloader.plugins.ClassLoaderUtils;
-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.metadata.OSGiMetaData;
-import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.FrameworkListener;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.SynchronousBundleListener;
-
-/**
- * OSGiTestCase - Parent Test Case for OSGi tests.
- *
- * @author <a href="baileyje(a)gmail.com">John Bailey</a>
- * @version $Revision: 87848 $
- */
-public abstract class FrameworkTest extends MicrocontainerTest implements FrameworkListener, SynchronousBundleListener, ServiceListener
-{
- private final List<FrameworkEvent> frameworkEvents = new CopyOnWriteArrayList<FrameworkEvent>();
- private final List<BundleEvent> bundleEvents = new CopyOnWriteArrayList<BundleEvent>();
- private final List<ServiceEvent> serviceEvents = new CopyOnWriteArrayList<ServiceEvent>();
-
- /**
- * Create a new OSGiTestCase.
- *
- * @param name the test name
- */
- public FrameworkTest(String name)
- {
- super(name);
- }
-
- public static FrameworkTestDelegate getDelegate(Class<?> clazz) throws Exception
- {
- return new FrameworkTestDelegate(clazz);
- }
-
- /**
- * Get OSGiTestDelegate
- */
- protected FrameworkTestDelegate getDelegate()
- {
- return (FrameworkTestDelegate)super.getDelegate();
- }
-
- /**
- * Get BundleManager from Delegate
- *
- * @return The BundleManager
- */
- protected OSGiBundleManager getBundleManager()
- {
- return getDelegate().getBundleManager();
- }
-
- /**
- * Get the system bundle
- *
- * @return the system bundle
- */
- protected Bundle getSystemBundle()
- {
- return getBundleManager().getBundleById(0).getBundleInternal();
- }
-
- /**
- * Add the base bundles
- *
- * @param expected the collection to add to
- */
- protected void addBaseBundles(Collection<Bundle> expected)
- {
- expected.add(getSystemBundle());
- }
-
- /**
- * Create a bundle
- *
- * @param root the location of the location to deploy
- * @param child the child to deploy
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle addBundle(String root, String child) throws Exception
- {
- return getDelegate().addBundle(root, child);
- }
-
- /**
- * Create a bundle
- *
- * @param file the virtual file
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle addBundle(VirtualFile file) throws Exception
- {
- return getDelegate().addBundle(file);
- }
-
- /**
- * Create a bundle
- *
- * @param root the location of the location to deploy
- * @param child the child to deploy
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle deployBundle(String root, String child) throws Exception
- {
- return getDelegate().deployBundle(root, child);
- }
-
- /**
- * Create a bundle
- *
- * @param file the virtual file
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- protected Bundle deployBundle(VirtualFile file) throws Exception
- {
- return getDelegate().deployBundle(file);
- }
-
- protected Bundle installBundle(String location) throws BundleException
- {
- return getBundleManager().installBundle(location, null).getBundleInternal();
- }
-
- protected Bundle installBundle(String location, InputStream instream) throws BundleException
- {
- return getBundleManager().installBundle(location, instream).getBundleInternal();
- }
-
- protected Bundle installBundle(VirtualFile bundleFile) throws BundleException
- {
- return getBundleManager().installBundle(bundleFile).getBundleInternal();
- }
-
- /**
- * Remove a bundle
- *
- * @param bundle the bundle to remove
- * @throws Exception for any error
- */
- protected void uninstall(Bundle bundle) throws Exception
- {
- getDelegate().uninstall(bundle);
- }
-
- protected DeploymentUnit getDeploymentUnit(Bundle bundle)
- {
- return getDelegate().getDeploymentUnit(bundle);
- }
-
- protected VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
- {
- return getDelegate().assembleBundle(name, new String[] { resources }, packages);
- }
-
- protected VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().assembleBundle(name, resourcePaths, packages);
- }
-
- protected Bundle deployBundle(String name, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, (String[]) null, packages);
- }
-
- protected Bundle deployBundle(String name, String resourcePath, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, resourcePath, packages);
- }
-
- protected Bundle deployBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, null, resourcePaths, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, (String[]) null, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, resourcePath, packages);
- }
-
- protected Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- return getDelegate().deployBundle(name, metaData, resourcePaths, packages);
- }
-
- protected AssembledDirectory createAssembledDirectory(String name) throws Exception
- {
- return getDelegate().createAssembledDirectory(name, "");
- }
-
- protected AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
- {
- return getDelegate().createAssembledDirectory(name, rootName);
- }
-
- protected void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
- {
- getDelegate().addPackage(dir, reference);
- }
-
- protected void addPath(final AssembledDirectory dir, String path, String name) throws Exception
- {
- getDelegate().addPath(dir, path, name);
- }
-
- protected void assertBundleState(int expState, int wasState)
- {
- String expstr = ConstantsHelper.bundleState(expState);
- String wasstr = ConstantsHelper.bundleState(wasState);
- assertEquals("Bundle " + expstr, expstr, wasstr);
- }
-
- protected void assertClassEquality(Class<?> expected, Class<?> actual)
- {
- assertTrue("Should be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected == actual);
- }
-
- protected void assertNoClassEquality(Class<?> expected, Class<?> actual)
- {
- assertTrue("Should NOT be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected != actual);
- }
-
- protected void assertClassLoader(Class<?> clazz, Bundle expected)
- {
- if (expected == null)
- return;
- ClassLoader cl = clazz.getClassLoader();
- ClassLoader bundleClassLoader = getBundleClassLoader(expected);
- boolean result = bundleClassLoader.equals(cl);
- assertTrue(ClassLoaderUtils.classToString(clazz) + " should have expected classloader=" + expected, result);
- }
-
- protected ClassLoader getBundleClassLoader(Bundle expected)
- {
- return getDeploymentUnit(expected).getClassLoader();
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference) throws Exception
- {
- return assertLoadClass(start, reference, start);
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected) throws Exception
- {
- return assertLoadClass(start, reference, expected, false);
- }
-
- protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected, boolean isReference) throws Exception
- {
- Class<?> result = assertLoadClass(reference.getName(), start, expected);
- if (isReference)
- assertClassEquality(reference, result);
- else
- assertNoClassEquality(reference, result);
- return result;
- }
-
- protected Class<?> assertLoadClass(String name, Bundle bundle, Bundle expected)
- {
- Class<?> result = null;
- try
- {
- result = bundle.loadClass(name);
- getLog().debug("Got class: " + ClassLoaderUtils.classToString(result) + " for " + name + " from " + bundle);
- }
- catch (ClassNotFoundException e)
- {
- failure("Did not expect CNFE for " + name + " from " + bundle, e);
- }
- assertClassLoader(result, expected);
- return result;
- }
-
- protected void assertLoadClassFail(Bundle start, Class<?> reference)
- {
- assertLoadClassFail(start, reference.getName());
- }
-
- protected void assertLoadClassFail(Bundle start, String name)
- {
- try
- {
- start.loadClass(name);
- fail("Should not be here!");
- }
- catch (Exception expected)
- {
- checkThrowable(ClassNotFoundException.class, expected);
- }
- }
-
- protected URL getBundleResource(Bundle bundle, String path)
- {
- return getDelegate().getBundleResource(bundle, path);
- }
-
- protected Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
- {
- return getDelegate().getBundleResources(bundle, path);
- }
-
- protected void assertNoAllReferences(BundleContext bundleContext, String clazz) throws Exception
- {
- assertNoAllReferences(bundleContext, clazz, null);
- }
-
- protected void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
- {
- ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
- }
-
- protected void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
- {
- assertAllReferences(bundleContext, clazz, null, expected);
- }
-
- protected void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
- {
- ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
- }
-
- protected void assertNoReferences(BundleContext bundleContext, String clazz) throws Exception
- {
- assertNoReferences(bundleContext, clazz, null);
- }
-
- protected void assertNoReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
- {
- ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
- }
-
- protected void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
- {
- assertReferences(bundleContext, clazz, null, expected);
- }
-
- protected void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
- {
- ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
- assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
- }
-
- protected void assertNoGetReference(BundleContext bundleContext, String clazz) throws Exception
- {
- ServiceReference actual = bundleContext.getServiceReference(clazz);
- if (actual != null)
- getLog().debug(bundleContext + " got " + actual + " for clazz=" + clazz);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
- assertNull("Expected no references for clazz=" + clazz, actual);
- }
-
- protected void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected) throws Exception
- {
- ServiceReference actual = bundleContext.getServiceReference(clazz);
- if (actual != null)
- getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz);
- else
- getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
- assertEquals(bundleContext + " with clazz=" + clazz, expected, actual);
- }
-
- protected void assertUsingBundles(ServiceReference reference, Bundle... bundles)
- {
- Set<Bundle> actual = new HashSet<Bundle>();
- Bundle[] users = reference.getUsingBundles();
- if (users != null)
- actual.addAll(Arrays.asList(users));
-
- Set<Bundle> expected = new HashSet<Bundle>();
- expected.addAll(Arrays.asList(bundles));
-
- getLog().debug(reference + " users=" + actual);
-
- // switch - check expected on actual, since actual might be proxy
- assertEquals(actual, expected);
- }
-
- protected void assertBundle(Bundle b1, Bundle b2)
- {
- assertNotNull(b1);
- assertNotNull(b2);
- assertEquals(b1.getBundleId(), b2.getBundleId());
- }
-
- protected void assertObjectClass(String expected, ServiceReference reference)
- {
- assertObjectClass(new String[] { expected }, reference);
- }
-
- protected void assertObjectClass(String[] expected, ServiceReference reference)
- {
- Object actual = reference.getProperty(Constants.OBJECTCLASS);
- if (actual == null)
- fail("no object class???");
- if (actual instanceof String[] == false)
- fail(actual + " is not a string array??? " + actual.getClass().getName());
- assertEquals(expected, (String[])actual);
- }
-
- public void frameworkEvent(FrameworkEvent event)
- {
- synchronized (frameworkEvents)
- {
- getLog().debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
- frameworkEvents.add(event);
- frameworkEvents.notifyAll();
- }
- }
-
- protected void assertNoFrameworkEvent() throws Exception
- {
- getLog().debug("frameworkEvents=" + frameworkEvents);
- assertEquals(0, frameworkEvents.size());
- }
-
- protected void assertFrameworkEvent(int type) throws Exception
- {
- assertFrameworkEvent(type, getSystemBundle(), null);
- }
-
- protected void assertFrameworkEvent(int type, Class<? extends Throwable> expectedThrowable) throws Exception
- {
- assertFrameworkEvent(type, getSystemBundle(), expectedThrowable);
- }
-
- protected void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable) throws Exception
- {
- waitForEvent(frameworkEvents, type);
- getLog().debug("frameworkEvents=" + frameworkEvents);
- int size = frameworkEvents.size();
- assertTrue("" + size, size > 0);
- FrameworkEvent event = frameworkEvents.remove(0);
- assertEquals(ConstantsHelper.frameworkEvent(type), ConstantsHelper.frameworkEvent(event.getType()));
- Throwable t = event.getThrowable();
- if (expectedThrowable == null)
- {
- if (t != null)
- {
- getLog().error("Unexpected error in Framework event: ", t);
- fail("Unexpected throwable: " + t);
- }
- }
- else
- {
- checkThrowable(BundleException.class, t);
- checkDeepThrowable(expectedThrowable, t);
- }
- assertEquals(bundle, event.getSource());
- assertEquals(bundle, event.getBundle());
- }
-
- public void bundleChanged(BundleEvent event)
- {
- synchronized (bundleEvents)
- {
- getLog().debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
- bundleEvents.add(event);
- bundleEvents.notifyAll();
- }
- }
-
- protected void assertNoBundleEvent() throws Exception
- {
- getLog().debug("bundleEvents=" + bundleEvents);
- assertEquals(0, bundleEvents.size());
- }
-
- protected void assertBundleEvent(int type, Bundle bundle) throws Exception
- {
- waitForEvent(bundleEvents, type);
-
- getLog().debug("bundleEvents=" + bundleEvents);
- int size = bundleEvents.size();
- assertTrue("" + size, size > 0);
-
- if (bundle instanceof AbstractBundleState)
- bundle = ((AbstractBundleState)bundle).getBundle();
-
- BundleEvent foundEvent = null;
- for(int i=0; i < bundleEvents.size(); i++)
- {
- BundleEvent aux = bundleEvents.get(i);
- if (type == aux.getType())
- {
- if (bundle.equals(aux.getSource()) && bundle.equals(aux.getBundle()))
- {
- bundleEvents.remove(aux);
- foundEvent = aux;
- break;
- }
- }
- }
-
- if (foundEvent == null)
- fail("Cannot find event " + ConstantsHelper.bundleEvent(type) + " from " + bundle);
- }
-
- public void serviceChanged(ServiceEvent event)
- {
- synchronized (serviceEvents)
- {
- getLog().debug("ServiceChanged type=" + ConstantsHelper.serviceEvent(event.getType()) + " for " + event);
- serviceEvents.add(event);
- serviceEvents.notifyAll();
- }
- }
-
- protected void assertNoServiceEvent() throws Exception
- {
- getLog().debug("serviceEvents=" + serviceEvents);
- assertEquals(0, serviceEvents.size());
- }
-
- protected void assertServiceEvent(int type, ServiceReference reference) throws Exception
- {
- waitForEvent(serviceEvents, type);
- getLog().debug("serviceEvents=" + serviceEvents);
- int size = serviceEvents.size();
- assertTrue("" + size, size > 0);
- ServiceEvent event = serviceEvents.remove(0);
- assertEquals(ConstantsHelper.serviceEvent(type), ConstantsHelper.serviceEvent(event.getType()));
- assertEquals(reference, event.getSource());
- assertEquals(reference, event.getServiceReference());
- }
-
- @SuppressWarnings("rawtypes")
- private void waitForEvent(List events, int type) throws InterruptedException
- {
- // Timeout for event delivery: 3 sec
- int timeout = 30;
-
- boolean eventFound = false;
- while (eventFound == false && 0 < timeout)
- {
- synchronized (events)
- {
- events.wait(100);
- for (Object aux : events)
- {
- if (aux instanceof BundleEvent)
- {
- BundleEvent event = (BundleEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- else if (aux instanceof ServiceEvent)
- {
- ServiceEvent event = (ServiceEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- else if (aux instanceof FrameworkEvent)
- {
- FrameworkEvent event = (FrameworkEvent)aux;
- if (type == event.getType())
- {
- eventFound = true;
- break;
- }
- }
- }
- }
- timeout--;
- }
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,648 @@
+/*
+ * 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.test.osgi;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+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.metadata.OSGiMetaData;
+import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.SynchronousBundleListener;
+
+/**
+ * OSGiTestCase - Parent Test Case for OSGi tests.
+ *
+ * @author <a href="baileyje(a)gmail.com">John Bailey</a>
+ * @version $Revision: 87848 $
+ */
+public abstract class FrameworkTest extends MicrocontainerTest implements FrameworkListener, SynchronousBundleListener, ServiceListener
+{
+ private final List<FrameworkEvent> frameworkEvents = new CopyOnWriteArrayList<FrameworkEvent>();
+ private final List<BundleEvent> bundleEvents = new CopyOnWriteArrayList<BundleEvent>();
+ private final List<ServiceEvent> serviceEvents = new CopyOnWriteArrayList<ServiceEvent>();
+
+ /**
+ * Create a new OSGiTestCase.
+ *
+ * @param name the test name
+ */
+ public FrameworkTest(String name)
+ {
+ super(name);
+ }
+
+ public static FrameworkTestDelegate getDelegate(Class<?> clazz) throws Exception
+ {
+ return new FrameworkTestDelegate(clazz);
+ }
+
+ /**
+ * Get OSGiTestDelegate
+ */
+ protected FrameworkTestDelegate getDelegate()
+ {
+ return (FrameworkTestDelegate)super.getDelegate();
+ }
+
+ /**
+ * Get BundleManager from Delegate
+ *
+ * @return The BundleManager
+ */
+ protected OSGiBundleManager getBundleManager()
+ {
+ return getDelegate().getBundleManager();
+ }
+
+ /**
+ * Get the system bundle
+ *
+ * @return the system bundle
+ */
+ protected Bundle getSystemBundle()
+ {
+ return getBundleManager().getBundleById(0).getBundleInternal();
+ }
+
+ /**
+ * Add the base bundles
+ *
+ * @param expected the collection to add to
+ */
+ protected void addBaseBundles(Collection<Bundle> expected)
+ {
+ expected.add(getSystemBundle());
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param root the location of the location to deploy
+ * @param child the child to deploy
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle addBundle(String root, String child) throws Exception
+ {
+ return getDelegate().addBundle(root, child);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param file the virtual file
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle addBundle(VirtualFile file) throws Exception
+ {
+ return getDelegate().addBundle(file);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param root the location of the location to deploy
+ * @param child the child to deploy
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle deployBundle(String root, String child) throws Exception
+ {
+ return getDelegate().deployBundle(root, child);
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param file the virtual file
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ protected Bundle deployBundle(VirtualFile file) throws Exception
+ {
+ return getDelegate().deployBundle(file);
+ }
+
+ protected Bundle installBundle(String location) throws BundleException
+ {
+ return getBundleManager().installBundle(location, null).getBundleInternal();
+ }
+
+ protected Bundle installBundle(String location, InputStream instream) throws BundleException
+ {
+ return getBundleManager().installBundle(location, instream).getBundleInternal();
+ }
+
+ protected Bundle installBundle(VirtualFile bundleFile) throws BundleException
+ {
+ return getBundleManager().installBundle(AbstractVFS.adapt(bundleFile)).getBundleInternal();
+ }
+
+ /**
+ * Remove a bundle
+ *
+ * @param bundle the bundle to remove
+ * @throws Exception for any error
+ */
+ protected void uninstall(Bundle bundle) throws Exception
+ {
+ getDelegate().uninstall(bundle);
+ }
+
+ protected DeploymentUnit getDeploymentUnit(Bundle bundle)
+ {
+ return getDelegate().getDeploymentUnit(bundle);
+ }
+
+ protected VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+ {
+ return getDelegate().assembleBundle(name, new String[] { resources }, packages);
+ }
+
+ protected VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().assembleBundle(name, resourcePaths, packages);
+ }
+
+ protected Bundle deployBundle(String name, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, (String[]) null, packages);
+ }
+
+ protected Bundle deployBundle(String name, String resourcePath, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, resourcePath, packages);
+ }
+
+ protected Bundle deployBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, null, resourcePaths, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, (String[]) null, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, resourcePath, packages);
+ }
+
+ protected Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ return getDelegate().deployBundle(name, metaData, resourcePaths, packages);
+ }
+
+ protected AssembledDirectory createAssembledDirectory(String name) throws Exception
+ {
+ return getDelegate().createAssembledDirectory(name, "");
+ }
+
+ protected AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
+ {
+ return getDelegate().createAssembledDirectory(name, rootName);
+ }
+
+ protected void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
+ {
+ getDelegate().addPackage(dir, reference);
+ }
+
+ protected void addPath(final AssembledDirectory dir, String path, String name) throws Exception
+ {
+ getDelegate().addPath(dir, path, name);
+ }
+
+ protected void assertBundleState(int expState, int wasState)
+ {
+ String expstr = ConstantsHelper.bundleState(expState);
+ String wasstr = ConstantsHelper.bundleState(wasState);
+ assertEquals("Bundle " + expstr, expstr, wasstr);
+ }
+
+ protected void assertClassEquality(Class<?> expected, Class<?> actual)
+ {
+ assertTrue("Should be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected == actual);
+ }
+
+ protected void assertNoClassEquality(Class<?> expected, Class<?> actual)
+ {
+ assertTrue("Should NOT be the same " + ClassLoaderUtils.classToString(expected) + " and " + ClassLoaderUtils.classToString(actual), expected != actual);
+ }
+
+ protected void assertClassLoader(Class<?> clazz, Bundle expected)
+ {
+ if (expected == null)
+ return;
+ ClassLoader cl = clazz.getClassLoader();
+ ClassLoader bundleClassLoader = getBundleClassLoader(expected);
+ boolean result = bundleClassLoader.equals(cl);
+ assertTrue(ClassLoaderUtils.classToString(clazz) + " should have expected classloader=" + expected, result);
+ }
+
+ protected ClassLoader getBundleClassLoader(Bundle expected)
+ {
+ return getDeploymentUnit(expected).getClassLoader();
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference) throws Exception
+ {
+ return assertLoadClass(start, reference, start);
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected) throws Exception
+ {
+ return assertLoadClass(start, reference, expected, false);
+ }
+
+ protected Class<?> assertLoadClass(Bundle start, Class<?> reference, Bundle expected, boolean isReference) throws Exception
+ {
+ Class<?> result = assertLoadClass(reference.getName(), start, expected);
+ if (isReference)
+ assertClassEquality(reference, result);
+ else
+ assertNoClassEquality(reference, result);
+ return result;
+ }
+
+ protected Class<?> assertLoadClass(String name, Bundle bundle, Bundle expected)
+ {
+ Class<?> result = null;
+ try
+ {
+ result = bundle.loadClass(name);
+ getLog().debug("Got class: " + ClassLoaderUtils.classToString(result) + " for " + name + " from " + bundle);
+ }
+ catch (ClassNotFoundException e)
+ {
+ failure("Did not expect CNFE for " + name + " from " + bundle, e);
+ }
+ assertClassLoader(result, expected);
+ return result;
+ }
+
+ protected void assertLoadClassFail(Bundle start, Class<?> reference)
+ {
+ assertLoadClassFail(start, reference.getName());
+ }
+
+ protected void assertLoadClassFail(Bundle start, String name)
+ {
+ try
+ {
+ start.loadClass(name);
+ fail("Should not be here!");
+ }
+ catch (Exception expected)
+ {
+ checkThrowable(ClassNotFoundException.class, expected);
+ }
+ }
+
+ protected URL getBundleResource(Bundle bundle, String path)
+ {
+ return getDelegate().getBundleResource(bundle, path);
+ }
+
+ protected Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
+ {
+ return getDelegate().getBundleResources(bundle, path);
+ }
+
+ protected void assertNoAllReferences(BundleContext bundleContext, String clazz) throws Exception
+ {
+ assertNoAllReferences(bundleContext, clazz, null);
+ }
+
+ protected void assertNoAllReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+ }
+
+ protected void assertAllReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+ {
+ assertAllReferences(bundleContext, clazz, null, expected);
+ }
+
+ protected void assertAllReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getAllServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+ }
+
+ protected void assertNoReferences(BundleContext bundleContext, String clazz) throws Exception
+ {
+ assertNoReferences(bundleContext, clazz, null);
+ }
+
+ protected void assertNoReferences(BundleContext bundleContext, String clazz, String filter) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertNull("Expected no references for clazz=" + clazz + " filter=" + filter, actual);
+ }
+
+ protected void assertReferences(BundleContext bundleContext, String clazz, ServiceReference... expected) throws Exception
+ {
+ assertReferences(bundleContext, clazz, null, expected);
+ }
+
+ protected void assertReferences(BundleContext bundleContext, String clazz, String filter, ServiceReference... expected) throws Exception
+ {
+ ServiceReference[] actual = bundleContext.getServiceReferences(clazz, filter);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz + " filter=" + filter);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz + " filter=" + filter);
+ assertEquals(bundleContext + " with clazz=" + clazz + " filter=" + filter, expected, actual);
+ }
+
+ protected void assertNoGetReference(BundleContext bundleContext, String clazz) throws Exception
+ {
+ ServiceReference actual = bundleContext.getServiceReference(clazz);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + actual + " for clazz=" + clazz);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
+ assertNull("Expected no references for clazz=" + clazz, actual);
+ }
+
+ protected void assertGetReference(BundleContext bundleContext, String clazz, ServiceReference expected) throws Exception
+ {
+ ServiceReference actual = bundleContext.getServiceReference(clazz);
+ if (actual != null)
+ getLog().debug(bundleContext + " got " + Arrays.asList(actual) + " for clazz=" + clazz);
+ else
+ getLog().debug(bundleContext + " got nothing for clazz=" + clazz);
+ assertEquals(bundleContext + " with clazz=" + clazz, expected, actual);
+ }
+
+ protected void assertUsingBundles(ServiceReference reference, Bundle... bundles)
+ {
+ Set<Bundle> actual = new HashSet<Bundle>();
+ Bundle[] users = reference.getUsingBundles();
+ if (users != null)
+ actual.addAll(Arrays.asList(users));
+
+ Set<Bundle> expected = new HashSet<Bundle>();
+ expected.addAll(Arrays.asList(bundles));
+
+ getLog().debug(reference + " users=" + actual);
+
+ // switch - check expected on actual, since actual might be proxy
+ assertEquals(actual, expected);
+ }
+
+ protected void assertBundle(Bundle b1, Bundle b2)
+ {
+ assertNotNull(b1);
+ assertNotNull(b2);
+ assertEquals(b1.getBundleId(), b2.getBundleId());
+ }
+
+ protected void assertObjectClass(String expected, ServiceReference reference)
+ {
+ assertObjectClass(new String[] { expected }, reference);
+ }
+
+ protected void assertObjectClass(String[] expected, ServiceReference reference)
+ {
+ Object actual = reference.getProperty(Constants.OBJECTCLASS);
+ if (actual == null)
+ fail("no object class???");
+ if (actual instanceof String[] == false)
+ fail(actual + " is not a string array??? " + actual.getClass().getName());
+ assertEquals(expected, (String[])actual);
+ }
+
+ public void frameworkEvent(FrameworkEvent event)
+ {
+ synchronized (frameworkEvents)
+ {
+ getLog().debug("FrameworkEvent type=" + ConstantsHelper.frameworkEvent(event.getType()) + " for " + event);
+ frameworkEvents.add(event);
+ frameworkEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoFrameworkEvent() throws Exception
+ {
+ getLog().debug("frameworkEvents=" + frameworkEvents);
+ assertEquals(0, frameworkEvents.size());
+ }
+
+ protected void assertFrameworkEvent(int type) throws Exception
+ {
+ assertFrameworkEvent(type, getSystemBundle(), null);
+ }
+
+ protected void assertFrameworkEvent(int type, Class<? extends Throwable> expectedThrowable) throws Exception
+ {
+ assertFrameworkEvent(type, getSystemBundle(), expectedThrowable);
+ }
+
+ protected void assertFrameworkEvent(int type, Bundle bundle, Class<? extends Throwable> expectedThrowable) throws Exception
+ {
+ waitForEvent(frameworkEvents, type);
+ getLog().debug("frameworkEvents=" + frameworkEvents);
+ int size = frameworkEvents.size();
+ assertTrue("" + size, size > 0);
+ FrameworkEvent event = frameworkEvents.remove(0);
+ assertEquals(ConstantsHelper.frameworkEvent(type), ConstantsHelper.frameworkEvent(event.getType()));
+ Throwable t = event.getThrowable();
+ if (expectedThrowable == null)
+ {
+ if (t != null)
+ {
+ getLog().error("Unexpected error in Framework event: ", t);
+ fail("Unexpected throwable: " + t);
+ }
+ }
+ else
+ {
+ checkThrowable(BundleException.class, t);
+ checkDeepThrowable(expectedThrowable, t);
+ }
+ assertEquals(bundle, event.getSource());
+ assertEquals(bundle, event.getBundle());
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ synchronized (bundleEvents)
+ {
+ getLog().debug("BundleChanged type=" + ConstantsHelper.bundleEvent(event.getType()) + " for " + event);
+ bundleEvents.add(event);
+ bundleEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoBundleEvent() throws Exception
+ {
+ getLog().debug("bundleEvents=" + bundleEvents);
+ assertEquals(0, bundleEvents.size());
+ }
+
+ protected void assertBundleEvent(int type, Bundle bundle) throws Exception
+ {
+ waitForEvent(bundleEvents, type);
+
+ getLog().debug("bundleEvents=" + bundleEvents);
+ int size = bundleEvents.size();
+ assertTrue("" + size, size > 0);
+
+ if (bundle instanceof AbstractBundleState)
+ bundle = ((AbstractBundleState)bundle).getBundle();
+
+ BundleEvent foundEvent = null;
+ for(int i=0; i < bundleEvents.size(); i++)
+ {
+ BundleEvent aux = bundleEvents.get(i);
+ if (type == aux.getType())
+ {
+ if (bundle.equals(aux.getSource()) && bundle.equals(aux.getBundle()))
+ {
+ bundleEvents.remove(aux);
+ foundEvent = aux;
+ break;
+ }
+ }
+ }
+
+ if (foundEvent == null)
+ fail("Cannot find event " + ConstantsHelper.bundleEvent(type) + " from " + bundle);
+ }
+
+ public void serviceChanged(ServiceEvent event)
+ {
+ synchronized (serviceEvents)
+ {
+ getLog().debug("ServiceChanged type=" + ConstantsHelper.serviceEvent(event.getType()) + " for " + event);
+ serviceEvents.add(event);
+ serviceEvents.notifyAll();
+ }
+ }
+
+ protected void assertNoServiceEvent() throws Exception
+ {
+ getLog().debug("serviceEvents=" + serviceEvents);
+ assertEquals(0, serviceEvents.size());
+ }
+
+ protected void assertServiceEvent(int type, ServiceReference reference) throws Exception
+ {
+ waitForEvent(serviceEvents, type);
+ getLog().debug("serviceEvents=" + serviceEvents);
+ int size = serviceEvents.size();
+ assertTrue("" + size, size > 0);
+ ServiceEvent event = serviceEvents.remove(0);
+ assertEquals(ConstantsHelper.serviceEvent(type), ConstantsHelper.serviceEvent(event.getType()));
+ assertEquals(reference, event.getSource());
+ assertEquals(reference, event.getServiceReference());
+ }
+
+ @SuppressWarnings("rawtypes")
+ private void waitForEvent(List events, int type) throws InterruptedException
+ {
+ // Timeout for event delivery: 3 sec
+ int timeout = 30;
+
+ boolean eventFound = false;
+ while (eventFound == false && 0 < timeout)
+ {
+ synchronized (events)
+ {
+ events.wait(100);
+ for (Object aux : events)
+ {
+ if (aux instanceof BundleEvent)
+ {
+ BundleEvent event = (BundleEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ else if (aux instanceof ServiceEvent)
+ {
+ ServiceEvent event = (ServiceEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ else if (aux instanceof FrameworkEvent)
+ {
+ FrameworkEvent event = (FrameworkEvent)aux;
+ if (type == event.getType())
+ {
+ eventFound = true;
+ break;
+ }
+ }
+ }
+ }
+ timeout--;
+ }
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,380 +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 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 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;
-
-// $Id: $
-
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Enumeration;
-
-import junit.framework.AssertionFailedError;
-
-import org.jboss.classloader.plugins.ClassLoaderUtils;
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.Deployment;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-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.OSGiMetaData;
-import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * A OSGiTestDelegate
- *
- * @author <a href="baileyje(a)gmail.com">John Bailey</a>
- * @author Thomas.Diesler(a)jboss.com
- */
-public class FrameworkTestDelegate extends MicrocontainerTestDelegate
-{
- private OSGiBundleManager bundleManager;
-
- /**
- * Create a new OSGiTestDelegate.
- * @param clazz test class
- * @throws Exception for any error
- */
- FrameworkTestDelegate(Class<?> clazz) throws Exception
- {
- super(clazz);
- }
-
- /**
- * Deploys the jboss-osgi-bootstrap.xml bean descriptor to setup OSGi deployers
- */
- protected void deploy() throws Exception
- {
- String common = "/bootstrap/jboss-osgi-bootstrap.xml";
- URL url = getClass().getResource(common);
- if (url == null)
- throw new IllegalStateException(common + " not found");
- deploy(url);
- try
- {
- super.deploy();
- deployBundles();
- }
- catch (Throwable t)
- {
- undeploy();
- if (t instanceof Exception)
- throw (Exception)t;
- if (t instanceof Error)
- throw (Error)t;
- throw new RuntimeException("Error during deploy", t);
- }
- }
-
- protected void undeploy()
- {
- undeployBundles();
- super.undeploy();
- }
-
- @SuppressWarnings("unchecked")
- protected void deployBundles() throws Exception
- {
- try
- {
- Method method = clazz.getMethod("deployBundles", FrameworkTestDelegate.class);
- log.debug("Deploying Bundles...");
- method.invoke(null, this);
- }
- catch (NoSuchMethodException e)
- {
- log.debug("No deployBundles() in " + clazz.getName());
- }
- }
-
- protected void undeployBundles()
- {
- OSGiBundleManager bundleManager = getBundleManager();
- Collection<AbstractBundleState> bundles = bundleManager.getBundles();
- for (AbstractBundleState aux : bundles)
- {
- try
- {
- if (aux.getBundleId() != 0)
- {
- AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)aux;
- bundleManager.uninstallBundle(bundleState);
- }
- }
- catch (Throwable t)
- {
- getLog().warn("Error undeploying bundle: " + aux, t);
- }
- }
- }
-
- public OSGiBundleManager getBundleManager()
- {
- if (bundleManager == null)
- {
- bundleManager = getBean("OSGiBundleManager", ControllerState.INSTALLED, OSGiBundleManager.class);
- try
- {
- if (bundleManager.isFrameworkActive() == false)
- bundleManager.startFramework();
- }
- catch (BundleException ex)
- {
- throw new IllegalStateException("Cannot start bundle manager", ex);
- }
- }
- return bundleManager;
- }
-
- public DeployerClient getDeployerClient()
- {
- return getBundleManager().getDeployerClient();
- }
-
- /**
- * Create a bundle
- *
- * @param root the location to deploy
- * @param child the child to deploy
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- public Bundle addBundle(String root, String child) throws Exception
- {
- URL resourceRoot = getClass().getResource(root);
- if (resourceRoot == null)
- throw new AssertionFailedError("Resource not found: " + root);
- URL childResource = new URL(resourceRoot, child);
- AbstractBundleState bundleState = getBundleManager().installBundle(childResource);
- return bundleState.getBundleInternal();
- }
-
- /**
- * Create a bundle
- *
- * @param file the virtual file
- * @return Bundle for the deployment
- * @throws Exception for any error
- */
- public Bundle addBundle(VirtualFile file) throws Exception
- {
- AbstractBundleState bundleState = getBundleManager().installBundle(file);
- return bundleState.getBundleInternal();
- }
-
- /**
- * Remove a bundle
- *
- * @param bundle the bundle to remove
- * @throws Exception for any error
- */
- public void uninstall(Bundle bundle) throws Exception
- {
- if (bundle.getState() != Bundle.UNINSTALLED)
- {
- AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
- getBundleManager().uninstallBundle(bundleState);
- }
- }
-
- public DeploymentUnit getDeploymentUnit(Bundle bundle)
- {
- DeploymentUnit deploymentUnit = getBundleManager().getDeployment(bundle.getBundleId());
- if (deploymentUnit == null)
- throw new AssertionFailedError("Bundle not installed: " + bundle);
- return deploymentUnit;
- }
-
- public VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
- {
- return assembleBundle(name, new String[] { resources }, packages);
- }
-
- public VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
- return assembledDirectory;
- }
-
- public Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
- {
- AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", new String[] { resourcePath }, packages);
- return deployBundle(assembledDirectory, metaData);
- }
-
- public Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
- return deployBundle(assembledDirectory, metaData);
- }
-
- public Bundle deployBundle(VirtualFile virtualFile, OSGiMetaData metaData) throws Exception
- {
- Deployment deployment = createDeployment(virtualFile, metaData);
- return deployBundle(deployment);
- }
-
- public Bundle deployBundle(String root, String child) throws Exception
- {
- URL resourceRoot = getClass().getResource(root);
- if (resourceRoot == null)
- throw new AssertionFailedError("Resource not found: " + root);
- URL childResource = new URL(resourceRoot, child);
- return deployBundle(childResource);
- }
-
- public Bundle deployBundle(URL url) throws Exception
- {
- // Get the root file
- VirtualFile root;
- try
- {
- root = VFS.getRoot(url);
- }
- catch (IOException e)
- {
- throw new BundleException("Invalid url=" + url, e);
- }
-
- return deployBundle(root);
- }
-
- public Bundle deployBundle(VirtualFile file) throws Exception
- {
- return deployBundle(file, null);
- }
-
- public Bundle deployBundle(Deployment deployment) throws Exception
- {
- DeployerClient deployerClient = getDeployerClient();
- MainDeployerStructure deployerStructure = (MainDeployerStructure) deployerClient;
- deployerClient.deploy(deployment);
- try
- {
- DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState == null)
- throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
-
- return bundleState.getBundleInternal();
- }
- catch (Exception e)
- {
- deployerClient.undeploy(deployment);
- throw e;
- }
- }
-
- public Deployment createDeployment(VirtualFile virtualFile) throws Exception
- {
- return createDeployment(virtualFile, null);
- }
-
- public Deployment createDeployment(VirtualFile virtualFile, OSGiMetaData metaData) throws Exception
- {
- return createDeployment(virtualFile, metaData, OSGiMetaData.class);
- }
-
- @SuppressWarnings({"unchecked"})
- public <T> Deployment createDeployment(VirtualFile virtualFile, T metaData, Class<T> expectedType) throws Exception
- {
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(virtualFile);
- if (metaData != null)
- {
- if (expectedType == null)
- expectedType = (Class<T>)metaData.getClass();
-
- MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- att.addAttachment(expectedType, metaData);
- }
- return deployment;
- }
-
- public AssembledDirectory createAssembledDirectory(String name, String rootName, String[] resourcePaths, Class<?>... packages) throws Exception
- {
- AssembledDirectory assembledDirectory = createAssembledDirectory(name, rootName);
- if (resourcePaths != null)
- {
- for (String path : resourcePaths)
- addPath(assembledDirectory, path, "");
- }
- if (packages != null)
- {
- for (Class<?> reference : packages)
- addPackage(assembledDirectory, reference);
- }
- return assembledDirectory;
- }
-
- public AssembledDirectory createAssembledDirectory(String name) throws Exception
- {
- return createAssembledDirectory(name, "");
- }
-
- public AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
- {
- return AssembledDirectory.createAssembledDirectory(name, rootName);
- }
-
- public void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
- {
- String packagePath = ClassLoaderUtils.packageNameToPath(reference.getName());
- dir.addResources(reference, new String[] { packagePath + "/*.class" }, new String[0]);
- }
-
- public void addPath(final AssembledDirectory dir, String path, String name) throws Exception
- {
- URL url = getClass().getResource(path);
- if (url == null)
- throw new AssertionFailedError(path + " not found");
-
- VirtualFile file = VFS.getVirtualFile(url, name);
- // TODO - remove this filter after new VFS relase
- SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
- dir.addPath(file, noJars);
- }
-
- public URL getBundleResource(Bundle bundle, String path)
- {
- return getDeploymentUnit(bundle).getResourceLoader().getResource(path);
- }
-
- public Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
- {
- return getDeploymentUnit(bundle).getResourceLoader().getResources(path);
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,380 @@
+/*
+ * 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 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 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;
+
+// $Id: $
+
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.util.Collection;
+import java.util.Enumeration;
+
+import junit.framework.AssertionFailedError;
+
+import org.jboss.classloader.plugins.ClassLoaderUtils;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.Deployment;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+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.OSGiMetaData;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
+import org.jboss.virtual.AssembledDirectory;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.plugins.context.jar.JarUtils;
+import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * A OSGiTestDelegate
+ *
+ * @author <a href="baileyje(a)gmail.com">John Bailey</a>
+ * @author Thomas.Diesler(a)jboss.com
+ */
+public class FrameworkTestDelegate extends MicrocontainerTestDelegate
+{
+ private OSGiBundleManager bundleManager;
+
+ /**
+ * Create a new OSGiTestDelegate.
+ * @param clazz test class
+ * @throws Exception for any error
+ */
+ FrameworkTestDelegate(Class<?> clazz) throws Exception
+ {
+ super(clazz);
+ }
+
+ /**
+ * Deploys the jboss-osgi-bootstrap.xml bean descriptor to setup OSGi deployers
+ */
+ protected void deploy() throws Exception
+ {
+ String common = "/bootstrap/jboss-osgi-bootstrap.xml";
+ URL url = getClass().getResource(common);
+ if (url == null)
+ throw new IllegalStateException(common + " not found");
+ deploy(url);
+ try
+ {
+ super.deploy();
+ deployBundles();
+ }
+ catch (Throwable t)
+ {
+ undeploy();
+ if (t instanceof Exception)
+ throw (Exception)t;
+ if (t instanceof Error)
+ throw (Error)t;
+ throw new RuntimeException("Error during deploy", t);
+ }
+ }
+
+ protected void undeploy()
+ {
+ undeployBundles();
+ super.undeploy();
+ }
+
+ protected void deployBundles() throws Exception
+ {
+ try
+ {
+ Method method = clazz.getMethod("deployBundles", FrameworkTestDelegate.class);
+ log.debug("Deploying Bundles...");
+ method.invoke(null, this);
+ }
+ catch (NoSuchMethodException e)
+ {
+ log.debug("No deployBundles() in " + clazz.getName());
+ }
+ }
+
+ protected void undeployBundles()
+ {
+ OSGiBundleManager bundleManager = getBundleManager();
+ Collection<AbstractBundleState> bundles = bundleManager.getBundles();
+ for (AbstractBundleState aux : bundles)
+ {
+ try
+ {
+ if (aux.getBundleId() != 0)
+ {
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)aux;
+ bundleManager.uninstallBundle(bundleState);
+ }
+ }
+ catch (Throwable t)
+ {
+ getLog().warn("Error undeploying bundle: " + aux, t);
+ }
+ }
+ }
+
+ public OSGiBundleManager getBundleManager()
+ {
+ if (bundleManager == null)
+ {
+ bundleManager = getBean("OSGiBundleManager", ControllerState.INSTALLED, OSGiBundleManager.class);
+ try
+ {
+ if (bundleManager.isFrameworkActive() == false)
+ bundleManager.startFramework();
+ }
+ catch (BundleException ex)
+ {
+ throw new IllegalStateException("Cannot start bundle manager", ex);
+ }
+ }
+ return bundleManager;
+ }
+
+ public DeployerClient getDeployerClient()
+ {
+ return getBundleManager().getDeployerClient();
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param root the location to deploy
+ * @param child the child to deploy
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ public Bundle addBundle(String root, String child) throws Exception
+ {
+ URL resourceRoot = getClass().getResource(root);
+ if (resourceRoot == null)
+ throw new AssertionFailedError("Resource not found: " + root);
+ URL childResource = new URL(resourceRoot, child);
+ AbstractBundleState bundleState = getBundleManager().installBundle(childResource);
+ return bundleState.getBundleInternal();
+ }
+
+ /**
+ * Create a bundle
+ *
+ * @param file the virtual file
+ * @return Bundle for the deployment
+ * @throws Exception for any error
+ */
+ public Bundle addBundle(VirtualFile file) throws Exception
+ {
+ AbstractBundleState bundleState = getBundleManager().installBundle(AbstractVFS.adapt(file));
+ return bundleState.getBundleInternal();
+ }
+
+ /**
+ * Remove a bundle
+ *
+ * @param bundle the bundle to remove
+ * @throws Exception for any error
+ */
+ public void uninstall(Bundle bundle) throws Exception
+ {
+ if (bundle.getState() != Bundle.UNINSTALLED)
+ {
+ AbstractDeployedBundleState bundleState = OSGiBundleState.assertBundleState(bundle);
+ getBundleManager().uninstallBundle(bundleState);
+ }
+ }
+
+ public DeploymentUnit getDeploymentUnit(Bundle bundle)
+ {
+ DeploymentUnit deploymentUnit = getBundleManager().getDeployment(bundle.getBundleId());
+ if (deploymentUnit == null)
+ throw new AssertionFailedError("Bundle not installed: " + bundle);
+ return deploymentUnit;
+ }
+
+ public VirtualFile assembleBundle(String name, String resources, Class<?>... packages) throws Exception
+ {
+ return assembleBundle(name, new String[] { resources }, packages);
+ }
+
+ public VirtualFile assembleBundle(String name, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
+ return assembledDirectory;
+ }
+
+ public Bundle deployBundle(String name, OSGiMetaData metaData, String resourcePath, Class<?>... packages) throws Exception
+ {
+ AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", new String[] { resourcePath }, packages);
+ return deployBundle(assembledDirectory, metaData);
+ }
+
+ public Bundle deployBundle(String name, OSGiMetaData metaData, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ AssembledDirectory assembledDirectory = createAssembledDirectory(name, "", resourcePaths, packages);
+ return deployBundle(assembledDirectory, metaData);
+ }
+
+ public Bundle deployBundle(VirtualFile virtualFile, OSGiMetaData metaData) throws Exception
+ {
+ Deployment deployment = createDeployment(virtualFile, metaData);
+ return deployBundle(deployment);
+ }
+
+ public Bundle deployBundle(String root, String child) throws Exception
+ {
+ URL resourceRoot = getClass().getResource(root);
+ if (resourceRoot == null)
+ throw new AssertionFailedError("Resource not found: " + root);
+ URL childResource = new URL(resourceRoot, child);
+ return deployBundle(childResource);
+ }
+
+ public Bundle deployBundle(URL url) throws Exception
+ {
+ // Get the root file
+ VirtualFile root;
+ try
+ {
+ root = VFS.getRoot(url);
+ }
+ catch (IOException e)
+ {
+ throw new BundleException("Invalid url=" + url, e);
+ }
+
+ return deployBundle(root);
+ }
+
+ public Bundle deployBundle(VirtualFile file) throws Exception
+ {
+ return deployBundle(file, null);
+ }
+
+ public Bundle deployBundle(Deployment deployment) throws Exception
+ {
+ DeployerClient deployerClient = getDeployerClient();
+ MainDeployerStructure deployerStructure = (MainDeployerStructure) deployerClient;
+ deployerClient.deploy(deployment);
+ try
+ {
+ DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
+ AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
+ if (bundleState == null)
+ throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
+
+ return bundleState.getBundleInternal();
+ }
+ catch (Exception e)
+ {
+ deployerClient.undeploy(deployment);
+ throw e;
+ }
+ }
+
+ public Deployment createDeployment(VirtualFile virtualFile) throws Exception
+ {
+ return createDeployment(virtualFile, null);
+ }
+
+ public Deployment createDeployment(VirtualFile virtualFile, OSGiMetaData metaData) throws Exception
+ {
+ return createDeployment(virtualFile, metaData, OSGiMetaData.class);
+ }
+
+ @SuppressWarnings({"unchecked"})
+ public <T> Deployment createDeployment(VirtualFile virtualFile, T metaData, Class<T> expectedType) throws Exception
+ {
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(virtualFile);
+ if (metaData != null)
+ {
+ if (expectedType == null)
+ expectedType = (Class<T>)metaData.getClass();
+
+ MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+ att.addAttachment(expectedType, metaData);
+ }
+ return deployment;
+ }
+
+ public AssembledDirectory createAssembledDirectory(String name, String rootName, String[] resourcePaths, Class<?>... packages) throws Exception
+ {
+ AssembledDirectory assembledDirectory = createAssembledDirectory(name, rootName);
+ if (resourcePaths != null)
+ {
+ for (String path : resourcePaths)
+ addPath(assembledDirectory, path, "");
+ }
+ if (packages != null)
+ {
+ for (Class<?> reference : packages)
+ addPackage(assembledDirectory, reference);
+ }
+ return assembledDirectory;
+ }
+
+ public AssembledDirectory createAssembledDirectory(String name) throws Exception
+ {
+ return createAssembledDirectory(name, "");
+ }
+
+ public AssembledDirectory createAssembledDirectory(String name, String rootName) throws Exception
+ {
+ return AssembledDirectory.createAssembledDirectory(name, rootName);
+ }
+
+ public void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
+ {
+ String packagePath = ClassLoaderUtils.packageNameToPath(reference.getName());
+ dir.addResources(reference, new String[] { packagePath + "/*.class" }, new String[0]);
+ }
+
+ public void addPath(final AssembledDirectory dir, String path, String name) throws Exception
+ {
+ URL url = getClass().getResource(path);
+ if (url == null)
+ throw new AssertionFailedError(path + " not found");
+
+ VirtualFile file = VFS.getVirtualFile(url, name);
+ // TODO - remove this filter after new VFS relase
+ SuffixesExcludeFilter noJars = new SuffixesExcludeFilter(JarUtils.getSuffixes());
+ dir.addPath(file, noJars);
+ }
+
+ public URL getBundleResource(Bundle bundle, String path)
+ {
+ return getDeploymentUnit(bundle).getResourceLoader().getResource(path);
+ }
+
+ public Enumeration<URL> getBundleResources(Bundle bundle, String path) throws Exception
+ {
+ return getDeploymentUnit(bundle).getResourceLoader().getResources(path);
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,1240 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.resolver;
-
-// $Id$
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.jboss.test.osgi.classloader.support.a.A;
-import org.jboss.virtual.VirtualFile;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * An abstract resolver test.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Nov-2009
- */
-public abstract class AbstractImportExportTest extends AbstractResolverTest
-{
- @Test
- public void testSimpleImport() throws Exception
- {
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testSimpleImportPackageFails() throws Exception
- {
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testExplicitBundleResolve() throws Exception
- {
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Only resolve BundleB
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(new Bundle[] { bundleB });
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class can be loaded
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testSelfImportPackage() throws Exception
- {
- // Bundle-SymbolicName: selfimport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/selfimport", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testVersionImportPackage() throws Exception
- {
- //Bundle-SymbolicName: packageimportversion
- //Import-Package: org.jboss.test.osgi.classloader.support.a;version="[0.0.0,1.0.0]"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportversion");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: packageexportversion100
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testVersionImportPackageFails() throws Exception
- {
- //Bundle-SymbolicName: packageimportversionfails
- //Import-Package: org.jboss.test.osgi.classloader.support.a;version="[3.0,4.0)"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportversionfails");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: packageexportversion100
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testOptionalImportPackage() throws Exception
- {
- //Bundle-SymbolicName: packageimportoptional
- //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testOptionalImportPackageWired() throws Exception
- {
- //Bundle-SymbolicName: packageimportoptional
- //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testOptionalImportPackageNotWired() throws Exception
- {
- //Bundle-SymbolicName: packageimportoptional
- //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class cannot be loaded from bundleA
- // because the wire could not be established when bundleA was resolved
- assertLoadFails(bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testBundleNameImportPackage() throws Exception
- {
- //Bundle-SymbolicName: bundlenameimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=simpleexport
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundlenameimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: simpleexport
- //Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testBundleNameImportPackageFails() throws Exception
- {
- //Bundle-SymbolicName: bundlenameimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=simpleexport
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundlenameimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: sigleton;singleton:=true
- //Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/singleton", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testBundleVersionImportPackage() throws Exception
- {
- //Bundle-SymbolicName: bundleversionimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[0.0.0,1.0.0)"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundleversionimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testBundleVersionImportPackageFails() throws Exception
- {
- //Bundle-SymbolicName: bundleversionimportfails
- //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[1.0.0,2.0.0)"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundleversionimportfails");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- // [TODO] require bundle visibility
- public void testRequireBundle() throws Exception
- {
- //Bundle-SymbolicName: requirebundle
- //Require-Bundle: simpleexport
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleFails() throws Exception
- {
- //Bundle-SymbolicName: requirebundle
- //Require-Bundle: simpleexport
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleOptional() throws Exception
- {
- //Bundle-SymbolicName: requirebundleoptional
- //Require-Bundle: simpleexport;resolution:=optional
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleoptional");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleVersion() throws Exception
- {
- //Bundle-SymbolicName: requirebundleversion
- //Require-Bundle: simpleexport;bundle-version="[0.0.0,1.0.0]"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversion");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleB, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleVersionFails() throws Exception
- {
- //Bundle-SymbolicName: versionrequirebundlefails
- //Require-Bundle: simpleexport;bundle-version="[1.0.0,2.0.0)"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversionfails");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoadFails(bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterResolved() throws Exception
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
-
- // Bundle-SymbolicName: simpleexportother
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
-
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleA, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterResolvedReverse() throws Exception
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
-
- // Bundle-SymbolicName: simpleexportother
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleB, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterHigherVersion() throws Exception
- {
- //Bundle-SymbolicName: packageexportversion100
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportversion100", A.class);
-
- //Bundle-SymbolicName: packageexportversion200
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion200", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleB, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterHigherVersionReverse() throws Exception
- {
- //Bundle-SymbolicName: packageexportversion200
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportversion200", A.class);
-
- //Bundle-SymbolicName: packageexportversion100
- //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleA, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterLowerId() throws Exception
- {
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
-
- // Bundle-SymbolicName: simpleexportother
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleA, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPreferredExporterLowerIdReverse() throws Exception
- {
- // Bundle-SymbolicName: simpleexportother
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexportother", A.class);
-
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
-
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- Bundle bundleC = framework.installBundle(fileC);
- try
- {
- allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleB, bundleB, A.class);
- assertLoaderBundle(bundleA, bundleC, A.class);
- }
- finally
- {
- bundleC.uninstall();
- }
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttribute() throws Exception
- {
- //Bundle-SymbolicName: packageexportattribute
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: simpleimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleA, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
-
- //Bundle-SymbolicName: packageimportattribute
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
- fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
- bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleA, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeFails() throws Exception
- {
- //Bundle-SymbolicName: packageexportattribute
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: packageimportattributefails
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB INSTALLED", Bundle.INSTALLED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoadFails(bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeMandatory() throws Exception
- {
- //Bundle-SymbolicName: packageexportattributemandatory
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: packageimportattribute
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoaderBundle(bundleA, bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeMandatoryFails() throws Exception
- {
- //Bundle-SymbolicName: packageexportattributemandatory
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- //Bundle-SymbolicName: simpleimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertFalse("Not all resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- assertEquals("BundleB INSTALLED", Bundle.INSTALLED, bundleB.getState());
-
- // Verify that the class load
- assertLoaderBundle(bundleA, bundleA, A.class);
- assertLoadFails(bundleB, A.class);
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testSystemPackageImport() throws Exception
- {
- //Bundle-SymbolicName: systempackageimport
- //Import-Package: org.osgi.framework;version=1.4
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/systempackageimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- // Resolve the installed bundles
- PackageAdmin packageAdmin = getPackageAdmin();
- boolean allResolved = packageAdmin.resolveBundles(null);
- assertTrue("All resolved", allResolved);
-
- // Verify bundle states
- assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,1240 @@
+/*
+ * 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.resolver;
+
+// $Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.classloader.support.a.A;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * An abstract resolver test.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 09-Nov-2009
+ */
+public abstract class AbstractImportExportTest extends AbstractResolverTest
+{
+ @Test
+ public void testSimpleImport() throws Exception
+ {
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testSimpleImportPackageFails() throws Exception
+ {
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testExplicitBundleResolve() throws Exception
+ {
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Only resolve BundleB
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(new Bundle[] { bundleB });
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class can be loaded
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testSelfImportPackage() throws Exception
+ {
+ // Bundle-SymbolicName: selfimport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/selfimport", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testVersionImportPackage() throws Exception
+ {
+ //Bundle-SymbolicName: packageimportversion
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;version="[0.0.0,1.0.0]"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportversion");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testVersionImportPackageFails() throws Exception
+ {
+ //Bundle-SymbolicName: packageimportversionfails
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;version="[3.0,4.0)"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportversionfails");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testOptionalImportPackage() throws Exception
+ {
+ //Bundle-SymbolicName: packageimportoptional
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testOptionalImportPackageWired() throws Exception
+ {
+ //Bundle-SymbolicName: packageimportoptional
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testOptionalImportPackageNotWired() throws Exception
+ {
+ //Bundle-SymbolicName: packageimportoptional
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;resolution:=optional
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageimportoptional");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class cannot be loaded from bundleA
+ // because the wire could not be established when bundleA was resolved
+ assertLoadFails(bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testBundleNameImportPackage() throws Exception
+ {
+ //Bundle-SymbolicName: bundlenameimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=simpleexport
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundlenameimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: simpleexport
+ //Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testBundleNameImportPackageFails() throws Exception
+ {
+ //Bundle-SymbolicName: bundlenameimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-symbolic-name=simpleexport
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundlenameimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: sigleton;singleton:=true
+ //Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/singleton", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testBundleVersionImportPackage() throws Exception
+ {
+ //Bundle-SymbolicName: bundleversionimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[0.0.0,1.0.0)"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundleversionimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testBundleVersionImportPackageFails() throws Exception
+ {
+ //Bundle-SymbolicName: bundleversionimportfails
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;bundle-version="[1.0.0,2.0.0)"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/bundleversionimportfails");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ // [TODO] require bundle visibility
+ public void testRequireBundle() throws Exception
+ {
+ //Bundle-SymbolicName: requirebundle
+ //Require-Bundle: simpleexport
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleFails() throws Exception
+ {
+ //Bundle-SymbolicName: requirebundle
+ //Require-Bundle: simpleexport
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleOptional() throws Exception
+ {
+ //Bundle-SymbolicName: requirebundleoptional
+ //Require-Bundle: simpleexport;resolution:=optional
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleoptional");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleVersion() throws Exception
+ {
+ //Bundle-SymbolicName: requirebundleversion
+ //Require-Bundle: simpleexport;bundle-version="[0.0.0,1.0.0]"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversion");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleB, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleVersionFails() throws Exception
+ {
+ //Bundle-SymbolicName: versionrequirebundlefails
+ //Require-Bundle: simpleexport;bundle-version="[1.0.0,2.0.0)"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversionfails");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA INSTALLED", Bundle.INSTALLED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoadFails(bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterResolved() throws Exception
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
+
+ // Bundle-SymbolicName: simpleexportother
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleA, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterResolvedReverse() throws Exception
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
+
+ // Bundle-SymbolicName: simpleexportother
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleB, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterHigherVersion() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportversion100", A.class);
+
+ //Bundle-SymbolicName: packageexportversion200
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion200", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleB, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterHigherVersionReverse() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportversion200
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=2.0.0
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportversion200", A.class);
+
+ //Bundle-SymbolicName: packageexportversion100
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;version=1.0.0
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageexportversion100", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleA, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterLowerId() throws Exception
+ {
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
+
+ // Bundle-SymbolicName: simpleexportother
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexportother", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleA, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPreferredExporterLowerIdReverse() throws Exception
+ {
+ // Bundle-SymbolicName: simpleexportother
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexportother", A.class);
+
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleexport", A.class);
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileC = assembleBundle("bundleC", "/bundles/resolver/simpleimport");
+
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ Bundle bundleC = framework.installBundle(fileC);
+ try
+ {
+ allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleC RESOLVED", Bundle.RESOLVED, bundleC.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleB, bundleB, A.class);
+ assertLoaderBundle(bundleA, bundleC, A.class);
+ }
+ finally
+ {
+ bundleC.uninstall();
+ }
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttribute() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportattribute
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: simpleimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleA, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+
+ //Bundle-SymbolicName: packageimportattribute
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
+ bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleA, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeFails() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportattribute
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: packageimportattributefails
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB INSTALLED", Bundle.INSTALLED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoadFails(bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeMandatory() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportattributemandatory
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: packageimportattribute
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB RESOLVED", Bundle.RESOLVED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoaderBundle(bundleA, bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeMandatoryFails() throws Exception
+ {
+ //Bundle-SymbolicName: packageexportattributemandatory
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ //Bundle-SymbolicName: simpleimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertFalse("Not all resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ assertEquals("BundleB INSTALLED", Bundle.INSTALLED, bundleB.getState());
+
+ // Verify that the class load
+ assertLoaderBundle(bundleA, bundleA, A.class);
+ assertLoadFails(bundleB, A.class);
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testSystemPackageImport() throws Exception
+ {
+ //Bundle-SymbolicName: systempackageimport
+ //Import-Package: org.osgi.framework;version=1.4
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/systempackageimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ // Resolve the installed bundles
+ PackageAdmin packageAdmin = getPackageAdmin();
+ boolean allResolved = packageAdmin.resolveBundles(null);
+ assertTrue("All resolved", allResolved);
+
+ // Verify bundle states
+ assertEquals("BundleA RESOLVED", Bundle.RESOLVED, bundleA.getState());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,450 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.resolver;
-
-// $Id$
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.osgi.framework.resolver.ExportPackage;
-import org.jboss.osgi.framework.resolver.ImportPackage;
-import org.jboss.osgi.framework.resolver.RequiredBundle;
-import org.jboss.osgi.framework.resolver.Resolver;
-import org.jboss.osgi.framework.resolver.ResolverBundle;
-import org.jboss.test.osgi.classloader.support.a.A;
-import org.jboss.virtual.VirtualFile;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * Test {@link Resolver} metadata.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Nov-2009
- */
-public class ResolverMetadataTest extends AbstractResolverTest
-{
- @Test
- public void testSimpleExport() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- // Bundle-SymbolicName: simpleexport
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- assertEquals(1, resolver.getBundles().size());
-
- ResolverBundle resBundleA = resolver.getBundle(bundleA.getSymbolicName(), null);
- assertNotNull("Resolvable not null", resBundleA);
-
- resBundleA = resolver.getBundle(bundleA.getSymbolicName(), bundleA.getVersion());
- assertNotNull("Resolvable not null", resBundleA);
-
- resBundleA = resolver.getBundle(bundleA);
- assertNotNull("Resolvable not null", resBundleA);
-
- assertNotNull(resBundleA.getBundle());
- assertEquals("simpleexport", resBundleA.getSymbolicName());
- assertEquals(Version.emptyVersion, resBundleA.getVersion());
-
- List<ExportPackage> exportPackages = resBundleA.getExportPackages();
- assertNotNull("ExportPackages not null", exportPackages);
- assertEquals(1, exportPackages.size());
-
- ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
- assertNotNull("ExportPackage not null", exportPackage);
- assertEquals("org.jboss.test.osgi.classloader.support.a", exportPackage.getName());
-
- assertEquals(Version.emptyVersion, exportPackage.getVersion());
- assertEquals(0, exportPackage.getUses().size());
- assertEquals(0, exportPackage.getMandatory().size());
- assertNull("Null includes", exportPackage.getIncludes());
- assertNull("Null excludes", exportPackage.getExcludes());
-
- List<ImportPackage> importPackages = resBundleA.getImportPackages();
- assertNotNull("ImportPackages not null", importPackages);
- assertEquals(0, importPackages.size());
-
- assertFalse("No sigleton", resBundleA.isSingleton());
- assertFalse("Not resolved", resBundleA.isResolved());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testSimpleImport() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- // Bundle-SymbolicName: simpleimport
- // Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
-
- List<ImportPackage> importPackages = resBundleA.getImportPackages();
- assertNotNull("ImportPackages not null", importPackages);
- assertEquals(1, importPackages.size());
-
- ImportPackage importPackage = resBundleA.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- assertNotNull("ImportPackage not null", importPackage);
- assertEquals("org.jboss.test.osgi.classloader.support.a", importPackage.getName());
-
- assertEquals("[0.0.0,?)", importPackage.getVersion().toString());
- assertNull("Null bundle-symbolic-name", importPackage.getBundleSymbolicName());
- assertNull("Null bundle-version", importPackage.getBundleVersion());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testSingleton() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- // Bundle-SymbolicName: singleton;singleton:=true
- // Export-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/singleton", A.class);
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- assertTrue("Sigleton", resBundleA.isSingleton());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundle() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: requirebundle
- //Require-Bundle: simpleexport
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
- assertEquals("RequiredBundles not null", 1, requiredBundles.size());
- RequiredBundle reqBundle = requiredBundles.get(0);
- assertEquals("simpleexport", reqBundle.getSymbolicName());
- assertNull("Null version", reqBundle.getVersion());
- assertFalse("Not optional", reqBundle.isOptional());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleOptional() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: requirebundle
- //Require-Bundle: simpleexport;resolution:=optional
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleoptional");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
- assertEquals("RequiredBundles not null", 1, requiredBundles.size());
- RequiredBundle reqBundle = requiredBundles.get(0);
- assertEquals("simpleexport", reqBundle.getSymbolicName());
- assertNull("Null version", reqBundle.getVersion());
- assertTrue("Resolution optional", reqBundle.isOptional());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testRequireBundleVersion() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: requirebundle
- //Require-Bundle: simpleexport;bundle-version="[0.0.0,1.0.0]"
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversion");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
- assertEquals("RequiredBundles not null", 1, requiredBundles.size());
- RequiredBundle reqBundle = requiredBundles.get(0);
- assertEquals("simpleexport", reqBundle.getSymbolicName());
- assertNotNull("Version not null", reqBundle.getVersion());
- assertFalse("Not optional", reqBundle.isOptional());
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttribute() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: packageexportattribute
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> exportAttributes = exportPackage.getAttributes();
- assertTrue("Contains attr", exportAttributes.contains("test"));
- assertEquals("x", exportPackage.getAttribute("test"));
-
- //Bundle-SymbolicName: simpleimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
-
- //Bundle-SymbolicName: packageimportattribute
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
- fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
- bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> importAttributes = importPackage.getAttributes();
- assertTrue("Contains attr", importAttributes.contains("test"));
- assertEquals("x", importPackage.getAttribute("test"));
- assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeFails() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: packageexportattribute
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> attributes = exportPackage.getAttributes();
- assertTrue("Contains attr", attributes.contains("test"));
- assertEquals("x", exportPackage.getAttribute("test"));
-
- //Bundle-SymbolicName: packageimportattributefails
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> importAttributes = importPackage.getAttributes();
- assertTrue("Contains attr", importAttributes.contains("test"));
- assertEquals("y", importPackage.getAttribute("test"));
- assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeMandatory() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: packageexportattributemandatory
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> attributes = exportPackage.getAttributes();
- assertTrue("Contains test", attributes.contains("test"));
- assertEquals("x", exportPackage.getAttribute("test"));
- Set<String> mandatory = exportPackage.getMandatory();
- assertTrue("Contains test", mandatory.contains("test"));
-
- //Bundle-SymbolicName: packageimportattribute
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> importAttributes = importPackage.getAttributes();
- assertTrue("Contains attr", importAttributes.contains("test"));
- assertEquals("x", importPackage.getAttribute("test"));
- assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-
- @Test
- public void testPackageAttributeMandatoryFails() throws Exception
- {
- Resolver resolver = getTestResolver();
- if (resolver == null)
- return;
-
- //Bundle-SymbolicName: packageexportattributemandatory
- //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
- VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory");
- Bundle bundleA = framework.installBundle(fileA);
- try
- {
- ResolverBundle resBundleA = resolver.getBundle(bundleA);
- ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> attributes = exportPackage.getAttributes();
- assertTrue("Contains test", attributes.contains("test"));
- assertEquals("x", exportPackage.getAttribute("test"));
- Set<String> mandatory = exportPackage.getMandatory();
- assertTrue("Contains test", mandatory.contains("test"));
-
- //Bundle-SymbolicName: simpleimport
- //Import-Package: org.jboss.test.osgi.classloader.support.a
- VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
- Bundle bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
-
- //Bundle-SymbolicName: packageimportattributefails
- //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
- fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
- bundleB = framework.installBundle(fileB);
- try
- {
- ResolverBundle resBundleB = resolver.getBundle(bundleB);
- ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
- Set<String> importAttributes = importPackage.getAttributes();
- assertTrue("Contains attr", importAttributes.contains("test"));
- assertEquals("y", importPackage.getAttribute("test"));
- assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
- }
- finally
- {
- bundleB.uninstall();
- }
- }
- finally
- {
- bundleA.uninstall();
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/testsuite/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,450 @@
+/*
+ * 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.resolver;
+
+// $Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Set;
+
+import org.jboss.osgi.framework.resolver.ExportPackage;
+import org.jboss.osgi.framework.resolver.ImportPackage;
+import org.jboss.osgi.framework.resolver.RequiredBundle;
+import org.jboss.osgi.framework.resolver.Resolver;
+import org.jboss.osgi.framework.resolver.ResolverBundle;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.test.osgi.classloader.support.a.A;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * Test {@link Resolver} metadata.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 09-Nov-2009
+ */
+public class ResolverMetadataTest extends AbstractResolverTest
+{
+ @Test
+ public void testSimpleExport() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ // Bundle-SymbolicName: simpleexport
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleexport", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ assertEquals(1, resolver.getBundles().size());
+
+ ResolverBundle resBundleA = resolver.getBundle(bundleA.getSymbolicName(), null);
+ assertNotNull("Resolvable not null", resBundleA);
+
+ resBundleA = resolver.getBundle(bundleA.getSymbolicName(), bundleA.getVersion());
+ assertNotNull("Resolvable not null", resBundleA);
+
+ resBundleA = resolver.getBundle(bundleA);
+ assertNotNull("Resolvable not null", resBundleA);
+
+ assertNotNull(resBundleA.getBundle());
+ assertEquals("simpleexport", resBundleA.getSymbolicName());
+ assertEquals(Version.emptyVersion, resBundleA.getVersion());
+
+ List<ExportPackage> exportPackages = resBundleA.getExportPackages();
+ assertNotNull("ExportPackages not null", exportPackages);
+ assertEquals(1, exportPackages.size());
+
+ ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
+ assertNotNull("ExportPackage not null", exportPackage);
+ assertEquals("org.jboss.test.osgi.classloader.support.a", exportPackage.getName());
+
+ assertEquals(Version.emptyVersion, exportPackage.getVersion());
+ assertEquals(0, exportPackage.getUses().size());
+ assertEquals(0, exportPackage.getMandatory().size());
+ assertNull("Null includes", exportPackage.getIncludes());
+ assertNull("Null excludes", exportPackage.getExcludes());
+
+ List<ImportPackage> importPackages = resBundleA.getImportPackages();
+ assertNotNull("ImportPackages not null", importPackages);
+ assertEquals(0, importPackages.size());
+
+ assertFalse("No sigleton", resBundleA.isSingleton());
+ assertFalse("Not resolved", resBundleA.isResolved());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testSimpleImport() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ // Bundle-SymbolicName: simpleimport
+ // Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/simpleimport");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+
+ List<ImportPackage> importPackages = resBundleA.getImportPackages();
+ assertNotNull("ImportPackages not null", importPackages);
+ assertEquals(1, importPackages.size());
+
+ ImportPackage importPackage = resBundleA.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ assertNotNull("ImportPackage not null", importPackage);
+ assertEquals("org.jboss.test.osgi.classloader.support.a", importPackage.getName());
+
+ assertEquals("[0.0.0,?)", importPackage.getVersion().toString());
+ assertNull("Null bundle-symbolic-name", importPackage.getBundleSymbolicName());
+ assertNull("Null bundle-version", importPackage.getBundleVersion());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testSingleton() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ // Bundle-SymbolicName: singleton;singleton:=true
+ // Export-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/singleton", A.class);
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ assertTrue("Sigleton", resBundleA.isSingleton());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundle() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: requirebundle
+ //Require-Bundle: simpleexport
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundle");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
+ assertEquals("RequiredBundles not null", 1, requiredBundles.size());
+ RequiredBundle reqBundle = requiredBundles.get(0);
+ assertEquals("simpleexport", reqBundle.getSymbolicName());
+ assertNull("Null version", reqBundle.getVersion());
+ assertFalse("Not optional", reqBundle.isOptional());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleOptional() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: requirebundle
+ //Require-Bundle: simpleexport;resolution:=optional
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleoptional");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
+ assertEquals("RequiredBundles not null", 1, requiredBundles.size());
+ RequiredBundle reqBundle = requiredBundles.get(0);
+ assertEquals("simpleexport", reqBundle.getSymbolicName());
+ assertNull("Null version", reqBundle.getVersion());
+ assertTrue("Resolution optional", reqBundle.isOptional());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testRequireBundleVersion() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: requirebundle
+ //Require-Bundle: simpleexport;bundle-version="[0.0.0,1.0.0]"
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/requirebundleversion");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ List<RequiredBundle> requiredBundles = resBundleA.getRequiredBundles();
+ assertEquals("RequiredBundles not null", 1, requiredBundles.size());
+ RequiredBundle reqBundle = requiredBundles.get(0);
+ assertEquals("simpleexport", reqBundle.getSymbolicName());
+ assertNotNull("Version not null", reqBundle.getVersion());
+ assertFalse("Not optional", reqBundle.isOptional());
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttribute() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: packageexportattribute
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> exportAttributes = exportPackage.getAttributes();
+ assertTrue("Contains attr", exportAttributes.contains("test"));
+ assertEquals("x", exportPackage.getAttribute("test"));
+
+ //Bundle-SymbolicName: simpleimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+
+ //Bundle-SymbolicName: packageimportattribute
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
+ bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> importAttributes = importPackage.getAttributes();
+ assertTrue("Contains attr", importAttributes.contains("test"));
+ assertEquals("x", importPackage.getAttribute("test"));
+ assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeFails() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: packageexportattribute
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattribute");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> attributes = exportPackage.getAttributes();
+ assertTrue("Contains attr", attributes.contains("test"));
+ assertEquals("x", exportPackage.getAttribute("test"));
+
+ //Bundle-SymbolicName: packageimportattributefails
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> importAttributes = importPackage.getAttributes();
+ assertTrue("Contains attr", importAttributes.contains("test"));
+ assertEquals("y", importPackage.getAttribute("test"));
+ assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeMandatory() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: packageexportattributemandatory
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> attributes = exportPackage.getAttributes();
+ assertTrue("Contains test", attributes.contains("test"));
+ assertEquals("x", exportPackage.getAttribute("test"));
+ Set<String> mandatory = exportPackage.getMandatory();
+ assertTrue("Contains test", mandatory.contains("test"));
+
+ //Bundle-SymbolicName: packageimportattribute
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=x
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattribute");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> importAttributes = importPackage.getAttributes();
+ assertTrue("Contains attr", importAttributes.contains("test"));
+ assertEquals("x", importPackage.getAttribute("test"));
+ assertTrue("Attribute match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+
+ @Test
+ public void testPackageAttributeMandatoryFails() throws Exception
+ {
+ Resolver resolver = getTestResolver();
+ if (resolver == null)
+ return;
+
+ //Bundle-SymbolicName: packageexportattributemandatory
+ //Export-Package: org.jboss.test.osgi.classloader.support.a;test=x;mandatory:=test
+ VirtualFile fileA = assembleBundle("bundleA", "/bundles/resolver/packageexportattributemandatory");
+ Bundle bundleA = framework.installBundle(fileA);
+ try
+ {
+ ResolverBundle resBundleA = resolver.getBundle(bundleA);
+ ExportPackage exportPackage = resBundleA.getExportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> attributes = exportPackage.getAttributes();
+ assertTrue("Contains test", attributes.contains("test"));
+ assertEquals("x", exportPackage.getAttribute("test"));
+ Set<String> mandatory = exportPackage.getMandatory();
+ assertTrue("Contains test", mandatory.contains("test"));
+
+ //Bundle-SymbolicName: simpleimport
+ //Import-Package: org.jboss.test.osgi.classloader.support.a
+ VirtualFile fileB = assembleBundle("bundleB", "/bundles/resolver/simpleimport");
+ Bundle bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+
+ //Bundle-SymbolicName: packageimportattributefails
+ //Import-Package: org.jboss.test.osgi.classloader.support.a;test=y
+ fileB = assembleBundle("bundleB", "/bundles/resolver/packageimportattributefails");
+ bundleB = framework.installBundle(fileB);
+ try
+ {
+ ResolverBundle resBundleB = resolver.getBundle(bundleB);
+ ImportPackage importPackage = resBundleB.getImportPackage("org.jboss.test.osgi.classloader.support.a");
+ Set<String> importAttributes = importPackage.getAttributes();
+ assertTrue("Contains attr", importAttributes.contains("test"));
+ assertEquals("y", importPackage.getAttribute("test"));
+ assertFalse("Attribute no match", exportPackage.matchAttributes(importPackage));
+ }
+ finally
+ {
+ bundleB.uninstall();
+ }
+ }
+ finally
+ {
+ bundleA.uninstall();
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21 (from rev 101768, projects/jboss-osgi/projects/runtime/framework/trunk/core)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/.classpath 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,10 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="src" path="src/main/java"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,371 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ====================================================================== -->
-<!-- -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- -->
-<!-- ====================================================================== -->
-
-<!-- $Id$ -->
-
-<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
-
-<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 Framework - Core</name>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
- <packaging>bundle</packaging>
-
- <parent>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework-parent</artifactId>
- <version>1.0.0.Alpha4-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.jboss.osgi.framework</groupId>
- <artifactId>jboss-osgi-framework-metadata</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-structure-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-jmx</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-aop-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployers</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployment</artifactId>
- </dependency>
-
- <!-- OSGi Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
-
- <!-- Test bundles dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-apache-xerces</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jmx</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jndi</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-reflect</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.web</groupId>
- <artifactId>pax-web-jetty-bundle</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testing</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>scripts/assembly-all.xml</descriptor>
- </descriptors>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
- <Bundle-Name>JBossOSGi Framework</Bundle-Name>
- <Bundle-Version>${version}</Bundle-Version>
- <Export-Package>
- org.osgi.framework;version="1.5",
- org.osgi.framework.launch;version="1.0",
- org.osgi.framework.hooks.service;version="1.0",
- org.osgi.service.packageadmin;version="1.2",
- org.osgi.service.startlevel;version="1.1",
- org.osgi.util.tracker;version="1.4"
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Xmx512m</argLine>
- <systemProperties>
- <property>
- <name>log4j.output.dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
- <value>bootstrap/jboss-osgi-bootstrap.xml</value>
- </property>
- <property>
- <name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
- </property>
- <property>
- <name>test.archive.directory</name>
- <value>${project.build.directory}/test-libs</value>
- </property>
- </systemProperties>
- <excludes>
- <!-- excludes listed here need to have a jira issue associated <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude> -->
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml (from rev 101772, projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/pom.xml 2010-03-03 14:45:40 UTC (rev 101775)
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
+
+<!-- $Id$ -->
+
+<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
+
+<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 Framework - VFS21</name>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-vfs21</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-parent</artifactId>
+ <version>1.0.0.Alpha4-SNAPSHOT</version>
+ </parent>
+
+ <!-- Properties -->
+ <properties>
+ <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
+ </properties>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-vfs</artifactId>
+ <version>${version.jboss.vfs}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ </plugins>
+ </build>
+</project>
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleCapability.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,160 +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.classloading;
-
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.ModuleCapability;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * OSGiBundleCapability.
- *
- * todo BundlePermission/PROVIDE
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleCapability extends ModuleCapability
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 2366716668262831380L;
-
- /** The bundle state */
- private AbstractBundleState bundleState;
-
- /**
- * Create a new OSGiBundleCapability
- *
- * @param bundleState the bundleState
- * @return the capability
- * @throws IllegalArgumentException for a null metadata
- */
- public static OSGiBundleCapability create(AbstractBundleState bundleState)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundleState");
-
- String symbolicName = bundleState.getSymbolicName();
- Version version = bundleState.getVersion();
-
- return new OSGiBundleCapability(symbolicName, version, bundleState);
- }
-
- /**
- * Create a new OSGiBundleCapability.
- *
- * @param name the name
- * @param version the version pass null of the default version
- * @param metadata the metadata
- * @throws IllegalArgumentException for a null name or requireBundle
- */
- public OSGiBundleCapability(String name, Version version, AbstractBundleState bundleState)
- {
- super(name, version);
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundleState");
- this.bundleState = bundleState;
- }
-
- /**
- * Get the metadata.
- *
- * @return the metadata.
- */
- public OSGiMetaData getMetaData()
- {
- return bundleState.getOSGiMetaData();
- }
-
- @Override
- public boolean resolves(Module reqModule, Requirement requirement)
- {
- if (super.resolves(reqModule, requirement) == false)
- return false;
- if (requirement instanceof OSGiBundleRequirement == false)
- return true;
-
- // Review its not clear to me from the spec whether attribute matching
- // beyond the version should work for require-bundle?
- Version ourVersion = Version.parseVersion(getMetaData().getBundleVersion());
- OSGiBundleRequirement bundleRequirement = (OSGiBundleRequirement)requirement;
- VersionRange requiredRange = bundleRequirement.getVersionRange();
- if (requiredRange.isInRange(ourVersion) == false)
- return false;
-
- ParameterizedAttribute ourParameters = getMetaData().getBundleParameters();
- if (ourParameters == null)
- return false;
-
- Map<String, Parameter> params = bundleRequirement.getAttributes();
- if (params != null && params.isEmpty() == false)
- {
- for (String name : params.keySet())
- {
- if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))
- continue;
-
- String reqValue = (String)params.get(name).getValue();
- String ourValue = ourParameters.getAttributeValue(name, String.class);
- if (reqValue.equals(ourValue) == false)
- return false;
- }
- }
-
- return true;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiBundleCapability == false)
- return false;
- if (super.equals(obj) == false)
- return false;
- OSGiBundleCapability other = (OSGiBundleCapability)obj;
- return getMetaData().equals(other.getMetaData());
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- ParameterizedAttribute parameters = getMetaData().getBundleParameters();
- if (parameters != null)
- {
- Map<String, Parameter> params = parameters.getAttributes();
- if (params != null && params.isEmpty() == false)
- buffer.append(" attributes=").append(params);
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiBundleRequirement.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,143 +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.classloading;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.ModuleRequirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
-import org.osgi.framework.Constants;
-
-/**
- * OSGiBundleRequirement.
- *
- * todo BundlePermission/REQUIRE
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleRequirement extends ModuleRequirement
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 4264597072894634275L;
-
- private String visibility;
- private String resolution;
- private Map<String, Parameter> attributes;
-
- /**
- * Create a new OSGiBundleRequirement.
- *
- * @param requireBundle the require bundle metadata
- * @return the requirement
- * @throws IllegalArgumentException for a null requireBundle
- */
- public static OSGiBundleRequirement create(ParameterizedAttribute requireBundle)
- {
- if (requireBundle == null)
- throw new IllegalArgumentException("Null require bundle");
-
- String name = requireBundle.getAttribute();
-
- AbstractVersionRange range = null;
- String version = requireBundle.getAttributeValue(Constants.BUNDLE_VERSION_ATTRIBUTE, String.class);
- if (version != null)
- range = (AbstractVersionRange)AbstractVersionRange.valueOf(version);
-
- String visibility = requireBundle.getDirectiveValue(Constants.VISIBILITY_DIRECTIVE, String.class);
- String resolution = requireBundle.getDirectiveValue(Constants.RESOLUTION_DIRECTIVE, String.class);
- Map<String, Parameter> attributes = requireBundle.getAttributes();
-
- return new OSGiBundleRequirement(name, range, visibility, resolution, attributes);
- }
-
- /**
- * Create a new bundle requirement.
- *
- * @param name the symbolic name of the required bundle
- * @param versionRange the version range of the required bundle
- */
- public static OSGiBundleRequirement create(String name, VersionRange versionRange)
- {
- return new OSGiBundleRequirement(name, versionRange, Constants.VISIBILITY_PRIVATE, Constants.RESOLUTION_MANDATORY, null);
- }
-
- /**
- * Create a new OSGiBundleRequirement.
- */
- private OSGiBundleRequirement(String name, VersionRange versionRange, String visDirective, String resDirective, Map<String, Parameter> attrMap)
- {
- super(name, versionRange);
-
- attributes = attrMap;
- if (attributes == null)
- attributes = new HashMap<String, Parameter>();
-
- visibility = visDirective;
- if (visibility == null)
- visibility = Constants.VISIBILITY_PRIVATE;
-
- resolution = resDirective;
- if (resolution == null)
- resolution = Constants.RESOLUTION_MANDATORY;
-
- if (Constants.VISIBILITY_REEXPORT.equals(visibility))
- setReExport(true);
-
- if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
- setOptional(true);
- }
-
- public Map<String, Parameter> getAttributes()
- {
- return Collections.unmodifiableMap(attributes);
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiBundleRequirement == false)
- return false;
- if (super.equals(obj) == false)
- return false;
-
- return true;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- super.toString(buffer);
- if (attributes.containsKey(Constants.VISIBILITY_DIRECTIVE) == false)
- buffer.append(Constants.VISIBILITY_DIRECTIVE + ":=" + visibility);
- if (attributes.containsKey(Constants.RESOLUTION_DIRECTIVE) == false)
- buffer.append(Constants.RESOLUTION_DIRECTIVE + ":=" + resolution);
- buffer.append(attributes);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoading.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoading.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoading.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,37 +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.classloading;
-
-// $Id$
-
-import org.jboss.classloading.spi.dependency.ClassLoading;
-
-/**
- * The ClassLoading for OSGi bundles.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 05-Jan-2010
- */
-public class OSGiClassLoading extends ClassLoading
-{
-
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoadingMetaData.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,146 +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.classloading;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
-import org.osgi.framework.Version;
-
-/**
- * An extension of {@link ClassLoadingMetaData} that captures OSGi specific
- * classloading metadata.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 08-Jan-2010
- */
-public class OSGiClassLoadingMetaData extends ClassLoadingMetaData
-{
- private static final long serialVersionUID = 1L;
-
- // 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;
- }
-
- public void setFragmentHost(FragmentHostMetaData fragmentHost)
- {
- this.fragmentHost = fragmentHost;
- }
-
- public List<OSGiClassLoadingMetaData> getAttachedClassLoadingMetaData()
- {
- return Collections.unmodifiableList(attachedFragments);
- }
-
- public void attachClassLoadingMetaData(OSGiClassLoadingMetaData fragment)
- {
- if (fragment == null)
- throw new IllegalArgumentException("Null fragment");
- if (fragment.getFragmentHost() == null)
- throw new IllegalArgumentException("Not a fragment: " + fragment);
- if (getFragmentHost() != null)
- throw new IllegalArgumentException("Cannot attach a fragment to a fragment: " + fragment);
-
- attachedFragments.add(fragment);
- }
-
- /**
- * 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
- {
- private String symbolicName;
- private Version bundleVersion;
- private String extension;
-
- public FragmentHostMetaData(String symbolicName)
- {
- if (symbolicName == null)
- throw new IllegalArgumentException("Null symbolicName");
-
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public Version getBundleVersion()
- {
- return bundleVersion;
- }
-
- public String getExtension()
- {
- return extension;
- }
-
- public void setExtension(String extension)
- {
- this.extension = extension;
- }
-
- public void setBundleVersion(Version bundleVersion)
- {
- this.bundleVersion = bundleVersion;
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiCoreClassFilter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiCoreClassFilter.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiCoreClassFilter.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,72 +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.classloading;
-
-// $Id: $
-
-import org.jboss.classloader.spi.filter.PackageClassFilter;
-
-/**
- * A class filter for OSGi Core packages.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 02-Feb-2010
- */
-public final class OSGiCoreClassFilter extends PackageClassFilter
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 5679852972501066041L;
-
- /** The singleton instance */
- public static OSGiCoreClassFilter INSTANCE = new OSGiCoreClassFilter();
-
- private OSGiCoreClassFilter()
- {
- super(getCorePackages());
- }
-
- public static String[] getCorePackages()
- {
- return new String[] {
- "org.osgi.framework",
- "org.osgi.framework.hooks",
- "org.osgi.framework.hooks.service",
- "org.osgi.framework.launch",
- "org.osgi.service.condpermadmin",
- "org.osgi.service.packageadmin",
- "org.osgi.service.permissionadmin",
- "org.osgi.service.startlevel",
- "org.osgi.service.url"
- };
- }
-
- public String toString()
- {
- return "OSGI_CORE";
- }
-
- @Override
- public void setIncludeJava(boolean includeJava)
- {
- throw new UnsupportedOperationException("Cannot modify OSGi Core Filter");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiModule.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,44 +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.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;
-
- public OSGiModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
- {
- super(unit);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageCapability.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,295 +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.classloading;
-
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.jboss.classloading.plugins.metadata.PackageCapability;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.metadata.Requirement;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-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.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.PackageAttribute;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
-import org.jboss.osgi.framework.plugins.ResolverPlugin;
-import org.jboss.osgi.framework.resolver.Resolver;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * OSGiPackageCapability.
- *
- * todo PackagePermission/EXPORT todo uses todo include/exclude
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiPackageCapability extends PackageCapability
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 3940667616588052822L;
-
- /** The bundle state */
- private AbstractBundleState bundleState;
-
- /** The export package */
- private PackageAttribute exportPackage;
-
- /** The mandatory attributes */
- private String[] mandatoryAttributes;
-
- /**
- * Create a new OSGiPackageCapability.
- *
- * @param bundleState the bundle state
- * @param exportPackage the export package metadata
- * @return the capability
- * @throws IllegalArgumentException for null metadata
- */
- @SuppressWarnings("deprecation")
- public static OSGiPackageCapability create(AbstractBundleState bundleState, PackageAttribute exportPackage)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle");
-
- String name = exportPackage.getAttribute();
- String versionString = exportPackage.getAttributeValue(Constants.VERSION_ATTRIBUTE, String.class);
-
- String oldVersionString = exportPackage.getAttributeValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (oldVersionString != null)
- {
- if (versionString != null && versionString.equals(oldVersionString) == false)
- throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
- + " of " + oldVersionString);
- if (versionString == null)
- versionString = oldVersionString;
- }
-
- Version version = null;
- if (versionString != null)
- {
- // Handle version strings with quotes
- if (versionString.startsWith("\"") && versionString.endsWith("\""))
- versionString = versionString.substring(1, versionString.length() - 1);
-
- version = Version.parseVersion(versionString);
- }
-
- OSGiPackageCapability capability = new OSGiPackageCapability(bundleState, name, version, exportPackage);
- capability.setSplitPackagePolicy(SplitPackagePolicy.First);
-
- return capability;
- }
-
- private OSGiPackageCapability(AbstractBundleState bundleState, String name, Version version, PackageAttribute exportPackage)
- {
- super(name, version);
- this.bundleState = bundleState;
- this.exportPackage = exportPackage;
-
- String mandatory = exportPackage.getDirectiveValue(Constants.MANDATORY_DIRECTIVE, String.class);
- if (mandatory != null)
- {
- StringTokenizer tokens = new StringTokenizer(mandatory, ",");
- mandatoryAttributes = new String[tokens.countTokens()];
- int i = 0;
- while (tokens.hasMoreTokens())
- mandatoryAttributes[i++] = tokens.nextToken();
- }
-
- if (exportPackage.getAttribute(Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE) != null)
- throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE + " on an Export-Package");
- if (exportPackage.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE) != null)
- throw new IllegalStateException("You cannot specify " + Constants.BUNDLE_VERSION_ATTRIBUTE + " on an Export-Package");
- }
-
- @Override
- public boolean resolves(Module reqModule, Requirement requirement)
- {
- if (super.resolves(reqModule, requirement) == false)
- return false;
- if (requirement instanceof OSGiPackageRequirement == false)
- return true;
-
- OSGiPackageRequirement osgiPackageRequirement = (OSGiPackageRequirement)requirement;
- if (matchPackageAttributes(osgiPackageRequirement) == false)
- return false;
-
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- Resolver bundleResolver = bundleManager.getOptionalPlugin(ResolverPlugin.class);
- if (bundleResolver != null)
- {
- // Get the bundle associated with the requirement
- String reqLocation = reqModule.getContextName();
- AbstractBundleState reqBundle = bundleManager.getBundleByLocation(reqLocation);
- if (reqBundle == null)
- throw new IllegalStateException("Cannot get bundle for: " + reqLocation);
-
- // Get the exporter for this requirement
- if (reqBundle instanceof OSGiBundleState)
- {
- String packageName = osgiPackageRequirement.getName();
- return bundleResolver.match(reqBundle, bundleState, packageName);
- }
- }
-
- return true;
- }
-
- /**
- * Get the Module associated with this capability
- *
- * @return the module
- */
- public Module getModule()
- {
- Module module = null;
- if (bundleState instanceof AbstractDeployedBundleState)
- {
- AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)bundleState;
- DeploymentUnit unit = depBundle.getDeploymentUnit();
- module = unit.getAttachment(Module.class);
- if (module == null)
- throw new IllegalStateException("Cannot obtain module from: " + bundleState);
- }
- return module;
- }
-
- @SuppressWarnings("deprecation")
- public boolean matchPackageAttributes(OSGiPackageRequirement packageRequirement)
- {
- String capPackageName = getName();
- String reqPackageName = packageRequirement.getName();
- if (capPackageName.equals(reqPackageName) == false)
- return false;
-
- VersionRange reqVersionRange = packageRequirement.getVersionRange();
- Object capVersion = getVersion();
- if (reqVersionRange.isInRange(capVersion) == false)
- return false;
-
- OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
- PackageAttribute capParameters = exportPackage;
- PackageAttribute reqParameters = packageRequirement.getPackageMetaData();
-
- boolean validMatch = true;
-
- // Check all the manadatory attributes are present
- if (validMatch == true && mandatoryAttributes != null)
- {
- for (String mand : mandatoryAttributes)
- {
- Parameter reqAttributeValue = reqParameters.getAttribute(mand);
- if (reqParameters == null || reqAttributeValue == null)
- {
- validMatch = false;
- break;
- }
- }
- }
-
- if (validMatch == true && reqParameters != null)
- {
- Map<String, Parameter> params = reqParameters.getAttributes();
- if (params != null && params.isEmpty() == false)
- {
- for (String name : params.keySet())
- {
- String otherValue = reqParameters.getAttributeValue(name, String.class);
- String ourValue = capParameters.getAttributeValue(name, String.class);
-
- if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(name))
- {
- if (otherValue.equals(osgiMetaData.getBundleSymbolicName()) == false)
- validMatch = false;
- }
- else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(name))
- {
- VersionRange range = (VersionRange)AbstractVersionRange.valueOf(otherValue);
- if (range.isInRange(osgiMetaData.getBundleVersion()) == false)
- validMatch = false;
- }
- else if (Constants.PACKAGE_SPECIFICATION_VERSION.equals(name) || Constants.VERSION_ATTRIBUTE.equals(name))
- {
- continue;
- }
- else
- {
- if (ourValue == null || ourValue.equals(otherValue) == false)
- validMatch = false;
- }
-
- if (validMatch == false)
- break;
- }
- }
- }
-
- return validMatch;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiPackageCapability == false)
- return false;
- if (super.equals(obj) == false)
- return false;
-
- return true;
- }
-
- private String shortString;
-
- public String toShortString()
- {
- if (shortString == null)
- {
- StringBuffer buffer = new StringBuffer(bundleState.getCanonicalName() + "[" + getName());
- Map<String, Parameter> attributes = exportPackage.getAttributes();
- Map<String, Parameter> directives = exportPackage.getDirectives();
- for (Map.Entry<String, Parameter> entry : directives.entrySet())
- buffer.append(";" + entry.getKey() + ":=" + entry.getValue().getValue());
- for (Map.Entry<String, Parameter> entry : attributes.entrySet())
- buffer.append(";" + entry.getKey() + "=" + entry.getValue().getValue());
- buffer.append("]");
- shortString = buffer.toString();
- }
- return shortString;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- buffer.append(toShortString());
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/classloading/OSGiPackageRequirement.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,182 +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.classloading;
-
-import java.util.Map;
-
-import org.jboss.classloading.plugins.metadata.PackageRequirement;
-import org.jboss.classloading.spi.dependency.Module;
-import org.jboss.classloading.spi.version.VersionRange;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.metadata.PackageAttribute;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
-import org.osgi.framework.Constants;
-
-/**
- * OSGiPackageRequirement.
- *
- * todo PackagePermission/IMPORT
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiPackageRequirement extends PackageRequirement
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 5109907232396093061L;
-
- /** The bundle state */
- private AbstractBundleState bundleState;
-
- /** The attributes */
- private PackageAttribute requirePackage;
-
- /**
- * Create a new OSGiPackageRequirement.
- *
- * @param bundleState the bundle state
- * @param requirePackage the require package metadata
- * @return the requirement
- * @throws IllegalArgumentException for a null requirePackage
- */
- @SuppressWarnings("deprecation")
- public static OSGiPackageRequirement create(AbstractBundleState bundleState, PackageAttribute requirePackage)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle");
- if (requirePackage == null)
- throw new IllegalArgumentException("Null require package");
-
- String name = requirePackage.getAttribute();
-
- AbstractVersionRange range = null;
- String versionString = requirePackage.getAttributeValue(Constants.VERSION_ATTRIBUTE, String.class);
- if (versionString != null)
- {
- range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
- String oldVersionString = requirePackage.getAttributeValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (oldVersionString != null && oldVersionString.equals(versionString) == false)
- throw new IllegalStateException(Constants.VERSION_ATTRIBUTE + " of " + versionString + " does not match " + Constants.PACKAGE_SPECIFICATION_VERSION
- + " of " + oldVersionString);
- }
- else
- {
- versionString = requirePackage.getAttributeValue(Constants.PACKAGE_SPECIFICATION_VERSION, String.class);
- if (versionString != null)
- range = (AbstractVersionRange)AbstractVersionRange.valueOf(versionString);
- }
-
- return new OSGiPackageRequirement(bundleState, name, range, requirePackage);
- }
-
- /**
- * Create a new OSGiPackageRequirement.
- *
- * @param bundleState the bundleState
- * @param name the name
- * @param versionRange the version range - pass null for all versions
- * @param requirePackage the require package metadata
- * @throws IllegalArgumentException for a null name or requirePackage
- */
- public OSGiPackageRequirement(AbstractBundleState bundleState, String name, VersionRange versionRange, PackageAttribute requirePackage)
- {
- super(name, versionRange);
- this.bundleState = bundleState;
-
- if (requirePackage != null)
- {
- this.requirePackage = requirePackage;
- String resolution = requirePackage.getDirectiveValue(Constants.RESOLUTION_DIRECTIVE, String.class);
- if (Constants.RESOLUTION_OPTIONAL.equals(resolution))
- setOptional(true);
- }
- }
-
- /**
- * Get the requirePackage metadata.
- *
- * @return the requirePackage.
- */
- public PackageAttribute getPackageMetaData()
- {
- return requirePackage;
- }
-
- /**
- * Get the Module associated with this requirement
- *
- * @return the module
- */
- public Module getModule()
- {
- Module module = null;
- if (bundleState instanceof AbstractDeployedBundleState)
- {
- AbstractDeployedBundleState depBundle = (AbstractDeployedBundleState)bundleState;
- DeploymentUnit unit = depBundle.getDeploymentUnit();
- module = unit.getAttachment(Module.class);
- if (module == null)
- throw new IllegalStateException("Cannot obtain module from: " + bundleState);
- }
- return module;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof OSGiPackageRequirement == false)
- return false;
- if (super.equals(obj) == false)
- return false;
-
- return true;
- }
-
- private String shortString;
- public String toShortString()
- {
- if (shortString == null)
- {
- StringBuffer buffer = new StringBuffer(bundleState.getCanonicalName() + "[" + getName());
- Map<String, Parameter> attributes = requirePackage.getAttributes();
- Map<String, Parameter> directives = requirePackage.getDirectives();
- for (Map.Entry<String, Parameter> entry : directives.entrySet())
- buffer.append(";" + entry.getKey() + ":=" + entry.getValue().getValue());
- for (Map.Entry<String, Parameter> entry : attributes.entrySet())
- buffer.append(";" + entry.getKey() + "=" + entry.getValue().getValue());
- buffer.append("]");
- shortString = buffer.toString();
- }
- return shortString;
- }
-
- @Override
- protected void toString(StringBuffer buffer)
- {
- buffer.append(toShortString());
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/AbstractOSGiClassLoadingDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,152 +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.util.List;
-
-import org.jboss.classloader.spi.ClassLoaderDomain;
-import org.jboss.classloading.spi.metadata.CapabilitiesMetaData;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.classloading.spi.metadata.RequirementsMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-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.classloading.OSGiBundleCapability;
-import org.jboss.osgi.framework.classloading.OSGiBundleRequirement;
-import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
-import org.jboss.osgi.framework.classloading.OSGiPackageCapability;
-import org.jboss.osgi.framework.classloading.OSGiPackageRequirement;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.PackageAttribute;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.plugins.SystemPackagesPlugin;
-
-/**
- * An abstract OSGi classloading deployer, that maps {@link OSGiMetaData} into {@link ClassLoadingMetaData}.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 07-Jan-2010
- */
-public class AbstractOSGiClassLoadingDeployer extends AbstractSimpleRealDeployer<OSGiMetaData>
-{
- private ClassLoaderDomain domain;
- private ClassLoaderFactory factory;
-
- public AbstractOSGiClassLoadingDeployer()
- {
- super(OSGiMetaData.class);
- addInput(AbstractBundleState.class);
- setOutput(ClassLoadingMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
- }
-
- public void setDomain(ClassLoaderDomain domain)
- {
- this.domain = domain;
- }
-
- public void setFactory(ClassLoaderFactory factory)
- {
- this.factory = factory;
- }
-
- @Override
- public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
- {
- if (unit.isAttachmentPresent(ClassLoadingMetaData.class))
- return;
-
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState == null)
- throw new IllegalStateException("No bundle state");
-
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
-
- OSGiClassLoadingMetaData classLoadingMetaData = new OSGiClassLoadingMetaData();
- classLoadingMetaData.setName(bundleState.getSymbolicName());
- classLoadingMetaData.setVersion(bundleState.getVersion());
- classLoadingMetaData.setDomain(domain != null ? domain.getName() : null);
-
- CapabilitiesMetaData capabilities = classLoadingMetaData.getCapabilities();
- RequirementsMetaData requirements = classLoadingMetaData.getRequirements();
-
- OSGiBundleCapability bundleCapability = OSGiBundleCapability.create(bundleState);
- capabilities.addCapability(bundleCapability);
-
- // Required Bundles
- List<ParameterizedAttribute> requireBundles = osgiMetaData.getRequireBundles();
- if (requireBundles != null && requireBundles.isEmpty() == false)
- {
- for (ParameterizedAttribute requireBundle : requireBundles)
- {
- OSGiBundleRequirement requirement = OSGiBundleRequirement.create(requireBundle);
- requirements.addRequirement(requirement);
- }
- }
-
- // Export Packages
- List<PackageAttribute> exported = osgiMetaData.getExportPackages();
- if (exported != null && exported.isEmpty() == false)
- {
- for (PackageAttribute packageAttribute : exported)
- {
- OSGiPackageCapability packageCapability = OSGiPackageCapability.create(bundleState, packageAttribute);
- capabilities.addCapability(packageCapability);
- }
- }
-
- // Import Packages
- List<PackageAttribute> imported = osgiMetaData.getImportPackages();
- if (imported != null && imported.isEmpty() == false)
- {
- SystemPackagesPlugin syspackPlugin = bundleManager.getPlugin(SystemPackagesPlugin.class);
- for (PackageAttribute packageAttribute : imported)
- {
- String packageName = packageAttribute.getAttribute();
-
- // [TODO] Should system packages be added as capabilities?
- boolean isSystemPackage = syspackPlugin.isSystemPackage(packageName);
- if (isSystemPackage == false)
- {
- OSGiPackageRequirement requirement = OSGiPackageRequirement.create(bundleState, packageAttribute);
- requirements.addRequirement(requirement);
- }
- }
- }
-
- unit.addAttachment(ClassLoadingMetaData.class, classLoadingMetaData);
-
- // AnnotationMetaDataDeployer.ANNOTATION_META_DATA_COMPLETE
- unit.addAttachment("org.jboss.deployment.annotation.metadata.complete", Boolean.TRUE);
-
- // Add the OSGi ClassLoaderFactory if configured
- if (factory != null)
- unit.addAttachment(ClassLoaderFactory.class, factory);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleActivatorDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,76 +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;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.osgi.framework.BundleException;
-
-/**
- * OSGiBundleActivatorDeployer.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleActivatorDeployer extends AbstractSimpleRealDeployer<OSGiBundleState>
-{
- public OSGiBundleActivatorDeployer()
- {
- super(OSGiBundleState.class);
- setTopLevelOnly(true);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, OSGiBundleState bundleState) throws DeploymentException
- {
- try
- {
- bundleState.startInternal();
- }
- catch (BundleException ex)
- {
- // We do not rethrow this exception to the deployer framework.
- // An exception during Bundle.start() is regarded as a normal deployment condition and handeled internally by the OSGi layer.
- // The OSGiBundleManager picks up this BundleException and rethrows it if available.
- unit.addAttachment(BundleException.class, ex);
- }
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, OSGiBundleState bundleState)
- {
- try
- {
- bundleState.stopInternal();
- }
- catch (BundleException ex)
- {
- // We do not rethrow this exception to the deployer framework.
- // An exception during Bundle.start() is regarded as a normal deployment condition and handeled internally by the OSGi layer.
- // The OSGiBundleManager picks up this BundleException and rethrows it if available.
- unit.addAttachment(BundleException.class, ex);
- }
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleClassLoadingDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,53 +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 org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-
-/**
- * An OSGi classloading deployer, that maps osgi metadata into classloading metadata
- * for non-fragment bundles.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleClassLoadingDeployer extends AbstractOSGiClassLoadingDeployer
-{
- @Override
- public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
- {
- super.deploy(unit, osgiMetaData);
-
- // Return if this is not a real bundle (i.e. a fragment)
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState.isFragment())
- return;
-
- // nothing special to do
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateCreateDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,66 +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;
-
-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.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-
-/**
- * A deployer that creates the bundle state through the bundle manager.
- *
- * The bundle is not yet INSTALLED.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- * @author Thomas.Diesler(a)jboss.com
- */
-public class OSGiBundleStateCreateDeployer extends AbstractRealDeployer
-{
- /** The bundle manager */
- protected OSGiBundleManager bundleManager;
-
- public OSGiBundleStateCreateDeployer(OSGiBundleManager bundleManager)
- {
- if (bundleManager == null)
- throw new IllegalArgumentException("Null bundle manager");
- this.bundleManager = bundleManager;
-
- setInput(OSGiMetaData.class);
- setOutput(AbstractBundleState.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
- }
-
- @Override
- public void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- unit.setRequiredStage(DeploymentStages.DESCRIBE);
-
- // Create the bundle state
- bundleManager.addDeployment(unit);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateInstallDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,65 +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;
-
-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.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * A deployer that adds the bundle state to the bundle manager.
- *
- * This causes the bundle to get INSTALLED.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Feb-2010
- */
-public class OSGiBundleStateInstallDeployer extends AbstractSimpleRealDeployer<AbstractBundleState>
-{
- public OSGiBundleStateInstallDeployer()
- {
- super(AbstractBundleState.class);
- addInput(ClassLoadingMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, AbstractBundleState bundleState) throws DeploymentException
- {
- // Add the bundle to the manager when it is metadata complete
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- bundleManager.addBundle(bundleState);
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, AbstractBundleState bundleState)
- {
- // Remove the bundle from the manager
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- bundleManager.removeBundle(bundleState);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateResolveDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateResolveDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiBundleStateResolveDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,59 +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;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-import org.jboss.osgi.framework.bundle.OSGiFragmentState;
-import org.osgi.framework.Bundle;
-
-/**
- * A deployer that sets the bundle state to RESOLVED when the ClassLoader becomes available.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 24-Feb-2010
- */
-public class OSGiBundleStateResolveDeployer extends AbstractSimpleRealDeployer<OSGiBundleState>
-{
- // The relative order at which to change the bindle state to RESOLVED
- static final int RELATIVE_ORDER = 200;
-
- public OSGiBundleStateResolveDeployer()
- {
- super(OSGiBundleState.class);
- setStage(DeploymentStages.CLASSLOADER);
- setRelativeOrder(RELATIVE_ORDER);
- setTopLevelOnly(true);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, OSGiBundleState bundleState) throws DeploymentException
- {
- // Change the bundle state to RESOLVED
- bundleState.changeState(Bundle.RESOLVED);
- for (OSGiFragmentState fragment : bundleState.getAttachedFragments())
- fragment.changeState(Bundle.RESOLVED);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiContextTrackerDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiContextTrackerDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiContextTrackerDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,55 +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;
-
-import org.jboss.dependency.spi.tracker.ContextTracker;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.OSGiBundleState;
-
-/**
- * Add context tracker to deployment.
- *
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-public class OSGiContextTrackerDeployer extends AbstractSimpleRealDeployer<OSGiBundleState>
-{
- public OSGiContextTrackerDeployer()
- {
- super(OSGiBundleState.class);
- setStage(DeploymentStages.POST_PARSE);
- }
-
- public void deploy(DeploymentUnit unit, OSGiBundleState deployment) throws DeploymentException
- {
- // add it to metadata so other non-osgi pieces can use it
- unit.getMutableMetaData().addMetaData(deployment, ContextTracker.class);
- }
-
- @Override
- public void undeploy(DeploymentUnit unit, OSGiBundleState deployment)
- {
- unit.getMutableMetaData().removeMetaData(ContextTracker.class);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiDeployersWrapper.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,211 +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;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-import org.jboss.deployers.client.spi.main.MainDeployer;
-import org.jboss.deployers.plugins.main.MainDeployerImpl;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.Deployers;
-import org.jboss.deployers.spi.deployer.DeploymentStage;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentContext;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.managed.api.ManagedObject;
-import org.jboss.osgi.deployment.deployer.Deployment;
-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.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * A Deployers implementation that wraps the deployers that are associated with the MainDeployer.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 04-Sep-2009
- */
-public class OSGiDeployersWrapper implements Deployers
-{
- /** The log */
- private static final Logger log = Logger.getLogger(OSGiDeployersWrapper.class);
-
- private MainDeployer mainDeployer;
- private Deployers deployers;
- private OSGiBundleManager bundleManager;
- private PackageAdmin packageAdmin;
-
- /** The list of unresolved bundles */
- private List<OSGiBundleState> unresolvedBundles = new CopyOnWriteArrayList<OSGiBundleState>();
-
- public OSGiDeployersWrapper(MainDeployer mainDeployer, OSGiBundleManager bundleManager)
- {
- if (bundleManager == null)
- throw new IllegalArgumentException("Null bundleManager");
- if (mainDeployer instanceof MainDeployerImpl == false)
- throw new IllegalStateException("Cannot instrument: " + mainDeployer);
-
- this.mainDeployer = mainDeployer;
- this.bundleManager = bundleManager;
-
- // Swap the deployers implementation
- MainDeployerImpl mainDeployerImpl = (MainDeployerImpl)mainDeployer;
- this.deployers = mainDeployerImpl.getDeployers();
- mainDeployerImpl.setDeployers(this);
- }
-
- private PackageAdmin getPackageAdmin()
- {
- if (packageAdmin == null)
- {
- BundleContext sysContext = bundleManager.getSystemContext();
- ServiceReference sref = sysContext.getServiceReference(PackageAdmin.class.getName());
- if (sref == null)
- throw new IllegalStateException("Cannot obtain PackageAdmin");
-
- packageAdmin = (PackageAdmin)sysContext.getService(sref);
- }
- return packageAdmin;
- }
-
- public void process(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
- {
- // Delegate to the original deployers
- deployers.process(deploy, undeploy);
-
- // OSGi bundles resolve phase
- afterDeployersProcess(deploy, undeploy);
- }
-
- private void afterDeployersProcess(List<DeploymentContext> deploy, List<DeploymentContext> undeploy)
- {
- // Process undeploy contexts
- if (undeploy != null)
- {
- for (DeploymentContext context : undeploy)
- {
- DeploymentUnit unit = context.getDeploymentUnit();
- AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
- if (bundle != null)
- {
- unresolvedBundles.remove(bundle);
- }
- }
- }
-
- // Process deploy contexts
- if (deploy != null)
- {
- // Collect unresolved bundles
- for (DeploymentContext context : deploy)
- {
- DeploymentUnit unit = context.getDeploymentUnit();
- AbstractBundleState bundle = unit.getAttachment(AbstractBundleState.class);
- if (bundle == null || bundle.isFragment())
- continue;
-
- Deployment dep = unit.getAttachment(Deployment.class);
- boolean autoStart = (dep != null ? dep.isAutoStart() : true);
-
- if (autoStart == true && bundle.getState() == Bundle.INSTALLED)
- {
- unresolvedBundles.add(0, (OSGiBundleState)bundle);
- }
- }
-
- // Try to resolve all unresolved bundles
- if (unresolvedBundles.isEmpty() == false)
- {
- OSGiBundleState[] unresolved = new OSGiBundleState[unresolvedBundles.size()];
- unresolvedBundles.toArray(unresolved);
-
- // Use PackageAdmin to resolve the bundles
- getPackageAdmin().resolveBundles(unresolved);
-
- for (AbstractDeployedBundleState aux : unresolved)
- {
- if (aux.getState() != Bundle.RESOLVED)
- log.info("Unresolved: " + aux);
-
- if (aux.getState() == Bundle.RESOLVED)
- {
- unresolvedBundles.remove(aux);
-
- try
- {
- // When resolved progress to INSTALLED
- String name = aux.getDeploymentUnit().getName();
- mainDeployer.change(name, DeploymentStages.INSTALLED);
- }
- catch (DeploymentException ex)
- {
- log.error(ex);
- }
- }
- }
- }
- }
- }
-
- public void change(DeploymentContext context, DeploymentStage stage) throws DeploymentException
- {
- deployers.change(context, stage);
- }
-
- public void checkComplete(DeploymentContext... contexts) throws DeploymentException
- {
- deployers.checkComplete(contexts);
- }
-
- public void checkComplete(Collection<DeploymentContext> errors, Collection<org.jboss.deployers.client.spi.Deployment> missingDeployer) throws DeploymentException
- {
- deployers.checkComplete(errors, missingDeployer);
- }
-
- public void checkStructureComplete(DeploymentContext... contexts) throws DeploymentException
- {
- deployers.checkStructureComplete(contexts);
- }
-
- public DeploymentStage getDeploymentStage(DeploymentContext context) throws DeploymentException
- {
- return deployers.getDeploymentStage(context);
- }
-
- public Map<String, ManagedObject> getManagedObjects(DeploymentContext context) throws DeploymentException
- {
- return deployers.getManagedObjects(context);
- }
-
- public void shutdown()
- {
- deployers.shutdown();
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentClassLoadingDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,80 +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 org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.framework.bundle.AbstractBundleState;
-import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData;
-import org.jboss.osgi.framework.classloading.OSGiClassLoadingMetaData.FragmentHostMetaData;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * An OSGi classloading deployer, that maps osgi metadata into classloading metadata
- * for fragment bundles.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 07-Jan-2010
- */
-public class OSGiFragmentClassLoadingDeployer extends AbstractOSGiClassLoadingDeployer
-{
- @Override
- public void deploy(DeploymentUnit unit, OSGiMetaData osgiMetaData) throws DeploymentException
- {
- super.deploy(unit, osgiMetaData);
-
- // Return if this is not a bundle fragment
- AbstractBundleState bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState.isFragment() == false)
- return;
-
- OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)unit.getAttachment(ClassLoadingMetaData.class);
-
- // Initialize the Fragment-Host
- ParameterizedAttribute hostAttr = osgiMetaData.getFragmentHost();
- FragmentHostMetaData fragmentHost = new FragmentHostMetaData(hostAttr.getAttribute());
- classLoadingMetaData.setFragmentHost(fragmentHost);
-
- Parameter bundleVersionAttr = hostAttr.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE);
- if (bundleVersionAttr != null)
- fragmentHost.setBundleVersion((Version)bundleVersionAttr.getValue());
-
- Parameter extensionDirective = hostAttr.getDirective(Constants.EXTENSION_DIRECTIVE);
- if (extensionDirective != null)
- fragmentHost.setExtension((String)extensionDirective.getValue());
-
- // TODO Modify the CL metadata of the host such that eventually the CL policy
- // contains a DelegateLoader for the attached fragment
-
- // Adding the fragment as an OSGiBundleRequirement to the host does not work because
- // those requirements end up as DependencyItems already during the INSTALL phase.
- // Remember to do equivalent code in OSGiBundleClassLoadingDeployer
- // in case the fragment gets installed before the host.
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,66 +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;
-
-import org.jboss.classloading.spi.dependency.policy.ClassLoaderPolicyModule;
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-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
-{
- /* [TODO] We don't need to overwrite deploy if the base class can handle an already attached Module
- public void deploy(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
- {
- // If there is no module attached proceed as normal
- Module module = unit.getAttachment(Module.class);
- if (module == null)
- {
- super.deploy(unit, metaData);
- return;
- }
-
- // If there is already a module attached and this is an OSGi deployment
- // remove the old module and create a new OSGiModule
- if (metaData instanceof OSGiClassLoadingMetaData)
- {
- ClassLoading classLoading = getClassLoading();
- classLoading.removeModule(module);
- unit.removeAttachment(Module.class);
- super.deploy(unit, metaData);
- }
- }
- */
-
- @Override
- protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
- {
- return new OSGiModule(unit, metaData);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiModuleDeployerTempWorkaround.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,70 +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;
-
-import org.jboss.classloading.spi.dependency.ClassLoading;
-import org.jboss.classloading.spi.dependency.Module;
-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.OSGiClassLoadingMetaData;
-import org.jboss.osgi.framework.classloading.OSGiModule;
-
-/**
- * [TODO] Remove this deployer when the VFSClassLoaderDescribeDeployer
- * suports an already attached Module.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision: 100143 $
- */
-public class OSGiModuleDeployerTempWorkaround extends VFSClassLoaderDescribeDeployer
-{
- public OSGiModuleDeployerTempWorkaround()
- {
- // Make sure we come after the ClassLoaderDescribeDeployer
- setInput(Module.class);
- }
-
- @Override
- public void deploy(DeploymentUnit unit, ClassLoadingMetaData metaData) throws DeploymentException
- {
- // If there is already a module attached and this is an OSGi deployment
- // remove the old module and create a new OSGiModule
- if (metaData instanceof OSGiClassLoadingMetaData)
- {
- Module module = unit.removeAttachment(Module.class);
- ClassLoading classLoading = getClassLoading();
- classLoading.removeModule(module);
- unit.removeAttachment(Module.class);
- super.deploy(unit, metaData);
- }
- }
-
- @Override
- protected ClassLoaderPolicyModule createModule(DeploymentUnit unit, ClassLoadingMetaData metaData)
- {
- OSGiModule module = new OSGiModule(unit, metaData);
- return module;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/vfs21/src/main/java/org/jboss/osgi/framework/deployers/OSGiNativeCodeMetaDataDeployer.java 2010-03-03 14:45:40 UTC (rev 101775)
@@ -1,264 +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.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-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.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.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.Parameter;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.osgi.framework.Constants;
-
-/**
- * A deployer that takes care of loading native code libraries.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 19-Dec-2009
- */
-public class OSGiNativeCodeMetaDataDeployer extends AbstractRealDeployer
-{
- /** Maps an alias to an OSGi processor name */
- private static Map<String, String> processorAlias = new HashMap<String, String>();
- static
- {
- processorAlias.put("pentium", "x86");
- processorAlias.put("i386", "x86");
- processorAlias.put("i486", "x86");
- processorAlias.put("i586", "x86");
- processorAlias.put("i686", "x86");
- processorAlias.put("amd64", "x86-64");
- processorAlias.put("em64t", "x86-64");
- processorAlias.put("x86_64", "x86-64");
- }
-
- /** Maps an alias to an OSGi osname */
- private static Map<String, String> osAlias = new HashMap<String, String>();
- static
- {
- osAlias.put("SymbianOS", "Epoc32");
- osAlias.put("hp-ux", "HPUX");
- osAlias.put("Mac OS", "MacOS");
- osAlias.put("Mac OS X", "MacOSX");
- osAlias.put("OS/2", "OS2");
- osAlias.put("procnto", "QNX");
- osAlias.put("Win95", "Windows95");
- osAlias.put("Windows 95", "Windows95");
- osAlias.put("Win32", "Windows95");
- osAlias.put("Win98", "Windows98");
- osAlias.put("Windows 98", "Windows98");
- osAlias.put("Win32", "Windows98");
- osAlias.put("WinNT", "WindowsNT");
- osAlias.put("Windows NT", "WindowsNT");
- osAlias.put("Win32", "WindowsNT");
- osAlias.put("WinCE", "WindowsCE");
- osAlias.put("Windows CE", "WindowsCE");
- osAlias.put("Win2000", "Windows2000");
- osAlias.put("Windows 2000", "Windows2000");
- osAlias.put("Win32", "Windows2000");
- osAlias.put("Win2003", "Windows2003");
- osAlias.put("Windows 2003", "Windows2003");
- osAlias.put("Win32", "Windows2003");
- osAlias.put("Windows Server 2003", "Windows2003");
- osAlias.put("WinXP", "WindowsXP");
- osAlias.put("Windows XP", "WindowsXP");
- osAlias.put("Win32", "WindowsXP");
- osAlias.put("WinVista", "WindowsVista");
- osAlias.put("Windows Vista", "WindowsVista");
- osAlias.put("Win32", "WindowsVista");
- osAlias.put("Windows 7", "Windows7");
- }
-
- public OSGiNativeCodeMetaDataDeployer()
- {
- setInput(ClassLoadingMetaData.class);
- setStage(DeploymentStages.POST_PARSE);
- setTopLevelOnly(true);
- }
-
- @SuppressWarnings("unchecked")
- @Override
- protected void internalDeploy(DeploymentUnit unit) throws DeploymentException
- {
- AbstractBundleState absBundleState = unit.getAttachment(AbstractBundleState.class);
- if ((absBundleState instanceof OSGiBundleState) == false)
- return;
-
- OSGiClassLoadingMetaData classLoadingMetaData = (OSGiClassLoadingMetaData)unit.getAttachment(ClassLoadingMetaData.class);
- if (classLoadingMetaData == null)
- throw new IllegalStateException("No ClassLoadingMetaData");
-
- OSGiBundleState bundleState = (OSGiBundleState)absBundleState;
- OSGiBundleManager bundleManager = bundleState.getBundleManager();
- OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
- List<ParameterizedAttribute> nativeCodeParams = osgiMetaData.getBundleNativeCode();
- if (nativeCodeParams == null)
- return;
-
- // Find the matching parameters
- List<ParameterizedAttribute> matchedParams = new ArrayList<ParameterizedAttribute>();
- for (ParameterizedAttribute param : nativeCodeParams)
- {
- if (matchParameter(bundleManager, param))
- matchedParams.add(param);
- }
-
- // If no native clauses were selected in step 1, this algorithm is terminated
- // and a BundleException is thrown if the optional clause is not present
- if (matchedParams.size() == 0)
- {
- // [TODO] optional
- throw new DeploymentException("No native clauses selected from: " + nativeCodeParams);
- }
-
- // The selected clauses are now sorted in the following priority order:
- // * osversion: floor of the osversion range in descending order, osversion not specified
- // * language: language specified, language not specified
- // * Position in the Bundle-NativeCode manifest header: lexical left to right
- if (matchedParams.size() > 1)
- {
- // [TODO] selected clauses are now sorted
- }
-
- NativeLibraryMetaData nativeLibraries = classLoadingMetaData.getNativeLibraries();
- for (ParameterizedAttribute param : matchedParams)
- {
- Parameter osnameParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_OSNAME);
- Parameter procParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_PROCESSOR);
- //Parameter osversionParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_OSVERSION);
-
- List<String> osNames;
- if (osnameParam.isCollection())
- osNames = (List<String>)osnameParam.getValue();
- else
- osNames = Collections.singletonList((String)osnameParam.getValue());
-
- String libpath = param.getAttribute();
- String libsource = bundleState.getCanonicalName();
-
- NativeLibrary library = new NativeLibrary(osNames, libpath, libsource);
-
- // Processors
- if (procParam != null)
- {
- List<String> processors;
- if (procParam.isCollection())
- processors = (List<String>)procParam.getValue();
- else
- processors = Collections.singletonList((String)procParam.getValue());
-
- library.setProcessors(processors);
- }
-
- // [TODO] osVersions, languages, selectionFilter, optional
- // library.setOsVersions(osVersions);
- // library.setLanguages(languages);
- // library.setSelectionFilter(selectionFilter);
- // library.setOptional(optional);
-
- nativeLibraries.addNativeLibrary(library);
- }
- }
-
- @SuppressWarnings("unchecked")
- private boolean matchParameter(OSGiBundleManager bundleManager, ParameterizedAttribute param)
- {
- String fwOSName = bundleManager.getProperty(Constants.FRAMEWORK_OS_NAME);
- String fwProcessor = bundleManager.getProperty(Constants.FRAMEWORK_PROCESSOR);
- //String fwOSVersion = bundleManager.getProperty(Constants.FRAMEWORK_OS_VERSION);
-
- // Only select the native code clauses for which the following expressions all evaluate to true
- // * osname ~= [org.osgi.framework.os.name]
- // * processor ~= [org.osgi.framework.processor]
- // * osversion range includes [org.osgi.framework.os.version] or osversion is not specified
- // * language ~= [org.osgi.framework.language] or language is not specified
- // * selection-filter evaluates to true when using the values of the system properties or selection-filter is not specified
-
- Parameter osnameParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_OSNAME);
- Parameter procParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_PROCESSOR);
- //Parameter osversionParam = param.getAttribute(Constants.BUNDLE_NATIVECODE_OSVERSION);
-
- boolean match = (osnameParam != null);
-
- // osname ~= [org.osgi.framework.os.name]
- if (match == true && osnameParam != null)
- {
- List<String> osNames;
- if (osnameParam.isCollection())
- osNames = (List<String>)osnameParam.getValue();
- else
- osNames = Collections.singletonList((String)osnameParam.getValue());
-
- boolean osmatch = false;
- for (String osname : osNames)
- {
- osmatch = (osname.equalsIgnoreCase(fwOSName) || osname.equalsIgnoreCase(osAlias.get(fwOSName)));
- if (osmatch == true)
- break;
- }
-
- match &= osmatch;
- }
-
- // processor ~= [org.osgi.framework.processor]
- match &= (procParam != null);
- if (match && procParam != null)
- {
- List<String> processors;
- if (procParam.isCollection())
- processors = (List<String>)procParam.getValue();
- else
- processors = Collections.singletonList((String)procParam.getValue());
-
- boolean procmatch = false;
- for (String proc : processors)
- {
- procmatch = (proc.equals(fwProcessor) || proc.equals(processorAlias.get(fwProcessor)));
- if (procmatch == true)
- break;
- }
-
- match &= procmatch;
- }
-
- // [TODO] osversion range includes [org.osgi.framework.os.version] or osversion is not specified
- // [TODO] language ~= [org.osgi.framework.language] or language is not specified
- // [TODO] selection-filter evaluates to true when using the values of the system properties or selection-filter is not specified
- return match;
- }
-}
14 years, 4 months
JBoss-OSGI SVN: r101772 - in projects/jboss-osgi/projects: runtime/framework/trunk/core and 13 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 08:09:03 -0500 (Wed, 03 Mar 2010)
New Revision: 101772
Added:
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFileAssembly.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/AssemblyAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSEntryPathsEnumeration.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSFindEntriesEnumeration.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/URLHelper.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/testing/trunk/pom.xml
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
Log:
Use VFS abstration in jboss-osgi-testing
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 13:09:03 UTC (rev 101772)
@@ -251,6 +251,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-log4j</artifactId>
<scope>test</scope>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -51,7 +51,7 @@
import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.util.ConstantsHelper;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -37,7 +37,7 @@
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
import org.jboss.osgi.vfs.AbstractVFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -83,7 +83,7 @@
// The framework is expected to preserve the location passed into installBundle(String)
Deployment dep = unit.getAttachment(Deployment.class);
location = (dep != null ? dep.getLocation() : unit.getName());
- rootFile = (dep != null ? (VirtualFile)AbstractVFS.adapt(dep.getRoot()) : ((VFSDeploymentUnit)unit).getRoot());
+ rootFile = (dep != null ? dep.getRoot() : AbstractVFS.adapt(((VFSDeploymentUnit)unit).getRoot()));
bundleId = bundleIDGenerator.incrementAndGet();
@@ -179,26 +179,14 @@
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
+ try
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSEntryPathsEnumeration(root, child);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
- }
-
+ return rootFile.getEntryPaths(path);
}
- return null;
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error determining entry paths for " + rootFile + " path=" + path);
+ }
}
@Override
@@ -232,7 +220,7 @@
}
@SuppressWarnings("rawtypes")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ public Enumeration findEntries(String path, String pattern, boolean recurse)
{
if (path == null)
throw new IllegalArgumentException("Null path");
@@ -241,32 +229,16 @@
if (noAdminPermission(AdminPermission.RESOURCE))
return null;
- // [TODO] fragments
resolveBundle();
-
- if (filePattern == null)
- filePattern = "*";
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
+
+ try
{
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
- }
-
+ return rootFile.findEntries(path, pattern, recurse);
}
- return null;
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error finding entries for " + rootFile + " path=" + path + " pattern=" + pattern + " recurse=" + recurse);
+ }
}
/**
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleContextWrapper.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -27,7 +27,7 @@
import java.io.InputStream;
import java.util.Dictionary;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -74,10 +74,9 @@
import org.jboss.osgi.framework.util.URLHelper;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VFSUtils;
+import org.jboss.osgi.vfs.VirtualFile;
import org.jboss.util.platform.Java;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
@@ -452,7 +451,7 @@
VirtualFile root;
try
{
- root = VFS.getRoot(locationURL);
+ root = AbstractVFS.getChild(locationURL);
}
catch (IOException e)
{
@@ -508,7 +507,7 @@
Deployment dep;
try
{
- BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+ BundleInfo info = BundleInfo.createBundleInfo(root, location);
dep = DeploymentFactory.createDeployment(info);
dep.setAutoStart(autoStart);
}
@@ -533,7 +532,7 @@
// Create the deployment and deploy it
try
{
- VirtualFile root = (VirtualFile)AbstractVFS.adapt(dep.getRoot());
+ org.jboss.virtual.VirtualFile root = (org.jboss.virtual.VirtualFile)AbstractVFS.adapt(dep.getRoot());
VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
att.addAttachment(Deployment.class, dep);
@@ -685,9 +684,9 @@
try
{
URL storageLocation = getBundleStorageLocation(in);
- VirtualFile root = VFS.getRoot(storageLocation);
+ VirtualFile root = AbstractVFS.getChild(storageLocation);
- BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+ BundleInfo info = BundleInfo.createBundleInfo(root, location);
Deployment dep = DeploymentFactory.createDeployment(info);
dep.addAttachment(AbstractBundleState.class, bundleState);
dep.setBundleUpdate(true);
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSEntryPathsEnumeration.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -1,101 +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.bundle;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.List;
-
-import org.jboss.virtual.VirtualFile;
-
-/**
- * VFSEntryPathsEnumeration.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-class VFSEntryPathsEnumeration implements Enumeration<String>
-{
- /** The paths */
- private Iterator<String> paths;
-
- /**
- * Fix the path
- *
- * @param file the file to fix
- * @param rootPath the root path
- * @return the fixxed path
- */
- private String fixPath(VirtualFile file, String rootPath)
- {
- try
- {
- String result = file.getPathName();
- int length = rootPath.length();
- if (length != 0)
- result = result.substring(length);
- if (file.isLeaf() == false && result.endsWith("/") == false)
- result += "/";
- return result;
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error fixing path for " + file, e);
- }
- }
-
- /**
- * Create a new VFSEntryPathsEnumeration.
- *
- * @param root the root file
- * @param file the file to enumerate
- * @throws IOException for any error
- */
- public VFSEntryPathsEnumeration(VirtualFile root, VirtualFile file) throws IOException
- {
- if (root == null)
- throw new IllegalArgumentException("Null root");
- if (file == null)
- throw new IllegalArgumentException("Null file");
-
- String rootPath = root.getPathName();
- ArrayList<String> paths = new ArrayList<String>();
- paths.add(fixPath(file, rootPath));
-
- List<VirtualFile> children = file.getChildrenRecursively();
- for (VirtualFile child : children)
- paths.add(fixPath(child, rootPath));
- this.paths = paths.iterator();
- }
-
- public boolean hasMoreElements()
- {
- return paths.hasNext();
- }
-
- public String nextElement()
- {
- return paths.next();
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/VFSFindEntriesEnumeration.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -1,134 +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.bundle;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.jboss.virtual.plugins.vfs.helpers.MatchAllVirtualFileFilter;
-
-/**
- * VFSFindEntriesEnumeration.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-class VFSFindEntriesEnumeration implements Enumeration<URL>
-{
- /** The paths */
- private Iterator<URL> paths;
-
- /**
- * Convert file pattern (RFC 1960-based Filter) into a RegEx pattern
- *
- * @param filePattern the file pattern
- * @return Regular expressions pattern
- */
- private static Pattern convertToPattern(String filePattern)
- {
- filePattern = filePattern.replace("*", ".*");
- return Pattern.compile("^" + filePattern + "$");
- }
-
- /**
- * Create a new VFSFindEntriesEnumeration.
- *
- * @param root the root file
- * @param file the file to enumerate
- * @param filePattern the file pattern
- * @param recurse whether to recurse
- * @throws IOException for any error
- */
- public VFSFindEntriesEnumeration(VirtualFile root, VirtualFile file, String filePattern, boolean recurse) throws IOException
- {
- if (root == null)
- throw new IllegalArgumentException("Null root");
- if (file == null)
- throw new IllegalArgumentException("Null file");
-
- String rootPath = root.getPathName();
- VisitorAttributes attributes = new VisitorAttributes();
- attributes.setIncludeRoot(false);
- attributes.setLeavesOnly(true);
- if (recurse)
- attributes.setRecurseFilter(MatchAllVirtualFileFilter.INSTANCE);
- VisitorImpl visitor = new VisitorImpl(rootPath, filePattern, attributes);
- file.visit(visitor);
- this.paths = visitor.paths.iterator();
- }
-
- public boolean hasMoreElements()
- {
- return paths.hasNext();
- }
-
- public URL nextElement()
- {
- return paths.next();
- }
-
- static class VisitorImpl implements VirtualFileVisitor
- {
- ArrayList<URL> paths = new ArrayList<URL>();
-
- Pattern filter;
- String rootPath;
- VisitorAttributes attributes;
-
- VisitorImpl(String rootPath, String filter, VisitorAttributes attributes)
- {
- this.rootPath = rootPath;
- this.filter = convertToPattern(filter);
- this.attributes = attributes;
- }
-
- public VisitorAttributes getAttributes()
- {
- return attributes;
- }
-
- public void visit(VirtualFile virtualFile)
- {
- // See if the filter matches
- Matcher matcher = filter.matcher(virtualFile.getName());
- if (matcher.find() == false)
- return;
-
- try
- {
- paths.add(virtualFile.toURL());
- }
- catch (Exception e)
- {
- throw new RuntimeException("Error visiting " + virtualFile, e);
- }
- }
- }
-}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/classloading/OSGiClassLoaderPolicy.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -45,6 +45,7 @@
import org.jboss.osgi.framework.metadata.NativeLibrary;
import org.jboss.osgi.framework.metadata.NativeLibraryMetaData;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.virtual.VFSUtils;
import org.jboss.virtual.VirtualFile;
@@ -251,7 +252,7 @@
if (libraryFile == null)
{
// Get the virtual file for entry for the library
- VirtualFile fileSource = bundleState.getRoot().getChild(libpath);
+ VirtualFile fileSource = (VirtualFile)AbstractVFS.adapt(bundleState.getRoot().getChild(libpath));
// Create a unique local file location
libraryFile = getUniqueLibraryFile(bundleState, libpath);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/deployers/OSGiFragmentAttachmentDeployer.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -34,6 +34,8 @@
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.bundle.OSGiFragmentState;
import org.jboss.osgi.framework.classloading.OSGiClassLoaderPolicy;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
/**
@@ -94,7 +96,7 @@
OSGiBundleState hostState = fragState.getFragmentHost();
DeploymentUnit hostUnit = hostState.getDeploymentUnit();
OSGiClassLoaderPolicy hostPolicy = (OSGiClassLoaderPolicy)hostUnit.getAttachment(ClassLoaderPolicy.class);
- hostPolicy.attachFragment(fragState.getRoot());
+ hostPolicy.attachFragment((VirtualFile)AbstractVFS.adapt(fragState.getRoot()));
}
}
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/launch/OSGiFramework.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -29,7 +29,7 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleWrapper;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.FrameworkEvent;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/URLHelper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/URLHelper.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/URLHelper.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -24,7 +24,7 @@
import java.net.MalformedURLException;
import java.net.URL;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
/**
* A helper for URL convertions that does not throw checked exceptions.
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTest.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -37,6 +37,7 @@
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.spi.util.ConstantsHelper;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.test.kernel.junit.MicrocontainerTest;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
@@ -179,7 +180,7 @@
protected Bundle installBundle(VirtualFile bundleFile) throws BundleException
{
- return getBundleManager().installBundle(bundleFile).getBundleInternal();
+ return getBundleManager().installBundle(AbstractVFS.adapt(bundleFile)).getBundleInternal();
}
/**
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/FrameworkTestDelegate.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -45,6 +45,7 @@
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.bundle.OSGiBundleState;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.test.kernel.junit.MicrocontainerTestDelegate;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VFS;
@@ -192,7 +193,7 @@
*/
public Bundle addBundle(VirtualFile file) throws Exception
{
- AbstractBundleState bundleState = getBundleManager().installBundle(file);
+ AbstractBundleState bundleState = getBundleManager().installBundle(AbstractVFS.adapt(file));
return bundleState.getBundleInternal();
}
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/AbstractImportExportTest.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -27,8 +27,8 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import org.jboss.osgi.vfs.VirtualFile;
import org.jboss.test.osgi.classloader.support.a.A;
-import org.jboss.virtual.VirtualFile;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.service.packageadmin.PackageAdmin;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/resolver/ResolverMetadataTest.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -37,8 +37,8 @@
import org.jboss.osgi.framework.resolver.RequiredBundle;
import org.jboss.osgi.framework.resolver.Resolver;
import org.jboss.osgi.framework.resolver.ResolverBundle;
+import org.jboss.osgi.vfs.VirtualFile;
import org.jboss.test.osgi.classloader.support.a.A;
-import org.jboss.virtual.VirtualFile;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.Version;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 13:09:03 UTC (rev 101772)
@@ -58,6 +58,7 @@
<version.jboss.osgi.reflect>2.2.0</version.jboss.osgi.reflect>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
+ <version.jboss.osgi.vfs>1.0.0-SNAPSHOT</version.jboss.osgi.vfs>
<version.jboss.osgi.xml.binding>2.0.2.Beta4</version.jboss.osgi.xml.binding>
<version.jboss.test>1.1.4.GA</version.jboss.test>
<version.ops4j.pax.web>0.7.2</version.ops4j.pax.web>
@@ -269,6 +270,11 @@
<artifactId>jboss-osgi-testing</artifactId>
<version>${version.jboss.osgi.testing}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <version>${version.jboss.osgi.vfs}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
Modified: projects/jboss-osgi/projects/testing/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-03-03 13:09:03 UTC (rev 101772)
@@ -68,7 +68,7 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.vfs</groupId>
- <artifactId>jboss-osgi-vfs21</artifactId>
+ <artifactId>jboss-osgi-vfs</artifactId>
<version>${version.jboss.osgi.vfs}</version>
</dependency>
<dependency>
@@ -133,6 +133,12 @@
<version>${version.jboss.osgi.felix}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <version>${version.jboss.osgi.vfs}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTest.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -28,8 +28,7 @@
import javax.naming.NamingException;
import org.jboss.logging.Logger;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.junit.After;
import org.junit.Before;
import org.osgi.framework.Bundle;
@@ -52,8 +51,6 @@
protected OSGiTest()
{
- // Prevent unknown protocol: vfsfile
- VFS.init();
}
/**
Modified: projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/testing/trunk/src/main/java/org/jboss/osgi/testing/OSGiTestHelper.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -39,9 +39,9 @@
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.osgi.testing.internal.EmbeddedRuntime;
import org.jboss.osgi.testing.internal.RemoteRuntime;
-import org.jboss.virtual.AssembledDirectory;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFileAssembly;
import org.osgi.framework.Bundle;
/**
@@ -220,12 +220,12 @@
public VirtualFile assembleBundle(String name, String[] resources, Class<?>... packages) throws Exception
{
- AssembledDirectory assembledDirectory = AssembledDirectory.createAssembledDirectory(name, "");
+ VirtualFileAssembly assembly = AbstractVFS.createVirtualFileAssembly(name);
for (String path : resources)
- addPath(assembledDirectory, path, "");
+ addPath(assembly, path, "");
for (Class<?> reference : packages)
- addPackage(assembledDirectory, reference);
- return assembledDirectory;
+ addPackage(assembly, reference);
+ return assembly;
}
public void assertBundleState(int expState, int wasState)
@@ -259,17 +259,18 @@
}
}
- private void addPath(AssembledDirectory dir, String path, String name) throws Exception
+ private void addPath(VirtualFileAssembly dir, String path, String name) throws Exception
{
URL url = getClass().getResource(path);
if (url == null)
throw new AssertionFailedError(path + " not found");
- VirtualFile file = VFS.getVirtualFile(url, name);
+ VirtualFile root = AbstractVFS.getChild(url);
+ VirtualFile file = root.getChild(name);
dir.addPath(file);
}
- private void addPackage(AssembledDirectory dir, Class<?> reference) throws Exception
+ private void addPackage(VirtualFileAssembly dir, Class<?> reference) throws Exception
{
String packagePath = packageNameToPath(reference.getName());
dir.addResources(reference, new String[] { packagePath + "/*.class" }, new String[0]);
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -22,6 +22,7 @@
package org.jboss.osgi.vfs;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
/**
@@ -41,6 +42,11 @@
return getVFSAdaptor().getChild(url);
}
+ public static VirtualFileAssembly createVirtualFileAssembly(String name) throws IOException, URISyntaxException
+ {
+ return getVFSAdaptor().createVirtualFileAssembly(name);
+ }
+
public static VirtualFile adapt(Object virtualFile)
{
return getVFSAdaptor().adapt(virtualFile);
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -22,6 +22,7 @@
package org.jboss.osgi.vfs;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
/**
@@ -44,6 +45,8 @@
*/
VirtualFile getChild(URL url) throws IOException;
+ VirtualFileAssembly createVirtualFileAssembly(String name) throws IOException, URISyntaxException;
+
/**
* Adapt a concrete instance of a jboss-vfs VirtualFile.
* @param virtualFile The VirtualFile instance
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -26,6 +26,8 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.Enumeration;
+import java.util.List;
/**
* A basic abstraction of a VirtualFile used by the OSGi layer.
@@ -46,6 +48,24 @@
String getName();
/**
+ * Get the VFS relative path name (org/jboss/X.java)
+ *
+ * @return the VFS relative path name
+ * @throws IllegalStateException if the file is closed
+ */
+ String getPathName();
+
+ /**
+ * Whether it is a simple leaf of the VFS,
+ * i.e. whether it can contain other files
+ *
+ * @return true if a simple file.
+ * @throws IOException for any problem accessing the virtual file system
+ * @throws IllegalStateException if the file is closed
+ */
+ boolean isFile() throws IOException;
+
+ /**
* Get the VF URL (file://root/org/jboss/X.java)
*
* @return the full URL to the VF in the VFS.
@@ -67,6 +87,36 @@
VirtualFile getChild(String string) throws IOException;
/**
+ * Get all the children recursively<p>
+ *
+ * This always uses {@link VisitorAttributes#RECURSE}
+ *
+ * @return the children
+ * @throws IOException for any problem accessing the virtual file system
+ * @throws IllegalStateException if the file is closed
+ */
+ List<VirtualFile> getChildrenRecursively() throws IOException;
+
+ /**
+ * Returns entries in this bundle and its attached fragments. This bundle's
+ * class loader is not used to search for entries. Only the contents of this
+ * bundle and its attached fragments are searched for the specified entries.
+ *
+ * @see Bundle.findEntries(String path, String pattern, boolean recurse)
+ */
+ Enumeration<URL> findEntries(String path, String pattern, boolean recurse) throws IOException;
+
+ /**
+ * Returns an Enumeration of all the paths (<code>String</code> objects)
+ * to entries within this bundle whose longest sub-path matches the
+ * specified path. This bundle's class loader is not used to search for
+ * entries. Only the contents of this bundle are searched.
+ *
+ * @see Bundle.getEntryPaths(String path)
+ */
+ Enumeration<String> getEntryPaths(String path) throws IOException;
+
+ /**
* Access the file contents.
*
* @return an InputStream for the file contents.
Added: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFileAssembly.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFileAssembly.java (rev 0)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFileAssembly.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -0,0 +1,60 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.vfs;
+
+import java.io.IOException;
+
+
+/**
+ * A basic abstraction of a VirtualFileAssembly used by the OSGi layer.
+ *
+ * This abstraction should be removed once we settle on a single jboss-vfs version.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 02-Mar-2010
+ */
+public interface VirtualFileAssembly extends VirtualFile
+{
+ /**
+ * Add files recursively from root, using the no jars filter.
+ *
+ * @param root the root
+ * @throws IOException for any error
+ */
+ void addPath(VirtualFile file) throws IOException;
+
+ /**
+ * Locate the .class resource of baseResource. From this resource, determine the base of the resource
+ * i.e. what jar or classpath directory it lives in.
+ *
+ * Once the base of the resource is found, scan all files recursively within the base using the include and exclude
+ * patterns. A mirror file structure will be created within this AssembledDirectory. Ths is very useful when you
+ * want to create a virtual jar that contains a subset of .class files in your classpath.
+ *
+ * The include/exclude patterns follow the Ant file pattern matching syntax. See ant.apache.org for more details.
+ *
+ * @param baseResource the base resource
+ * @param includes the includes
+ * @param excludes the excludes
+ */
+ void addResources(Class<?> reference, String[] includes, String[] excludes);
+}
Added: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/AssemblyAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/AssemblyAdaptor21.java (rev 0)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/AssemblyAdaptor21.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -0,0 +1,56 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2006, 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.vfs21;
+
+import java.io.IOException;
+import java.net.URISyntaxException;
+
+import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFileAssembly;
+import org.jboss.virtual.AssembledDirectory;
+
+/**
+ * An adaptor to the jboss-vfs-2.1.x VirtualFile.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 02-Mar-2010
+ */
+class AssemblyAdaptor21 extends VirtualFileAdaptor21 implements VirtualFileAssembly
+{
+ private AssembledDirectory delegate;
+
+ public AssemblyAdaptor21(AssembledDirectory assembly) throws IOException, URISyntaxException
+ {
+ super(assembly);
+ this.delegate = assembly;
+ }
+
+ public void addPath(VirtualFile file) throws IOException
+ {
+ delegate.addPath(((VirtualFileAdaptor21)file).getDelegate());
+ }
+
+ public void addResources(Class<?> reference, String[] includes, String[] excludes)
+ {
+ delegate.addResources(reference, includes, excludes);
+ }
+}
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -22,10 +22,13 @@
package org.jboss.osgi.vfs21;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
import org.jboss.osgi.vfs.VFSAdaptor;
import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFileAssembly;
+import org.jboss.virtual.AssembledDirectory;
/**
* An adaptor to the jboss-vfs-2.1.x VFS.
@@ -41,6 +44,12 @@
return new VirtualFileAdaptor21(root);
}
+ public VirtualFileAssembly createVirtualFileAssembly(String name) throws IOException, URISyntaxException
+ {
+ AssembledDirectory assembly = AssembledDirectory.createAssembledDirectory(name, "");
+ return new AssemblyAdaptor21(assembly);
+ }
+
public VirtualFile adapt(Object virtualFile)
{
if (virtualFile == null)
@@ -54,6 +63,9 @@
public Object adapt(VirtualFile virtualFile)
{
+ if (virtualFile == null)
+ return null;
+
VirtualFileAdaptor21 adaptor = (VirtualFileAdaptor21)virtualFile;
return adaptor.getDelegate();
}
Added: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSEntryPathsEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSEntryPathsEnumeration.java (rev 0)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSEntryPathsEnumeration.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -0,0 +1,99 @@
+/*
+* 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.vfs21;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import org.jboss.virtual.VirtualFile;
+
+/**
+ * An enumeration of VFS entry paths.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author thomas.diesler(a)jboss.com
+ * @version $Revision: 1.1 $
+ */
+class VFSEntryPathsEnumeration implements Enumeration<String>
+{
+ /** The paths */
+ private Iterator<String> paths;
+
+ /**
+ * Create a new VFSEntryPathsEnumeration.
+ *
+ * @param root the root file
+ * @param file the file to enumerate
+ * @throws IOException for any error
+ */
+ public VFSEntryPathsEnumeration(VirtualFile root, VirtualFile file) throws IOException
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root");
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+
+ String rootPath = root.getPathName();
+ ArrayList<String> paths = new ArrayList<String>();
+ paths.add(fixPath(rootPath, file));
+
+ List<VirtualFile> children = file.getChildrenRecursively();
+ for (VirtualFile child : children)
+ paths.add(fixPath(rootPath, child));
+
+ this.paths = paths.iterator();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return paths.hasNext();
+ }
+
+ public String nextElement()
+ {
+ return paths.next();
+ }
+
+ private String fixPath(String rootPath, VirtualFile file)
+ {
+ try
+ {
+ String result = file.getPathName();
+
+ int length = rootPath.length();
+ if (length != 0)
+ result = result.substring(length);
+
+ if (file.isLeaf() == false && result.endsWith("/") == false)
+ result += "/";
+
+ return result;
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error fixing path for " + file, e);
+ }
+ }
+}
Added: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSFindEntriesEnumeration.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSFindEntriesEnumeration.java (rev 0)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSFindEntriesEnumeration.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -0,0 +1,133 @@
+/*
+* 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.vfs21;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.virtual.VirtualFile;
+import org.jboss.virtual.VirtualFileVisitor;
+import org.jboss.virtual.VisitorAttributes;
+import org.jboss.virtual.plugins.vfs.helpers.MatchAllVirtualFileFilter;
+
+/**
+ * An enumeration of VFS entries.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author thomas.diesler(a)jboss.com
+ * @version $Revision: 1.1 $
+ */
+class VFSFindEntriesEnumeration implements Enumeration<URL>
+{
+ /** The paths */
+ private Iterator<URL> paths;
+
+ /**
+ * Create a new VFSFindEntriesEnumeration.
+ *
+ * @param root the root file
+ * @param file the file to enumerate
+ * @param filePattern the file pattern
+ * @param recurse whether to recurse
+ * @throws IOException for any error
+ */
+ public VFSFindEntriesEnumeration(VirtualFile root, VirtualFile file, String filePattern, boolean recurse) throws IOException
+ {
+ if (root == null)
+ throw new IllegalArgumentException("Null root");
+ if (file == null)
+ throw new IllegalArgumentException("Null file");
+
+ String rootPath = root.getPathName();
+ VisitorAttributes attributes = new VisitorAttributes();
+ attributes.setIncludeRoot(false);
+ attributes.setLeavesOnly(true);
+ if (recurse)
+ attributes.setRecurseFilter(MatchAllVirtualFileFilter.INSTANCE);
+
+ VisitorImpl visitor = new VisitorImpl(rootPath, filePattern, attributes);
+ file.visit(visitor);
+
+ this.paths = visitor.paths.iterator();
+ }
+
+ public boolean hasMoreElements()
+ {
+ return paths.hasNext();
+ }
+
+ public URL nextElement()
+ {
+ return paths.next();
+ }
+
+ static class VisitorImpl implements VirtualFileVisitor
+ {
+ ArrayList<URL> paths = new ArrayList<URL>();
+
+ Pattern filter;
+ String rootPath;
+ VisitorAttributes attributes;
+
+ VisitorImpl(String rootPath, String filter, VisitorAttributes attributes)
+ {
+ this.rootPath = rootPath;
+ this.filter = convertToPattern(filter);
+ this.attributes = attributes;
+ }
+
+ public VisitorAttributes getAttributes()
+ {
+ return attributes;
+ }
+
+ public void visit(VirtualFile virtualFile)
+ {
+ // See if the filter matches
+ Matcher matcher = filter.matcher(virtualFile.getName());
+ if (matcher.find() == false)
+ return;
+
+ try
+ {
+ paths.add(virtualFile.toURL());
+ }
+ catch (Exception e)
+ {
+ throw new RuntimeException("Error visiting " + virtualFile, e);
+ }
+ }
+
+ // Convert file pattern (RFC 1960-based Filter) into a RegEx pattern
+ private static Pattern convertToPattern(String filePattern)
+ {
+ filePattern = filePattern.replace("*", ".*");
+ return Pattern.compile("^" + filePattern + "$");
+ }
+
+ }
+}
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -26,6 +26,10 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
import org.jboss.osgi.vfs.VirtualFile;
@@ -38,7 +42,7 @@
class VirtualFileAdaptor21 implements VirtualFile
{
private org.jboss.virtual.VirtualFile delegate;
-
+
public VirtualFileAdaptor21(org.jboss.virtual.VirtualFile delegate)
{
this.delegate = delegate;
@@ -53,7 +57,17 @@
{
return delegate.getName();
}
-
+
+ public String getPathName()
+ {
+ return delegate.getPathName();
+ }
+
+ public boolean isFile() throws IOException
+ {
+ return delegate.isLeaf();
+ }
+
public URL toURL() throws MalformedURLException, URISyntaxException
{
return delegate.toURL();
@@ -64,13 +78,54 @@
org.jboss.virtual.VirtualFile child = delegate.getChild(path);
if (child == null)
return null;
-
+
return new VirtualFileAdaptor21(child);
}
+ public List<VirtualFile> getChildrenRecursively() throws IOException
+ {
+ List<VirtualFile> files = new ArrayList<VirtualFile>();
+ for (org.jboss.virtual.VirtualFile child : delegate.getChildrenRecursively())
+ files.add(new VirtualFileAdaptor21(child));
+
+ return Collections.unmodifiableList(files);
+ }
+
+ public Enumeration<URL> findEntries(String path, String pattern, boolean recurse) throws IOException
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ if (pattern == null)
+ pattern = "*";
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+
+ org.jboss.virtual.VirtualFile child = delegate.getChild(path);
+ if (child == null)
+ return null;
+
+ return new VFSFindEntriesEnumeration(delegate, child, pattern, recurse);
+ }
+
+ public Enumeration<String> getEntryPaths(String path) throws IOException
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+
+ org.jboss.virtual.VirtualFile child = delegate.getChild(path);
+ if (child == null)
+ return null;
+
+ return new VFSEntryPathsEnumeration(delegate, child);
+ }
+
public InputStream openStream() throws IOException
{
return delegate.openStream();
}
}
-
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -27,6 +27,7 @@
import org.jboss.osgi.vfs.VFSAdaptor;
import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFileAssembly;
/**
* An adaptor to the jboss-vfs-3.0.x VFS.
@@ -50,6 +51,11 @@
return new VirtualFileAdaptor30(root);
}
+ public VirtualFileAssembly createVirtualFileAssembly(String name) throws IOException, URISyntaxException
+ {
+ throw new IllegalArgumentException("not implemented");
+ }
+
public VirtualFile adapt(Object virtualFile)
{
if (virtualFile == null)
@@ -63,6 +69,9 @@
public Object adapt(VirtualFile virtualFile)
{
+ if (virtualFile == null)
+ return null;
+
VirtualFileAdaptor30 adaptor = (VirtualFileAdaptor30)virtualFile;
return adaptor.getDelegate();
}
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-03 11:31:45 UTC (rev 101771)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-03 13:09:03 UTC (rev 101772)
@@ -26,6 +26,10 @@
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
import org.jboss.osgi.vfs.VirtualFile;
@@ -54,6 +58,16 @@
return delegate.getName();
}
+ public String getPathName()
+ {
+ return delegate.getPathName();
+ }
+
+ public boolean isFile() throws IOException
+ {
+ return delegate.isFile();
+ }
+
public URL toURL() throws MalformedURLException, URISyntaxException
{
return delegate.toURL();
@@ -68,6 +82,25 @@
return new VirtualFileAdaptor30(child);
}
+ public List<VirtualFile> getChildrenRecursively() throws IOException
+ {
+ List<VirtualFile> files = new ArrayList<VirtualFile>();
+ for (org.jboss.vfs.VirtualFile child : delegate.getChildrenRecursively())
+ files.add(new VirtualFileAdaptor30(child));
+
+ return Collections.unmodifiableList(files);
+ }
+
+ public Enumeration<URL> findEntries(String path, String pattern, boolean recurse) throws IOException
+ {
+ throw new IllegalArgumentException("not implemented");
+ }
+
+ public Enumeration<String> getEntryPaths(String path)
+ {
+ throw new IllegalArgumentException("not implemented");
+ }
+
public InputStream openStream() throws IOException
{
return delegate.openStream();
14 years, 4 months
JBoss-OSGI SVN: r101770 - projects/jboss-osgi/trunk/testsuite/functional.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 05:37:03 -0500 (Wed, 03 Mar 2010)
New Revision: 101770
Modified:
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
Log:
Fix non-native functional tests build
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-03-03 10:30:50 UTC (rev 101769)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-03-03 10:37:03 UTC (rev 101770)
@@ -44,6 +44,25 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ <version>${version.jboss.aop.mc.int}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss.aop</groupId>
+ <artifactId>jboss-aop</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>javassist</groupId>
+ <artifactId>javassist</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>${version.javax.ejb}</version>
14 years, 4 months
JBoss-OSGI SVN: r101769 - in projects/jboss-osgi/projects/runtime/framework/trunk/metadata: src/main/java/org/jboss/osgi/framework/metadata and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 05:30:50 -0500 (Wed, 03 Mar 2010)
New Revision: 101769
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/CaseInsensitiveDictionary.java
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath
Log:
Fix missing CaseInsensitiveDictionary
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath 2010-03-03 10:22:49 UTC (rev 101768)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath 2010-03-03 10:30:50 UTC (rev 101769)
@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Added: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/CaseInsensitiveDictionary.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/CaseInsensitiveDictionary.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/CaseInsensitiveDictionary.java 2010-03-03 10:30:50 UTC (rev 101769)
@@ -0,0 +1,145 @@
+/*
+* 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.metadata;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+
+import org.jboss.util.collection.Iterators;
+
+/**
+ * CaseInsensitiveDictionary.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+@SuppressWarnings("rawtypes")
+public class CaseInsensitiveDictionary extends Hashtable
+{
+ private static final long serialVersionUID = 5802491129524016545L;
+
+ /** The delegate dictionary */
+ private Dictionary<String, Object> delegate;
+
+ /** The original keys */
+ private Set<String> originalKeys;
+
+ /**
+ * Create a new CaseInsensitiveDictionary.
+ *
+ * @param delegate the delegate
+ */
+ @SuppressWarnings("unchecked")
+ public CaseInsensitiveDictionary(Dictionary delegate)
+ {
+ if (delegate == null)
+ throw new IllegalArgumentException("Null delegaqte");
+
+ this.delegate = new Hashtable<String, Object>(delegate.size());
+ this.originalKeys = Collections.synchronizedSet(new HashSet<String>());
+ Enumeration<String> e = delegate.keys();
+ while (e.hasMoreElements())
+ {
+ String key = e.nextElement();
+ if (get(key) != null)
+ throw new IllegalArgumentException("Properties contain duplicates with varying case for key=" + key + " : " + delegate);
+
+ this.delegate.put(key.toLowerCase(), delegate.get(key));
+ originalKeys.add(key);
+ }
+ }
+
+ public Enumeration<Object> elements()
+ {
+ return delegate.elements();
+ }
+
+ @SuppressWarnings("unchecked")
+ public synchronized boolean equals(Object obj)
+ {
+ if (obj == this)
+ return true;
+ if (obj == null || obj instanceof Dictionary == false)
+ return false;
+
+ Dictionary<String, Object> other = (Dictionary)obj;
+
+ if (size() != other.size())
+ return false;
+ if (isEmpty())
+ return true;
+
+ for (String key : originalKeys)
+ {
+ if (get(key).equals(other.get(key)))
+ return false;
+ }
+ return true;
+ }
+
+ public Object get(Object key)
+ {
+ if (key instanceof String)
+ key = ((String)key).toLowerCase();
+ return delegate.get(key);
+ }
+
+ public int hashCode()
+ {
+ return delegate.hashCode();
+ }
+
+ public boolean isEmpty()
+ {
+ return delegate.isEmpty();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Enumeration<String> keys()
+ {
+ return Iterators.toEnumeration(originalKeys.iterator());
+ }
+
+ public Object put(Object key, Object value)
+ {
+ throw new UnsupportedOperationException("immutable");
+ }
+
+ public Object remove(Object key)
+ {
+ throw new UnsupportedOperationException("immutable");
+ }
+
+ public int size()
+ {
+ return delegate.size();
+ }
+
+ public String toString()
+ {
+ return delegate.toString();
+ }
+}
14 years, 4 months
JBoss-OSGI SVN: r101768 - in projects/jboss-osgi/projects/runtime/framework/trunk: core and 8 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 05:22:49 -0500 (Wed, 03 Mar 2010)
New Revision: 101768
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/internal/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/scripts/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/etc/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/bundle/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/classloading/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/deployers/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/launch/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/packageadmin/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/plugins/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/resolver/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/service/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/util/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/vfs/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/resources/
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/test/
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
Log:
Externalize framework metadata
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,39 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!-- ====================================================================== -->
- <!-- -->
- <!-- JBoss, the OpenSource J2EE webOS -->
- <!-- -->
- <!-- Distributable under LGPL license. -->
- <!-- See terms of license at http://www.gnu.org. -->
- <!-- -->
- <!-- ====================================================================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
- <!-- $Id$ -->
+<!-- $Id$ -->
- <!--
- Set these VM properties in your IDE debugger
-
- -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
- -Dlog4j.configuration=log4j-console.xml
- -->
+<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
<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 Framework - Core</name>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.framework</groupId>
<artifactId>jboss-osgi-framework</artifactId>
<packaging>bundle</packaging>
<parent>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.framework</groupId>
<artifactId>jboss-osgi-framework-parent</artifactId>
<version>1.0.0.Alpha4-SNAPSHOT</version>
</parent>
<dependencies>
<dependency>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-metadata</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>biz.aQute</groupId>
<artifactId>bnd</artifactId>
</dependency>
@@ -362,9 +362,7 @@
</property>
</systemProperties>
<excludes>
- <!-- excludes listed here need to have a jira issue associated
- <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
- -->
+ <!-- excludes listed here need to have a jira issue associated <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude> -->
</excludes>
</configuration>
</plugin>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractBundleState.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -43,12 +43,12 @@
import org.jboss.dependency.plugins.tracker.AbstractContextTracker;
import org.jboss.dependency.spi.ControllerContext;
import org.jboss.dependency.spi.tracker.ContextTracking;
+import org.jboss.osgi.framework.metadata.CaseInsensitiveDictionary;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
import org.jboss.osgi.framework.plugins.ServiceManagerPlugin;
-import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.util.ConstantsHelper;
import org.jboss.virtual.VirtualFile;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiServiceState.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -45,9 +45,9 @@
import org.jboss.metadata.spi.scope.CommonLevels;
import org.jboss.metadata.spi.scope.Scope;
import org.jboss.metadata.spi.scope.ScopeKey;
+import org.jboss.osgi.framework.metadata.CaseInsensitiveDictionary;
import org.jboss.osgi.framework.plugins.ControllerContextPlugin;
import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
-import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.jboss.osgi.spi.util.BundleClassLoader;
import org.jboss.util.collection.CollectionsFactory;
import org.jboss.util.id.GUID;
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ActivationPolicyMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,53 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.List;
-
-/**
- * OSGi activation policy metadata.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ActivationPolicyMetaData
-{
- /**
- * Get the type.
- *
- * @return the type
- */
- String getType();
-
- /**
- * Get include packages.
- *
- * @return the include packages
- */
- List<String> getIncludes();
-
- /**
- * Get the exclude packages.
- *
- * @return the exclude packages
- */
- List<String> getExcludes();
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeAware.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,37 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * Attribute string value holder.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface AttributeAware
-{
- /**
- * Get the attribute.
- *
- * @return string attribute value
- */
- String getAttribute();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/AttributeMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,44 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * ServiceAttributeMetaData.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface AttributeMetaData
-{
- /**
- * Get the name.
- *
- * @return the name.
- */
- String getName();
-
- /**
- * Get the value.
- *
- * @return the value.
- */
- ServiceValueMetaData getValue();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/DependencyMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,37 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * Metadata about what a osgi service's dependency.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface DependencyMetaData
-{
- /**
- * What is the dependency
- *
- * @return the dependency
- */
- Object getDependency();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/HolderMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,62 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.Set;
-
-import org.jboss.beans.metadata.spi.ClassLoaderMetaData;
-
-/**
- * Common OSGi meta data mainAttributes.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface HolderMetaData
-{
- /**
- * Get the element id.
- *
- * @return unique string id
- */
- String getId();
-
- /**
- * Get the exposed interface.
- *
- * @return qualified interface name.
- */
- String getInterface();
-
- /**
- * Get the dependencies.
- *
- * @return set of dependencies.
- */
- Set<DependencyMetaData> getDepends();
-
- /**
- * Get the classloader metadata.
- *
- * @return classloader metadata
- */
- ClassLoaderMetaData getContextClassLoader();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ListenerMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,36 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * Simple listener meta data - referencing bean as listener.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ListenerMetaData
-{
- String getRef();
-
- String getBindMethod();
-
- String getUnbindMethod();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ManifestParser.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,266 +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.
-*/
-
-// This class is based on some original classes from
-// Apache Felix which is licensed as below
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.jboss.osgi.framework.metadata;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.osgi.framework.metadata.internal.AbstractPackageAttribute;
-import org.jboss.osgi.framework.metadata.internal.AbstractParameter;
-import org.jboss.osgi.framework.metadata.internal.AbstractParameterizedAttribute;
-
-/**
- * ManifestParser.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class ManifestParser
-{
- /**
- * Parse packages
- *
- * @param header the header
- * @param list the list of packages to create
- */
- public static void parsePackages(String header, List<PackageAttribute> list)
- {
- parse(header, list, true);
- }
-
- /**
- * Parse parameters
- *
- * @param header the header
- * @param list the list of parameters to create
- */
- public static void parseParameters(String header, List<ParameterizedAttribute> list)
- {
- parse(header, list, false);
- }
-
- /**
- * Parse paths
- *
- * @param header the header
- * @param list the list of paths to create
- */
- public static void parsePaths(String header, List<ParameterizedAttribute> list)
- {
- parse(header, list, false);
- }
-
- /**
- * Parse a header
- *
- * @param header the header
- * @param list the list to create
- * @param packages whether to create packages
- */
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public static void parse(String header, List list, boolean packages)
- {
- if (header == null)
- return;
- if (header.length() == 0)
- throw new IllegalArgumentException("Empty header");
-
- // Split the header into clauses using which are seperated by commas
- // Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2,
- // path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
- List<String> clauses = parseDelimitedString(header, ",");
-
- // Now parse each clause
- for (String clause : clauses)
- {
- // Split the cause into paths, directives and attributes using the semi-colon
- // Like this: path; path; dir1:=dirval1; dir2:=dirval2; attr1=attrval1; attr2=attrval2
- List<String> pieces = parseDelimitedString(clause, ";");
-
- // Collect the paths they should be first
- List<String> paths = new ArrayList<String>();
- for (String piece : pieces)
- {
- if (piece.indexOf('=') >= 0)
- break;
- paths.add(unquote(piece));
- }
- if (paths.isEmpty())
- throw new IllegalArgumentException("No paths for " + clause);
-
- Map<String, Parameter> directives = null;
- Map<String, Parameter> attributes = null;
-
- for (int i = paths.size(); i < pieces.size(); ++i)
- {
- String piece = pieces.get(i);
- int seperator = piece.indexOf(":=");
- if (seperator >= 0)
- {
- String name = piece.substring(0, seperator);
- String value = piece.substring(seperator + 2);
- if (directives == null)
- directives = new HashMap<String, Parameter>();
- String unquoted = unquote(name);
- if (directives.containsKey(unquoted))
- throw new IllegalStateException("Dupicate directive: " + unquoted);
- directives.put(unquoted, new AbstractParameter(unquote(value)));
- }
- else
- {
- seperator = piece.indexOf("=");
- if (seperator >= 0)
- {
- String name = piece.substring(0, seperator);
- String value = piece.substring(seperator + 1);
- if (attributes == null)
- attributes = new HashMap<String, Parameter>();
- String unquoted = unquote(name);
- if (attributes.containsKey(unquoted))
- throw new IllegalStateException("Dupicate attribute: " + unquoted);
- attributes.put(unquoted, new AbstractParameter(unquote(value)));
- }
- else
- {
- throw new IllegalArgumentException("Path " + piece + " should appear before attributes and directives in " + clause);
- }
- }
- }
-
- for (String path : paths)
- {
- ParameterizedAttribute metadata = null;
- if (packages)
- metadata = new AbstractPackageAttribute(path, attributes, directives);
- else
- metadata = new AbstractParameterizedAttribute(path, attributes, directives);
-
- list.add(metadata);
- }
-
- }
- }
-
- /**
- * Remove around quotes around a string
- *
- * @param string the string
- * @return the unquoted string
- */
- private static String unquote(String string)
- {
- if (string.length() < 2)
- return string;
- if (string.charAt(0) == '\"' && string.charAt(string.length()-1) == '\"')
- return string.substring(1, string.length()-1);
- return string;
- }
-
- /**
- * Parses delimited string and returns an array containing the tokens. This
- * parser obeys quotes, so the delimiter character will be ignored if it is
- * inside of a quote. This method assumes that the quote character is not
- * included in the set of delimiter characters.
- * @param value the delimited string to parse.
- * @param delim the characters delimiting the tokens.
- * @return an array of string tokens or null if there were no tokens.
- **/
- private static List<String> parseDelimitedString(String value, String delim)
- {
- if (value == null)
- value = "";
-
- List<String> list = new ArrayList<String>();
-
- int CHAR = 1;
- int DELIMITER = 2;
- int STARTQUOTE = 4;
- int ENDQUOTE = 8;
-
- StringBuilder sb = new StringBuilder();
-
- int expecting = (CHAR | DELIMITER | STARTQUOTE);
-
- for (int i = 0; i < value.length(); i++)
- {
- char c = value.charAt(i);
-
- boolean isDelimiter = (delim.indexOf(c) >= 0);
- boolean isQuote = (c == '"');
-
- if (isDelimiter && ((expecting & DELIMITER) > 0))
- {
- list.add(sb.toString().trim());
- sb.delete(0, sb.length());
- expecting = (CHAR | DELIMITER | STARTQUOTE);
- }
- else if (isQuote && ((expecting & STARTQUOTE) > 0))
- {
- sb.append(c);
- expecting = CHAR | ENDQUOTE;
- }
- else if (isQuote && ((expecting & ENDQUOTE) > 0))
- {
- sb.append(c);
- expecting = (CHAR | STARTQUOTE | DELIMITER);
- }
- else if ((expecting & CHAR) > 0)
- {
- sb.append(c);
- }
- else
- {
- throw new IllegalArgumentException("Invalid delimited string: '" + value + "' delimiter=" + delim);
- }
- }
-
- if (sb.length() > 0)
- list.add(sb.toString().trim());
-
- return list;
- }
-
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibrary.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -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.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;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/NativeLibraryMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,81 +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.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);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/OSGiMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,201 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.net.URL;
-import java.util.Dictionary;
-import java.util.List;
-
-import org.jboss.deployers.vfs.spi.deployer.ManifestMetaData;
-
-/**
- * OSGi specific manifest meta data.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- * @author Thomas.Diesler(a)jboss.com
- */
-public interface OSGiMetaData extends ManifestMetaData
-{
- /**
- * Get the headers in raw unlocalized format.
- *
- * @return the headers
- */
- Dictionary<String, String> getHeaders();
-
- /**
- * Extension point to read custom manifest headers.
- *
- * @param key the header key
- * @return value or null of no such header
- */
- String getHeader(String key);
-
- /**
- * Get bundle activation policy.
- *
- * @return bundle activation policy
- */
- ActivationPolicyMetaData getBundleActivationPolicy();
-
- /**
- * Get bundle activator class name.
- *
- * @return bundle activator classname or null if no such attribute
- */
- String getBundleActivator();
-
- /**
- * Get the bundle category
- *
- * @return list of category names
- */
- List<String> getBundleCategory();
-
- /**
- * Get the bundle classpath
- *
- * @return list of JAR file path names or directories inside bundle
- */
- List<String> getBundleClassPath();
-
- /**
- * Get the description
- *
- * @return a description
- */
- String getBundleDescription();
-
- /**
- * Get the localization's location
- *
- * @return location in the bundle for localization files
- */
- String getBundleLocalization();
-
- /**
- * Get the bundle manifest version
- *
- * @return bundle's specification number
- */
- int getBundleManifestVersion();
-
- /**
- * Get the name
- *
- * @return readable name
- */
- String getBundleName();
-
- /**
- * Get native code libs
- * @return native libs contained in the bundle
- */
- List<ParameterizedAttribute> getBundleNativeCode();
-
- /**
- * Get required exectuion envs
- *
- * @return list of execution envs that must be present on the Service Platform
- */
- List<String> getRequiredExecutionEnvironment();
-
- /**
- * Get bundle symbolic name.
- *
- * @return bundle's symbolic name
- */
- String getBundleSymbolicName();
-
- /**
- * Get the bundle parameters
- *
- * @return the bundle parameters
- */
- ParameterizedAttribute getBundleParameters();
-
- /**
- * Get the update url.
- *
- * @return URL of an update bundle location
- */
- URL getBundleUpdateLocation();
-
- /**
- * Get bundle's version.
- *
- * Note, R3 does not define a specific syntax for Bundle-Version.
- *
- * @return version of this bundle
- */
- String getBundleVersion();
-
- /**
- * Get dynamic imports.
- *
- * @return package names that should be dynamically imported when needed
- */
- List<PackageAttribute> getDynamicImports();
-
- /**
- * Get the export packages.
- *
- * @return exported packages
- */
- List<PackageAttribute> getExportPackages();
-
- /**
- * Get the fragment host.
- *
- * @return host bundle for this fragment
- */
- ParameterizedAttribute getFragmentHost();
-
- /**
- * Get the import packages.
- *
- * @return imported packages.
- */
- List<PackageAttribute> getImportPackages();
-
- /**
- * Get the required exports
- *
- * @return required exports from anoter bundle
- */
- List<ParameterizedAttribute> getRequireBundles();
-
- /**
- * Whether the bundle is a singleton
- *
- * @return true when it is a singleton
- */
- boolean isSingleton();
-
- /**
- * Get the fragment attrachment
- *
- * todo fragments
- * @return the fragment attachment
- */
- String getFragmentAttachment();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/PackageAttribute.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,42 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import org.jboss.reflect.spi.PackageInfo;
-
-/**
- * A package info.
- * Includes version and properties.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface PackageAttribute extends VersionRangeAttribute, ParameterizedAttribute
-{
- /**
- * Get the package info.
- * Must 'match' getAttribute method
- * from AttributeAware interface.
- *
- * @return package info
- */
- PackageInfo getPackageInfo();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/Parameter.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,54 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * Parameter interface - single value or set of values.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface Parameter
-{
- /**
- * Get value.
- * Simple string value or collection of string values.
- *
- * @return value
- */
- Object getValue();
-
- /**
- * Add value.
- *
- * @param value string to add
- */
- void addValue(String value);
-
- /**
- * Has multiple values.
- * Used when same name is used for multiple parameter values.
- * Value _can_ be casted into Collection<String>.
- *
- * @return true is returned type is Collection, otherwise false
- */
- boolean isCollection();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ParameterizedAttribute.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,105 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.Map;
-
-/**
- * Attribute with parameters.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- */
-public interface ParameterizedAttribute extends AttributeAware
-{
- /**
- * Get the attributes.
- *
- * @return the attributes or an empty map
- */
- Map<String, Parameter> getAttributes();
-
- /**
- * Get an attribute by name.
- *
- * @param name attributes's name
- * @return the attribute
- */
- Parameter getAttribute(String name);
-
- /**
- * Get an attribute value
- *
- * @param <T> the expected type
- * @param name the name of the attribute
- * @param type the expected type
- * @return the attribute value
- */
- <T> T getAttributeValue(String name, Class<T> type);
-
- /**
- * Get a directive value
- *
- * @param <T> the expected type
- * @param name the name of the directive
- * @param defaultValue the default value when no attribute is specified
- * @param type the expected type
- * @return the attribute value
- */
- <T> T getAttributeValue(String name, T defaultValue, Class<T> type);
-
- /**
- * Get the declerations
- *
- * @return the directives or an empty map
- */
- Map<String, Parameter> getDirectives();
-
- /**
- * Get a directive by name.
- *
- * @param name directive's name
- * @return the directive
- */
- Parameter getDirective(String name);
-
- /**
- * Get a directive value
- *
- * @param <T> the expected type
- * @param name the name of the directive
- * @param type the expected type
- * @return the directive value
- */
- <T> T getDirectiveValue(String name, Class<T> type);
-
- /**
- * Get a directive value
- *
- * @param <T> the expected type
- * @param name the name of the directive
- * @param defaultValue the default value when no directive is specified
- * @param type the expected type
- * @return the directive value
- */
- <T> T getDirectiveValue(String name, T defaultValue, Class<T> type);
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ReferenceMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.List;
-import java.util.Set;
-
-import org.jboss.beans.metadata.spi.PropertyMetaData;
-
-/**
- * OSGi reference meta data.
- * Extends ValueMetaData - can be used as a value via proxy.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ReferenceMetaData extends HolderMetaData, ServiceValueMetaData
-{
- String getFilter();
-
-// Cardinality getCardinality();
-
- Integer getTimeout();
-
- List<ListenerMetaData> getListeners();
-
- Set<PropertyMetaData> getProperties();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceControllerContext.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,48 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import org.jboss.dependency.spi.ControllerContext;
-import org.jboss.dependency.spi.dispatch.InvokeDispatchContext;
-import org.osgi.framework.BundleContext;
-
-/**
- * Information about Bundle[Context] and ServiceMetaData.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ServiceControllerContext extends ControllerContext, InvokeDispatchContext
-{
- /**
- * Get the metadata
- *
- * @return the service metadata
- */
- ServiceMetaData getServiceMetaData();
-
- /**
- * Get the BundleContext
- *
- * @return underlying bundle context
- */
- BundleContext getBundleContext();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceDeployment.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,52 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.List;
-
-/**
- * An osgi service deployment
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ServiceDeployment
-{
- /**
- * Get the name of the deployment
- *
- * @return the name
- */
- String getName();
-
- /**
- * Set the name of the deployment
- *
- * @param name the name
- */
- void setName(String name);
-
- /**
- * Get the services in the deployment
- * @return List<ServiceMetaData>
- */
- List<ServiceMetaData> getServices();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,44 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * OSGi service meta data.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface ServiceMetaData extends HolderMetaData, ServiceMetaDataVisitorNode
-{
- List<AttributeMetaData> getAttributes();
-
- Set<String> getInterfaces();
-
- Map<String, String> getServiceProperties();
-
- String getRef();
-
- boolean getLazyInit();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitor.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,68 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import org.jboss.dependency.spi.ControllerState;
-import org.jboss.dependency.spi.DependencyItem;
-
-/**
- * ServiceMetaDataVisitor.
- *
- * @author <a href="ales.justin(a)jboss.com">Ales Justin</a>
- */
-public interface ServiceMetaDataVisitor
-{
- /**
- * Get the controller context
- *
- * @return the context
- */
- ServiceControllerContext getControllerContext();
-
- /**
- * Get the context state
- *
- * @return the context state
- */
- ControllerState getContextState();
-
- /**
- * Set the context state
- *
- * @param contextState the context state
- */
- void setContextState(ControllerState contextState);
-
- /**
- * Add a dependency
- *
- * @param dependency the dependency
- */
- void addDependency(DependencyItem dependency);
-
- /**
- * Visit the node
- *
- * @param node the node
- */
- void visit(ServiceMetaDataVisitorNode node);
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceMetaDataVisitorNode.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import java.util.Iterator;
-
-/**
- * ServiceMetaDataVisitorNode.
- *
- * @author <a href="ales.justin(a)jboss.com">Ales Justin</a>
- */
-public interface ServiceMetaDataVisitorNode
-{
- /**
- * Visit the node
- *
- * @param vistor the visitor
- */
- public void visit(ServiceMetaDataVisitor vistor);
-
- /**
- * Return the child nodes
- *
- * @return Iterator<MetaDataVisitorNode> or null if there aren't any
- */
- public Iterator<? extends ServiceMetaDataVisitorNode> getChildren();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/ServiceValueMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,41 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * ServiceValueMetaData.
- *
- * @author <a href="ales.justin(a)jboss.com">Ales Justin</a>
- */
-public interface ServiceValueMetaData extends ServiceMetaDataVisitorNode
-{
- /**
- * Get the value
- *
- * @param bundleContext the bundle context
- * @return the value
- * @throws Throwable for any error
- */
- Object getValue(BundleContext bundleContext) throws Throwable;
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRange.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,61 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange;
-import org.osgi.framework.Version;
-
-/**
- * Version range.
- * [floor, ceiling]
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface VersionRange
-{
- /**
- * The version range that matches all versions
- */
- static VersionRange allVersions = AbstractVersionRange.valueOf("0.0.0");
-
- /**
- * Get the floor version.
- *
- * @return floor version
- */
- Version getFloor();
-
- /**
- * Get the ceiling version.
- *
- * @return ceiling version
- */
- Version getCeiling();
-
- /**
- * Is param verision between (including) floor and ceiling.
- *
- * @param version version parameter to compare
- * @return true if version param in version range interval
- */
- boolean isInRange(Version version);
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/VersionRangeAttribute.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,37 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, 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;
-
-/**
- * Attribute with VersionRange attribute.
- *
- * @author <a href="mailto:ales.justin@jboss.com">Ales Justin</a>
- */
-public interface VersionRangeAttribute extends AttributeAware
-{
- /**
- * Get the version range.
- *
- * @return version range for this attribute
- */
- VersionRange getVersion();
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/util/CaseInsensitiveDictionary.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,145 +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.util;
-
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
-
-import org.jboss.util.collection.Iterators;
-
-/**
- * CaseInsensitiveDictionary.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-@SuppressWarnings("rawtypes")
-public class CaseInsensitiveDictionary extends Hashtable
-{
- private static final long serialVersionUID = 5802491129524016545L;
-
- /** The delegate dictionary */
- private Dictionary<String, Object> delegate;
-
- /** The original keys */
- private Set<String> originalKeys;
-
- /**
- * Create a new CaseInsensitiveDictionary.
- *
- * @param delegate the delegate
- */
- @SuppressWarnings("unchecked")
- public CaseInsensitiveDictionary(Dictionary delegate)
- {
- if (delegate == null)
- throw new IllegalArgumentException("Null delegaqte");
-
- this.delegate = new Hashtable<String, Object>(delegate.size());
- this.originalKeys = Collections.synchronizedSet(new HashSet<String>());
- Enumeration<String> e = delegate.keys();
- while (e.hasMoreElements())
- {
- String key = e.nextElement();
- if (get(key) != null)
- throw new IllegalArgumentException("Properties contain duplicates with varying case for key=" + key + " : " + delegate);
-
- this.delegate.put(key.toLowerCase(), delegate.get(key));
- originalKeys.add(key);
- }
- }
-
- public Enumeration<Object> elements()
- {
- return delegate.elements();
- }
-
- @SuppressWarnings("unchecked")
- public synchronized boolean equals(Object obj)
- {
- if (obj == this)
- return true;
- if (obj == null || obj instanceof Dictionary == false)
- return false;
-
- Dictionary<String, Object> other = (Dictionary)obj;
-
- if (size() != other.size())
- return false;
- if (isEmpty())
- return true;
-
- for (String key : originalKeys)
- {
- if (get(key).equals(other.get(key)))
- return false;
- }
- return true;
- }
-
- public Object get(Object key)
- {
- if (key instanceof String)
- key = ((String)key).toLowerCase();
- return delegate.get(key);
- }
-
- public int hashCode()
- {
- return delegate.hashCode();
- }
-
- public boolean isEmpty()
- {
- return delegate.isEmpty();
- }
-
- @SuppressWarnings("unchecked")
- public Enumeration<String> keys()
- {
- return Iterators.toEnumeration(originalKeys.iterator());
- }
-
- public Object put(Object key, Object value)
- {
- throw new UnsupportedOperationException("immutable");
- }
-
- public Object remove(Object key)
- {
- throw new UnsupportedOperationException("immutable");
- }
-
- public int size()
- {
- return delegate.size();
- }
-
- public String toString()
- {
- return delegate.toString();
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/metadata (from rev 101767, projects/jboss-osgi/projects/runtime/framework/trunk/core)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/.classpath 2010-03-03 10:22:49 UTC (rev 101768)
@@ -4,7 +4,7 @@
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
@@ -1,373 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
- <!-- ====================================================================== -->
- <!-- -->
- <!-- JBoss, the OpenSource J2EE webOS -->
- <!-- -->
- <!-- Distributable under LGPL license. -->
- <!-- See terms of license at http://www.gnu.org. -->
- <!-- -->
- <!-- ====================================================================== -->
-
- <!-- $Id$ -->
-
- <!--
- Set these VM properties in your IDE debugger
-
- -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
- -Dlog4j.configuration=log4j-console.xml
- -->
-
-<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 Framework - Core</name>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
- <packaging>bundle</packaging>
-
- <parent>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-framework-parent</artifactId>
- <version>1.0.0.Alpha4-SNAPSHOT</version>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloading-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-core-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-impl</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-structure-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-jmx</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-aop-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-mc-int</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployers</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployment</artifactId>
- </dependency>
-
- <!-- OSGi Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
-
- <!-- Test bundles dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-apache-xerces</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jmx</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jndi</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-reflect</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.web</groupId>
- <artifactId>pax-web-jetty-bundle</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testing</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>scripts/assembly-all.xml</descriptor>
- </descriptors>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
- <Bundle-Name>JBossOSGi Framework</Bundle-Name>
- <Bundle-Version>${version}</Bundle-Version>
- <Export-Package>
- org.osgi.framework;version="1.5",
- org.osgi.framework.launch;version="1.0",
- org.osgi.framework.hooks.service;version="1.0",
- org.osgi.service.packageadmin;version="1.2",
- org.osgi.service.startlevel;version="1.1",
- org.osgi.util.tracker;version="1.4"
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Xmx512m</argLine>
- <systemProperties>
- <property>
- <name>log4j.output.dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
- <value>bootstrap/jboss-osgi-bootstrap.xml</value>
- </property>
- <property>
- <name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
- </property>
- <property>
- <name>test.archive.directory</name>
- <value>${project.build.directory}/test-libs</value>
- </property>
- </systemProperties>
- <excludes>
- <!-- excludes listed here need to have a jira issue associated
- <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
- -->
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml (from rev 101766, projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, the OpenSource J2EE webOS -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+ <!--
+ Set these VM properties in your IDE debugger
+
+ -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
+ -Dlog4j.configuration=log4j-console.xml
+ -->
+
+<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 Framework - Metadata</name>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-metadata</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi.framework</groupId>
+ <artifactId>jboss-osgi-framework-parent</artifactId>
+ <version>1.0.0.Alpha4-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ </plugins>
+ </build>
+</project>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src (from rev 101766, projects/jboss-osgi/projects/runtime/framework/trunk/core/src)
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java 2010-03-03 09:56:16 UTC (rev 101766)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/metadata/src/main/java/org/jboss/osgi/framework/metadata/internal/AbstractOSGiMetaData.java 2010-03-03 10:22:49 UTC (rev 101768)
@@ -64,13 +64,13 @@
import org.jboss.classloading.spi.version.VersionComparatorRegistry;
import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
import org.jboss.osgi.framework.metadata.ActivationPolicyMetaData;
+import org.jboss.osgi.framework.metadata.CaseInsensitiveDictionary;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.metadata.PackageAttribute;
import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange.OSGiVersionToOSGiVersionComparator;
import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange.OSGiVersionToStringComparator;
import org.jboss.osgi.framework.metadata.internal.AbstractVersionRange.OSGiVersionToVersionComparator;
-import org.jboss.osgi.framework.util.CaseInsensitiveDictionary;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 10:03:50 UTC (rev 101767)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 10:22:49 UTC (rev 101768)
@@ -17,7 +17,7 @@
<modelVersion>4.0.0</modelVersion>
<name>JBossOSGi Framework</name>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.framework</groupId>
<artifactId>jboss-osgi-framework-parent</artifactId>
<packaging>pom</packaging>
@@ -67,6 +67,7 @@
<!-- Modules -->
<modules>
<module>core</module>
+ <module>metadata</module>
</modules>
<!-- Dependency Management -->
14 years, 4 months
JBoss-OSGI SVN: r101767 - in projects/jboss-osgi/projects/runtime/framework/trunk: core and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 05:03:50 -0500 (Wed, 03 Mar 2010)
New Revision: 101767
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/core/.project
projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/
projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.maven.ide.eclipse.prefs
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/core/
Log:
Fix framework eclipse build
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-03-03 09:56:16 UTC (rev 101766)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-03-03 10:03:50 UTC (rev 101767)
@@ -1,6 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Property changes on: projects/jboss-osgi/projects/runtime/framework/trunk/core
___________________________________________________________________
Name: svn:ignore
+ target
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.classpath 2010-03-03 10:03:50 UTC (rev 101767)
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
+ <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="target/classes"/>
+</classpath>
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/.project
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.project (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.project 2010-03-03 10:03:50 UTC (rev 101767)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-framework</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.eclipse.jdt.core.prefs 2010-03-03 10:03:50 UTC (rev 101767)
@@ -0,0 +1,6 @@
+#Wed Mar 03 11:00:13 CET 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/.settings/org.maven.ide.eclipse.prefs 2010-03-03 10:03:50 UTC (rev 101767)
@@ -0,0 +1,9 @@
+#Wed Mar 03 11:00:10 CET 2010
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
14 years, 4 months
JBoss-OSGI SVN: r101766 - in projects/jboss-osgi/projects/runtime/framework/trunk: core and 4 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 04:56:16 -0500 (Wed, 03 Mar 2010)
New Revision: 101766
Added:
projects/jboss-osgi/projects/runtime/framework/trunk/core/
projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/core/scripts/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/bundle/
projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
projects/jboss-osgi/projects/runtime/framework/trunk/scripts/
projects/jboss-osgi/projects/runtime/framework/trunk/src/
Modified:
projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
Log:
split framework into modules
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-03-03 09:42:26 UTC (rev 101765)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/.classpath 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,9 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/pom.xml 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,373 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, the OpenSource J2EE webOS -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+ <!--
+ Set these VM properties in your IDE debugger
+
+ -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
+ -Dlog4j.configuration=log4j-console.xml
+ -->
+
+<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 Framework - Core</name>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-framework</artifactId>
+ <packaging>bundle</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-framework-parent</artifactId>
+ <version>1.0.0.Alpha4-SNAPSHOT</version>
+ </parent>
+
+ <dependencies>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloader</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-core-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-impl</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-structure-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-jmx</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-jmx-aop-mc-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-jmx-mc-int</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployers</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployment</artifactId>
+ </dependency>
+
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <!-- Test bundles dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-apache-xerces</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jaxb</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jndi</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-reflect</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-xml-binding</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-jetty-bundle</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ <execution>
+ <id>all</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>scripts/assembly-all.xml</descriptor>
+ </descriptors>
+ <archive>
+ <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-idea-plugin</artifactId>
+ <configuration>
+ <downloadSources>true</downloadSources>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
+ <Bundle-Name>JBossOSGi Framework</Bundle-Name>
+ <Bundle-Version>${version}</Bundle-Version>
+ <Export-Package>
+ org.osgi.framework;version="1.5",
+ org.osgi.framework.launch;version="1.0",
+ org.osgi.framework.hooks.service;version="1.0",
+ org.osgi.service.packageadmin;version="1.2",
+ org.osgi.service.startlevel;version="1.1",
+ org.osgi.util.tracker;version="1.4"
+ </Export-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <argLine>-Xmx512m</argLine>
+ <systemProperties>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${project.build.directory}</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
+ <value>bootstrap/jboss-osgi-bootstrap.xml</value>
+ </property>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
+ </property>
+ <property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ </systemProperties>
+ <excludes>
+ <!-- excludes listed here need to have a jira issue associated
+ <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
+ -->
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/scripts (from rev 101664, projects/jboss-osgi/projects/runtime/framework/trunk/scripts)
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src (from rev 101664, projects/jboss-osgi/projects/runtime/framework/trunk/src)
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,280 +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.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.AdminPermission;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * The abstract state of a user deployed {@link Bundle} or Fragment.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 25-Dec-2009
- */
-public abstract class AbstractDeployedBundleState extends AbstractBundleState
-{
- /** Used to generate a unique id */
- private static final AtomicLong bundleIDGenerator = new AtomicLong();
-
- /** The bundle id */
- private long bundleId;
-
- /** The bundle location */
- private String location;
-
- /** The bundle root file */
- private VirtualFile rootFile;
-
- /** The list of deployment units */
- private List<DeploymentUnit> units = new ArrayList<DeploymentUnit>();
-
- /** The headers localized with the default locale */
- Dictionary<String, String> headersOnUninstall;
-
- /**
- * Create a new BundleState.
- * @throws IllegalArgumentException for a null parameter
- */
- public AbstractDeployedBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
- {
- super(bundleManager);
-
- if (unit == null)
- throw new IllegalArgumentException("Null deployment unit");
-
- // The bundle location is not necessarily the bundle root url
- // The framework is expected to preserve the location passed into installBundle(String)
- Deployment dep = unit.getAttachment(Deployment.class);
- location = (dep != null ? dep.getLocation() : unit.getName());
- rootFile = (dep != null ? dep.getRoot() : ((VFSDeploymentUnit)unit).getRoot());
-
- bundleId = bundleIDGenerator.incrementAndGet();
-
- addDeploymentUnit(unit);
- }
-
- /**
- * Get the root file for this bundle
- */
- public VirtualFile getRoot()
- {
- return rootFile;
- }
-
- @Override
- public OSGiMetaData getOSGiMetaData()
- {
- DeploymentUnit unit = getDeploymentUnit();
- OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
- return osgiMetaData;
- }
-
- public long getBundleId()
- {
- return bundleId;
- }
-
- /**
- * Get the DeploymentUnit that was added last.
- *
- * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
- * A sucessful call to {@link #update()} or its variants pushes an additional
- * DeploymentUnit to the stack.
- *
- * @return the unit that corresponds to the last sucessful update.
- */
- public DeploymentUnit getDeploymentUnit()
- {
- int index = (units.size() - 1);
- return units.get(index);
- }
-
- /**
- * Add a DeploymentUnit to the list.
- *
- * @see {@link OSGiBundleManager#updateBundle(DeployedBundleState, InputStream)}
- */
- void addDeploymentUnit(DeploymentUnit unit)
- {
- unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
- units.add(unit);
- }
-
- /**
- * Get the list of DeploymentUnits.
- *
- * @see {@link OSGiBundleManager#uninstallBundle(DeployedBundleState)}
- */
- List<DeploymentUnit> getDeploymentUnits()
- {
- return Collections.unmodifiableList(units);
- }
-
- public String getLocation()
- {
- return location;
- }
-
- @Override
- public Dictionary<String, String> getHeaders(String locale)
- {
- // This method must continue to return Manifest header information while this bundle is in the UNINSTALLED state,
- // however the header values must only be available in the raw and default locale values
- if (getState() == Bundle.UNINSTALLED)
- return headersOnUninstall;
-
- return super.getHeaders(locale);
- }
-
- public URL getEntry(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- return getEntryInternal(path);
- }
-
- @SuppressWarnings("rawtypes")
- public Enumeration getEntryPaths(String path)
- {
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSEntryPathsEnumeration(root, child);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
- }
-
- }
- return null;
- }
-
- @Override
- protected URL getEntryInternal(String path)
- {
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
-
- if (path.startsWith("/"))
- path = path.substring(1);
-
- return vfsDeploymentUnit.getResourceLoader().getResource(path);
- }
- return null;
- }
-
- public void uninstall() throws BundleException
- {
- checkAdminPermission(AdminPermission.LIFECYCLE);
-
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
- if (getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // Cache the headers in the default locale
- headersOnUninstall = getHeaders(null);
-
- getBundleManager().uninstallBundle(this);
- }
-
- @SuppressWarnings("rawtypes")
- public Enumeration findEntries(String path, String filePattern, boolean recurse)
- {
- if (path == null)
- throw new IllegalArgumentException("Null path");
-
- checkInstalled();
- if (noAdminPermission(AdminPermission.RESOURCE))
- return null;
-
- // [TODO] fragments
- resolveBundle();
-
- if (filePattern == null)
- filePattern = "*";
-
- DeploymentUnit unit = getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit)
- {
- VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
- VirtualFile root = vfsDeploymentUnit.getRoot();
- if (path.startsWith("/"))
- path = path.substring(1);
- try
- {
- VirtualFile child = root.getChild(path);
- if (child != null)
- return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
- }
- catch (IOException e)
- {
- throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
- }
-
- }
- return null;
- }
-
- /**
- * Try to resolve the bundle
- * @return true when resolved
- */
- protected boolean resolveBundle()
- {
- PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
- return packageAdmin.resolveBundles(new Bundle[] { this });
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,281 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.AdminPermission;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * The abstract state of a user deployed {@link Bundle} or Fragment.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 25-Dec-2009
+ */
+public abstract class AbstractDeployedBundleState extends AbstractBundleState
+{
+ /** Used to generate a unique id */
+ private static final AtomicLong bundleIDGenerator = new AtomicLong();
+
+ /** The bundle id */
+ private long bundleId;
+
+ /** The bundle location */
+ private String location;
+
+ /** The bundle root file */
+ private VirtualFile rootFile;
+
+ /** The list of deployment units */
+ private List<DeploymentUnit> units = new ArrayList<DeploymentUnit>();
+
+ /** The headers localized with the default locale */
+ Dictionary<String, String> headersOnUninstall;
+
+ /**
+ * Create a new BundleState.
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public AbstractDeployedBundleState(OSGiBundleManager bundleManager, DeploymentUnit unit)
+ {
+ super(bundleManager);
+
+ if (unit == null)
+ throw new IllegalArgumentException("Null deployment unit");
+
+ // The bundle location is not necessarily the bundle root url
+ // The framework is expected to preserve the location passed into installBundle(String)
+ Deployment dep = unit.getAttachment(Deployment.class);
+ location = (dep != null ? dep.getLocation() : unit.getName());
+ rootFile = (dep != null ? (VirtualFile)AbstractVFS.adapt(dep.getRoot()) : ((VFSDeploymentUnit)unit).getRoot());
+
+ bundleId = bundleIDGenerator.incrementAndGet();
+
+ addDeploymentUnit(unit);
+ }
+
+ /**
+ * Get the root file for this bundle
+ */
+ public VirtualFile getRoot()
+ {
+ return rootFile;
+ }
+
+ @Override
+ public OSGiMetaData getOSGiMetaData()
+ {
+ DeploymentUnit unit = getDeploymentUnit();
+ OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+ return osgiMetaData;
+ }
+
+ public long getBundleId()
+ {
+ return bundleId;
+ }
+
+ /**
+ * Get the DeploymentUnit that was added last.
+ *
+ * Initially, an OSGiBundleState is associated with just one DeploymentUnit.
+ * A sucessful call to {@link #update()} or its variants pushes an additional
+ * DeploymentUnit to the stack.
+ *
+ * @return the unit that corresponds to the last sucessful update.
+ */
+ public DeploymentUnit getDeploymentUnit()
+ {
+ int index = (units.size() - 1);
+ return units.get(index);
+ }
+
+ /**
+ * Add a DeploymentUnit to the list.
+ *
+ * @see {@link OSGiBundleManager#updateBundle(DeployedBundleState, InputStream)}
+ */
+ void addDeploymentUnit(DeploymentUnit unit)
+ {
+ unit.getMutableMetaData().addMetaData(unit, DeploymentUnit.class);
+ units.add(unit);
+ }
+
+ /**
+ * Get the list of DeploymentUnits.
+ *
+ * @see {@link OSGiBundleManager#uninstallBundle(DeployedBundleState)}
+ */
+ List<DeploymentUnit> getDeploymentUnits()
+ {
+ return Collections.unmodifiableList(units);
+ }
+
+ public String getLocation()
+ {
+ return location;
+ }
+
+ @Override
+ public Dictionary<String, String> getHeaders(String locale)
+ {
+ // This method must continue to return Manifest header information while this bundle is in the UNINSTALLED state,
+ // however the header values must only be available in the raw and default locale values
+ if (getState() == Bundle.UNINSTALLED)
+ return headersOnUninstall;
+
+ return super.getHeaders(locale);
+ }
+
+ public URL getEntry(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ return getEntryInternal(path);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration getEntryPaths(String path)
+ {
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSEntryPathsEnumeration(root, child);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error determining entry paths for " + root + " path=" + path);
+ }
+
+ }
+ return null;
+ }
+
+ @Override
+ protected URL getEntryInternal(String path)
+ {
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+
+ if (path.startsWith("/"))
+ path = path.substring(1);
+
+ return vfsDeploymentUnit.getResourceLoader().getResource(path);
+ }
+ return null;
+ }
+
+ public void uninstall() throws BundleException
+ {
+ checkAdminPermission(AdminPermission.LIFECYCLE);
+
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown
+ if (getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // Cache the headers in the default locale
+ headersOnUninstall = getHeaders(null);
+
+ getBundleManager().uninstallBundle(this);
+ }
+
+ @SuppressWarnings("rawtypes")
+ public Enumeration findEntries(String path, String filePattern, boolean recurse)
+ {
+ if (path == null)
+ throw new IllegalArgumentException("Null path");
+
+ checkInstalled();
+ if (noAdminPermission(AdminPermission.RESOURCE))
+ return null;
+
+ // [TODO] fragments
+ resolveBundle();
+
+ if (filePattern == null)
+ filePattern = "*";
+
+ DeploymentUnit unit = getDeploymentUnit();
+ if (unit instanceof VFSDeploymentUnit)
+ {
+ VFSDeploymentUnit vfsDeploymentUnit = (VFSDeploymentUnit)unit;
+ VirtualFile root = vfsDeploymentUnit.getRoot();
+ if (path.startsWith("/"))
+ path = path.substring(1);
+ try
+ {
+ VirtualFile child = root.getChild(path);
+ if (child != null)
+ return new VFSFindEntriesEnumeration(root, child, filePattern, recurse);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Error finding entries for " + root + " path=" + path + " pattern=" + filePattern + " recurse=" + recurse);
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Try to resolve the bundle
+ * @return true when resolved
+ */
+ protected boolean resolveBundle()
+ {
+ PackageAdminPlugin packageAdmin = getBundleManager().getPlugin(PackageAdminPlugin.class);
+ return packageAdmin.resolveBundles(new Bundle[] { this });
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,1561 +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.bundle;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
-import org.jboss.deployers.client.spi.DeployerClient;
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
-import org.jboss.deployers.client.spi.IncompleteDeployments;
-import org.jboss.deployers.client.spi.MissingDependency;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.attachments.MutableAttachments;
-import org.jboss.deployers.spi.deployer.DeploymentStages;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
-import org.jboss.deployers.vfs.spi.client.VFSDeployment;
-import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
-import org.jboss.kernel.Kernel;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentFactory;
-import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
-import org.jboss.osgi.framework.metadata.OSGiMetaData;
-import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
-import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
-import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
-import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
-import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
-import org.jboss.osgi.framework.plugins.Plugin;
-import org.jboss.osgi.framework.plugins.ResolverPlugin;
-import org.jboss.osgi.framework.plugins.ServicePlugin;
-import org.jboss.osgi.framework.util.URLHelper;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.util.platform.Java;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.Version;
-import org.osgi.service.packageadmin.PackageAdmin;
-
-/**
- * OSGiBundleManager.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @author Thomas.Diesler(a)jboss.com
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- * @version $Revision: 1.1 $
- */
-public class OSGiBundleManager
-{
- /** The log */
- private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
-
- /** The bundle manager's bean name: OSGiBundleManager */
- public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
- /** The framework execution environment */
- private static String OSGi_FRAMEWORK_EXECUTIONENVIRONMENT;
- /** The framework language */
- private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
- /** The os name */
- private static String OSGi_FRAMEWORK_OS_NAME;
- /** The os version */
- private static String OSGi_FRAMEWORK_OS_VERSION;
- /** The os version */
- private static String OSGi_FRAMEWORK_PROCESSOR;
- /** The framework vendor */
- private static String OSGi_FRAMEWORK_VENDOR = "jboss.org";
- /** The framework version. This is the version of the org.osgi.framework package in r4v42 */
- private static String OSGi_FRAMEWORK_VERSION = "1.5";
- /** The bundles by id */
- private List<AbstractBundleState> allBundles = new CopyOnWriteArrayList<AbstractBundleState>();
- /** The kernel */
- private Kernel kernel;
- /** The main deployer */
- private DeployerClient deployerClient;
- /** The executor */
- private Executor executor;
- /** The system bundle */
- private OSGiSystemState systemBundle;
- /** The registered manager plugins */
- private Map<Class<?>, Plugin> plugins = Collections.synchronizedMap(new LinkedHashMap<Class<?>, Plugin>());
- /** The frame work properties */
- private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
- /** The framework stop monitor*/
- private AtomicInteger stopMonitor = new AtomicInteger(0);
-
- static
- {
- AccessController.doPrivileged(new PrivilegedAction<Object>()
- {
- public Object run()
- {
- List<String> execEnvironments = new ArrayList<String>();
- if (Java.isCompatible(Java.VERSION_1_5))
- execEnvironments.add("J2SE-1.5");
- if (Java.isCompatible(Java.VERSION_1_6))
- execEnvironments.add("JavaSE-1.6");
-
- String envlist = execEnvironments.toString();
- envlist = envlist.substring(1, envlist.length() - 1);
- OSGi_FRAMEWORK_EXECUTIONENVIRONMENT = envlist;
-
- OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
- OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
- OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
-
- System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
- return null;
- }
- });
- }
-
- /**
- * Create a new OSGiBundleManager.
- *
- * @param kernel the kernel
- * @param deployerClient the deployer client
- * @param registry the deployment registry
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
- {
- this(kernel, deployerClient, null);
- }
-
- /**
- * Create a new OSGiBundleManager.
- *
- * @param kernel the kernel
- * @param deployerClient the deployer client
- * @param registry the deployment registry
- * @param executor the executor
- * @throws IllegalArgumentException for a null parameter
- */
- public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
- {
- if (kernel == null)
- throw new IllegalArgumentException("Null kernel");
- if (deployerClient == null)
- throw new IllegalArgumentException("Null deployerClient");
- if (deployerClient instanceof MainDeployerStructure == false)
- throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
-
- this.kernel = kernel;
- this.deployerClient = deployerClient;
-
- // TODO thread factory
- if (executor == null)
- executor = Executors.newFixedThreadPool(10);
-
- this.executor = executor;
- }
-
- public void start()
- {
- // Create the system Bundle
- systemBundle = new OSGiSystemState(this);
- addBundle(systemBundle);
- }
-
- public void stop()
- {
- // nothing to do
- }
-
- /**
- * Get the kernel
- *
- * @return the kernel
- */
- public Kernel getKernel()
- {
- return kernel;
- }
-
- /**
- * Get the deployerClient.
- *
- * @return the deployerClient.
- */
- public DeployerClient getDeployerClient()
- {
- return deployerClient;
- }
-
- /**
- * Set the framework properties
- *
- * @param properties the properties
- */
- public void setProperties(Map<String, Object> props)
- {
- properties.putAll(props);
-
- // Init default framework properties
- if (getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT) == null)
- setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, OSGi_FRAMEWORK_EXECUTIONENVIRONMENT);
- if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
- setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
- if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
- setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
- if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
- setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
- if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
- setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
- if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
- setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
- if (getProperty(Constants.FRAMEWORK_VERSION) == null)
- setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
- }
-
- /**
- * Get a property
- *
- * @param key the property key
- * @return the property
- * @throws SecurityException if the caller doesn't have the relevant property permission
- */
- public String getProperty(String key)
- {
- Object value = properties.get(key);
- if (value == null)
- value = System.getProperty(key);
-
- if (value instanceof String == false)
- return null;
-
- return (String)value;
- }
-
- /**
- * Set a property. This is used at the frame work init state.
- *
- * @param key the prperty key
- * @param value the property value
- */
- public void setProperty(String key, String value)
- {
- properties.put(key, value);
- }
-
- /**
- * Get a plugin that is registered with the bundle manager.
- *
- * @param <T> the pluging type
- * @param clazz the plugin type
- * @return the plugin
- * @throws IllegalStateException if the requested plugin class is not registered
- */
- @SuppressWarnings("unchecked")
- public <T extends Plugin> T getPlugin(Class<T> clazz)
- {
- T plugin = (T)plugins.get(clazz);
- if (plugin == null)
- throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
-
- return plugin;
- }
-
- /**
- * Get an optional plugin that is registered with the bundle manager.
- *
- * @param <T> the pluging type
- * @param clazz the plugin type
- * @return The plugin instance or null if the requested plugin class is not registered
- */
- @SuppressWarnings("unchecked")
- public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
- {
- return (T)plugins.get(clazz);
- }
-
- /**
- * Add a plugin
- *
- * @param plugin the plugin
- */
- public void addPlugin(Plugin plugin)
- {
- Class<?> key = getPluginKey(plugin);
- log.debug("Add plugin: " + key.getName());
- plugins.put(key, plugin);
-
- // In case a service plugin gets added after the framework is started
- if (isFrameworkActive() == true && plugin instanceof ServicePlugin)
- {
- ServicePlugin servicePlugin = (ServicePlugin)plugin;
- servicePlugin.startService();
- }
- }
-
- /**
- * Get the key for a given plugin
- *
- * @param plugin the plugin
- * @return the class
- */
- private Class<?> getPluginKey(Plugin plugin)
- {
- if (plugin == null)
- throw new IllegalArgumentException("Null plugin");
-
- Class<?> clazz = plugin.getClass();
- Class<?> key = getPluginKey(plugin, clazz);
-
- // If the plugin could not be added by Interface, use the clazz directly
- return (key != null ? key : clazz);
- }
-
- /**
- * Get the plugin key by scanning the interfaces for the given clazz.
- *
- * @param plugin the plugin
- * @param clazz the class
- * @return The first interface that extends Plugin.
- */
- private Class<?> getPluginKey(Plugin plugin, Class<?> clazz)
- {
- // Scan the interfaces on the class
- for (Class<?> interf : clazz.getInterfaces())
- {
- if (interf == Plugin.class || interf == ServicePlugin.class)
- continue;
-
- if (Plugin.class.isAssignableFrom(interf))
- {
- return interf;
- }
- }
-
- // Interface not found, try the plugin's superclass
- Class<?> superclass = clazz.getSuperclass();
- if (Plugin.class.isAssignableFrom(superclass))
- return getPluginKey(plugin, superclass);
-
- return null;
- }
-
- /**
- * Remove a plugin
- *
- * @param plugin the plugin to remove
- */
- public void removePlugin(Plugin plugin)
- {
- Class<?> key = getPluginKey(plugin);
- log.debug("Remove plugin: " + key.getName());
- plugins.remove(key);
- }
-
- /**
- * Are we active
- * @return true when the system is active
- */
- public boolean isFrameworkActive()
- {
- // We are active if the system bundle is ACTIVE
- AbstractBundleState bundleState = getSystemBundle();
- return bundleState.getState() == Bundle.ACTIVE;
- }
-
- /**
- * Install a bundle from an URL.
- *
- * @param url the url of the bundle
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState installBundle(URL url) throws BundleException
- {
- if (url == null)
- throw new BundleException("Null url");
-
- return installBundle(url.toExternalForm(), null);
- }
-
- /**
- * Install a bundle from an input stream.
- *
- * @param location the bundle's location identifier
- * @param input an optional input stream to read the bundle content from
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
- {
- if (location == null)
- throw new BundleException("Null location");
-
- URL locationURL;
-
- // Get the location URL
- if (input != null)
- {
- locationURL = getBundleStorageLocation(input);
- }
- else
- {
- locationURL = getLocationURL(location);
- }
-
- // Get the root file
- VirtualFile root;
- try
- {
- root = VFS.getRoot(locationURL);
- }
- catch (IOException e)
- {
- throw new BundleException("Invalid bundle location=" + locationURL, e);
- }
-
- return install(root, location, false);
- }
-
- private URL getBundleStorageLocation(InputStream input) throws BundleException
- {
- try
- {
- BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
- String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
-
- // [TODO] do properly
- File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
- FileOutputStream fos = new FileOutputStream(file);
- VFSUtils.copyStream(input, fos);
- fos.close();
-
- URL locationURL = file.toURI().toURL();
- return locationURL;
- }
- catch (IOException ex)
- {
- throw new BundleException("Cannot store bundle from input stream", ex);
- }
- }
-
- /**
- * Install a bundle from a virtual file.
- *
- * @param root the virtual file that point to the bundle
- *
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState installBundle(VirtualFile root) throws BundleException
- {
- return install(root, root.toString(), false);
- }
-
- /*
- * Installs a bundle from the given virtual file.
- */
- private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
- {
- if (location == null)
- throw new IllegalArgumentException("Null location");
-
- Deployment dep;
- try
- {
- BundleInfo info = BundleInfo.createBundleInfo(root, location);
- dep = DeploymentFactory.createDeployment(info);
- dep.setAutoStart(autoStart);
- }
- catch (RuntimeException ex)
- {
- throw new BundleException("Cannot install bundle: " + root, ex);
- }
-
- return installBundle(dep);
- }
-
- /**
- * Install a bundle from a deployment.
- *
- * @param dep the deployment that represents the bundle
- *
- * @return the bundle state
- * @throws BundleException for any error
- */
- public AbstractBundleState installBundle(Deployment dep) throws BundleException
- {
- // Create the deployment and deploy it
- try
- {
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(dep.getRoot());
- MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
- att.addAttachment(Deployment.class, dep);
-
- // In case of update the OSGiBundleState is attached
- AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
- if (bundleState != null)
- att.addAttachment(AbstractBundleState.class, bundleState);
-
- deployerClient.deploy(deployment);
- try
- {
- MainDeployerStructure deployerStructure = (MainDeployerStructure)deployerClient;
- DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
- bundleState = unit.getAttachment(AbstractBundleState.class);
- if (bundleState == null)
- throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
-
- return bundleState;
- }
- catch (Exception e)
- {
- deployerClient.undeploy(deployment);
- throw e;
- }
- }
- catch (IncompleteDeploymentException ex)
- {
- String errorMessage = getIncompleteDeploymentInfo(dep, ex);
- throw new BundleException(errorMessage);
- }
- catch (Exception ex)
- {
- throw new BundleException("Error installing bundle from: " + dep, ex);
- }
- }
-
- private String getIncompleteDeploymentInfo(Deployment dep, IncompleteDeploymentException ex)
- {
- IncompleteDeployments deployments = ex.getIncompleteDeployments();
-
- StringWriter stringWriter = new StringWriter();
- PrintWriter printWriter = new PrintWriter(stringWriter);
- printWriter.println("Error installing bundle from: " + dep);
-
- // Contexts in error
- Collection<Throwable> contextsError = deployments.getContextsInError().values();
- if (contextsError.size() > 0)
- {
- printWriter.println("\nContext Errors:");
- for (Throwable th : contextsError)
- {
- printWriter.println("\n");
- th.printStackTrace(printWriter);
- }
- }
-
- // Deployments in error
- Collection<Throwable> deploymentsInError = deployments.getDeploymentsInError().values();
- if (deploymentsInError.size() > 0)
- {
- printWriter.println("\nDeployment Errors:");
- for (Throwable th : deploymentsInError)
- {
- printWriter.println("\n");
- th.printStackTrace(printWriter);
- }
- }
-
- // Missing Dependencies
- Collection<Set<MissingDependency>> missingDependencies = deployments.getContextsMissingDependencies().values();
- if (missingDependencies.size() > 0)
- {
- printWriter.println("\nMissing Dependencies:");
- for (Set<MissingDependency> missDeps : missingDependencies)
- {
- for (MissingDependency missDep : missDeps)
- {
- printWriter.println("\n " + missDep);
- }
- }
- }
-
- // Missing Deployers
- Collection<String> missingDeployers = deployments.getDeploymentsMissingDeployer();
- if (missingDeployers.size() > 0)
- {
- printWriter.println("\nMissing Deployers:");
- for (String missDep : missingDeployers)
- {
- printWriter.println("\n " + missDep);
- }
- }
-
- String errorMessage = stringWriter.toString();
- return errorMessage;
- }
-
- /**
- * Updates a bundle from an InputStream.
- */
- public void updateBundle(AbstractDeployedBundleState bundleState, InputStream in) throws BundleException
- {
- // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting,
- // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
- URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
- if (updateURL == null)
- {
- // This updates the bundle from its original location
- VirtualFile root = bundleState.getRoot();
- updateURL = URLHelper.toURL(root);
- }
- if (in == null)
- {
- try
- {
- in = updateURL.openStream();
- }
- catch (IOException ex)
- {
- throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
- }
- }
-
- // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes.
- boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
-
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
- if (bundleState.getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated.
- // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been
- // has been called or the Framework is relaunched.
-
- // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method.
- // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
- if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
- {
- stopBundle(bundleState);
- }
-
- // The updated version of this bundle is read from the input stream and installed.
- // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored
- // and a BundleException must be thrown after completion of the remaining steps.
- String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
- AbstractBundleState updatedBundleState = null;
- BundleException throwAfterUpdate = null;
- try
- {
- URL storageLocation = getBundleStorageLocation(in);
- VirtualFile root = VFS.getRoot(storageLocation);
-
- BundleInfo info = BundleInfo.createBundleInfo(root, location);
- Deployment dep = DeploymentFactory.createDeployment(info);
- dep.addAttachment(AbstractBundleState.class, bundleState);
- dep.setBundleUpdate(true);
- dep.setAutoStart(false);
-
- updatedBundleState = installBundle(dep);
- updatedBundleState.updateLastModified();
- }
- catch (Exception ex)
- {
- if (ex instanceof BundleException)
- throwAfterUpdate = (BundleException)ex;
- else
- throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
-
- if (activeBeforeUpdate)
- {
- startBundle(bundleState);
- }
- }
-
- // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
- if (updatedBundleState != null)
- {
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
-
- // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method.
- // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
- if (activeBeforeUpdate)
- {
- if (updatedBundleState.isFragment() == false)
- startBundle((AbstractDeployedBundleState)updatedBundleState);
- }
- }
-
- // A BundleException must be thrown after completion of the remaining steps
- if (throwAfterUpdate != null)
- {
- throw throwAfterUpdate;
- }
- }
-
- /**
- * Uninstall a bundle
- *
- * @param bundleState the bundle
- * @throws BundleException for any error
- */
- public void uninstallBundle(AbstractDeployedBundleState bundleState) throws BundleException
- {
- long id = bundleState.getBundleId();
- if (getBundleById(id) == null)
- throw new BundleException(bundleState + " not installed");
-
- // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped
- // as described in the Bundle.stop method.
- int state = bundleState.getState();
- if (state == Bundle.ACTIVE || state == Bundle.STARTING || state == Bundle.STOPPING)
- {
- try
- {
- if (bundleState.isFragment() == false)
- stopBundle((AbstractDeployedBundleState)bundleState);
- }
- catch (Exception ex)
- {
- // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is
- // fired containing the exception
- fireError(bundleState, "Error stopping bundle: " + bundleState, ex);
- }
- }
-
- DeploymentException depEx = null;
- for (DeploymentUnit unit : bundleState.getDeploymentUnits())
- {
- try
- {
- deployerClient.undeploy(unit.getName());
- bundleState.updateLastModified();
- }
- catch (DeploymentException ex)
- {
- log.error("Cannot undeploy: " + unit.getName(), depEx = ex);
- }
- }
-
- // Rethrow deployment exception
- if (depEx != null)
- {
- Throwable cause = depEx.getCause();
- if (cause instanceof BundleException)
- throw (BundleException)cause;
-
- throw new BundleException("Unable to uninstall " + bundleState, cause);
- }
- }
-
- /**
- * Add a deployment to the manager, which creates the bundle state.
- *
- * Note, the bundle state is not yet added to the manager.
- */
- public AbstractBundleState addDeployment(DeploymentUnit unit)
- {
- if (unit == null)
- throw new IllegalArgumentException("Null unit");
-
- // In case of Bundle.update() the OSGiBundleState is attached
- AbstractBundleState absBundle = unit.getAttachment(AbstractBundleState.class);
- if (absBundle != null)
- {
- // Add the DeploymentUnit to the OSGiBundleState
- OSGiBundleState depBundle = (OSGiBundleState)absBundle;
- depBundle.addDeploymentUnit(unit);
- }
- else
- {
- OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
- ParameterizedAttribute fragmentHost = osgiMetaData.getFragmentHost();
- if (fragmentHost != null)
- {
- // Create a new OSGiFragmentState
- OSGiFragmentState fragmentState = new OSGiFragmentState(this, unit);
- absBundle = fragmentState;
- }
- else
- {
- // Create a new OSGiBundleState
- AbstractDeployedBundleState bundleState = new OSGiBundleState(this, unit);
- absBundle = bundleState;
- }
- }
-
- // Attach the abstract bundle state
- unit.addAttachment(AbstractBundleState.class, absBundle);
-
- if (absBundle.isFragment())
- unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
- else
- unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
-
- return absBundle;
- }
-
- /**
- * Add a bundle to the manager.
- *
- * Note, the bundle must be metadata complete when it is added to the manager.
- * An extender might pickup the INSTALLED event and use PackageAdmin to examine the
- * exported packages for example.
- *
- * @param bundleState the bundle state
- * @throws IllegalArgumentException for a null bundle state
- */
- public void addBundle(AbstractBundleState bundleState)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle state");
-
- // Do nothing if this is a bundle update
- if (bundleState instanceof OSGiBundleState)
- {
- DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
- if (unit.getAttachment(ClassLoadingMetaData.class) == null)
- throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
-
- Deployment dep = unit.getAttachment(Deployment.class);
- if (dep != null && dep.isBundleUpdate())
- return;
- }
-
- validateBundle(bundleState);
-
- allBundles.add(bundleState);
-
- bundleState.changeState(Bundle.INSTALLED, true);
-
- // Add the bundle to the resolver
- // Note, plugins are not registered when the system bundle is added
- ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
- if (bundleResolver != null)
- bundleResolver.addBundle(bundleState);
-
- log.debug("Added: " + bundleState);
- }
-
- /**
- * Validate the bundle
- *
- * @param bundleState the bundle state
- */
- private void validateBundle(AbstractBundleState bundleState)
- {
- OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
- if (osgiMetaData == null)
- return;
-
- OSGiBundleValidator validator;
-
- // Delegate to the validator for the appropriate revision
- if (osgiMetaData.getBundleManifestVersion() > 1)
- validator = new OSGiBundleValidatorR4(this);
- else
- validator = new OSGiBundleValidatorR3(this);
-
- validator.validateBundle(bundleState);
- }
-
- /**
- * Remove a bundle
- *
- * @param bundleState the bundle state
- * @throws IllegalArgumentException for a null bundle state
- */
- public void removeBundle(AbstractBundleState bundleState)
- {
- if (bundleState == null)
- throw new IllegalArgumentException("Null bundle state");
-
- bundleState.uninstallInternal();
-
- // Remove the bundle from the resolver
- ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
- if (bundleResolver != null)
- bundleResolver.removeBundle(bundleState);
-
- allBundles.remove(bundleState);
- log.debug("Removed " + bundleState.getCanonicalName());
- }
-
- /**
- * Get the system bundle
- *
- * @return the system bundle
- */
- public OSGiSystemState getSystemBundle()
- {
- return systemBundle;
- }
-
- /**
- * Get the system bundle context
- *
- * @return the system bundle context
- */
- public BundleContext getSystemContext()
- {
- return systemBundle.getBundleContext();
- }
-
- /**
- * Get a deployment
- *
- * @param id the id of the bundle
- * @return the deployment or null if there is no bundle with that id
- */
- public DeploymentUnit getDeployment(long id)
- {
- if (id == 0)
- throw new IllegalArgumentException("Cannot get deployment from system bundle");
-
- AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleById(id);
- if (bundleState == null)
- return null;
-
- return bundleState.getDeploymentUnit();
- }
-
- /**
- * Get a bundle by id
- *
- * @param id the id of the bundle
- * @return the bundle or null if there is no bundle with that id
- */
- public AbstractBundleState getBundleById(long id)
- {
- AbstractBundleState result = null;
- for (AbstractBundleState aux : allBundles)
- {
- if (id == aux.getBundleId())
- {
- result = aux;
- break;
- }
- }
- return result;
- }
-
- /**
- * Get a bundle by symbolic name and version
- *
- * @param symbolicName the symbolic name of the bundle
- * @param version the version of the bundle
- * @return the bundle or null if there is no bundle with that id
- */
- public AbstractBundleState getBundle(String symbolicName, Version version)
- {
- AbstractBundleState result = null;
- for (AbstractBundleState aux : allBundles)
- {
- String auxName = aux.getSymbolicName();
- Version auxVersion = aux.getVersion();
- if (auxName.equals(symbolicName) && auxVersion.equals(version))
- {
- result = aux;
- break;
- }
- }
- return result;
- }
-
- /**
- * Get the underlying bundle state for a bundle
- *
- * @param bundle the bundle
- * @return the bundle state
- * @throws IllegalArgumentException if it is an unrecognised bundle
- */
- public AbstractBundleState getBundleState(Bundle bundle)
- {
- if (bundle instanceof OSGiBundleWrapper)
- bundle = ((OSGiBundleWrapper)bundle).getBundleState();
-
- if (bundle instanceof AbstractBundleState == false)
- throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
-
- return (AbstractBundleState)bundle;
- }
-
- /**
- * Get a bundle by location
- *
- * @param location the location of the bundle
- * @return the bundle or null if there is no bundle with that location
- */
- public AbstractBundleState getBundleByLocation(String location)
- {
- if (location == null)
- throw new IllegalArgumentException("Null location");
-
- AbstractBundleState result = null;
-
- for (AbstractBundleState aux : allBundles)
- {
- String auxLocation = aux.getLocation();
- if (location.equals(auxLocation))
- {
- result = aux;
- break;
- }
-
- // Fallback to the deployment name
- else if (aux instanceof AbstractDeployedBundleState)
- {
- DeploymentUnit unit = ((AbstractDeployedBundleState)aux).getDeploymentUnit();
- if (location.equals(unit.getName()))
- {
- result = aux;
- break;
- }
- }
- }
- return result;
- }
-
- /**
- * Get all the bundles
- *
- * @return the bundles
- */
- public Collection<AbstractBundleState> getBundles()
- {
- List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
- for (AbstractBundleState aux : allBundles)
- {
- bundles.add(aux);
- }
- return Collections.unmodifiableList(bundles);
- }
-
- /**
- * Get the bundles with the given state
- *
- * @param state the bundle state
- * @return the bundles
- */
- public Collection<AbstractBundleState> getBundles(int state)
- {
- List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
- for (AbstractBundleState aux : allBundles)
- {
- if (aux.getState() == state)
- bundles.add(aux);
- }
- return Collections.unmodifiableList(bundles);
- }
-
- /**
- * Start a bundle.
- *
- * Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
- * A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
- * A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
- *
- * @see OSGiBundleActivatorDeployer
- * @see OSGiBundleState#startInternal()
- */
- public void startBundle(AbstractDeployedBundleState bundleState) throws BundleException
- {
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
- if (bundleState.getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
- // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was
- // unable to be started.
-
- // If this bundle's state is ACTIVE then this method returns immediately.
- if (bundleState.getState() == Bundle.ACTIVE)
- return;
-
- // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation
- // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted
- // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
-
- // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle,
- // a BundleException is thrown.
- if (bundleState.getState() != Bundle.RESOLVED)
- {
- // Resolve all INSTALLED bundles through the PackageAdmin
- PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
- packageAdmin.resolveBundles(null);
-
- if (bundleState.getState() != Bundle.RESOLVED)
- throw new BundleException("Cannot resolve bundle: " + bundleState);
- }
-
- // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
- // * If this bundle's state is STARTING then this method returns immediately.
- // * This bundle's state is set to STARTING.
- // * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
- // * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
-
- try
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
- deployerClient.checkComplete(unit.getName());
-
- // The potential BundleException is attached by the OSGiBundleActivatorDeployer
- BundleException startEx = unit.removeAttachment(BundleException.class);
- if (startEx != null)
- {
- // Reset the deployment unit to stage classloader
- deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
- deployerClient.checkComplete(unit.getName());
-
- // Rethrow the attached BundleException
- throw startEx;
- }
- }
- catch (DeploymentException ex)
- {
- Throwable cause = ex.getCause();
- if (cause instanceof BundleException)
- throw (BundleException)cause;
-
- throw new BundleException("Error starting " + bundleState, (cause != null ? cause : ex));
- }
- }
-
- /**
- * Stop a bundle
- *
- * Stopping a bundle is done in an attempt to move the bundle's DeploymentUnit to state CLASSLOADER.
- *
- * @see OSGiBundleActivatorDeployer
- * @see OSGiBundleState#stopInternal()
- */
- public void stopBundle(AbstractDeployedBundleState bundleState) throws BundleException
- {
- // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
- if (bundleState.getState() == Bundle.UNINSTALLED)
- throw new IllegalStateException("Bundle already uninstalled: " + this);
-
- // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
- // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle
- // was unable to be stopped.
-
- // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped.
- // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
-
- // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
- if (bundleState.getState() != Bundle.STARTING && bundleState.getState() != Bundle.ACTIVE)
- return;
-
- try
- {
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
- deployerClient.checkComplete(unit.getName());
-
- // The potential BundleException is attached by the OSGiBundleActivatorDeployer
- BundleException stopEx = unit.removeAttachment(BundleException.class);
- if (stopEx != null)
- {
- // Rethrow the attached BundleException
- throw stopEx;
- }
- }
- catch (DeploymentException ex)
- {
- Throwable cause = ex.getCause();
- if (cause instanceof BundleException)
- throw (BundleException)cause;
-
- throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
- }
- }
-
- /**
- * Load class from a bundle.
- * If it cannot be loaded, return null.
- *
- * @param bundle the bundle to load from
- * @param clazz the class
- * @return class or null
- */
- Class<?> loadClassFailsafe(Bundle bundle, String clazz)
- {
- try
- {
- return bundle.loadClass(clazz);
- }
- catch (ClassNotFoundException e)
- {
- return null;
- }
- }
-
- /**
- * Get the executor.
- *
- * @return the executor.
- */
- Executor getExecutor()
- {
- return executor;
- }
-
- /**
- * Initialize this Framework.
- *
- * After calling this method, this Framework must:
- * - Be in the Bundle.STARTING state.
- * - Have a valid Bundle Context.
- * - Be at start level 0.
- * - Have event handling enabled.
- * - Have reified Bundle objects for all installed bundles.
- * - Have registered any framework services. For example, PackageAdmin, ConditionalPermissionAdmin, StartLevel.
- *
- * This Framework will not actually be started until start is called.
- *
- * This method does nothing if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE or Bundle.STOPPING states.
- */
- public void initFramework()
- {
- // Log INFO about this implementation
- String implTitle = getClass().getPackage().getImplementationTitle();
- String implVersion = getClass().getPackage().getImplementationVersion();
- log.info(implTitle + " - " + implVersion);
-
- int state = systemBundle.getState();
-
- // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
- if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
- return;
-
- // Put into the STARTING state
- systemBundle.changeState(Bundle.STARTING);
-
- // Create the system bundle context
- systemBundle.createBundleContext();
-
- // [TODO] Be at start level 0
-
- // Have event handling enabled
- FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
- eventsPlugin.setActive(true);
-
- // Have registered any framework services.
- for (Plugin plugin : plugins.values())
- {
- if (plugin instanceof ServicePlugin)
- {
- ServicePlugin servicePlugin = (ServicePlugin)plugin;
- servicePlugin.startService();
- }
- }
-
- // Cleanup the storage area
- String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
- BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
- if (storagePlugin != null)
- storagePlugin.cleanStorage(storageClean);
- }
-
- /**
- * Start the framework
- *
- * @throws BundleException for any error
- */
- public void startFramework() throws BundleException
- {
- // If this Framework is not in the STARTING state, initialize this Framework
- if (systemBundle.getState() != Bundle.STARTING)
- initFramework();
-
- // All installed bundles must be started
- AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
- if (autoInstall != null)
- {
- autoInstall.installBundles();
- autoInstall.startBundles();
- }
-
- // Add the system bundle to the resolver
- ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
- if (bundleResolver != null)
- bundleResolver.addBundle(systemBundle);
-
- // This Framework's state is set to ACTIVE
- systemBundle.changeState(Bundle.ACTIVE);
-
- // A framework event of type STARTED is fired
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
- }
-
- /**
- * Stop this Framework.
- *
- * The method returns immediately to the caller after initiating the following steps to be taken on another thread.
- *
- * 1. This Framework's state is set to Bundle.STOPPING.
- * 2. All installed bundles must be stopped without changing each bundle's persistent autostart setting.
- * 3. Unregister all services registered by this Framework.
- * 4. Event handling is disabled.
- * 5. This Framework's state is set to Bundle.RESOLVED.
- * 6. All resources held by this Framework are released. This includes threads, bundle class loaders, open files, etc.
- * 7. Notify all threads that are waiting at waitForStop that the stop operation has completed.
- *
- * After being stopped, this Framework may be discarded, initialized or started.
- */
- public void stopFramework()
- {
- int beforeCount = stopMonitor.get();
- Runnable stopcmd = new Runnable()
- {
- public void run()
- {
- synchronized (stopMonitor)
- {
- // Start the stop process
- stopMonitor.addAndGet(1);
-
- // This Framework's state is set to Bundle.STOPPING
- systemBundle.changeState(Bundle.STOPPING);
-
- // If this Framework implements the optional Start Level Service Specification,
- // then the start level of this Framework is moved to start level zero (0), as described in the Start Level Service Specification.
-
- // All installed bundles must be stopped without changing each bundle's persistent autostart setting
- for (AbstractBundleState bundleState : getBundles())
- {
- if (bundleState != systemBundle)
- {
- try
- {
- // [TODO] don't change the persistent state
- bundleState.stop();
- }
- catch (Exception ex)
- {
- // Any exceptions that occur during bundle stopping must be wrapped in a BundleException and then
- // published as a framework event of type FrameworkEvent.ERROR
- fireError(bundleState, "stopping bundle", ex);
- }
- }
- }
-
- // Stop registered service plugins
- List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
- Collections.reverse(reverseServicePlugins);
- for (Plugin plugin : reverseServicePlugins)
- {
- if (plugin instanceof ServicePlugin)
- {
- ServicePlugin servicePlugin = (ServicePlugin)plugin;
- servicePlugin.stopService();
- }
- }
-
- // Event handling is disabled
- FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
- eventsPlugin.setActive(false);
-
- // This Framework's state is set to Bundle.RESOLVED
- systemBundle.changeState(Bundle.RESOLVED);
-
- // All resources held by this Framework are released
- systemBundle.destroyBundleContext();
-
- // Notify all threads that are waiting at waitForStop that the stop operation has completed
- stopMonitor.notifyAll();
- }
- }
- };
- executor.execute(stopcmd);
-
- // Wait for the stop thread
- while (stopMonitor.get() == beforeCount)
- {
- try
- {
- Thread.sleep(100);
- }
- catch (InterruptedException ex)
- {
- // ignore
- }
- }
- }
-
- /**
- * Wait until this Framework has completely stopped.
- *
- * The stop and update methods on a Framework performs an asynchronous stop of the Framework.
- * This method can be used to wait until the asynchronous stop of this Framework has completed.
- * This method will only wait if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING states.
- * Otherwise it will return immediately.
- *
- * A Framework Event is returned to indicate why this Framework has stopped.
- */
- public FrameworkEvent waitForStop(long timeout) throws InterruptedException
- {
- int state = systemBundle.getState();
-
- // Only wait when this Framework is in Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING state
- if (state != Bundle.STARTING && state != Bundle.ACTIVE && state != Bundle.STOPPING)
- return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
-
- long timeoutTime = System.currentTimeMillis() + timeout;
- synchronized (stopMonitor)
- {
- while (state != Bundle.RESOLVED && System.currentTimeMillis() < timeoutTime)
- {
- stopMonitor.wait(timeout);
- state = systemBundle.getState();
- }
- }
-
- if (System.currentTimeMillis() > timeoutTime)
- return new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, systemBundle, null);
-
- return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
- }
-
- /**
- * Stop the framework
- */
- public void restartFramework()
- {
- AbstractBundleState systemBundle = getSystemBundle();
- if (systemBundle.getState() != Bundle.ACTIVE)
- return;
-
- for (AbstractBundleState bundleState : getBundles())
- {
- if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
- {
- try
- {
- // [TODO] don't change the persistent state
- bundleState.stop();
- }
- catch (Throwable t)
- {
- fireWarning(bundleState, "stopping bundle", t);
- }
- try
- {
- bundleState.start();
- }
- catch (Throwable t)
- {
- fireError(bundleState, "starting bundle", t);
- }
- }
- }
- }
-
- private URL getLocationURL(String location) throws BundleException
- {
- // Try location as URL
- URL url = null;
- try
- {
- url = new URL(location);
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
-
- // Try location as File
- if (url == null)
- {
- try
- {
- File file = new File(location);
- if (file.exists())
- url = file.toURI().toURL();
- }
- catch (MalformedURLException e)
- {
- // ignore
- }
- }
-
- if (url == null)
- throw new BundleException("Unable to handle location=" + location);
-
- return url;
- }
-
- /**
- * Fire a framework error
- *
- * @param bundle the bundle
- * @param context the msg context
- * @param t the throwable
- */
- void fireError(Bundle bundle, String context, Throwable t)
- {
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- if (t instanceof BundleException)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
- else if (bundle != null)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
- else
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
- }
-
- /**
- * Fire a framework error
- *
- * @param bundle the bundle
- * @param context the msg context
- * @param t the throwable
- */
- void fireWarning(Bundle bundle, String context, Throwable t)
- {
- FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
- if (t instanceof BundleException)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
- else if (bundle != null)
- plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
- else
- plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
- }
-}
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,1563 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file in the
+* distribution for a full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+package org.jboss.osgi.framework.bundle;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.classloading.spi.metadata.ClassLoadingMetaData;
+import org.jboss.deployers.client.spi.DeployerClient;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.client.spi.IncompleteDeployments;
+import org.jboss.deployers.client.spi.MissingDependency;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.attachments.MutableAttachments;
+import org.jboss.deployers.spi.deployer.DeploymentStages;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
+import org.jboss.deployers.vfs.spi.client.VFSDeployment;
+import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
+import org.jboss.kernel.Kernel;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.framework.deployers.OSGiBundleActivatorDeployer;
+import org.jboss.osgi.framework.metadata.OSGiMetaData;
+import org.jboss.osgi.framework.metadata.ParameterizedAttribute;
+import org.jboss.osgi.framework.plugins.AutoInstallPlugin;
+import org.jboss.osgi.framework.plugins.BundleStoragePlugin;
+import org.jboss.osgi.framework.plugins.FrameworkEventsPlugin;
+import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.framework.plugins.Plugin;
+import org.jboss.osgi.framework.plugins.ResolverPlugin;
+import org.jboss.osgi.framework.plugins.ServicePlugin;
+import org.jboss.osgi.framework.util.URLHelper;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.util.platform.Java;
+import org.jboss.virtual.VFS;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.Version;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * OSGiBundleManager.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @author Thomas.Diesler(a)jboss.com
+ * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
+ * @version $Revision: 1.1 $
+ */
+public class OSGiBundleManager
+{
+ /** The log */
+ private static final Logger log = Logger.getLogger(OSGiBundleManager.class);
+
+ /** The bundle manager's bean name: OSGiBundleManager */
+ public static final String BEAN_BUNDLE_MANAGER = "OSGiBundleManager";
+ /** The framework execution environment */
+ private static String OSGi_FRAMEWORK_EXECUTIONENVIRONMENT;
+ /** The framework language */
+ private static String OSGi_FRAMEWORK_LANGUAGE = Locale.getDefault().getISO3Language(); // REVIEW correct?
+ /** The os name */
+ private static String OSGi_FRAMEWORK_OS_NAME;
+ /** The os version */
+ private static String OSGi_FRAMEWORK_OS_VERSION;
+ /** The os version */
+ private static String OSGi_FRAMEWORK_PROCESSOR;
+ /** The framework vendor */
+ private static String OSGi_FRAMEWORK_VENDOR = "jboss.org";
+ /** The framework version. This is the version of the org.osgi.framework package in r4v42 */
+ private static String OSGi_FRAMEWORK_VERSION = "1.5";
+ /** The bundles by id */
+ private List<AbstractBundleState> allBundles = new CopyOnWriteArrayList<AbstractBundleState>();
+ /** The kernel */
+ private Kernel kernel;
+ /** The main deployer */
+ private DeployerClient deployerClient;
+ /** The executor */
+ private Executor executor;
+ /** The system bundle */
+ private OSGiSystemState systemBundle;
+ /** The registered manager plugins */
+ private Map<Class<?>, Plugin> plugins = Collections.synchronizedMap(new LinkedHashMap<Class<?>, Plugin>());
+ /** The frame work properties */
+ private Map<String, Object> properties = new ConcurrentHashMap<String, Object>();
+ /** The framework stop monitor*/
+ private AtomicInteger stopMonitor = new AtomicInteger(0);
+
+ static
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ List<String> execEnvironments = new ArrayList<String>();
+ if (Java.isCompatible(Java.VERSION_1_5))
+ execEnvironments.add("J2SE-1.5");
+ if (Java.isCompatible(Java.VERSION_1_6))
+ execEnvironments.add("JavaSE-1.6");
+
+ String envlist = execEnvironments.toString();
+ envlist = envlist.substring(1, envlist.length() - 1);
+ OSGi_FRAMEWORK_EXECUTIONENVIRONMENT = envlist;
+
+ OSGi_FRAMEWORK_OS_NAME = System.getProperty("os.name");
+ OSGi_FRAMEWORK_OS_VERSION = System.getProperty("os.version");
+ OSGi_FRAMEWORK_PROCESSOR = System.getProperty("os.arch");
+
+ System.setProperty("org.osgi.vendor.framework", "org.jboss.osgi.plugins.framework");
+ return null;
+ }
+ });
+ }
+
+ /**
+ * Create a new OSGiBundleManager.
+ *
+ * @param kernel the kernel
+ * @param deployerClient the deployer client
+ * @param registry the deployment registry
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient)
+ {
+ this(kernel, deployerClient, null);
+ }
+
+ /**
+ * Create a new OSGiBundleManager.
+ *
+ * @param kernel the kernel
+ * @param deployerClient the deployer client
+ * @param registry the deployment registry
+ * @param executor the executor
+ * @throws IllegalArgumentException for a null parameter
+ */
+ public OSGiBundleManager(Kernel kernel, DeployerClient deployerClient, Executor executor)
+ {
+ if (kernel == null)
+ throw new IllegalArgumentException("Null kernel");
+ if (deployerClient == null)
+ throw new IllegalArgumentException("Null deployerClient");
+ if (deployerClient instanceof MainDeployerStructure == false)
+ throw new IllegalArgumentException("Deployer client does not implement " + MainDeployerStructure.class.getName());
+
+ this.kernel = kernel;
+ this.deployerClient = deployerClient;
+
+ // TODO thread factory
+ if (executor == null)
+ executor = Executors.newFixedThreadPool(10);
+
+ this.executor = executor;
+ }
+
+ public void start()
+ {
+ // Create the system Bundle
+ systemBundle = new OSGiSystemState(this);
+ addBundle(systemBundle);
+ }
+
+ public void stop()
+ {
+ // nothing to do
+ }
+
+ /**
+ * Get the kernel
+ *
+ * @return the kernel
+ */
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ /**
+ * Get the deployerClient.
+ *
+ * @return the deployerClient.
+ */
+ public DeployerClient getDeployerClient()
+ {
+ return deployerClient;
+ }
+
+ /**
+ * Set the framework properties
+ *
+ * @param properties the properties
+ */
+ public void setProperties(Map<String, Object> props)
+ {
+ properties.putAll(props);
+
+ // Init default framework properties
+ if (getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT) == null)
+ setProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, OSGi_FRAMEWORK_EXECUTIONENVIRONMENT);
+ if (getProperty(Constants.FRAMEWORK_LANGUAGE) == null)
+ setProperty(Constants.FRAMEWORK_LANGUAGE, OSGi_FRAMEWORK_LANGUAGE);
+ if (getProperty(Constants.FRAMEWORK_OS_NAME) == null)
+ setProperty(Constants.FRAMEWORK_OS_NAME, OSGi_FRAMEWORK_OS_NAME);
+ if (getProperty(Constants.FRAMEWORK_OS_VERSION) == null)
+ setProperty(Constants.FRAMEWORK_OS_VERSION, OSGi_FRAMEWORK_OS_VERSION);
+ if (getProperty(Constants.FRAMEWORK_PROCESSOR) == null)
+ setProperty(Constants.FRAMEWORK_PROCESSOR, OSGi_FRAMEWORK_PROCESSOR);
+ if (getProperty(Constants.FRAMEWORK_VENDOR) == null)
+ setProperty(Constants.FRAMEWORK_VENDOR, OSGi_FRAMEWORK_VENDOR);
+ if (getProperty(Constants.FRAMEWORK_VERSION) == null)
+ setProperty(Constants.FRAMEWORK_VERSION, OSGi_FRAMEWORK_VERSION);
+ }
+
+ /**
+ * Get a property
+ *
+ * @param key the property key
+ * @return the property
+ * @throws SecurityException if the caller doesn't have the relevant property permission
+ */
+ public String getProperty(String key)
+ {
+ Object value = properties.get(key);
+ if (value == null)
+ value = System.getProperty(key);
+
+ if (value instanceof String == false)
+ return null;
+
+ return (String)value;
+ }
+
+ /**
+ * Set a property. This is used at the frame work init state.
+ *
+ * @param key the prperty key
+ * @param value the property value
+ */
+ public void setProperty(String key, String value)
+ {
+ properties.put(key, value);
+ }
+
+ /**
+ * Get a plugin that is registered with the bundle manager.
+ *
+ * @param <T> the pluging type
+ * @param clazz the plugin type
+ * @return the plugin
+ * @throws IllegalStateException if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Plugin> T getPlugin(Class<T> clazz)
+ {
+ T plugin = (T)plugins.get(clazz);
+ if (plugin == null)
+ throw new IllegalStateException("Cannot obtain plugin for: " + clazz.getName());
+
+ return plugin;
+ }
+
+ /**
+ * Get an optional plugin that is registered with the bundle manager.
+ *
+ * @param <T> the pluging type
+ * @param clazz the plugin type
+ * @return The plugin instance or null if the requested plugin class is not registered
+ */
+ @SuppressWarnings("unchecked")
+ public <T extends Plugin> T getOptionalPlugin(Class<T> clazz)
+ {
+ return (T)plugins.get(clazz);
+ }
+
+ /**
+ * Add a plugin
+ *
+ * @param plugin the plugin
+ */
+ public void addPlugin(Plugin plugin)
+ {
+ Class<?> key = getPluginKey(plugin);
+ log.debug("Add plugin: " + key.getName());
+ plugins.put(key, plugin);
+
+ // In case a service plugin gets added after the framework is started
+ if (isFrameworkActive() == true && plugin instanceof ServicePlugin)
+ {
+ ServicePlugin servicePlugin = (ServicePlugin)plugin;
+ servicePlugin.startService();
+ }
+ }
+
+ /**
+ * Get the key for a given plugin
+ *
+ * @param plugin the plugin
+ * @return the class
+ */
+ private Class<?> getPluginKey(Plugin plugin)
+ {
+ if (plugin == null)
+ throw new IllegalArgumentException("Null plugin");
+
+ Class<?> clazz = plugin.getClass();
+ Class<?> key = getPluginKey(plugin, clazz);
+
+ // If the plugin could not be added by Interface, use the clazz directly
+ return (key != null ? key : clazz);
+ }
+
+ /**
+ * Get the plugin key by scanning the interfaces for the given clazz.
+ *
+ * @param plugin the plugin
+ * @param clazz the class
+ * @return The first interface that extends Plugin.
+ */
+ private Class<?> getPluginKey(Plugin plugin, Class<?> clazz)
+ {
+ // Scan the interfaces on the class
+ for (Class<?> interf : clazz.getInterfaces())
+ {
+ if (interf == Plugin.class || interf == ServicePlugin.class)
+ continue;
+
+ if (Plugin.class.isAssignableFrom(interf))
+ {
+ return interf;
+ }
+ }
+
+ // Interface not found, try the plugin's superclass
+ Class<?> superclass = clazz.getSuperclass();
+ if (Plugin.class.isAssignableFrom(superclass))
+ return getPluginKey(plugin, superclass);
+
+ return null;
+ }
+
+ /**
+ * Remove a plugin
+ *
+ * @param plugin the plugin to remove
+ */
+ public void removePlugin(Plugin plugin)
+ {
+ Class<?> key = getPluginKey(plugin);
+ log.debug("Remove plugin: " + key.getName());
+ plugins.remove(key);
+ }
+
+ /**
+ * Are we active
+ * @return true when the system is active
+ */
+ public boolean isFrameworkActive()
+ {
+ // We are active if the system bundle is ACTIVE
+ AbstractBundleState bundleState = getSystemBundle();
+ return bundleState.getState() == Bundle.ACTIVE;
+ }
+
+ /**
+ * Install a bundle from an URL.
+ *
+ * @param url the url of the bundle
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState installBundle(URL url) throws BundleException
+ {
+ if (url == null)
+ throw new BundleException("Null url");
+
+ return installBundle(url.toExternalForm(), null);
+ }
+
+ /**
+ * Install a bundle from an input stream.
+ *
+ * @param location the bundle's location identifier
+ * @param input an optional input stream to read the bundle content from
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState installBundle(String location, InputStream input) throws BundleException
+ {
+ if (location == null)
+ throw new BundleException("Null location");
+
+ URL locationURL;
+
+ // Get the location URL
+ if (input != null)
+ {
+ locationURL = getBundleStorageLocation(input);
+ }
+ else
+ {
+ locationURL = getLocationURL(location);
+ }
+
+ // Get the root file
+ VirtualFile root;
+ try
+ {
+ root = VFS.getRoot(locationURL);
+ }
+ catch (IOException e)
+ {
+ throw new BundleException("Invalid bundle location=" + locationURL, e);
+ }
+
+ return install(root, location, false);
+ }
+
+ private URL getBundleStorageLocation(InputStream input) throws BundleException
+ {
+ try
+ {
+ BundleStoragePlugin plugin = getPlugin(BundleStoragePlugin.class);
+ String path = plugin.getStorageDir(getSystemBundle()).getCanonicalPath();
+
+ // [TODO] do properly
+ File file = new File(path + "/bundle-" + System.currentTimeMillis() + ".jar");
+ FileOutputStream fos = new FileOutputStream(file);
+ VFSUtils.copyStream(input, fos);
+ fos.close();
+
+ URL locationURL = file.toURI().toURL();
+ return locationURL;
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot store bundle from input stream", ex);
+ }
+ }
+
+ /**
+ * Install a bundle from a virtual file.
+ *
+ * @param root the virtual file that point to the bundle
+ *
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState installBundle(VirtualFile root) throws BundleException
+ {
+ return install(root, root.toString(), false);
+ }
+
+ /*
+ * Installs a bundle from the given virtual file.
+ */
+ private AbstractBundleState install(VirtualFile root, String location, boolean autoStart) throws BundleException
+ {
+ if (location == null)
+ throw new IllegalArgumentException("Null location");
+
+ Deployment dep;
+ try
+ {
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+ dep = DeploymentFactory.createDeployment(info);
+ dep.setAutoStart(autoStart);
+ }
+ catch (RuntimeException ex)
+ {
+ throw new BundleException("Cannot install bundle: " + root, ex);
+ }
+
+ return installBundle(dep);
+ }
+
+ /**
+ * Install a bundle from a deployment.
+ *
+ * @param dep the deployment that represents the bundle
+ *
+ * @return the bundle state
+ * @throws BundleException for any error
+ */
+ public AbstractBundleState installBundle(Deployment dep) throws BundleException
+ {
+ // Create the deployment and deploy it
+ try
+ {
+ VirtualFile root = (VirtualFile)AbstractVFS.adapt(dep.getRoot());
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
+ MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
+ att.addAttachment(Deployment.class, dep);
+
+ // In case of update the OSGiBundleState is attached
+ AbstractBundleState bundleState = dep.getAttachment(AbstractBundleState.class);
+ if (bundleState != null)
+ att.addAttachment(AbstractBundleState.class, bundleState);
+
+ deployerClient.deploy(deployment);
+ try
+ {
+ MainDeployerStructure deployerStructure = (MainDeployerStructure)deployerClient;
+ DeploymentUnit unit = deployerStructure.getDeploymentUnit(deployment.getName());
+ bundleState = unit.getAttachment(AbstractBundleState.class);
+ if (bundleState == null)
+ throw new IllegalStateException("Unable to determine bundle state for " + deployment.getName());
+
+ return bundleState;
+ }
+ catch (Exception e)
+ {
+ deployerClient.undeploy(deployment);
+ throw e;
+ }
+ }
+ catch (IncompleteDeploymentException ex)
+ {
+ String errorMessage = getIncompleteDeploymentInfo(dep, ex);
+ throw new BundleException(errorMessage);
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Error installing bundle from: " + dep, ex);
+ }
+ }
+
+ private String getIncompleteDeploymentInfo(Deployment dep, IncompleteDeploymentException ex)
+ {
+ IncompleteDeployments deployments = ex.getIncompleteDeployments();
+
+ StringWriter stringWriter = new StringWriter();
+ PrintWriter printWriter = new PrintWriter(stringWriter);
+ printWriter.println("Error installing bundle from: " + dep);
+
+ // Contexts in error
+ Collection<Throwable> contextsError = deployments.getContextsInError().values();
+ if (contextsError.size() > 0)
+ {
+ printWriter.println("\nContext Errors:");
+ for (Throwable th : contextsError)
+ {
+ printWriter.println("\n");
+ th.printStackTrace(printWriter);
+ }
+ }
+
+ // Deployments in error
+ Collection<Throwable> deploymentsInError = deployments.getDeploymentsInError().values();
+ if (deploymentsInError.size() > 0)
+ {
+ printWriter.println("\nDeployment Errors:");
+ for (Throwable th : deploymentsInError)
+ {
+ printWriter.println("\n");
+ th.printStackTrace(printWriter);
+ }
+ }
+
+ // Missing Dependencies
+ Collection<Set<MissingDependency>> missingDependencies = deployments.getContextsMissingDependencies().values();
+ if (missingDependencies.size() > 0)
+ {
+ printWriter.println("\nMissing Dependencies:");
+ for (Set<MissingDependency> missDeps : missingDependencies)
+ {
+ for (MissingDependency missDep : missDeps)
+ {
+ printWriter.println("\n " + missDep);
+ }
+ }
+ }
+
+ // Missing Deployers
+ Collection<String> missingDeployers = deployments.getDeploymentsMissingDeployer();
+ if (missingDeployers.size() > 0)
+ {
+ printWriter.println("\nMissing Deployers:");
+ for (String missDep : missingDeployers)
+ {
+ printWriter.println("\n " + missDep);
+ }
+ }
+
+ String errorMessage = stringWriter.toString();
+ return errorMessage;
+ }
+
+ /**
+ * Updates a bundle from an InputStream.
+ */
+ public void updateBundle(AbstractDeployedBundleState bundleState, InputStream in) throws BundleException
+ {
+ // If the specified InputStream is null, the Framework must create the InputStream from which to read the updated bundle by interpreting,
+ // in an implementation dependent manner, this bundle's Bundle-UpdateLocation Manifest header, if present, or this bundle's original location.
+ URL updateURL = bundleState.getOSGiMetaData().getBundleUpdateLocation();
+ if (updateURL == null)
+ {
+ // This updates the bundle from its original location
+ VirtualFile root = bundleState.getRoot();
+ updateURL = URLHelper.toURL(root);
+ }
+ if (in == null)
+ {
+ try
+ {
+ in = updateURL.openStream();
+ }
+ catch (IOException ex)
+ {
+ throw new BundleException("Cannot obtain update input stream for: " + bundleState, ex);
+ }
+ }
+
+ // If this bundle's state is ACTIVE, it must be stopped before the update and started after the update successfully completes.
+ boolean activeBeforeUpdate = (bundleState.getState() == Bundle.ACTIVE);
+
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // If this bundle has exported any packages that are imported by another bundle, these packages must not be updated.
+ // Instead, the previous package version must remain exported until the PackageAdmin.refreshPackages method has been
+ // has been called or the Framework is relaunched.
+
+ // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped as described in the Bundle.stop method.
+ // If Bundle.stop throws an exception, the exception is rethrown terminating the update.
+ if (bundleState.getState() == Bundle.ACTIVE || bundleState.getState() == Bundle.STARTING || bundleState.getState() == Bundle.STOPPING)
+ {
+ stopBundle(bundleState);
+ }
+
+ // The updated version of this bundle is read from the input stream and installed.
+ // If the Framework is unable to install the updated version of this bundle, the original version of this bundle must be restored
+ // and a BundleException must be thrown after completion of the remaining steps.
+ String location = (updateURL != null ? updateURL.toExternalForm() : bundleState.getCanonicalName() + "/update");
+ AbstractBundleState updatedBundleState = null;
+ BundleException throwAfterUpdate = null;
+ try
+ {
+ URL storageLocation = getBundleStorageLocation(in);
+ VirtualFile root = VFS.getRoot(storageLocation);
+
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
+ Deployment dep = DeploymentFactory.createDeployment(info);
+ dep.addAttachment(AbstractBundleState.class, bundleState);
+ dep.setBundleUpdate(true);
+ dep.setAutoStart(false);
+
+ updatedBundleState = installBundle(dep);
+ updatedBundleState.updateLastModified();
+ }
+ catch (Exception ex)
+ {
+ if (ex instanceof BundleException)
+ throwAfterUpdate = (BundleException)ex;
+ else
+ throwAfterUpdate = new BundleException("Cannot install updated bundle from: " + location, ex);
+
+ if (activeBeforeUpdate)
+ {
+ startBundle(bundleState);
+ }
+ }
+
+ // If the updated version of this bundle was successfully installed, a bundle event of type BundleEvent.UPDATED is fired
+ if (updatedBundleState != null)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireBundleEvent(updatedBundleState, BundleEvent.UPDATED);
+
+ // If this bundle's state was originally ACTIVE, the updated bundle is started as described in the Bundle.start method.
+ // If Bundle.start throws an exception, a Framework event of type FrameworkEvent.ERROR is fired containing the exception
+ if (activeBeforeUpdate)
+ {
+ if (updatedBundleState.isFragment() == false)
+ startBundle((AbstractDeployedBundleState)updatedBundleState);
+ }
+ }
+
+ // A BundleException must be thrown after completion of the remaining steps
+ if (throwAfterUpdate != null)
+ {
+ throw throwAfterUpdate;
+ }
+ }
+
+ /**
+ * Uninstall a bundle
+ *
+ * @param bundleState the bundle
+ * @throws BundleException for any error
+ */
+ public void uninstallBundle(AbstractDeployedBundleState bundleState) throws BundleException
+ {
+ long id = bundleState.getBundleId();
+ if (getBundleById(id) == null)
+ throw new BundleException(bundleState + " not installed");
+
+ // If this bundle's state is ACTIVE, STARTING or STOPPING, this bundle is stopped
+ // as described in the Bundle.stop method.
+ int state = bundleState.getState();
+ if (state == Bundle.ACTIVE || state == Bundle.STARTING || state == Bundle.STOPPING)
+ {
+ try
+ {
+ if (bundleState.isFragment() == false)
+ stopBundle((AbstractDeployedBundleState)bundleState);
+ }
+ catch (Exception ex)
+ {
+ // If Bundle.stop throws an exception, a Framework event of type FrameworkEvent.ERROR is
+ // fired containing the exception
+ fireError(bundleState, "Error stopping bundle: " + bundleState, ex);
+ }
+ }
+
+ DeploymentException depEx = null;
+ for (DeploymentUnit unit : bundleState.getDeploymentUnits())
+ {
+ try
+ {
+ deployerClient.undeploy(unit.getName());
+ bundleState.updateLastModified();
+ }
+ catch (DeploymentException ex)
+ {
+ log.error("Cannot undeploy: " + unit.getName(), depEx = ex);
+ }
+ }
+
+ // Rethrow deployment exception
+ if (depEx != null)
+ {
+ Throwable cause = depEx.getCause();
+ if (cause instanceof BundleException)
+ throw (BundleException)cause;
+
+ throw new BundleException("Unable to uninstall " + bundleState, cause);
+ }
+ }
+
+ /**
+ * Add a deployment to the manager, which creates the bundle state.
+ *
+ * Note, the bundle state is not yet added to the manager.
+ */
+ public AbstractBundleState addDeployment(DeploymentUnit unit)
+ {
+ if (unit == null)
+ throw new IllegalArgumentException("Null unit");
+
+ // In case of Bundle.update() the OSGiBundleState is attached
+ AbstractBundleState absBundle = unit.getAttachment(AbstractBundleState.class);
+ if (absBundle != null)
+ {
+ // Add the DeploymentUnit to the OSGiBundleState
+ OSGiBundleState depBundle = (OSGiBundleState)absBundle;
+ depBundle.addDeploymentUnit(unit);
+ }
+ else
+ {
+ OSGiMetaData osgiMetaData = unit.getAttachment(OSGiMetaData.class);
+ ParameterizedAttribute fragmentHost = osgiMetaData.getFragmentHost();
+ if (fragmentHost != null)
+ {
+ // Create a new OSGiFragmentState
+ OSGiFragmentState fragmentState = new OSGiFragmentState(this, unit);
+ absBundle = fragmentState;
+ }
+ else
+ {
+ // Create a new OSGiBundleState
+ AbstractDeployedBundleState bundleState = new OSGiBundleState(this, unit);
+ absBundle = bundleState;
+ }
+ }
+
+ // Attach the abstract bundle state
+ unit.addAttachment(AbstractBundleState.class, absBundle);
+
+ if (absBundle.isFragment())
+ unit.addAttachment(OSGiFragmentState.class, (OSGiFragmentState)absBundle);
+ else
+ unit.addAttachment(OSGiBundleState.class, (OSGiBundleState)absBundle);
+
+ return absBundle;
+ }
+
+ /**
+ * Add a bundle to the manager.
+ *
+ * Note, the bundle must be metadata complete when it is added to the manager.
+ * An extender might pickup the INSTALLED event and use PackageAdmin to examine the
+ * exported packages for example.
+ *
+ * @param bundleState the bundle state
+ * @throws IllegalArgumentException for a null bundle state
+ */
+ public void addBundle(AbstractBundleState bundleState)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle state");
+
+ // Do nothing if this is a bundle update
+ if (bundleState instanceof OSGiBundleState)
+ {
+ DeploymentUnit unit = ((AbstractDeployedBundleState)bundleState).getDeploymentUnit();
+ if (unit.getAttachment(ClassLoadingMetaData.class) == null)
+ throw new IllegalStateException("Cannot obtain ClassLoadingMetaData");
+
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (dep != null && dep.isBundleUpdate())
+ return;
+ }
+
+ validateBundle(bundleState);
+
+ allBundles.add(bundleState);
+
+ bundleState.changeState(Bundle.INSTALLED, true);
+
+ // Add the bundle to the resolver
+ // Note, plugins are not registered when the system bundle is added
+ ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+ if (bundleResolver != null)
+ bundleResolver.addBundle(bundleState);
+
+ log.debug("Added: " + bundleState);
+ }
+
+ /**
+ * Validate the bundle
+ *
+ * @param bundleState the bundle state
+ */
+ private void validateBundle(AbstractBundleState bundleState)
+ {
+ OSGiMetaData osgiMetaData = bundleState.getOSGiMetaData();
+ if (osgiMetaData == null)
+ return;
+
+ OSGiBundleValidator validator;
+
+ // Delegate to the validator for the appropriate revision
+ if (osgiMetaData.getBundleManifestVersion() > 1)
+ validator = new OSGiBundleValidatorR4(this);
+ else
+ validator = new OSGiBundleValidatorR3(this);
+
+ validator.validateBundle(bundleState);
+ }
+
+ /**
+ * Remove a bundle
+ *
+ * @param bundleState the bundle state
+ * @throws IllegalArgumentException for a null bundle state
+ */
+ public void removeBundle(AbstractBundleState bundleState)
+ {
+ if (bundleState == null)
+ throw new IllegalArgumentException("Null bundle state");
+
+ bundleState.uninstallInternal();
+
+ // Remove the bundle from the resolver
+ ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+ if (bundleResolver != null)
+ bundleResolver.removeBundle(bundleState);
+
+ allBundles.remove(bundleState);
+ log.debug("Removed " + bundleState.getCanonicalName());
+ }
+
+ /**
+ * Get the system bundle
+ *
+ * @return the system bundle
+ */
+ public OSGiSystemState getSystemBundle()
+ {
+ return systemBundle;
+ }
+
+ /**
+ * Get the system bundle context
+ *
+ * @return the system bundle context
+ */
+ public BundleContext getSystemContext()
+ {
+ return systemBundle.getBundleContext();
+ }
+
+ /**
+ * Get a deployment
+ *
+ * @param id the id of the bundle
+ * @return the deployment or null if there is no bundle with that id
+ */
+ public DeploymentUnit getDeployment(long id)
+ {
+ if (id == 0)
+ throw new IllegalArgumentException("Cannot get deployment from system bundle");
+
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleById(id);
+ if (bundleState == null)
+ return null;
+
+ return bundleState.getDeploymentUnit();
+ }
+
+ /**
+ * Get a bundle by id
+ *
+ * @param id the id of the bundle
+ * @return the bundle or null if there is no bundle with that id
+ */
+ public AbstractBundleState getBundleById(long id)
+ {
+ AbstractBundleState result = null;
+ for (AbstractBundleState aux : allBundles)
+ {
+ if (id == aux.getBundleId())
+ {
+ result = aux;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get a bundle by symbolic name and version
+ *
+ * @param symbolicName the symbolic name of the bundle
+ * @param version the version of the bundle
+ * @return the bundle or null if there is no bundle with that id
+ */
+ public AbstractBundleState getBundle(String symbolicName, Version version)
+ {
+ AbstractBundleState result = null;
+ for (AbstractBundleState aux : allBundles)
+ {
+ String auxName = aux.getSymbolicName();
+ Version auxVersion = aux.getVersion();
+ if (auxName.equals(symbolicName) && auxVersion.equals(version))
+ {
+ result = aux;
+ break;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get the underlying bundle state for a bundle
+ *
+ * @param bundle the bundle
+ * @return the bundle state
+ * @throws IllegalArgumentException if it is an unrecognised bundle
+ */
+ public AbstractBundleState getBundleState(Bundle bundle)
+ {
+ if (bundle instanceof OSGiBundleWrapper)
+ bundle = ((OSGiBundleWrapper)bundle).getBundleState();
+
+ if (bundle instanceof AbstractBundleState == false)
+ throw new IllegalArgumentException("Cannot obtain bunde state from: " + bundle);
+
+ return (AbstractBundleState)bundle;
+ }
+
+ /**
+ * Get a bundle by location
+ *
+ * @param location the location of the bundle
+ * @return the bundle or null if there is no bundle with that location
+ */
+ public AbstractBundleState getBundleByLocation(String location)
+ {
+ if (location == null)
+ throw new IllegalArgumentException("Null location");
+
+ AbstractBundleState result = null;
+
+ for (AbstractBundleState aux : allBundles)
+ {
+ String auxLocation = aux.getLocation();
+ if (location.equals(auxLocation))
+ {
+ result = aux;
+ break;
+ }
+
+ // Fallback to the deployment name
+ else if (aux instanceof AbstractDeployedBundleState)
+ {
+ DeploymentUnit unit = ((AbstractDeployedBundleState)aux).getDeploymentUnit();
+ if (location.equals(unit.getName()))
+ {
+ result = aux;
+ break;
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Get all the bundles
+ *
+ * @return the bundles
+ */
+ public Collection<AbstractBundleState> getBundles()
+ {
+ List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
+ for (AbstractBundleState aux : allBundles)
+ {
+ bundles.add(aux);
+ }
+ return Collections.unmodifiableList(bundles);
+ }
+
+ /**
+ * Get the bundles with the given state
+ *
+ * @param state the bundle state
+ * @return the bundles
+ */
+ public Collection<AbstractBundleState> getBundles(int state)
+ {
+ List<AbstractBundleState> bundles = new ArrayList<AbstractBundleState>();
+ for (AbstractBundleState aux : allBundles)
+ {
+ if (aux.getState() == state)
+ bundles.add(aux);
+ }
+ return Collections.unmodifiableList(bundles);
+ }
+
+ /**
+ * Start a bundle.
+ *
+ * Stating a bundle is done in an attempt to move the bundle's DeploymentUnit to state INSTALLED.
+ * A failure to resolve the bundle is fatal, the bundle should remain in state INSTALLED.
+ * A failure in BundleActivator.start() is a normal condition not handled by the deployment layer.
+ *
+ * @see OSGiBundleActivatorDeployer
+ * @see OSGiBundleState#startInternal()
+ */
+ public void startBundle(AbstractDeployedBundleState bundleState) throws BundleException
+ {
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
+ // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle was
+ // unable to be started.
+
+ // If this bundle's state is ACTIVE then this method returns immediately.
+ if (bundleState.getState() == Bundle.ACTIVE)
+ return;
+
+ // [TODO] If the START_TRANSIENT option is not set then set this bundle's autostart setting to Started with declared activation
+ // if the START_ACTIVATION_POLICY option is set or Started with eager activation if not set. When the Framework is restarted
+ // and this bundle's autostart setting is not Stopped, this bundle must be automatically started.
+
+ // If this bundle's state is not RESOLVED, an attempt is made to resolve this bundle. If the Framework cannot resolve this bundle,
+ // a BundleException is thrown.
+ if (bundleState.getState() != Bundle.RESOLVED)
+ {
+ // Resolve all INSTALLED bundles through the PackageAdmin
+ PackageAdmin packageAdmin = getPlugin(PackageAdminPlugin.class);
+ packageAdmin.resolveBundles(null);
+
+ if (bundleState.getState() != Bundle.RESOLVED)
+ throw new BundleException("Cannot resolve bundle: " + bundleState);
+ }
+
+ // [TODO] If the START_ACTIVATION_POLICY option is set and this bundle's declared activation policy is lazy then:
+ // * If this bundle's state is STARTING then this method returns immediately.
+ // * This bundle's state is set to STARTING.
+ // * A bundle event of type BundleEvent.LAZY_ACTIVATION is fired.
+ // * This method returns immediately and the remaining steps will be followed when this bundle's activation is later triggered.
+
+ try
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ deployerClient.change(unit.getName(), DeploymentStages.INSTALLED);
+ deployerClient.checkComplete(unit.getName());
+
+ // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+ BundleException startEx = unit.removeAttachment(BundleException.class);
+ if (startEx != null)
+ {
+ // Reset the deployment unit to stage classloader
+ deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+ deployerClient.checkComplete(unit.getName());
+
+ // Rethrow the attached BundleException
+ throw startEx;
+ }
+ }
+ catch (DeploymentException ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof BundleException)
+ throw (BundleException)cause;
+
+ throw new BundleException("Error starting " + bundleState, (cause != null ? cause : ex));
+ }
+ }
+
+ /**
+ * Stop a bundle
+ *
+ * Stopping a bundle is done in an attempt to move the bundle's DeploymentUnit to state CLASSLOADER.
+ *
+ * @see OSGiBundleActivatorDeployer
+ * @see OSGiBundleState#stopInternal()
+ */
+ public void stopBundle(AbstractDeployedBundleState bundleState) throws BundleException
+ {
+ // If this bundle's state is UNINSTALLED then an IllegalStateException is thrown.
+ if (bundleState.getState() == Bundle.UNINSTALLED)
+ throw new IllegalStateException("Bundle already uninstalled: " + this);
+
+ // [TODO] If this bundle is in the process of being activated or deactivated then this method must wait for activation or deactivation
+ // to complete before continuing. If this does not occur in a reasonable time, a BundleException is thrown to indicate this bundle
+ // was unable to be stopped.
+
+ // [TODO] If the STOP_TRANSIENT option is not set then then set this bundle's persistent autostart setting to to Stopped.
+ // When the Framework is restarted and this bundle's autostart setting is Stopped, this bundle must not be automatically started.
+
+ // If this bundle's state is not STARTING or ACTIVE then this method returns immediately
+ if (bundleState.getState() != Bundle.STARTING && bundleState.getState() != Bundle.ACTIVE)
+ return;
+
+ try
+ {
+ DeploymentUnit unit = bundleState.getDeploymentUnit();
+ deployerClient.change(unit.getName(), DeploymentStages.CLASSLOADER);
+ deployerClient.checkComplete(unit.getName());
+
+ // The potential BundleException is attached by the OSGiBundleActivatorDeployer
+ BundleException stopEx = unit.removeAttachment(BundleException.class);
+ if (stopEx != null)
+ {
+ // Rethrow the attached BundleException
+ throw stopEx;
+ }
+ }
+ catch (DeploymentException ex)
+ {
+ Throwable cause = ex.getCause();
+ if (cause instanceof BundleException)
+ throw (BundleException)cause;
+
+ throw new BundleException("Error stopping " + bundleState, (cause != null ? cause : ex));
+ }
+ }
+
+ /**
+ * Load class from a bundle.
+ * If it cannot be loaded, return null.
+ *
+ * @param bundle the bundle to load from
+ * @param clazz the class
+ * @return class or null
+ */
+ Class<?> loadClassFailsafe(Bundle bundle, String clazz)
+ {
+ try
+ {
+ return bundle.loadClass(clazz);
+ }
+ catch (ClassNotFoundException e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Get the executor.
+ *
+ * @return the executor.
+ */
+ Executor getExecutor()
+ {
+ return executor;
+ }
+
+ /**
+ * Initialize this Framework.
+ *
+ * After calling this method, this Framework must:
+ * - Be in the Bundle.STARTING state.
+ * - Have a valid Bundle Context.
+ * - Be at start level 0.
+ * - Have event handling enabled.
+ * - Have reified Bundle objects for all installed bundles.
+ * - Have registered any framework services. For example, PackageAdmin, ConditionalPermissionAdmin, StartLevel.
+ *
+ * This Framework will not actually be started until start is called.
+ *
+ * This method does nothing if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE or Bundle.STOPPING states.
+ */
+ public void initFramework()
+ {
+ // Log INFO about this implementation
+ String implTitle = getClass().getPackage().getImplementationTitle();
+ String implVersion = getClass().getPackage().getImplementationVersion();
+ log.info(implTitle + " - " + implVersion);
+
+ int state = systemBundle.getState();
+
+ // This method does nothing if called when this Framework is in the STARTING, ACTIVE or STOPPING state
+ if (state == Bundle.STARTING || state == Bundle.ACTIVE || state == Bundle.STOPPING)
+ return;
+
+ // Put into the STARTING state
+ systemBundle.changeState(Bundle.STARTING);
+
+ // Create the system bundle context
+ systemBundle.createBundleContext();
+
+ // [TODO] Be at start level 0
+
+ // Have event handling enabled
+ FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
+ eventsPlugin.setActive(true);
+
+ // Have registered any framework services.
+ for (Plugin plugin : plugins.values())
+ {
+ if (plugin instanceof ServicePlugin)
+ {
+ ServicePlugin servicePlugin = (ServicePlugin)plugin;
+ servicePlugin.startService();
+ }
+ }
+
+ // Cleanup the storage area
+ String storageClean = getProperty(Constants.FRAMEWORK_STORAGE_CLEAN);
+ BundleStoragePlugin storagePlugin = getOptionalPlugin(BundleStoragePlugin.class);
+ if (storagePlugin != null)
+ storagePlugin.cleanStorage(storageClean);
+ }
+
+ /**
+ * Start the framework
+ *
+ * @throws BundleException for any error
+ */
+ public void startFramework() throws BundleException
+ {
+ // If this Framework is not in the STARTING state, initialize this Framework
+ if (systemBundle.getState() != Bundle.STARTING)
+ initFramework();
+
+ // All installed bundles must be started
+ AutoInstallPlugin autoInstall = getOptionalPlugin(AutoInstallPlugin.class);
+ if (autoInstall != null)
+ {
+ autoInstall.installBundles();
+ autoInstall.startBundles();
+ }
+
+ // Add the system bundle to the resolver
+ ResolverPlugin bundleResolver = getOptionalPlugin(ResolverPlugin.class);
+ if (bundleResolver != null)
+ bundleResolver.addBundle(systemBundle);
+
+ // This Framework's state is set to ACTIVE
+ systemBundle.changeState(Bundle.ACTIVE);
+
+ // A framework event of type STARTED is fired
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.STARTED, null);
+ }
+
+ /**
+ * Stop this Framework.
+ *
+ * The method returns immediately to the caller after initiating the following steps to be taken on another thread.
+ *
+ * 1. This Framework's state is set to Bundle.STOPPING.
+ * 2. All installed bundles must be stopped without changing each bundle's persistent autostart setting.
+ * 3. Unregister all services registered by this Framework.
+ * 4. Event handling is disabled.
+ * 5. This Framework's state is set to Bundle.RESOLVED.
+ * 6. All resources held by this Framework are released. This includes threads, bundle class loaders, open files, etc.
+ * 7. Notify all threads that are waiting at waitForStop that the stop operation has completed.
+ *
+ * After being stopped, this Framework may be discarded, initialized or started.
+ */
+ public void stopFramework()
+ {
+ int beforeCount = stopMonitor.get();
+ Runnable stopcmd = new Runnable()
+ {
+ public void run()
+ {
+ synchronized (stopMonitor)
+ {
+ // Start the stop process
+ stopMonitor.addAndGet(1);
+
+ // This Framework's state is set to Bundle.STOPPING
+ systemBundle.changeState(Bundle.STOPPING);
+
+ // If this Framework implements the optional Start Level Service Specification,
+ // then the start level of this Framework is moved to start level zero (0), as described in the Start Level Service Specification.
+
+ // All installed bundles must be stopped without changing each bundle's persistent autostart setting
+ for (AbstractBundleState bundleState : getBundles())
+ {
+ if (bundleState != systemBundle)
+ {
+ try
+ {
+ // [TODO] don't change the persistent state
+ bundleState.stop();
+ }
+ catch (Exception ex)
+ {
+ // Any exceptions that occur during bundle stopping must be wrapped in a BundleException and then
+ // published as a framework event of type FrameworkEvent.ERROR
+ fireError(bundleState, "stopping bundle", ex);
+ }
+ }
+ }
+
+ // Stop registered service plugins
+ List<Plugin> reverseServicePlugins = new ArrayList<Plugin>(plugins.values());
+ Collections.reverse(reverseServicePlugins);
+ for (Plugin plugin : reverseServicePlugins)
+ {
+ if (plugin instanceof ServicePlugin)
+ {
+ ServicePlugin servicePlugin = (ServicePlugin)plugin;
+ servicePlugin.stopService();
+ }
+ }
+
+ // Event handling is disabled
+ FrameworkEventsPlugin eventsPlugin = getPlugin(FrameworkEventsPlugin.class);
+ eventsPlugin.setActive(false);
+
+ // This Framework's state is set to Bundle.RESOLVED
+ systemBundle.changeState(Bundle.RESOLVED);
+
+ // All resources held by this Framework are released
+ systemBundle.destroyBundleContext();
+
+ // Notify all threads that are waiting at waitForStop that the stop operation has completed
+ stopMonitor.notifyAll();
+ }
+ }
+ };
+ executor.execute(stopcmd);
+
+ // Wait for the stop thread
+ while (stopMonitor.get() == beforeCount)
+ {
+ try
+ {
+ Thread.sleep(100);
+ }
+ catch (InterruptedException ex)
+ {
+ // ignore
+ }
+ }
+ }
+
+ /**
+ * Wait until this Framework has completely stopped.
+ *
+ * The stop and update methods on a Framework performs an asynchronous stop of the Framework.
+ * This method can be used to wait until the asynchronous stop of this Framework has completed.
+ * This method will only wait if called when this Framework is in the Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING states.
+ * Otherwise it will return immediately.
+ *
+ * A Framework Event is returned to indicate why this Framework has stopped.
+ */
+ public FrameworkEvent waitForStop(long timeout) throws InterruptedException
+ {
+ int state = systemBundle.getState();
+
+ // Only wait when this Framework is in Bundle.STARTING, Bundle.ACTIVE, or Bundle.STOPPING state
+ if (state != Bundle.STARTING && state != Bundle.ACTIVE && state != Bundle.STOPPING)
+ return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
+
+ long timeoutTime = System.currentTimeMillis() + timeout;
+ synchronized (stopMonitor)
+ {
+ while (state != Bundle.RESOLVED && System.currentTimeMillis() < timeoutTime)
+ {
+ stopMonitor.wait(timeout);
+ state = systemBundle.getState();
+ }
+ }
+
+ if (System.currentTimeMillis() > timeoutTime)
+ return new FrameworkEvent(FrameworkEvent.WAIT_TIMEDOUT, systemBundle, null);
+
+ return new FrameworkEvent(FrameworkEvent.STOPPED, systemBundle, null);
+ }
+
+ /**
+ * Stop the framework
+ */
+ public void restartFramework()
+ {
+ AbstractBundleState systemBundle = getSystemBundle();
+ if (systemBundle.getState() != Bundle.ACTIVE)
+ return;
+
+ for (AbstractBundleState bundleState : getBundles())
+ {
+ if (bundleState != systemBundle && bundleState.getState() == Bundle.ACTIVE)
+ {
+ try
+ {
+ // [TODO] don't change the persistent state
+ bundleState.stop();
+ }
+ catch (Throwable t)
+ {
+ fireWarning(bundleState, "stopping bundle", t);
+ }
+ try
+ {
+ bundleState.start();
+ }
+ catch (Throwable t)
+ {
+ fireError(bundleState, "starting bundle", t);
+ }
+ }
+ }
+ }
+
+ private URL getLocationURL(String location) throws BundleException
+ {
+ // Try location as URL
+ URL url = null;
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+
+ // Try location as File
+ if (url == null)
+ {
+ try
+ {
+ File file = new File(location);
+ if (file.exists())
+ url = file.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ }
+
+ if (url == null)
+ throw new BundleException("Unable to handle location=" + location);
+
+ return url;
+ }
+
+ /**
+ * Fire a framework error
+ *
+ * @param bundle the bundle
+ * @param context the msg context
+ * @param t the throwable
+ */
+ void fireError(Bundle bundle, String context, Throwable t)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ if (t instanceof BundleException)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, t);
+ else if (bundle != null)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.ERROR, new BundleException("Error " + context + " bundle: " + bundle, t));
+ else
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.ERROR, new BundleException("Error " + context, t));
+ }
+
+ /**
+ * Fire a framework error
+ *
+ * @param bundle the bundle
+ * @param context the msg context
+ * @param t the throwable
+ */
+ void fireWarning(Bundle bundle, String context, Throwable t)
+ {
+ FrameworkEventsPlugin plugin = getPlugin(FrameworkEventsPlugin.class);
+ if (t instanceof BundleException)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, t);
+ else if (bundle != null)
+ plugin.fireFrameworkEvent(bundle, FrameworkEvent.WARNING, new BundleException("Error " + context + " bundle: " + bundle, t));
+ else
+ plugin.fireFrameworkEvent(systemBundle, FrameworkEvent.WARNING, new BundleException("Error " + context, t));
+ }
+}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,113 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import java.net.URL;
-import java.util.Properties;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.deployer.DeployerService;
-import org.jboss.osgi.deployment.deployer.Deployment;
-import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
-import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
-import org.jboss.osgi.deployment.internal.SystemDeployerService;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * A plugin that manages bundle deployments.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 19-Oct-2009
- */
-public class DeployerServiceImpl extends AbstractServicePlugin implements DeployerServicePlugin
-{
- // Provide logging
- final Logger log = Logger.getLogger(DeployerServiceImpl.class);
-
- private DeployerService delegate;
-
- public DeployerServiceImpl(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- }
-
- public void startService()
- {
- BundleContext context = getSystemContext();
- delegate = new SystemDeployerService(context);
-
- DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
- context.registerService(DeploymentRegistryService.class.getName(), registry, null);
-
- Properties props = new Properties();
- props.put("provider", "system");
- context.registerService(DeployerService.class.getName(), this, props);
- }
-
- public void stopService()
- {
- // do nothing
- }
-
- public Deployment createDeployment(URL url) throws BundleException
- {
- return delegate.createDeployment(url);
- }
-
- public Deployment createDeployment(VirtualFile file) throws BundleException
- {
- return delegate.createDeployment(file);
- }
-
- public Deployment createDeployment(BundleInfo info) throws BundleException
- {
- return delegate.createDeployment(info);
- }
-
- public void deploy(Deployment[] bundleDeps) throws BundleException
- {
- delegate.deploy(bundleDeps);
- }
-
- public void deploy(URL url) throws BundleException
- {
- delegate.deploy(url);
- }
-
- public void undeploy(Deployment[] bundleDeps) throws BundleException
- {
- delegate.undeploy(bundleDeps);
- }
-
- public void undeploy(URL url) throws BundleException
- {
- delegate.undeploy(url);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,103 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import java.net.URL;
+import java.util.Properties;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.deployment.deployer.DeploymentRegistryService;
+import org.jboss.osgi.deployment.internal.DeploymentRegistryServiceImpl;
+import org.jboss.osgi.deployment.internal.SystemDeployerService;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * A plugin that manages bundle deployments.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Oct-2009
+ */
+public class DeployerServiceImpl extends AbstractServicePlugin implements DeployerServicePlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(DeployerServiceImpl.class);
+
+ private DeployerService delegate;
+
+ public DeployerServiceImpl(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void startService()
+ {
+ BundleContext context = getSystemContext();
+ delegate = new SystemDeployerService(context);
+
+ DeploymentRegistryService registry = new DeploymentRegistryServiceImpl(context);
+ context.registerService(DeploymentRegistryService.class.getName(), registry, null);
+
+ Properties props = new Properties();
+ props.put("provider", "system");
+ context.registerService(DeployerService.class.getName(), this, props);
+ }
+
+ public void stopService()
+ {
+ // do nothing
+ }
+
+ public Deployment createDeployment(URL url) throws BundleException
+ {
+ return delegate.createDeployment(url);
+ }
+
+ public Deployment createDeployment(VirtualFile file) throws BundleException
+ {
+ return delegate.createDeployment(file);
+ }
+
+ public Deployment createDeployment(BundleInfo info) throws BundleException
+ {
+ return delegate.createDeployment(info);
+ }
+
+ public void deploy(Deployment[] bundleDeps) throws BundleException
+ {
+ delegate.deploy(bundleDeps);
+ }
+
+ public void undeploy(Deployment[] bundleDeps) throws BundleException
+ {
+ delegate.undeploy(bundleDeps);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-import org.jboss.logging.Logger;
-import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
-import org.jboss.osgi.deployment.interceptor.InvocationContext;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
-import org.jboss.osgi.deployment.internal.InvocationContextImpl;
-import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A plugin that manages bundle lifecycle interceptors.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 19-Oct-2009
- */
-public class LifecycleInterceptorServiceImpl extends AbstractServicePlugin implements LifecycleInterceptorServicePlugin
-{
- // Provide logging
- final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
-
- private AbstractLifecycleInterceptorService delegate;
- private ServiceRegistration registration;
-
- public LifecycleInterceptorServiceImpl(final OSGiBundleManager bundleManager)
- {
- super(bundleManager);
- }
-
- public void startService()
- {
- BundleContext sysContext = getSystemContext();
- delegate = new AbstractLifecycleInterceptorService(sysContext)
- {
- @Override
- protected InvocationContext getInvocationContext(Bundle bundle)
- {
- long bundleId = bundle.getBundleId();
- AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
- if (bundleState == null)
- throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
-
- VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
- InvocationContext inv = unit.getAttachment(InvocationContext.class);
- if (inv == null)
- {
- BundleContext context = bundleState.getBundleManager().getSystemContext();
- DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
- inv = new InvocationContextImpl(context, bundle, unit.getRoot(), att);
- unit.addAttachment(InvocationContext.class, inv);
- }
- return inv;
- }
- };
-
- registration = sysContext.registerService(LifecycleInterceptorService.class.getName(), delegate, null);
- }
-
- public void stopService()
- {
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- delegate = null;
- }
- }
-
- public void handleStateChange(int state, Bundle bundle)
- {
- if (delegate != null)
- delegate.handleStateChange(state, bundle);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,105 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptorService;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService;
+import org.jboss.osgi.deployment.internal.InvocationContextImpl;
+import org.jboss.osgi.framework.bundle.AbstractDeployedBundleState;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A plugin that manages bundle lifecycle interceptors.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 19-Oct-2009
+ */
+public class LifecycleInterceptorServiceImpl extends AbstractServicePlugin implements LifecycleInterceptorServicePlugin
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(LifecycleInterceptorServiceImpl.class);
+
+ private AbstractLifecycleInterceptorService delegate;
+ private ServiceRegistration registration;
+
+ public LifecycleInterceptorServiceImpl(final OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+ }
+
+ public void startService()
+ {
+ BundleContext sysContext = getSystemContext();
+ delegate = new AbstractLifecycleInterceptorService(sysContext)
+ {
+ @Override
+ protected InvocationContext getInvocationContext(Bundle bundle)
+ {
+ long bundleId = bundle.getBundleId();
+ AbstractDeployedBundleState bundleState = (AbstractDeployedBundleState)getBundleManager().getBundleById(bundleId);
+ if (bundleState == null)
+ throw new IllegalStateException("Cannot obtain bundleState for: " + bundle);
+
+ VFSDeploymentUnit unit = (VFSDeploymentUnit)bundleState.getDeploymentUnit();
+ InvocationContext inv = unit.getAttachment(InvocationContext.class);
+ if (inv == null)
+ {
+ BundleContext context = bundleState.getBundleManager().getSystemContext();
+ DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
+ inv = new InvocationContextImpl(context, bundle, AbstractVFS.adapt(unit.getRoot()), att);
+ unit.addAttachment(InvocationContext.class, inv);
+ }
+ return inv;
+ }
+ };
+
+ registration = sysContext.registerService(LifecycleInterceptorService.class.getName(), delegate, null);
+ }
+
+ public void stopService()
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ delegate = null;
+ }
+ }
+
+ public void handleStateChange(int state, Bundle bundle)
+ {
+ if (delegate != null)
+ delegate.handleStateChange(state, bundle);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,109 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.service.internal;
-
-//$Id$
-
-import java.util.Set;
-
-import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.InvocationContext;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
-import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Bundle;
-
-/**
- * The lifecycle interceptor that verifies that deployments ending in '.war'
- * have a WEB-INF/web.xml descriptor.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 20-Oct-2009
- */
-public class WebXMLVerifierInterceptor extends AbstractServicePlugin implements LifecycleInterceptor
-{
- private LifecycleInterceptor delegate;
-
- public WebXMLVerifierInterceptor(OSGiBundleManager bundleManager)
- {
- super(bundleManager);
-
- delegate = new AbstractLifecycleInterceptor()
- {
- public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
- {
- if (state == Bundle.STARTING)
- {
- try
- {
- VirtualFile root = context.getRoot();
- VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
- String contextPath = (String)context.getBundle().getHeaders().get("Web-ContextPath");
- boolean isWebApp = contextPath != null || root.getName().endsWith(".war");
- if (isWebApp == true && webXML == null)
- throw new LifecycleInterceptorException("Cannot obtain web.xml from: " + root.toURL());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new LifecycleInterceptorException("Cannot check for web.xml", ex);
- }
- }
- }
- };
- }
-
- public void startService()
- {
- getSystemContext().registerService(LifecycleInterceptor.class.getName(), delegate, null);
- }
-
- public void stopService()
- {
- // do nothing
- }
-
- public Set<Class<?>> getInput()
- {
- return delegate.getInput();
- }
-
- public Set<Class<?>> getOutput()
- {
- return delegate.getOutput();
- }
-
- public int getRelativeOrder()
- {
- return delegate.getRelativeOrder();
- }
-
- public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
- {
- delegate.invoke(state, context);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java (from rev 101762, projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -0,0 +1,109 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.framework.service.internal;
+
+//$Id$
+
+import java.util.Set;
+
+import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
+import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
+import org.jboss.osgi.framework.bundle.OSGiBundleManager;
+import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
+import org.jboss.osgi.vfs.VirtualFile;
+import org.osgi.framework.Bundle;
+
+/**
+ * The lifecycle interceptor that verifies that deployments ending in '.war'
+ * have a WEB-INF/web.xml descriptor.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 20-Oct-2009
+ */
+public class WebXMLVerifierInterceptor extends AbstractServicePlugin implements LifecycleInterceptor
+{
+ private LifecycleInterceptor delegate;
+
+ public WebXMLVerifierInterceptor(OSGiBundleManager bundleManager)
+ {
+ super(bundleManager);
+
+ delegate = new AbstractLifecycleInterceptor()
+ {
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
+ {
+ if (state == Bundle.STARTING)
+ {
+ try
+ {
+ VirtualFile root = context.getRoot();
+ VirtualFile webXML = root.getChild("/WEB-INF/web.xml");
+ String contextPath = (String)context.getBundle().getHeaders().get("Web-ContextPath");
+ boolean isWebApp = contextPath != null || root.getName().endsWith(".war");
+ if (isWebApp == true && webXML == null)
+ throw new LifecycleInterceptorException("Cannot obtain web.xml from: " + root.toURL());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new LifecycleInterceptorException("Cannot check for web.xml", ex);
+ }
+ }
+ }
+ };
+ }
+
+ public void startService()
+ {
+ getSystemContext().registerService(LifecycleInterceptor.class.getName(), delegate, null);
+ }
+
+ public void stopService()
+ {
+ // do nothing
+ }
+
+ public Set<Class<?>> getInput()
+ {
+ return delegate.getInput();
+ }
+
+ public Set<Class<?>> getOutput()
+ {
+ return delegate.getOutput();
+ }
+
+ public int getRelativeOrder()
+ {
+ return delegate.getRelativeOrder();
+ }
+
+ public void invoke(int state, InvocationContext context) throws LifecycleInterceptorException
+ {
+ delegate.invoke(state, context);
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,185 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
-import org.osgi.framework.Bundle;
-
-/**
- * Bundle handler.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-class BundleHandler extends AbstractVirtualFileHandler
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 6650185906199900589L;
-
- private VirtualFile root; // bundle's root
- private VirtualFile file;
- private Bundle bundle;
-
- private volatile String relativePath;
- private volatile URI uri;
- private volatile VirtualFileHandler handler;
-
- public BundleHandler(VFSContext context, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
- {
- this(context, LazyVirtualFileHandler.create(file.getParent()), root, file, bundle);
- }
-
- private BundleHandler(VFSContext context, VirtualFileHandler parent, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
- {
- super(context, parent, file.getName());
- this.root = root;
- this.file = file;
- this.bundle = bundle;
- }
-
- protected VirtualFileHandler getHandler() throws IOException
- {
- if (handler == null)
- handler = LazyVirtualFileHandler.create(file);
-
- return handler;
- }
-
- protected String getRelativePath(boolean checkStart, boolean checkEnd)
- {
- if (relativePath == null)
- relativePath = AbstractStructureDeployer.getRelativePath(root, file);
-
- StringBuilder path = new StringBuilder(relativePath);
- if (checkStart && relativePath.startsWith("/") == false)
- path.insert(0, '/');
- if (checkEnd && relativePath.endsWith("/") == false)
- path.append('/');
-
- return path.toString();
- }
-
- protected VirtualFileHandler createChildHandler(VirtualFile child) throws IOException
- {
- return new BundleHandler(getVFSContext(), this, root, child, bundle);
- }
-
- public URI toURI() throws URISyntaxException
- {
- if (uri == null)
- uri = new URI("bundle", Long.toString(bundle.getBundleId()), getRelativePath(true, false), null);
-
- return uri;
- }
-
- public long getLastModified() throws IOException
- {
- return bundle.getLastModified();
- }
-
- public InputStream openStream() throws IOException
- {
- bundle.getResource(getRelativePath(false, false)); // permission check
-
- return file.openStream();
- }
-
- public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
- {
- bundle.findEntries(getRelativePath(false, false), null, false); // permission check
-
- List<VirtualFile> children = file.getChildren();
- if (children != null && children.isEmpty() == false)
- {
- List<VirtualFileHandler> handlers = new ArrayList<VirtualFileHandler>(children.size());
- for (VirtualFile child : children)
- {
- handlers.add(createChildHandler(child));
- }
- return handlers;
- }
- return Collections.emptyList();
- }
-
- public VirtualFileHandler getChild(String path) throws IOException
- {
- String fullPath = getRelativePath(false, true) + path;
- URL entry = bundle.getEntry(fullPath); // permission check
- if (entry == null)
- return null;
-
- VirtualFile child = file.getChild(path); // the child should exist, since entry does
- return createChildHandler(child);
- }
-
- //---------------------------------------------------------
-
- @Override
- protected URL toInternalVfsUrl() throws MalformedURLException, URISyntaxException
- {
- return toURI().toURL();
- }
-
- public long getSize() throws IOException
- {
- return file.getSize();
- }
-
- public boolean exists() throws IOException
- {
- return file.exists();
- }
-
- public boolean isLeaf() throws IOException
- {
- return file.isLeaf();
- }
-
- public boolean isHidden() throws IOException
- {
- return file.isHidden();
- }
-
- public boolean removeChild(String name) throws IOException
- {
- return getHandler().removeChild(name);
- }
-
- public boolean isNested() throws IOException
- {
- return VFSUtils.isNestedFile(file);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-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.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Bundle vfs context.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-public class BundleVFSContext extends AbstractVFSContext
-{
- private String name;
- private VirtualFileHandler root;
-
- public BundleVFSContext(URI rootURI, OSGiBundleManager manager) throws IOException
- {
- super(rootURI);
-
- name = parseName(rootURI);
-
- AbstractDeployedBundleState bundleState = getBundleState(rootURI, manager);
- String path = parsePath(rootURI);
- URL resource = bundleState.getEntry(path); // permission check
- if (resource == null)
- throw new IllegalArgumentException("No such resource: " + path + " in bundle: " + bundleState);
-
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit == false)
- throw new IllegalArgumentException("Cannot handle non VFS deployments: " + unit);
-
- VFSDeploymentUnit vdu = VFSDeploymentUnit.class.cast(unit);
- VirtualFile duRoot = vdu.getRoot();
- VirtualFile duFile = vdu.getFile(path); // should exist, resource != null
- root = new BundleHandler(this, duRoot, duFile, bundleState);
- }
-
- /**
- * Parse context name from uri.
- *
- * @param uri the uri
- * @return parsed context's name
- */
- protected String parseName(URI uri)
- {
- return uri.getHost();
- }
-
- /**
- * Parse resource path from uri.
- *
- * @param uri the uri
- * @return parsed resource path
- */
- protected String parsePath(URI uri)
- {
- String path = uri.getPath();
- if (path == null)
- path = "";
-
- return path;
- }
-
- /**
- * Get bundle state.
- *
- * @param uri the uri
- * @param manager the osgi manager
- * @return bundle state or exception if no such bundle exists
- */
- protected AbstractDeployedBundleState getBundleState(URI uri, OSGiBundleManager manager)
- {
- String host = uri.getHost();
- long id = Long.parseLong(host);
- if (id == 0)
- throw new IllegalArgumentException("Cannot handle system bundle, it's too abstract.");
-
- AbstractBundleState abs = manager.getBundleById(id);
- if (abs == null)
- throw new IllegalArgumentException("No such bundle: " + id);
-
- return OSGiBundleState.class.cast(abs); // should be able to cast, as it's not system
- }
-
- public String getName()
- {
- return name;
- }
-
- public VirtualFileHandler getRoot() throws IOException
- {
- return root;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.net.URL;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.io.IOException;
-
-import org.jboss.virtual.plugins.context.AbstractContextFactory;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * Bundle vfs context factory.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-public class BundleVFSContextFactory extends AbstractContextFactory
-{
- static
- {
- init();
- }
-
- private static final String HANDLER_PKGS = "java.protocol.handler.pkgs";
- private OSGiBundleManager manager;
-
- public BundleVFSContextFactory(OSGiBundleManager manager)
- {
- super("bundle");
- if (manager == null)
- throw new IllegalArgumentException("Null manager");
- this.manager = manager;
- }
-
- public static void init()
- {
- String pkg = BundleVFSContextFactory.class.getPackage().getName();
- String pkgs = System.getProperty(HANDLER_PKGS);
-
- if (pkgs == null || pkgs.trim().length() == 0)
- {
- pkgs = pkg;
- System.setProperty(HANDLER_PKGS, pkgs);
- }
- else if (pkgs.contains(pkg) == false)
- {
- pkgs += ("|" + pkg);
- System.setProperty(HANDLER_PKGS, pkgs);
- }
- }
-
- public void start()
- {
- VFSContextFactoryLocator.registerFactory(this);
- }
-
- public void stop()
- {
- VFSContextFactoryLocator.unregisterFactory(this);
- }
-
- public VFSContext getVFS(URL rootURL) throws IOException
- {
- try
- {
- return getVFS(rootURL.toURI());
- }
- catch (URISyntaxException e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- public VFSContext getVFS(URI rootURI) throws IOException
- {
- return new BundleVFSContext(rootURI, manager);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Create a lazy VirtualFileHandler based off VirtualFile
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-class LazyVirtualFileHandler
-{
- private static final Method getHandler;
-
- static
- {
- try
- {
- PrivilegedExceptionAction<Method> action = new PrivilegedExceptionAction<Method>()
- {
- public Method run() throws Exception
- {
- Method method = VirtualFile.class.getDeclaredMethod("getHandler");
- method.setAccessible(true);
- return method;
- }
- };
- getHandler = AccessController.doPrivileged(action);
-
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Create a VFH proxy, delaying the actual reflect hack.
- *
- * @param file the VFH owner
- * @return VFH proxy
- * @throws IOException for any error
- */
- static VirtualFileHandler create(VirtualFile file) throws IOException
- {
- if (file == null)
- return null;
-
- ClassLoader cl = LazyVirtualFileHandler.class.getClassLoader();
- Object proxy = Proxy.newProxyInstance(cl, new Class<?>[]{VirtualFileHandler.class}, new ProxyHandler(file));
- return VirtualFileHandler.class.cast(proxy);
- }
-
- private static class ProxyHandler implements InvocationHandler
- {
- private VirtualFile file;
- private volatile VirtualFileHandler handler;
-
- private ProxyHandler(VirtualFile file)
- {
- this.file = file;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return method.invoke(getHandler(), args);
- }
-
- private VirtualFileHandler getHandler() throws Exception
- {
- if (handler == null)
- handler = (VirtualFileHandler)getHandler.invoke(file);
-
- return handler;
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java 2010-03-01 16:11:14 UTC (rev 101664)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/core/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,233 +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.test.osgi.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.framework.vfs.BundleVFSContextFactory;
-import org.jboss.test.osgi.FrameworkTest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.osgi.framework.Bundle;
-
-/**
- * BundleVFSUnitTestCase.
- *
- * TODO test security
- * TODO test fragments
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-public class BundleVFSUnitTestCase extends FrameworkTest
-{
- private BundleVFSContextFactory factory;
-
- public static Test suite()
- {
- return suite(BundleVFSUnitTestCase.class);
- }
-
- public BundleVFSUnitTestCase(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- factory = new BundleVFSContextFactory(getBundleManager());
- factory.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- factory.stop();
- factory = null;
-
- super.tearDown();
- }
-
- public void testBasicOps() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- assertBundleByURI(uri, 0, true, "root.xml");
-
- uri = createURI(bundle, "root.xml");
- assertBundleByURI(uri, 0, false, null);
-
- uri = createURI(bundle, "META-INF");
- assertBundleByURI(uri, -1, true, "MANIFEST.MF");
-
- uri = createURI(bundle, "META-INF/MANIFEST.MF");
- assertBundleByURI(uri, 0, false, null);
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- public void testBasicNavigation() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- VirtualFile root = VFS.getRoot(uri);
- assertNotNull(root);
-
- VirtualFile metainf = root.getChild("META-INF");
- assertBundleByFile(metainf, -1, true, "MANIFEST.MF");
- List<VirtualFile> children = metainf.getChildren();
- assertTrue(children != null && children.size() == 1);
- assertEquals(root, metainf.getParent());
-
- VirtualFile manifest = metainf.getChild("MANIFEST.MF");
- assertBundleByFile(manifest, 0, false, null);
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- public void testVisitor() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- VirtualFile root = VFS.getRoot(uri);
- assertNotNull(root);
-
- List<VirtualFile> children = root.getChildren(new VirtualFileFilter()
- {
- public boolean accepts(VirtualFile file)
- {
- return file.getPathName().contains("META-INF");
- }
- });
- assertTrue(children != null && children.size() == 1);
-
- children = root.getChildrenRecursively(new VirtualFileFilter()
- {
- public boolean accepts(VirtualFile file)
- {
- return file.getPathName().contains("META-INF");
- }
- });
- assertTrue(children != null && children.size() == 2);
-
- final AtomicInteger counter = new AtomicInteger(0);
- root.visit(new VirtualFileVisitor()
- {
- public VisitorAttributes getAttributes()
- {
- return VisitorAttributes.RECURSE_LEAVES_ONLY;
- }
-
- public void visit(VirtualFile file)
- {
- if (file.getName().equals("entry2.xml")) counter.incrementAndGet();
- }
- });
- assertEquals(2, counter.get());
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- protected URI createURI(Bundle bundle, String path) throws Exception
- {
- if (path == null)
- path = "";
- if (path != null && path.startsWith("/") == false)
- path = "/" + path;
-
- return new URI("bundle", Long.toString(bundle.getBundleId()), path, null);
- }
-
- protected void assertBundleByURI(URI uri, int available, boolean hasChildren, String path) throws Exception
- {
- VFS vfs = VFS.getVFS(uri);
- assertNotNull(vfs);
- VirtualFile file = vfs.getRoot();
- assertNotNull(file);
-
- URI bURI = file.toURI();
- assertEquals(uri, bURI);
- URL url = uri.toURL();
- assertEquals(url, file.toURL());
-
- assertBundleByFile(file, available, hasChildren, path);
-
- // check url
- file = VFS.getRoot(url);
- assertBundleByFile(file, available, hasChildren, path);
- }
-
- protected void assertBundleByFile(VirtualFile file, int available, boolean hasChildren, String path) throws IOException
- {
- long lastModified = file.getLastModified();
- assertTrue(lastModified >= 0);
-
- InputStream is = file.openStream();
- try
- {
- assertTrue(is.available() > available);
- }
- finally
- {
- is.close();
- }
-
- List<VirtualFile> children = file.getChildren();
- assertEquals(hasChildren, children != null && children.isEmpty() == false);
-
- String cp = path;
- if (cp == null)
- cp = "rubbish"; // :-)
-
- VirtualFile child = file.getChild(cp);
- assertEquals(path != null, child != null);
-
- if (child != null)
- assertEquals(file, child.getParent());
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 09:42:26 UTC (rev 101765)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 09:56:16 UTC (rev 101766)
@@ -1,30 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
- <!-- ====================================================================== -->
- <!-- -->
- <!-- JBoss, the OpenSource J2EE webOS -->
- <!-- -->
- <!-- Distributable under LGPL license. -->
- <!-- See terms of license at http://www.gnu.org. -->
- <!-- -->
- <!-- ====================================================================== -->
+<!-- ====================================================================== -->
+<!-- -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- -->
+<!-- ====================================================================== -->
- <!-- $Id$ -->
+<!-- $Id$ -->
- <!--
- Set these VM properties in your IDE debugger
-
- -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target}
- -Dlog4j.configuration=log4j-console.xml
- -->
+<!-- Set these VM properties in your IDE debugger -Dlog4j.output.dir=${workspace_loc:jboss-osgi-framework/target} -Dlog4j.configuration=log4j-console.xml -->
<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 Core Framework</name>
+ <name>JBossOSGi Framework</name>
<groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-framework</artifactId>
- <packaging>bundle</packaging>
+ <artifactId>jboss-osgi-framework-parent</artifactId>
+ <packaging>pom</packaging>
<version>1.0.0.Alpha4-SNAPSHOT</version>
@@ -40,7 +35,7 @@
<developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
<url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
</scm>
-
+
<!-- Properties -->
<properties>
<version.apache.felix.configadmin>1.0.10</version.apache.felix.configadmin>
@@ -69,389 +64,216 @@
<version.osgi>4.2.0</version.osgi>
</properties>
- <dependencies>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.cl</groupId>
- <artifactId>jboss-classloader</artifactId>
- <version>${version.jboss.classloading}</version>
- </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-vfs</artifactId>
- <version>${version.jboss.classloading}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-client</artifactId>
- <version>${version.jboss.deployers}</version>
- </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-core</artifactId>
- <version>${version.jboss.deployers}</version>
- </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-impl</artifactId>
- <version>${version.jboss.deployers}</version>
- </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-vfs-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </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-jmx</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-kernel</artifactId>
- <version>${version.jboss.kernel}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-aop-mc-int</artifactId>
- <version>${version.jboss.kernel}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-jmx-mc-int</artifactId>
- <version>${version.jboss.kernel}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-dependency</artifactId>
- <version>${version.jboss.kernel}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- <version>${version.jboss.logging}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- <version>${version.jboss.mdr}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version.jboss.osgi.spi}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployers</artifactId>
- <version>${version.jboss.osgi.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
- <artifactId>jboss-osgi-deployment</artifactId>
- <version>${version.jboss.osgi.deployment}</version>
- </dependency>
+ <!-- Modules -->
+ <modules>
+ <module>core</module>
+ </modules>
+
+ <!-- Dependency Management -->
+ <dependencyManagement>
+ <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-classloading</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.cl</groupId>
+ <artifactId>jboss-classloading-vfs</artifactId>
+ <version>${version.jboss.classloading}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-client</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </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-core</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </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-impl</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </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-vfs-spi</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </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-jmx</artifactId>
+ <version>${version.jboss.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-kernel</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-jmx-aop-mc-int</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-jmx-mc-int</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.kernel</groupId>
+ <artifactId>jboss-dependency</artifactId>
+ <version>${version.jboss.kernel}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ <version>${version.jboss.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-mdr</artifactId>
+ <version>${version.jboss.mdr}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version.jboss.osgi.spi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployers</artifactId>
+ <version>${version.jboss.osgi.deployers}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.runtime</groupId>
+ <artifactId>jboss-osgi-deployment</artifactId>
+ <version>${version.jboss.osgi.deployment}</version>
+ </dependency>
- <!-- OSGi Dependencies -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>${version.osgi}</version>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <version>${version.osgi}</version>
- </dependency>
+ <!-- OSGi Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
- <!-- Test bundles dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <version>${version.apache.felix.configadmin}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <version>${version.apache.felix.log}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <version>${version.apache.felix.metatype}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-apache-xerces</artifactId>
- <version>${version.jboss.osgi.apache.xerces}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version.jboss.osgi.common}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common-core</artifactId>
- <version>${version.jboss.osgi.common.core}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-husky</artifactId>
- <version>${version.jboss.osgi.husky}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jaxb</artifactId>
- <version>${version.jboss.osgi.jaxb}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jmx</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <version>${version.jboss.osgi.jmx}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.jndi</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <version>${version.jboss.osgi.jndi}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-reflect</artifactId>
- <version>${version.jboss.osgi.reflect}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-xml-binding</artifactId>
- <version>${version.jboss.osgi.xml.binding}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.ops4j.pax.web</groupId>
- <artifactId>pax-web-jetty-bundle</artifactId>
- <version>${version.ops4j.pax.web}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.test</groupId>
- <artifactId>jboss-test</artifactId>
- <version>${version.jboss.test}</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-testing</artifactId>
- <version>${version.jboss.osgi.testing}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-log4j</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- <execution>
- <id>all</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- <configuration>
- <descriptors>
- <descriptor>scripts/assembly-all.xml</descriptor>
- </descriptors>
- <archive>
- <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-idea-plugin</artifactId>
- <configuration>
- <downloadSources>true</downloadSources>
- </configuration>
- </plugin>
- <plugin>
+ <!-- Test bundles dependencies -->
+ <dependency>
<groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>org.jboss.osgi.framework</Bundle-SymbolicName>
- <Bundle-Name>JBossOSGi Framework</Bundle-Name>
- <Bundle-Version>${version}</Bundle-Version>
- <Export-Package>
- org.osgi.framework;version="1.5",
- org.osgi.framework.launch;version="1.0",
- org.osgi.framework.hooks.service;version="1.0",
- org.osgi.service.packageadmin;version="1.2",
- org.osgi.service.startlevel;version="1.1",
- org.osgi.util.tracker;version="1.4"
- </Export-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <argLine>-Xmx512m</argLine>
- <systemProperties>
- <property>
- <name>log4j.output.dir</name>
- <value>${project.build.directory}</value>
- </property>
- <property>
- <name>org.jboss.osgi.framework.launch.bootstrapPath</name>
- <value>bootstrap/jboss-osgi-bootstrap.xml</value>
- </property>
- <property>
- <name>org.jboss.osgi.husky.Invoker</name>
- <value>org.jboss.osgi.husky.internal.AbstractInvoker</value>
- </property>
- <property>
- <name>test.archive.directory</name>
- <value>${project.build.directory}/test-libs</value>
- </property>
- </systemProperties>
- <excludes>
- <!-- excludes listed here need to have a jira issue associated
- <exclude>org/jboss/test/osgi/service/ServiceMixUnitTestCase.class</exclude>
- -->
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <version>${version.apache.felix.configadmin}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.apache.felix.log}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <version>${version.apache.felix.metatype}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-apache-xerces</artifactId>
+ <version>${version.jboss.osgi.apache.xerces}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi.common}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common-core</artifactId>
+ <version>${version.jboss.osgi.common.core}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <version>${version.jboss.osgi.husky}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jaxb</artifactId>
+ <version>${version.jboss.osgi.jaxb}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jmx</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi.jmx}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.jndi</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ <version>${version.jboss.osgi.jndi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-reflect</artifactId>
+ <version>${version.jboss.osgi.reflect}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-xml-binding</artifactId>
+ <version>${version.jboss.osgi.xml.binding}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.ops4j.pax.web</groupId>
+ <artifactId>pax-web-jetty-bundle</artifactId>
+ <version>${version.ops4j.pax.web}</version>
+ </dependency>
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>jboss-test</artifactId>
+ <version>${version.jboss.test}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-testing</artifactId>
+ <version>${version.jboss.osgi.testing}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
<profiles>
-
- <!--
- Name: distro
- Desc: Build the distribution
- -->
+
+ <!-- Name: distro Desc: Build the distribution -->
<profile>
<id>distro</id>
<build>
@@ -465,7 +287,7 @@
</plugins>
</build>
</profile>
-
+
</profiles>
</project>
14 years, 4 months
JBoss-OSGI SVN: r101764 - in projects/jboss-osgi/projects/runtime/framework/trunk/src: test/java/org/jboss/test/osgi/bundle and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 04:36:27 -0500 (Wed, 03 Mar 2010)
New Revision: 101764
Removed:
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/bundle/
projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
Log:
Remove framework/vfs
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2010-03-03 09:27:37 UTC (rev 101763)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleHandler.java 2010-03-03 09:36:27 UTC (rev 101764)
@@ -1,185 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVirtualFileHandler;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-import org.jboss.deployers.vfs.spi.structure.helpers.AbstractStructureDeployer;
-import org.osgi.framework.Bundle;
-
-/**
- * Bundle handler.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-class BundleHandler extends AbstractVirtualFileHandler
-{
- /** The serialVersionUID */
- private static final long serialVersionUID = 6650185906199900589L;
-
- private VirtualFile root; // bundle's root
- private VirtualFile file;
- private Bundle bundle;
-
- private volatile String relativePath;
- private volatile URI uri;
- private volatile VirtualFileHandler handler;
-
- public BundleHandler(VFSContext context, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
- {
- this(context, LazyVirtualFileHandler.create(file.getParent()), root, file, bundle);
- }
-
- private BundleHandler(VFSContext context, VirtualFileHandler parent, VirtualFile root, VirtualFile file, Bundle bundle) throws IOException
- {
- super(context, parent, file.getName());
- this.root = root;
- this.file = file;
- this.bundle = bundle;
- }
-
- protected VirtualFileHandler getHandler() throws IOException
- {
- if (handler == null)
- handler = LazyVirtualFileHandler.create(file);
-
- return handler;
- }
-
- protected String getRelativePath(boolean checkStart, boolean checkEnd)
- {
- if (relativePath == null)
- relativePath = AbstractStructureDeployer.getRelativePath(root, file);
-
- StringBuilder path = new StringBuilder(relativePath);
- if (checkStart && relativePath.startsWith("/") == false)
- path.insert(0, '/');
- if (checkEnd && relativePath.endsWith("/") == false)
- path.append('/');
-
- return path.toString();
- }
-
- protected VirtualFileHandler createChildHandler(VirtualFile child) throws IOException
- {
- return new BundleHandler(getVFSContext(), this, root, child, bundle);
- }
-
- public URI toURI() throws URISyntaxException
- {
- if (uri == null)
- uri = new URI("bundle", Long.toString(bundle.getBundleId()), getRelativePath(true, false), null);
-
- return uri;
- }
-
- public long getLastModified() throws IOException
- {
- return bundle.getLastModified();
- }
-
- public InputStream openStream() throws IOException
- {
- bundle.getResource(getRelativePath(false, false)); // permission check
-
- return file.openStream();
- }
-
- public List<VirtualFileHandler> getChildren(boolean ignoreErrors) throws IOException
- {
- bundle.findEntries(getRelativePath(false, false), null, false); // permission check
-
- List<VirtualFile> children = file.getChildren();
- if (children != null && children.isEmpty() == false)
- {
- List<VirtualFileHandler> handlers = new ArrayList<VirtualFileHandler>(children.size());
- for (VirtualFile child : children)
- {
- handlers.add(createChildHandler(child));
- }
- return handlers;
- }
- return Collections.emptyList();
- }
-
- public VirtualFileHandler getChild(String path) throws IOException
- {
- String fullPath = getRelativePath(false, true) + path;
- URL entry = bundle.getEntry(fullPath); // permission check
- if (entry == null)
- return null;
-
- VirtualFile child = file.getChild(path); // the child should exist, since entry does
- return createChildHandler(child);
- }
-
- //---------------------------------------------------------
-
- @Override
- protected URL toInternalVfsUrl() throws MalformedURLException, URISyntaxException
- {
- return toURI().toURL();
- }
-
- public long getSize() throws IOException
- {
- return file.getSize();
- }
-
- public boolean exists() throws IOException
- {
- return file.exists();
- }
-
- public boolean isLeaf() throws IOException
- {
- return file.isLeaf();
- }
-
- public boolean isHidden() throws IOException
- {
- return file.isHidden();
- }
-
- public boolean removeChild(String name) throws IOException
- {
- return getHandler().removeChild(name);
- }
-
- public boolean isNested() throws IOException
- {
- return VFSUtils.isNestedFile(file);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-03-03 09:27:37 UTC (rev 101763)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContext.java 2010-03-03 09:36:27 UTC (rev 101764)
@@ -1,126 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URL;
-
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.spi.structure.VFSDeploymentUnit;
-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.virtual.VirtualFile;
-import org.jboss.virtual.plugins.context.AbstractVFSContext;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Bundle vfs context.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-public class BundleVFSContext extends AbstractVFSContext
-{
- private String name;
- private VirtualFileHandler root;
-
- public BundleVFSContext(URI rootURI, OSGiBundleManager manager) throws IOException
- {
- super(rootURI);
-
- name = parseName(rootURI);
-
- AbstractDeployedBundleState bundleState = getBundleState(rootURI, manager);
- String path = parsePath(rootURI);
- URL resource = bundleState.getEntry(path); // permission check
- if (resource == null)
- throw new IllegalArgumentException("No such resource: " + path + " in bundle: " + bundleState);
-
- DeploymentUnit unit = bundleState.getDeploymentUnit();
- if (unit instanceof VFSDeploymentUnit == false)
- throw new IllegalArgumentException("Cannot handle non VFS deployments: " + unit);
-
- VFSDeploymentUnit vdu = VFSDeploymentUnit.class.cast(unit);
- VirtualFile duRoot = vdu.getRoot();
- VirtualFile duFile = vdu.getFile(path); // should exist, resource != null
- root = new BundleHandler(this, duRoot, duFile, bundleState);
- }
-
- /**
- * Parse context name from uri.
- *
- * @param uri the uri
- * @return parsed context's name
- */
- protected String parseName(URI uri)
- {
- return uri.getHost();
- }
-
- /**
- * Parse resource path from uri.
- *
- * @param uri the uri
- * @return parsed resource path
- */
- protected String parsePath(URI uri)
- {
- String path = uri.getPath();
- if (path == null)
- path = "";
-
- return path;
- }
-
- /**
- * Get bundle state.
- *
- * @param uri the uri
- * @param manager the osgi manager
- * @return bundle state or exception if no such bundle exists
- */
- protected AbstractDeployedBundleState getBundleState(URI uri, OSGiBundleManager manager)
- {
- String host = uri.getHost();
- long id = Long.parseLong(host);
- if (id == 0)
- throw new IllegalArgumentException("Cannot handle system bundle, it's too abstract.");
-
- AbstractBundleState abs = manager.getBundleById(id);
- if (abs == null)
- throw new IllegalArgumentException("No such bundle: " + id);
-
- return OSGiBundleState.class.cast(abs); // should be able to cast, as it's not system
- }
-
- public String getName()
- {
- return name;
- }
-
- public VirtualFileHandler getRoot() throws IOException
- {
- return root;
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java 2010-03-03 09:27:37 UTC (rev 101763)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/BundleVFSContextFactory.java 2010-03-03 09:36:27 UTC (rev 101764)
@@ -1,102 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.net.URL;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.io.IOException;
-
-import org.jboss.virtual.plugins.context.AbstractContextFactory;
-import org.jboss.virtual.spi.VFSContext;
-import org.jboss.virtual.spi.VFSContextFactoryLocator;
-import org.jboss.osgi.framework.bundle.OSGiBundleManager;
-
-/**
- * Bundle vfs context factory.
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-public class BundleVFSContextFactory extends AbstractContextFactory
-{
- static
- {
- init();
- }
-
- private static final String HANDLER_PKGS = "java.protocol.handler.pkgs";
- private OSGiBundleManager manager;
-
- public BundleVFSContextFactory(OSGiBundleManager manager)
- {
- super("bundle");
- if (manager == null)
- throw new IllegalArgumentException("Null manager");
- this.manager = manager;
- }
-
- public static void init()
- {
- String pkg = BundleVFSContextFactory.class.getPackage().getName();
- String pkgs = System.getProperty(HANDLER_PKGS);
-
- if (pkgs == null || pkgs.trim().length() == 0)
- {
- pkgs = pkg;
- System.setProperty(HANDLER_PKGS, pkgs);
- }
- else if (pkgs.contains(pkg) == false)
- {
- pkgs += ("|" + pkg);
- System.setProperty(HANDLER_PKGS, pkgs);
- }
- }
-
- public void start()
- {
- VFSContextFactoryLocator.registerFactory(this);
- }
-
- public void stop()
- {
- VFSContextFactoryLocator.unregisterFactory(this);
- }
-
- public VFSContext getVFS(URL rootURL) throws IOException
- {
- try
- {
- return getVFS(rootURL.toURI());
- }
- catch (URISyntaxException e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- public VFSContext getVFS(URI rootURI) throws IOException
- {
- return new BundleVFSContext(rootURI, manager);
- }
-}
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java 2010-03-03 09:27:37 UTC (rev 101763)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/vfs/LazyVirtualFileHandler.java 2010-03-03 09:36:27 UTC (rev 101764)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2008, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.framework.vfs;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.security.AccessController;
-import java.security.PrivilegedExceptionAction;
-
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.spi.VirtualFileHandler;
-
-/**
- * Create a lazy VirtualFileHandler based off VirtualFile
- *
- * @author <a href="mailto:ales.justin@jboss.org">Ales Justin</a>
- */
-class LazyVirtualFileHandler
-{
- private static final Method getHandler;
-
- static
- {
- try
- {
- PrivilegedExceptionAction<Method> action = new PrivilegedExceptionAction<Method>()
- {
- public Method run() throws Exception
- {
- Method method = VirtualFile.class.getDeclaredMethod("getHandler");
- method.setAccessible(true);
- return method;
- }
- };
- getHandler = AccessController.doPrivileged(action);
-
- }
- catch (Exception e)
- {
- throw new RuntimeException(e);
- }
- }
-
- /**
- * Create a VFH proxy, delaying the actual reflect hack.
- *
- * @param file the VFH owner
- * @return VFH proxy
- * @throws IOException for any error
- */
- static VirtualFileHandler create(VirtualFile file) throws IOException
- {
- if (file == null)
- return null;
-
- ClassLoader cl = LazyVirtualFileHandler.class.getClassLoader();
- Object proxy = Proxy.newProxyInstance(cl, new Class<?>[]{VirtualFileHandler.class}, new ProxyHandler(file));
- return VirtualFileHandler.class.cast(proxy);
- }
-
- private static class ProxyHandler implements InvocationHandler
- {
- private VirtualFile file;
- private volatile VirtualFileHandler handler;
-
- private ProxyHandler(VirtualFile file)
- {
- this.file = file;
- }
-
- public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
- {
- return method.invoke(getHandler(), args);
- }
-
- private VirtualFileHandler getHandler() throws Exception
- {
- if (handler == null)
- handler = (VirtualFileHandler)getHandler.invoke(file);
-
- return handler;
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java 2010-03-03 09:27:37 UTC (rev 101763)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/test/java/org/jboss/test/osgi/bundle/BundleVFSUnitTestCase.java 2010-03-03 09:36:27 UTC (rev 101764)
@@ -1,233 +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.test.osgi.bundle;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.net.URL;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.framework.vfs.BundleVFSContextFactory;
-import org.jboss.test.osgi.FrameworkTest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VirtualFile;
-import org.jboss.virtual.VirtualFileFilter;
-import org.jboss.virtual.VirtualFileVisitor;
-import org.jboss.virtual.VisitorAttributes;
-import org.osgi.framework.Bundle;
-
-/**
- * BundleVFSUnitTestCase.
- *
- * TODO test security
- * TODO test fragments
- * @author <a href="ales.justin(a)jboss.org">Ales Justin</a>
- */
-public class BundleVFSUnitTestCase extends FrameworkTest
-{
- private BundleVFSContextFactory factory;
-
- public static Test suite()
- {
- return suite(BundleVFSUnitTestCase.class);
- }
-
- public BundleVFSUnitTestCase(String name)
- {
- super(name);
- }
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- factory = new BundleVFSContextFactory(getBundleManager());
- factory.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- factory.stop();
- factory = null;
-
- super.tearDown();
- }
-
- public void testBasicOps() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- assertBundleByURI(uri, 0, true, "root.xml");
-
- uri = createURI(bundle, "root.xml");
- assertBundleByURI(uri, 0, false, null);
-
- uri = createURI(bundle, "META-INF");
- assertBundleByURI(uri, -1, true, "MANIFEST.MF");
-
- uri = createURI(bundle, "META-INF/MANIFEST.MF");
- assertBundleByURI(uri, 0, false, null);
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- public void testBasicNavigation() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- VirtualFile root = VFS.getRoot(uri);
- assertNotNull(root);
-
- VirtualFile metainf = root.getChild("META-INF");
- assertBundleByFile(metainf, -1, true, "MANIFEST.MF");
- List<VirtualFile> children = metainf.getChildren();
- assertTrue(children != null && children.size() == 1);
- assertEquals(root, metainf.getParent());
-
- VirtualFile manifest = metainf.getChild("MANIFEST.MF");
- assertBundleByFile(manifest, 0, false, null);
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- public void testVisitor() throws Exception
- {
- Bundle bundle = addBundle("/bundles/entries/", "entries-simple");
- try
- {
- URI uri = createURI(bundle, null);
- VirtualFile root = VFS.getRoot(uri);
- assertNotNull(root);
-
- List<VirtualFile> children = root.getChildren(new VirtualFileFilter()
- {
- public boolean accepts(VirtualFile file)
- {
- return file.getPathName().contains("META-INF");
- }
- });
- assertTrue(children != null && children.size() == 1);
-
- children = root.getChildrenRecursively(new VirtualFileFilter()
- {
- public boolean accepts(VirtualFile file)
- {
- return file.getPathName().contains("META-INF");
- }
- });
- assertTrue(children != null && children.size() == 2);
-
- final AtomicInteger counter = new AtomicInteger(0);
- root.visit(new VirtualFileVisitor()
- {
- public VisitorAttributes getAttributes()
- {
- return VisitorAttributes.RECURSE_LEAVES_ONLY;
- }
-
- public void visit(VirtualFile file)
- {
- if (file.getName().equals("entry2.xml")) counter.incrementAndGet();
- }
- });
- assertEquals(2, counter.get());
- }
- finally
- {
- uninstall(bundle);
- }
- }
-
- protected URI createURI(Bundle bundle, String path) throws Exception
- {
- if (path == null)
- path = "";
- if (path != null && path.startsWith("/") == false)
- path = "/" + path;
-
- return new URI("bundle", Long.toString(bundle.getBundleId()), path, null);
- }
-
- protected void assertBundleByURI(URI uri, int available, boolean hasChildren, String path) throws Exception
- {
- VFS vfs = VFS.getVFS(uri);
- assertNotNull(vfs);
- VirtualFile file = vfs.getRoot();
- assertNotNull(file);
-
- URI bURI = file.toURI();
- assertEquals(uri, bURI);
- URL url = uri.toURL();
- assertEquals(url, file.toURL());
-
- assertBundleByFile(file, available, hasChildren, path);
-
- // check url
- file = VFS.getRoot(url);
- assertBundleByFile(file, available, hasChildren, path);
- }
-
- protected void assertBundleByFile(VirtualFile file, int available, boolean hasChildren, String path) throws IOException
- {
- long lastModified = file.getLastModified();
- assertTrue(lastModified >= 0);
-
- InputStream is = file.openStream();
- try
- {
- assertTrue(is.available() > available);
- }
- finally
- {
- is.close();
- }
-
- List<VirtualFile> children = file.getChildren();
- assertEquals(hasChildren, children != null && children.isEmpty() == false);
-
- String cp = path;
- if (cp == null)
- cp = "rubbish"; // :-)
-
- VirtualFile child = file.getChild(cp);
- assertEquals(path != null, child != null);
-
- if (child != null)
- assertEquals(file, child.getParent());
- }
-}
\ No newline at end of file
14 years, 4 months
JBoss-OSGI SVN: r101762 - in projects/jboss-osgi: projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal and 24 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2010-03-03 04:20:23 -0500 (Wed, 03 Mar 2010)
New Revision: 101762
Modified:
projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml
projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
projects/jboss-osgi/projects/bundles/webapp/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java
projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentFactory.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
projects/jboss-osgi/projects/spi/trunk/pom.xml
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
projects/jboss-osgi/projects/testing/trunk/pom.xml
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Log:
Migrate to jboss-osgi-vfs abstraction
Modified: projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -39,8 +39,8 @@
<!-- Properties -->
<properties>
- <version.jboss.osgi.deployment>1.0.1</version.jboss.osgi.deployment>
- <version.jboss.osgi.spi>1.0.4</version.jboss.osgi.spi>
+ <version.jboss.osgi.deployment>1.0.2-SNAPSHOT</version.jboss.osgi.deployment>
+ <version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -82,6 +82,14 @@
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.serviceloader.internal.ServiceLoaderActivator</Bundle-Activator>
+ <Import-Package>
+ org.jboss.logging;version="[2.1,3.0)",
+ org.jboss.osgi.deployment*;version="[1.0,2.0)",
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
+ org.jboss.osgi.vfs;version="[1.0,2.0)",
+
+ org.osgi.framework;version="[1.5,2.0)",
+ </Import-Package>
<Export-Package>
org.jboss.osgi.serviceloader;version=${version}
</Export-Package>
Modified: projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/bundles/serviceloader/trunk/src/main/java/org/jboss/osgi/serviceloader/internal/ServiceLoaderInterceptor.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -29,16 +29,15 @@
import java.util.Enumeration;
import java.util.Hashtable;
+import org.jboss.logging.Logger;
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.InvocationContext;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* An interceptor that registeres service defined in META-INF/services.
@@ -49,7 +48,7 @@
public class ServiceLoaderInterceptor extends AbstractLifecycleInterceptor
{
// Provide logging
- private Logger log = LoggerFactory.getLogger(ServiceLoaderInterceptor.class);
+ private static final Logger log = Logger.getLogger(ServiceLoaderInterceptor.class);
@SuppressWarnings("unchecked")
public void invoke(int state, InvocationContext context)
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/.settings/org.eclipse.jdt.core.prefs 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/.settings/org.eclipse.jdt.core.prefs 2010-03-03 09:20:23 UTC (rev 101762)
@@ -1,5 +1,6 @@
-#Fri Mar 06 10:50:43 CET 2009
+#Wed Mar 03 09:58:58 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -101,10 +101,11 @@
javax.xml.parsers,
org.apache.commons.logging;version="[1.1,1.2)",
- org.jboss.logging;version="[2.1,2.2)",
- org.jboss.osgi.deployment.interceptor;version="[1.0,1.1)",
- org.jboss.osgi.spi.capability;version="[1.0,1.1)",
- org.jboss.virtual,
+ org.jboss.logging;version="[2.1,3.0)",
+ org.jboss.osgi.deployment*;version="[1.0,2.0)",
+ org.jboss.osgi.spi*;version="[1.0,2.0)",
+ org.jboss.osgi.vfs;version="[1.0,2.0)",
+
org.ops4j.pax.web.service,
org.osgi.service.http,
org.osgi.framework,
Modified: projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/bundles/webapp/trunk/src/main/java/org/jboss/osgi/webapp/internal/WebXMLParserInterceptor.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -30,7 +30,7 @@
import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.ops4j.pax.web.extender.war.internal.model.WebApp;
import org.ops4j.pax.web.extender.war.internal.parser.dom.DOMWebXmlParser;
import org.osgi.framework.Bundle;
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/.settings/org.eclipse.jdt.core.prefs 2010-03-03 09:20:23 UTC (rev 101762)
@@ -1,4 +1,4 @@
-#Thu Feb 25 11:21:35 CET 2010
+#Tue Mar 02 21:52:19 CET 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -38,8 +38,8 @@
<!-- Properties -->
<properties>
- <version.jboss.deployers>2.2.0.Alpha1</version.jboss.deployers>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
+ <version.jboss.osgi.vfs>1.0.0-SNAPSHOT</version.jboss.osgi.vfs>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -55,14 +55,6 @@
<version>${version.jboss.osgi.spi}</version>
</dependency>
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- <version>${version.jboss.deployers}</version>
- <scope>provided</scope>
- </dependency>
-
<!-- OSGi Dependencies -->
<dependency>
<groupId>org.osgi</groupId>
@@ -79,6 +71,12 @@
<!-- Test Dependecies -->
<dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <version>${version.jboss.osgi.vfs}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/AbstractDeployerService.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -26,7 +26,7 @@
import java.net.URL;
import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.BundleException;
/**
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeployerService.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -26,7 +26,7 @@
import java.net.URL;
import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.BundleException;
/**
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -21,12 +21,11 @@
*/
package org.jboss.osgi.deployment.deployer;
-import org.jboss.osgi.spi.Attachments;
-import org.jboss.virtual.VirtualFile;
-
-
//$Id$
+import org.jboss.osgi.spi.Attachments;
+import org.jboss.osgi.vfs.VirtualFile;
+
/**
* An abstraction of a bundle deployment
*
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentFactory.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/DeploymentFactory.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -27,7 +27,7 @@
import org.jboss.osgi.deployment.internal.DeploymentImpl;
import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.BundleException;
/**
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -24,7 +24,7 @@
//$Id$
import org.jboss.osgi.spi.Attachments;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -21,15 +21,15 @@
*/
package org.jboss.osgi.deployment.internal;
+//$Id$
+
import java.io.Serializable;
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.spi.util.AttachmentSupport;
import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
-//$Id$
-
/**
* An abstraction of a bundle deployment
*
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -27,7 +27,7 @@
import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.spi.Attachments;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/SystemDeployerService.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -63,7 +63,6 @@
this.context = context;
}
- @Override
public void deploy(Deployment[] depArr) throws BundleException
{
DeploymentRegistryService registry = getDeploymentRegistry();
@@ -134,7 +133,6 @@
}
}
- @Override
public void undeploy(Deployment[] depArr) throws BundleException
{
DeploymentRegistryService registry = getDeploymentRegistry();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -54,13 +54,13 @@
<version.jboss.osgi.apache.xerces>2.9.1.SP3</version.jboss.osgi.apache.xerces>
<version.jboss.osgi.common>1.0.3</version.jboss.osgi.common>
<version.jboss.osgi.common.core>2.2.13.GA</version.jboss.osgi.common.core>
- <version.jboss.osgi.deployment>1.0.1</version.jboss.osgi.deployment>
+ <version.jboss.osgi.deployers>1.0.5-SNAPSHOT</version.jboss.osgi.deployers>
+ <version.jboss.osgi.deployment>1.0.2-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.husky>1.0.4-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.osgi.jaxb>2.1.10.SP3</version.jboss.osgi.jaxb>
<version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
<version.jboss.osgi.jndi>1.0.3-SNAPSHOT</version.jboss.osgi.jndi>
<version.jboss.osgi.reflect>2.2.0</version.jboss.osgi.reflect>
- <version.jboss.osgi.runtime.deployers>1.0.4</version.jboss.osgi.runtime.deployers>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
<version.jboss.osgi.xml.binding>2.0.2.Beta4</version.jboss.osgi.xml.binding>
@@ -172,7 +172,7 @@
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-deployers</artifactId>
- <version>${version.jboss.osgi.runtime.deployers}</version>
+ <version>${version.jboss.osgi.deployers}</version>
</dependency>
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/AbstractDeployedBundleState.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -36,6 +36,7 @@
import org.jboss.osgi.deployment.deployer.Deployment;
import org.jboss.osgi.framework.metadata.OSGiMetaData;
import org.jboss.osgi.framework.plugins.PackageAdminPlugin;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.AdminPermission;
import org.osgi.framework.Bundle;
@@ -82,7 +83,7 @@
// The framework is expected to preserve the location passed into installBundle(String)
Deployment dep = unit.getAttachment(Deployment.class);
location = (dep != null ? dep.getLocation() : unit.getName());
- rootFile = (dep != null ? dep.getRoot() : ((VFSDeploymentUnit)unit).getRoot());
+ rootFile = (dep != null ? (VirtualFile)AbstractVFS.adapt(dep.getRoot()) : ((VFSDeploymentUnit)unit).getRoot());
bundleId = bundleIDGenerator.incrementAndGet();
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/bundle/OSGiBundleManager.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -73,6 +73,7 @@
import org.jboss.osgi.framework.plugins.ServicePlugin;
import org.jboss.osgi.framework.util.URLHelper;
import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.jboss.util.platform.Java;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VFSUtils;
@@ -507,7 +508,7 @@
Deployment dep;
try
{
- BundleInfo info = BundleInfo.createBundleInfo(root, location);
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
dep = DeploymentFactory.createDeployment(info);
dep.setAutoStart(autoStart);
}
@@ -532,7 +533,8 @@
// Create the deployment and deploy it
try
{
- VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(dep.getRoot());
+ VirtualFile root = (VirtualFile)AbstractVFS.adapt(dep.getRoot());
+ VFSDeployment deployment = VFSDeploymentFactory.getInstance().createVFSDeployment(root);
MutableAttachments att = (MutableAttachments)deployment.getPredeterminedManagedObjects();
att.addAttachment(Deployment.class, dep);
@@ -685,7 +687,7 @@
URL storageLocation = getBundleStorageLocation(in);
VirtualFile root = VFS.getRoot(storageLocation);
- BundleInfo info = BundleInfo.createBundleInfo(root, location);
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root), location);
Deployment dep = DeploymentFactory.createDeployment(info);
dep.addAttachment(AbstractBundleState.class, bundleState);
dep.setBundleUpdate(true);
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/DeployerServiceImpl.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -36,7 +36,7 @@
import org.jboss.osgi.framework.plugins.DeployerServicePlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
import org.jboss.osgi.spi.util.BundleInfo;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -96,18 +96,8 @@
delegate.deploy(bundleDeps);
}
- public void deploy(URL url) throws BundleException
- {
- delegate.deploy(url);
- }
-
public void undeploy(Deployment[] bundleDeps) throws BundleException
{
delegate.undeploy(bundleDeps);
}
-
- public void undeploy(URL url) throws BundleException
- {
- delegate.undeploy(url);
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/LifecycleInterceptorServiceImpl.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -34,6 +34,7 @@
import org.jboss.osgi.framework.plugins.LifecycleInterceptorServicePlugin;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
import org.jboss.osgi.framework.util.DeploymentUnitAttachments;
+import org.jboss.osgi.vfs.AbstractVFS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
@@ -76,7 +77,7 @@
{
BundleContext context = bundleState.getBundleManager().getSystemContext();
DeploymentUnitAttachments att = new DeploymentUnitAttachments(unit);
- inv = new InvocationContextImpl(context, bundle, unit.getRoot(), att);
+ inv = new InvocationContextImpl(context, bundle, AbstractVFS.adapt(unit.getRoot()), att);
unit.addAttachment(InvocationContext.class, inv);
}
return inv;
Modified: projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java
===================================================================
--- projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/runtime/framework/trunk/src/main/java/org/jboss/osgi/framework/service/internal/WebXMLVerifierInterceptor.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -31,7 +31,7 @@
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
import org.jboss.osgi.framework.bundle.OSGiBundleManager;
import org.jboss.osgi.framework.plugins.internal.AbstractServicePlugin;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
/**
Modified: projects/jboss-osgi/projects/spi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/spi/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -39,7 +39,7 @@
<!-- Properties -->
<properties>
<version.args4j>2.0.12</version.args4j>
- <version.jboss.vfs>2.1.3.SP1</version.jboss.vfs>
+ <version.jboss.osgi.vfs>1.0.0-SNAPSHOT</version.jboss.osgi.vfs>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -57,9 +57,9 @@
<artifactId>jboss-logging-spi</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-vfs</artifactId>
- <version>${version.jboss.vfs}</version>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs</artifactId>
+ <version>${version.jboss.osgi.vfs}</version>
</dependency>
<!-- Provided Dependencies -->
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/BundleInfo.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -31,9 +31,9 @@
import java.util.jar.Attributes;
import java.util.jar.Manifest;
-import org.jboss.virtual.VFS;
-import org.jboss.virtual.VFSUtils;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VFSUtils;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
@@ -261,7 +261,7 @@
{
try
{
- return VFS.getRoot(url);
+ return AbstractVFS.getChild(url);
}
catch (IOException e)
{
Modified: projects/jboss-osgi/projects/testing/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/testing/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -43,9 +43,10 @@
<version.apache.aries.jmx>1.0.0-incubating-SNAPSHOT</version.apache.aries.jmx>
<version.apache.felix.log>1.0.0</version.apache.felix.log>
<version.jboss.osgi.common>1.0.4-SNAPSHOT</version.jboss.osgi.common>
+ <version.jboss.osgi.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.felix>
<version.jboss.osgi.jmx>1.0.4-SNAPSHOT</version.jboss.osgi.jmx>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
- <version.jboss.osgi.runtime.felix>2.0.2.SP1-SNAPSHOT</version.jboss.osgi.runtime.felix>
+ <version.jboss.osgi.vfs>1.0.0-SNAPSHOT</version.jboss.osgi.vfs>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -66,6 +67,11 @@
<version>${version.jboss.osgi.jmx}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.vfs</groupId>
+ <artifactId>jboss-osgi-vfs21</artifactId>
+ <version>${version.jboss.osgi.vfs}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
@@ -124,7 +130,7 @@
<dependency>
<groupId>org.jboss.osgi.runtime</groupId>
<artifactId>jboss-osgi-runtime-felix</artifactId>
- <version>${version.jboss.osgi.runtime.felix}</version>
+ <version>${version.jboss.osgi.felix}</version>
<scope>test</scope>
</dependency>
</dependencies>
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/AbstractVFS.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -46,6 +46,11 @@
return getVFSAdaptor().adapt(virtualFile);
}
+ public static Object adapt(VirtualFile virtualFile)
+ {
+ return getVFSAdaptor().adapt(virtualFile);
+ }
+
@SuppressWarnings("unchecked")
private static VFSAdaptor getVFSAdaptor()
{
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSAdaptor.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -51,5 +51,12 @@
* @throws IllegalArgumentException If the given virtualFile is not a VirtualFile supported by the VFSAdaptor implementation
*/
VirtualFile adapt(Object virtualFile);
+
+ /**
+ * Adapt a VirtualFile to a concrete instance of a jboss-vfs VirtualFile.
+ * @param virtualFile The VirtualFile instance
+ * @return The jboss-vfs VirtualFile
+ */
+ Object adapt(VirtualFile virtualFile);
}
Modified: projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -38,6 +38,14 @@
public interface VirtualFile
{
/**
+ * Get the simple VF name (X.java)
+ *
+ * @return the simple file name
+ * @throws IllegalStateException if the file is closed
+ */
+ String getName();
+
+ /**
* Get the VF URL (file://root/org/jboss/X.java)
*
* @return the full URL to the VF in the VFS.
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VFSAdaptor21.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -43,7 +43,19 @@
public VirtualFile adapt(Object virtualFile)
{
+ if (virtualFile == null)
+ return null;
+
+ if (virtualFile instanceof org.jboss.virtual.VirtualFile == false)
+ throw new IllegalArgumentException("Not a org.jboss.virtual.VirtualFile: " + virtualFile);
+
return new VirtualFileAdaptor21((org.jboss.virtual.VirtualFile)virtualFile);
}
+
+ public Object adapt(VirtualFile virtualFile)
+ {
+ VirtualFileAdaptor21 adaptor = (VirtualFileAdaptor21)virtualFile;
+ return adaptor.getDelegate();
+ }
}
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -44,6 +44,16 @@
this.delegate = delegate;
}
+ org.jboss.virtual.VirtualFile getDelegate()
+ {
+ return delegate;
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
public URL toURL() throws MalformedURLException, URISyntaxException
{
return delegate.toURL();
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -52,7 +52,18 @@
public VirtualFile adapt(Object virtualFile)
{
+ if (virtualFile == null)
+ return null;
+
+ if (virtualFile instanceof org.jboss.vfs.VirtualFile == false)
+ throw new IllegalArgumentException("Not a org.jboss.vfs.VirtualFile: " + virtualFile);
+
return new VirtualFileAdaptor30((org.jboss.vfs.VirtualFile)virtualFile);
}
-}
+ public Object adapt(VirtualFile virtualFile)
+ {
+ VirtualFileAdaptor30 adaptor = (VirtualFileAdaptor30)virtualFile;
+ return adaptor.getDelegate();
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
===================================================================
--- projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -44,6 +44,16 @@
this.delegate = delegate;
}
+ org.jboss.vfs.VirtualFile getDelegate()
+ {
+ return delegate;
+ }
+
+ public String getName()
+ {
+ return delegate.getName();
+ }
+
public URL toURL() throws MalformedURLException, URISyntaxException
{
return delegate.toURL();
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -72,7 +72,7 @@
<version.jboss.osgi.jndi>1.0.3-SNAPSHOT</version.jboss.osgi.jndi>
<version.jboss.osgi.jta>1.0.1-SNAPSHOT</version.jboss.osgi.jta>
<version.jboss.osgi.reflect>2.2.0</version.jboss.osgi.reflect>
- <version.jboss.osgi.serviceloader>1.0.0</version.jboss.osgi.serviceloader>
+ <version.jboss.osgi.serviceloader>1.0.1-SNAPSHOT</version.jboss.osgi.serviceloader>
<version.jboss.osgi.spi>1.0.5-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.testing>1.0.0-SNAPSHOT</version.jboss.osgi.testing>
<version.jboss.osgi.webapp>0.7.2.SP2-SNAPSHOT</version.jboss.osgi.webapp>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/interceptor/processor/ParserInterceptor.java 2010-03-03 09:20:23 UTC (rev 101762)
@@ -30,7 +30,7 @@
import org.jboss.osgi.deployment.interceptor.AbstractLifecycleInterceptor;
import org.jboss.osgi.deployment.interceptor.InvocationContext;
import org.jboss.osgi.deployment.interceptor.LifecycleInterceptorException;
-import org.jboss.virtual.VirtualFile;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
/**
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-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -37,7 +37,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.testing;version=1.0
+ org.jboss.osgi.testing;version=1.0,
+ org.jboss.osgi.vfs;version=1.0
</value></entry>
</map>
</property>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-equinox.properties 2010-03-03 09:20:23 UTC (rev 101762)
@@ -29,6 +29,7 @@
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
org.jboss.osgi.testing;version=1.0, \
+ org.jboss.osgi.vfs;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2010-03-03 09:20:23 UTC (rev 101762)
@@ -32,6 +32,7 @@
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
org.jboss.osgi.testing;version=1.0, \
+ org.jboss.osgi.vfs;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -44,17 +44,6 @@
<!-- Dependencies -->
<dependencies>
<dependency>
- <groupId>org.jboss.kernel</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- <version>${version.jboss.aop.mc.int}</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-mdr</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>javax.ejb</groupId>
<artifactId>ejb-api</artifactId>
<version>${version.javax.ejb}</version>
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-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2010-03-03 09:20:23 UTC (rev 101762)
@@ -37,7 +37,8 @@
org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.testing;version=1.0
+ org.jboss.osgi.testing;version=1.0,
+ org.jboss.osgi.vfs;version=1.0
</value></entry>
</map>
</property>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-equinox.properties 2010-03-03 09:20:23 UTC (rev 101762)
@@ -26,6 +26,7 @@
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
org.jboss.osgi.testing;version=1.0, \
+ org.jboss.osgi.vfs;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2010-03-03 09:12:48 UTC (rev 101761)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2010-03-03 09:20:23 UTC (rev 101762)
@@ -29,6 +29,7 @@
org.jboss.osgi.spi.service;version=1.0, \
org.jboss.osgi.spi.util;version=1.0, \
org.jboss.osgi.testing;version=1.0, \
+ org.jboss.osgi.vfs;version=1.0, \
org.jboss.virtual;version=2.1, \
org.jboss.virtual.plugins.registry;version=2.1, \
org.jboss.virtual.plugins.context.jar;version=2.1, \
14 years, 4 months