Author: thomas.diesler(a)jboss.com
Date: 2010-03-14 12:26:12 -0400 (Sun, 14 Mar 2010)
New Revision: 102381
Added:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
Removed:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
Modified:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.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/internal/DeploymentImpl.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/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
projects/jboss-osgi/trunk/distribution/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Simplify AS deployers. Remove basic BundleMetaData.
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,97 +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.deployer;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.osgi.framework.Bundle;
-
-/**
- * Deploy the bundle contained MC beans onto the Kernel.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 06-May-2009
- */
-public class BundleContainedBeansDeployer extends
AbstractComponentDeployer<KernelDeployment, BeanMetaData>
-{
- /*
- * Create a new KernelDeploymentDeployer.
- */
- public BundleContainedBeansDeployer()
- {
- addInput(Bundle.class);
- addInput(ClassLoaderFactory.class);
- setDeploymentVisitor(new KernelDeploymentVisitor());
- setComponentVisitor(new BeanMetaDataVisitor());
- }
-
- /*
- * KernelDeploymentVisitor.
- */
- public static class KernelDeploymentVisitor extends
BeanMetaDataFactoryVisitor<KernelDeployment>
- {
- @Override
- public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws
DeploymentException
- {
- ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
- unit.createClassLoader(factory);
-
- super.deploy(unit, deployment);
- }
-
- public Class<KernelDeployment> getVisitorType()
- {
- return KernelDeployment.class;
- }
-
- protected List<BeanMetaData> getComponents(KernelDeployment deployment)
- {
- return deployment.getBeans();
- }
- }
-
- /*
- * BeanMetaDataVisitor.
- */
- public static class BeanMetaDataVisitor extends
BeanMetaDataFactoryVisitor<BeanMetaData>
- {
- public Class<BeanMetaData> getVisitorType()
- {
- return BeanMetaData.class;
- }
-
- protected List<BeanMetaData> getComponents(BeanMetaData deployment)
- {
- return Collections.singletonList(deployment);
- }
- }
-}
Added:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
(rev 0)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+//$Id: BundleMetaDataDeployer.java 101816 2010-03-04 12:26:58Z thomas.diesler(a)jboss.com
$
+
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployer;
+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.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.virtual.VFSUtils;
+import org.jboss.virtual.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * A deployer that parses the bundle's manifest and attaches a {@link Deployment}
object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Mar-2009
+ */
+public class BundleManifestParsingDeployer extends AbstractParsingDeployer
+{
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ // Deployemnt already attached, nothing to do
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (dep != null)
+ return;
+
+ // Not a VFSDeploymentUnit, nothing to do
+ if (unit instanceof VFSDeploymentUnit == false)
+ return;
+
+ // Extract the Bundle-SymbolicName
+ VirtualFile root = ((VFSDeploymentUnit)unit).getRoot();
+ String symbolicName = null;
+ try
+ {
+ Manifest manifest = VFSUtils.getManifest(root);
+ if (manifest == null)
+ return;
+
+ Attributes attribs = manifest.getMainAttributes();
+ symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+
+ // No Bundle-SymbolicName
+ if (symbolicName == null)
+ return;
+
+ // Create and attach the Deployment
+ try
+ {
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root));
+ dep = DeploymentFactory.createDeployment(info);
+ unit.addAttachment(Deployment.class, dep);
+ dep.setAutoStart(true);
+ }
+ catch (Exception ex)
+ {
+ // ignore, not a bundle deployment
+ }
+ }
+}
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-import org.osgi.framework.Version;
-
-/**
- * The Bundle metadata.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private Version version;
- private String location;
-
- // exteralizable usage
- public BundleMetaData()
- {
- }
-
- public BundleMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public Version getVersion()
- {
- return version;
- }
-
- public void setVersion(Version version)
- {
- this.version = version;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setLocation(String location)
- {
- this.location = location;
- }
-
- public String toString()
- {
- return "Bundle[" + symbolicName + "-" + version +
"]";
- }
-}
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import java.util.jar.Attributes;
-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.deployment.deployer.Deployment;
-import org.jboss.osgi.spi.OSGiConstants;
-import org.jboss.virtual.VirtualFile;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * Create {@link BundleMetaData} from Manifest Headers.
- *
- * If the manifest does not contain a header Bundle-SymbolicName this deployer does
nothing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
-{
- public BundleMetaDataDeployer()
- {
- super(BundleMetaData.class);
- addInput(Deployment.class);
- }
-
- @Override
- protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file,
BundleMetaData root) throws Exception
- {
- BundleMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- String symbolicName = metaData.getSymbolicName();
- log.debug("Bundle-SymbolicName: " + symbolicName + " in " +
file);
-
- Deployment dep = unit.getAttachment(Deployment.class);
- String location = (dep != null ? dep.getLocation() : unit.getName());
- metaData.setLocation(location);
-
- // Add a marker that this is an OSGi deployment
- unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);
- }
- return metaData;
- }
-
- @Override
- protected BundleMetaData createMetaData(Manifest manifest) throws Exception
- {
- BundleMetaData metaData = null;
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- {
- metaData = new BundleMetaData(symbolicName);
- String version = attribs.getValue(Constants.BUNDLE_VERSION);
- metaData.setVersion(Version.parseVersion(version));
- }
-
- return metaData;
- }
-}
Modified:
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs21/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -23,7 +23,6 @@
//$Id$
-import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -32,6 +31,8 @@
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.deployment.deployer.Deployment;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -40,20 +41,20 @@
* Installs the Bundle into the Framework's SystemContext.
*
* This deployer does not start the bundle. It leaves it in state INSTALLED.
- * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
+ * On undeploy the Bundle gets uninstalled from the Framework's system context.
*
* @author Thomas.Diesler(a)jboss.org
* @author Ales.Justin(a)jboss.org
* @since 03-Feb-2009
*/
-public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
+public class BundleRealDeployer extends AbstractSimpleRealDeployer<Deployment>
{
private BundleContext systemContext;
private List<URL> skipBundles = new ArrayList<URL>();
public BundleRealDeployer()
{
- super(BundleMetaData.class);
+ super(Deployment.class);
addOutput(Bundle.class);
setStage(DeploymentStages.POST_PARSE);
}
@@ -68,53 +69,45 @@
this.skipBundles = skipBundles;
}
- public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws
DeploymentException
+ public void deploy(DeploymentUnit unit, Deployment dep) throws DeploymentException
{
- String location = metadata.getLocation();
- if (location == null)
- throw new IllegalStateException("Cannot obtain bundle location for: "
+ metadata);
+ VirtualFile rootFile = dep.getRoot();
+ if (rootFile == null)
+ throw new IllegalStateException("Cannot obtain root file for: " +
dep);
// Normalize the bundle install path
- String path = location;
- try
+ String path = rootFile.getPathName();
+ if (path.endsWith("/"))
+ path = path.substring(0, path.length() - 1);
+
+ boolean skipBundle = false;
+ for (URL skip : skipBundles)
{
- URL url = new URL(location);
- path = url.getPath();
- if (path.endsWith("/"))
- path = path.substring(0, path.length() - 1);
+ String skipPath = skip.getPath();
+ if (skipPath.equals(path))
+ {
+ skipBundle = true;
+ break;
+ }
}
- catch (MalformedURLException ex)
- {
- // ignore
- }
+ if (skipBundle == true)
+ return;
try
{
- boolean skipBundle = false;
- for (URL skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(path))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(location);
- unit.addAttachment(Bundle.class, bundle);
- log.info("Installed: " + bundle);
- }
+ String location = dep.getLocation();
+ Bundle bundle = systemContext.installBundle(location);
+ unit.addAttachment(Bundle.class, bundle);
+ log.info("Installed: " + bundle);
}
- catch (BundleException ex)
+ catch (Exception ex)
{
- throw DeploymentException.rethrowAsDeploymentException("Cannot install
bundle: " + metadata, ex);
+ throw DeploymentException.rethrowAsDeploymentException("Cannot install
bundle: " + dep, ex);
}
}
@Override
- public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
+ public void undeploy(DeploymentUnit unit, Deployment dep)
{
Bundle bundle = unit.getAttachment(Bundle.class);
if (bundle != null)
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,97 +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.deployer;
-
-// $Id$
-
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.beans.metadata.spi.BeanMetaData;
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
-import org.jboss.deployers.structure.spi.ClassLoaderFactory;
-import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
-import org.jboss.kernel.spi.deployment.KernelDeployment;
-import org.osgi.framework.Bundle;
-
-/**
- * Deploy the bundle contained MC beans onto the Kernel.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 06-May-2009
- */
-public class BundleContainedBeansDeployer extends
AbstractComponentDeployer<KernelDeployment, BeanMetaData>
-{
- /*
- * Create a new KernelDeploymentDeployer.
- */
- public BundleContainedBeansDeployer()
- {
- addInput(Bundle.class);
- addInput(ClassLoaderFactory.class);
- setDeploymentVisitor(new KernelDeploymentVisitor());
- setComponentVisitor(new BeanMetaDataVisitor());
- }
-
- /*
- * KernelDeploymentVisitor.
- */
- public static class KernelDeploymentVisitor extends
BeanMetaDataFactoryVisitor<KernelDeployment>
- {
- @Override
- public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws
DeploymentException
- {
- ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
- unit.createClassLoader(factory);
-
- super.deploy(unit, deployment);
- }
-
- public Class<KernelDeployment> getVisitorType()
- {
- return KernelDeployment.class;
- }
-
- protected List<BeanMetaData> getComponents(KernelDeployment deployment)
- {
- return deployment.getBeans();
- }
- }
-
- /*
- * BeanMetaDataVisitor.
- */
- public static class BeanMetaDataVisitor extends
BeanMetaDataFactoryVisitor<BeanMetaData>
- {
- public Class<BeanMetaData> getVisitorType()
- {
- return BeanMetaData.class;
- }
-
- protected List<BeanMetaData> getComponents(BeanMetaData deployment)
- {
- return Collections.singletonList(deployment);
- }
- }
-}
Copied:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
(from rev 101884,
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java)
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java
(rev 0)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleManifestParsingDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2006, 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.deployer;
+
+//$Id$
+
+import java.io.IOException;
+import java.util.jar.Attributes;
+import java.util.jar.Manifest;
+
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployer;
+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.deployment.deployer.DeploymentFactory;
+import org.jboss.osgi.spi.util.BundleInfo;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.vfs.VFSUtils;
+import org.jboss.vfs.VirtualFile;
+import org.osgi.framework.Constants;
+
+/**
+ * A deployer that parses the bundle's manifest and attaches a {@link Deployment}
object.
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 14-Mar-2009
+ */
+public class BundleManifestParsingDeployer extends AbstractParsingDeployer
+{
+ @Override
+ public void deploy(DeploymentUnit unit) throws DeploymentException
+ {
+ // Deployemnt already attached, nothing to do
+ Deployment dep = unit.getAttachment(Deployment.class);
+ if (dep != null)
+ return;
+
+ // Not a VFSDeploymentUnit, nothing to do
+ if (unit instanceof VFSDeploymentUnit == false)
+ return;
+
+ // Extract the Bundle-SymbolicName
+ VirtualFile root = ((VFSDeploymentUnit)unit).getRoot();
+ String symbolicName = null;
+ try
+ {
+ Manifest manifest = VFSUtils.getManifest(root);
+ if (manifest == null)
+ return;
+
+ Attributes attribs = manifest.getMainAttributes();
+ symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ }
+ catch (IOException e)
+ {
+ // ignore
+ }
+
+ // No Bundle-SymbolicName
+ if (symbolicName == null)
+ return;
+
+ // Create and attach the Deployment
+ try
+ {
+ BundleInfo info = BundleInfo.createBundleInfo(AbstractVFS.adapt(root));
+ dep = DeploymentFactory.createDeployment(info);
+ unit.addAttachment(Deployment.class, dep);
+ dep.setAutoStart(true);
+ }
+ catch (Exception ex)
+ {
+ // ignore, not a bundle deployment
+ }
+ }
+}
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaData.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,80 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import org.jboss.deployers.vfs.spi.deployer.helpers.AbstractManifestMetaData;
-import org.osgi.framework.Version;
-
-/**
- * The Bundle metadata.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaData extends AbstractManifestMetaData
-{
- private String symbolicName;
- private Version version;
- private String location;
-
- // exteralizable usage
- public BundleMetaData()
- {
- }
-
- public BundleMetaData(String symbolicName)
- {
- this.symbolicName = symbolicName;
- }
-
- public String getSymbolicName()
- {
- return symbolicName;
- }
-
- public Version getVersion()
- {
- return version;
- }
-
- public void setVersion(Version version)
- {
- this.version = version;
- }
-
- public String getLocation()
- {
- return location;
- }
-
- public void setLocation(String location)
- {
- this.location = location;
- }
-
- public String toString()
- {
- return "Bundle[" + symbolicName + "-" + version +
"]";
- }
-}
Deleted:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleMetaDataDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -1,87 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2006, 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.deployer;
-
-//$Id$
-
-import java.util.jar.Attributes;
-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.deployment.deployer.Deployment;
-import org.jboss.osgi.spi.OSGiConstants;
-import org.jboss.vfs.VirtualFile;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * Create {@link BundleMetaData} from Manifest Headers.
- *
- * If the manifest does not contain a header Bundle-SymbolicName this deployer does
nothing.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 03-Feb-2009
- */
-public class BundleMetaDataDeployer extends ManifestDeployer<BundleMetaData>
-{
- public BundleMetaDataDeployer()
- {
- super(BundleMetaData.class);
- addInput(Deployment.class);
- }
-
- @Override
- protected BundleMetaData parse(VFSDeploymentUnit unit, VirtualFile file,
BundleMetaData root) throws Exception
- {
- BundleMetaData metaData = super.parse(unit, file, root);
- if (metaData != null)
- {
- String symbolicName = metaData.getSymbolicName();
- log.debug("Bundle-SymbolicName: " + symbolicName + " in " +
file);
-
- Deployment dep = unit.getAttachment(Deployment.class);
- String location = (dep != null ? dep.getLocation() : unit.getName());
- metaData.setLocation(location);
-
- // Add a marker that this is an OSGi deployment
- unit.addAttachment(OSGiConstants.KEY_BUNDLE_SYMBOLIC_NAME, symbolicName);
- }
- return metaData;
- }
-
- @Override
- protected BundleMetaData createMetaData(Manifest manifest) throws Exception
- {
- BundleMetaData metaData = null;
- Attributes attribs = manifest.getMainAttributes();
- String symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
- if (symbolicName != null)
- {
- metaData = new BundleMetaData(symbolicName);
- String version = attribs.getValue(Constants.BUNDLE_VERSION);
- metaData.setVersion(Version.parseVersion(version));
- }
-
- return metaData;
- }
-}
Modified:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleRealDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -23,7 +23,7 @@
//$Id$
-import java.net.MalformedURLException;
+import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -32,6 +32,8 @@
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.deployment.deployer.Deployment;
+import org.jboss.osgi.vfs.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -40,20 +42,20 @@
* Installs the Bundle into the Framework's SystemContext.
*
* This deployer does not start the bundle. It leaves it in state INSTALLED.
- * On undeploy the Bundle gets uninstalled from the Framework's SystemContext.
+ * On undeploy the Bundle gets uninstalled from the Framework's system context.
*
* @author Thomas.Diesler(a)jboss.org
* @author Ales.Justin(a)jboss.org
* @since 03-Feb-2009
*/
-public class BundleRealDeployer extends AbstractSimpleRealDeployer<BundleMetaData>
+public class BundleRealDeployer extends AbstractSimpleRealDeployer<Deployment>
{
private BundleContext systemContext;
private List<URL> skipBundles = new ArrayList<URL>();
public BundleRealDeployer()
{
- super(BundleMetaData.class);
+ super(Deployment.class);
addOutput(Bundle.class);
setStage(DeploymentStages.POST_PARSE);
}
@@ -68,53 +70,46 @@
this.skipBundles = skipBundles;
}
- public void deploy(DeploymentUnit unit, BundleMetaData metadata) throws
DeploymentException
+ public void deploy(DeploymentUnit unit, Deployment dep) throws DeploymentException
{
- String location = metadata.getLocation();
- if (location == null)
- throw new IllegalStateException("Cannot obtain bundle location for: "
+ metadata);
+ VirtualFile rootFile = dep.getRoot();
+ if (rootFile == null)
+ throw new IllegalStateException("Cannot obtain root file for: " +
dep);
// Normalize the bundle install path
- String path = location;
- try
+ String path = rootFile.getPathName();
+ if (path.endsWith("/"))
+ path = path.substring(0, path.length() - 1);
+
+ boolean skipBundle = false;
+ for (URL skip : skipBundles)
{
- URL url = new URL(location);
- path = url.getPath();
- if (path.endsWith("/"))
- path = path.substring(0, path.length() - 1);
+ String skipPath = skip.getPath();
+ if (skipPath.equals(path))
+ {
+ skipBundle = true;
+ break;
+ }
}
- catch (MalformedURLException ex)
- {
- // ignore
- }
+ if (skipBundle == true)
+ return;
try
{
- boolean skipBundle = false;
- for (URL skip : skipBundles)
- {
- String skipPath = skip.getPath();
- if (skipPath.equals(path))
- {
- skipBundle = true;
- break;
- }
- }
- if (skipBundle == false)
- {
- Bundle bundle = systemContext.installBundle(location);
- unit.addAttachment(Bundle.class, bundle);
- log.info("Installed: " + bundle);
- }
+ String location = rootFile.toURL().toExternalForm();
+ InputStream instream = rootFile.getStreamURL().openStream();
+ Bundle bundle = systemContext.installBundle(location, instream);
+ unit.addAttachment(Bundle.class, bundle);
+ log.info("Installed: " + bundle);
}
- catch (BundleException ex)
+ catch (Exception ex)
{
- throw DeploymentException.rethrowAsDeploymentException("Cannot install
bundle: " + metadata, ex);
+ throw DeploymentException.rethrowAsDeploymentException("Cannot install
bundle: " + dep, ex);
}
}
@Override
- public void undeploy(DeploymentUnit unit, BundleMetaData osGiMetaData)
+ public void undeploy(DeploymentUnit unit, Deployment dep)
{
Bundle bundle = unit.getAttachment(Bundle.class);
if (bundle != null)
Modified:
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java
===================================================================
---
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/deployers/trunk/vfs30/src/main/java/org/jboss/osgi/deployer/BundleStructureDeployer.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -28,9 +28,10 @@
import org.jboss.deployers.spi.DeploymentException;
import org.jboss.deployers.spi.structure.ContextInfo;
-import org.jboss.deployers.vfs.plugins.structure.AbstractVFSArchiveStructureDeployer;
+import org.jboss.deployers.vfs.plugins.structure.AbstractVFSStructureDeployer;
import org.jboss.deployers.vfs.spi.structure.StructureContext;
-import org.jboss.vfs.VFSUtils;
+import org.jboss.osgi.vfs.AbstractVFS;
+import org.jboss.osgi.vfs.VFSUtils;
import org.jboss.vfs.VirtualFile;
import org.osgi.framework.Constants;
@@ -40,7 +41,7 @@
* @author Thomas.Diesler(a)jboss.com
* @since 16-Apr-2009
*/
-public class BundleStructureDeployer extends AbstractVFSArchiveStructureDeployer
+public class BundleStructureDeployer extends AbstractVFSStructureDeployer
{
/**
* Sets the default relative order.
@@ -53,15 +54,8 @@
}
@Override
- protected boolean hasValidSuffix(String name)
+ public boolean determineStructure(StructureContext structureContext) throws
DeploymentException
{
- // We only accept bundles packaged as "*.jar"
- return name.endsWith(".jar");
- }
-
- @Override
- protected boolean doDetermineStructure(StructureContext structureContext) throws
DeploymentException
- {
ContextInfo context = null;
VirtualFile root = structureContext.getRoot();
@@ -69,7 +63,7 @@
{
// This file is not for me, because I'm only interested
// in root deployments that contain a MANIFEST.MF
- Manifest manifest = VFSUtils.getManifest(root);
+ Manifest manifest = VFSUtils.getManifest(AbstractVFS.adapt(root));
if (root != structureContext.getFile() || manifest == null)
return false;
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-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -62,12 +62,12 @@
/**
* Get the start level associated with this deployment
*/
- int getStartLevel();
+ Integer getStartLevel();
/**
* Set the start level associated with this deployment
*/
- void setStartLevel(int startLevel);
+ void setStartLevel(Integer startLevel);
/**
* Get the autostart flag associated with this deployment
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-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/runtime/deployment/trunk/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -41,7 +41,7 @@
private static final long serialVersionUID = 6216977125749367927L;
private BundleInfo info;
- private int startLevel;
+ private Integer startLevel;
private boolean autoStart;
private boolean update;
@@ -53,56 +53,70 @@
this.info = info;
}
+ @Override
public VirtualFile getRoot()
{
return info.getRoot();
}
+ @Override
public String getLocation()
{
return info.getLocation();
}
+ @Override
public String getSymbolicName()
{
return info.getSymbolicName();
}
+ @Override
public String getVersion()
{
return info.getVersion().toString();
}
+ @Override
public String getManifestHeader(String key)
{
return info.getManifestHeader(key);
}
- public int getStartLevel()
+ @Override
+ public Integer getStartLevel()
{
return startLevel;
}
- public void setStartLevel(int startLevel)
+ @Override
+ public void setStartLevel(Integer startLevel)
{
+ if (startLevel == null || startLevel < 1)
+ throw new IllegalArgumentException("Start level must be greater than one:
" + startLevel);
+
this.startLevel = startLevel;
}
+ @Override
public boolean isAutoStart()
{
return autoStart;
}
+ @Override
public void setAutoStart(boolean autoStart)
{
this.autoStart = autoStart;
}
+ @Override
public boolean isBundleUpdate()
{
return update;
}
+ @Override
public void setBundleUpdate(boolean update)
{
this.update = update;
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-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -35,7 +35,6 @@
import org.jboss.vfs.VFS;
import org.jboss.vfs.VFSUtils;
import org.jboss.vfs.spi.MountHandle;
-import org.jboss.vfs.util.automount.Automounter;
/**
* An adaptor to the jboss-vfs-3.0.x VFS.
@@ -45,7 +44,7 @@
*/
public class VFSAdaptor30 implements VFSAdaptor
{
- private static Map<String, VirtualFile> registry = new
ConcurrentHashMap<String, VirtualFile>();
+ private static Map<Object, VirtualFile> registry = new
ConcurrentHashMap<Object, VirtualFile>();
private static Set<String> suffixes = new HashSet<String>();
static
{
@@ -55,54 +54,58 @@
public VirtualFile getRoot(URL url) throws IOException
{
- VirtualFile virtualFile = registry.get(url.toExternalForm());
- if (virtualFile != null)
- return virtualFile;
-
- // Get the VFS file
- org.jboss.vfs.VirtualFile root;
try
{
- root = org.jboss.vfs.VFS.getChild(url);
+ return adapt(org.jboss.vfs.VFS.getChild(url));
}
catch (URISyntaxException ex)
{
throw new IOException(ex);
}
+ }
+
+ public VirtualFile adapt(Object other)
+ {
+ if (other == null)
+ return null;
+ if (other instanceof org.jboss.vfs.VirtualFile == false)
+ throw new IllegalArgumentException("Not a org.jboss.vfs.VirtualFile: "
+ other);
+
+ org.jboss.vfs.VirtualFile nativeFile = (org.jboss.vfs.VirtualFile)other;
+ VirtualFile abstractFile = registry.get(other);
+ if (abstractFile != null)
+ return abstractFile;
+
// Accept the file for mounting
MountHandle mountHandle = null;
- if (root.isFile() && Automounter.isMounted(root) == false)
+ if (nativeFile.isFile())
{
- String rootName = root.getName();
+ String rootName = nativeFile.getName();
for (String suffix : suffixes)
{
if (rootName.endsWith(suffix))
{
- TempFileProvider tmp = TempFileProvider.create("osgimount-",
null);
- mountHandle = VFS.mountZip(root, root, tmp);
- break;
+ try
+ {
+ TempFileProvider tmp = TempFileProvider.create("osgimount-",
null);
+ mountHandle = VFS.mountZip(nativeFile, nativeFile, tmp);
+ break;
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalStateException("Cannot mount native file: "
+ other, ex);
+ }
}
}
}
- // Register the virtual file
- virtualFile = new VirtualFileAdaptor30(root, mountHandle, url);
- registry.put(url.toExternalForm(), virtualFile);
- return virtualFile;
+ // Register the VirtualFile abstraction
+ abstractFile = new VirtualFileAdaptor30(nativeFile, mountHandle);
+ registry.put(nativeFile, abstractFile);
+ return abstractFile;
}
- 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)
{
if (virtualFile == null)
@@ -114,7 +117,7 @@
static void safeClose(VirtualFileAdaptor30 virtualFile)
{
- registry.remove(virtualFile.getRootURL());
+ registry.remove(virtualFile.getDelegate());
MountHandle mountHandle = virtualFile.getMountHandle();
if (mountHandle != null)
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-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-14
16:26:12 UTC (rev 102381)
@@ -44,13 +44,11 @@
{
private org.jboss.vfs.VirtualFile delegate;
private MountHandle mountHandle;
- private URL rootURL;
- VirtualFileAdaptor30(org.jboss.vfs.VirtualFile root, MountHandle mountHandle, URL
rootURL)
+ VirtualFileAdaptor30(org.jboss.vfs.VirtualFile root, MountHandle mountHandle)
{
this(root);
this.mountHandle = mountHandle;
- this.rootURL = rootURL;
}
VirtualFileAdaptor30(org.jboss.vfs.VirtualFile delegate)
@@ -70,11 +68,6 @@
return mountHandle;
}
- URL getRootURL()
- {
- return rootURL;
- }
-
public String getName()
{
return delegate.getName();
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
---
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2010-03-14
16:26:12 UTC (rev 102381)
@@ -107,7 +107,7 @@
<bean name="BundleClassLoaderDeployer"
class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
<property name="systemContext"><inject
bean="jboss.osgi:service=Framework" property="bundleContext"
/></property>
</bean>
- <bean name="BundleMetaDataDeployer"
class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
+ <bean name="BundleManifestParsingDeployer"
class="org.jboss.osgi.deployer.BundleManifestParsingDeployer" />
<bean name="BundleRealDeployer"
class="org.jboss.osgi.deployer.BundleRealDeployer">
<property name="systemContext"><inject
bean="jboss.osgi:service=Framework" property="bundleContext"
/></property>
<property name="skipBundles"><inject
bean="jboss.osgi:service=Framework" property="autoInstall"
/></property>
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
---
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2010-03-14
15:54:22 UTC (rev 102380)
+++
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2010-03-14
16:26:12 UTC (rev 102381)
@@ -107,7 +107,7 @@
<bean name="BundleClassLoaderDeployer"
class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
<property name="systemContext"><inject
bean="jboss.osgi:service=Framework" property="bundleContext"
/></property>
</bean>
- <bean name="BundleMetaDataDeployer"
class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
+ <bean name="BundleManifestParsingDeployer"
class="org.jboss.osgi.deployer.BundleManifestParsingDeployer" />
<bean name="BundleRealDeployer"
class="org.jboss.osgi.deployer.BundleRealDeployer">
<property name="systemContext"><inject
bean="jboss.osgi:service=Framework" property="bundleContext"
/></property>
<property name="skipBundles"><inject
bean="jboss.osgi:service=Framework" property="autoInstall"
/></property>
Modified: projects/jboss-osgi/trunk/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/pom.xml 2010-03-14 15:54:22 UTC (rev 102380)
+++ projects/jboss-osgi/trunk/distribution/pom.xml 2010-03-14 16:26:12 UTC (rev 102381)
@@ -432,11 +432,11 @@
<!-- Equinox Dependencies -->
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.equinox</groupId>
<artifactId>jboss-osgi-equinox</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.equinox</groupId>
<artifactId>jboss-osgi-equinox</artifactId>
<version>${version.jboss.osgi.equinox}</version>
<classifier>sources</classifier>
@@ -444,11 +444,11 @@
<!-- Felix Dependencies -->
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.felix</groupId>
<artifactId>jboss-osgi-felix</artifactId>
</dependency>
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.felix</groupId>
<artifactId>jboss-osgi-felix</artifactId>
<version>${version.jboss.osgi.felix}</version>
<classifier>sources</classifier>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2010-03-14 15:54:22 UTC (rev 102380)
+++ projects/jboss-osgi/trunk/pom.xml 2010-03-14 16:26:12 UTC (rev 102381)
@@ -248,14 +248,14 @@
<!-- Equinox Dependencies -->
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.equinox</groupId>
<artifactId>jboss-osgi-equinox</artifactId>
<version>${version.jboss.osgi.equinox}</version>
</dependency>
<!-- Felix Dependencies -->
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.felix</groupId>
<artifactId>jboss-osgi-felix</artifactId>
<version>${version.jboss.osgi.felix}</version>
</dependency>
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2010-03-14 15:54:22 UTC (rev 102380)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2010-03-14 16:26:12 UTC (rev 102381)
@@ -277,7 +277,7 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.equinox</groupId>
<artifactId>jboss-osgi-equinox</artifactId>
<scope>provided</scope>
</dependency>
@@ -306,7 +306,7 @@
</properties>
<dependencies>
<dependency>
- <groupId>org.jboss.osgi.runtime</groupId>
+ <groupId>org.jboss.osgi.felix</groupId>
<artifactId>jboss-osgi-felix</artifactId>
<scope>provided</scope>
</dependency>