385317 - Clean up of the Nano repository
diff --git a/build-nano/build.xml b/build-nano/build.xml
index 56dd169..9b35745 100644
--- a/build-nano/build.xml
+++ b/build-nano/build.xml
@@ -12,7 +12,6 @@
<pathelement location="../org.eclipse.virgo.nano.deployer.api"/>
<pathelement location="../org.eclipse.virgo.nano.deployer.hot"/>
<pathelement location="../org.eclipse.virgo.nano.deployer"/>
- <pathelement location="../org.eclipse.virgo.nano.war.deployer"/>
<pathelement location="../org.eclipse.virgo.nano.authentication"/>
<pathelement location="../org.eclipse.virgo.nano.shutdown"/>
</path>
diff --git a/build.versions b/build.versions
index 733d49c..0b9f3d8 100644
--- a/build.versions
+++ b/build.versions
@@ -4,86 +4,18 @@
org.eclipse.virgo.util=3.6.0.D-20120917212716
org.eclipse.virgo.build.tools=1.3.0.RELEASE
org.eclipse.gemini.blueprint=1.0.2.RELEASE
-org.springframework=3.1.0.RELEASE
-org.eclipse.gemini.web=2.2.0.BUILD-20120829065106
org.slf4j=1.6.1
# third parties
-javax.transaction=1.1.1.v201105210645
org.eclipse.osgi=3.8.0.v20120508-2119
-org.eclipse.equinox.launcher=1.3.0.v20120308-1358
-org.eclipse.equinox.simpleconfigurator=1.0.300.v20110815-1744
-ch.qos.logback.classic=1.0.3.v20120828-0612
-ch.qos.logback.core=1.0.3.v20120828-0612
-ch.qos.logback.slf4j=1.0.0.v201208311022
-javax.activation=1.1.0.v201108011116
-javax.mail=1.4.0.v201005080615
-javax.persistence.orbit=1.0.0.v200905011740
-javax.xml.rpc=1.1.0.v201005080400
-org.apache.catalina=7.0.29.v201208221210
-org.apache.catalina.ha=7.0.29.v201208230613
-org.apache.catalina.tribes=7.0.29.v201208230737
-org.apache.coyote=7.0.29.v201208230737
-org.apache.el=7.0.29.v201208220722
-org.apache.jasper=7.0.29.v201208230737
-org.apache.juli.extras=7.0.29.v201208220722
-org.apache.mina.core=2.0.2.v201108120515
-org.apache.sshd.core=0.5.0.v201108120515
-org.apache.tomcat.api=7.0.29.v201208220722
-org.apache.tomcat.util=7.0.29.v201208230737
-org.eclipse.jdt.core.compiler.batch=3.8.0.I20120518-2145
-org.slf4j.api=1.6.4.v20120130-2120
-org.slf4j.jul=1.6.4.v20120130-2120
-org.slf4j.jcl=1.6.4.v20120130-2120
-org.slf4j.log4j=1.6.4.v20120130-2120
-javax.annotation=1.1.0.v201108011116
-javax.el=2.2.0.v201108011116
-javax.servlet=3.0.0.v201112011016
-javax.servlet.jsp=2.2.0.v201112011158
-org.apache.felix.gogo.command=0.8.0.v201108120515
-org.apache.felix.gogo.runtime=0.8.0.v201108120515
-org.apache.felix.gogo.shell=0.8.0.v201110170705
-org.eclipse.core.contenttype=3.4.100.v20110423-0524
-org.eclipse.core.jobs=3.5.200.v20120511-1333
-org.eclipse.core.runtime=3.8.0.v20120511-1333
-org.eclipse.ecf=3.1.300.v20120319-0616
-org.eclipse.ecf.filetransfer=5.0.0.v20120319-0616
-org.eclipse.ecf.identity=3.1.200.v20120319-0616
-org.eclipse.ecf.provider.filetransfer=3.2.0.v20120319-0616
-org.eclipse.ecf.ssl=1.0.100.v20120319-0616
-org.eclipse.equinox.app=1.3.100.v20111010-1614
-org.eclipse.equinox.cm=1.0.400.v20120319-2029
-org.eclipse.equinox.common=3.6.100.v20120509-1351
-org.eclipse.equinox.console=1.0.0.v20120511-0559
-org.eclipse.equinox.console.ssh=1.0.0.v20120430-1356
-org.eclipse.equinox.ds=1.4.0.v20120112-1400
-org.eclipse.equinox.event=1.2.100.v20111010-1614
-org.eclipse.equinox.frameworkadmin=2.0.0.v20110808-1657
-org.eclipse.equinox.frameworkadmin.equinox=1.0.400.v20120428-0117
-org.eclipse.equinox.p2.artifact.repository=1.1.200.v20120430-1959
-org.eclipse.equinox.p2.console=1.0.300.v20120429-0125
-org.eclipse.equinox.p2.core=2.2.0.v20120430-0525
-org.eclipse.equinox.p2.director=2.2.0.v20120301-2203
-org.eclipse.equinox.p2.engine=2.2.0.v20120501-1502
-org.eclipse.equinox.p2.garbagecollector=1.0.200.v20110808-1657
-org.eclipse.equinox.p2.jarprocessor=1.0.200.v20110808-1657
-org.eclipse.equinox.p2.metadata=2.1.0.v20120430-2001
-org.eclipse.equinox.p2.metadata.repository=1.2.0.v20110808-1657
-org.eclipse.equinox.p2.publisher=1.2.0.v20120428-0117
-org.eclipse.equinox.p2.publisher.eclipse=1.1.0.v20120511-1931
-org.eclipse.equinox.p2.repository=2.2.0.v20120501-1446
-org.eclipse.equinox.p2.touchpoint.eclipse=2.1.100.v20120428-0117
-org.eclipse.equinox.p2.touchpoint.natives=1.1.0.v20120428-0117
-org.eclipse.equinox.p2.transport.ecf=1.0.100.v20120305-0333
-org.eclipse.equinox.preferences=3.5.0.v20120410-1344
-org.eclipse.equinox.registry=3.5.200.v20120427-1430
-org.eclipse.equinox.security=1.1.100.v20120424-1439
-org.eclipse.equinox.simpleconfigurator.manipulator=2.0.0.v20110808-1657
-org.eclipse.equinox.util=1.0.300.v20111010-1614
org.eclipse.osgi.services=3.3.0.v20120307-2102
-org.sat4j.core=2.3.0.v20110329
-org.sat4j.pb=2.3.0.v20110329
+org.eclipse.equinox.cm=1.0.400.v20120319-2029
+org.eclipse.equinox.event=1.2.100.v20111010-1614
org.eclipse.equinox.region=1.1.0.v20120319-1602
+org.slf4j.api=1.6.4.v20120130-2120
+org.eclipse.equinox.ds=1.4.0.v20120112-1400
+org.eclipse.equinox.simpleconfigurator=1.0.300.v20110815-1744
+org.eclipse.equinox.simpleconfigurator.manipulator=2.0.0.v20110808-1657
#Test
org.easymock=2.3.0
diff --git a/org.eclipse.virgo.nano.war.deployer/.classpath b/org.eclipse.virgo.nano.war.deployer/.classpath
deleted file mode 100644
index 23fc534..0000000
--- a/org.eclipse.virgo.nano.war.deployer/.classpath
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src/main/java">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="src/main/resources">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="false"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" output="target/test-classes" path="src/test/resources">
- <attributes>
- <attribute name="com.springsource.server.ide.jdt.core.test.classpathentry" value="true"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.6.0.D-20120917212716/org.eclipse.virgo.util.io-3.6.0.D-20120917212716.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.io/3.1.0.D-20111205151812/org.eclipse.virgo.util.io-sources-3.1.0.D-20111205151812.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.mirrored/org.eclipse.osgi/3.8.0.v20120508-2119/org.eclipse.osgi-3.8.0.v20120508-2119.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi/3.7.1.R37x_v20110808-1106/org.eclipse.osgi-sources-3.7.1.R37x_v20110808-1106.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.6.0.D-20120917213450/org.eclipse.virgo.medic-3.6.0.D-20120917213450.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic/3.1.0.D-20111205152504/org.eclipse.virgo.medic-sources-3.1.0.D-20111205152504.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.medic/org.eclipse.virgo.medic.core/3.6.0.D-20120917213450/org.eclipse.virgo.medic.core-3.6.0.D-20120917213450.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.gemini/org.eclipse.gemini.web.core/2.2.0.BUILD-20120829065106/org.eclipse.gemini.web.core-2.2.0.BUILD-20120829065106.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.gemini.web/org.eclipse.gemini.web.core/2.1.0.BUILD-20120525195844/org.eclipse.gemini.web.core-sources-2.1.0.BUILD-20120525195844.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.mirrored/org.eclipse.equinox.simpleconfigurator.manipulator/2.0.0.v20110808-1657/org.eclipse.equinox.simpleconfigurator.manipulator-2.0.0.v20110808-1657.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.mirrored/org.eclipse.equinox.simpleconfigurator/1.0.300.v20110815-1744/org.eclipse.equinox.simpleconfigurator-1.0.300.v20110815-1744.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.osgi/org.eclipse.equinox.simpleconfigurator/1.0.300.v20110815-1744/org.eclipse.equinox.simpleconfigurator-sources-1.0.300.v20110815-1744.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.mirrored/org.slf4j.api/1.6.4.v20120130-2120/org.slf4j.api-1.6.4.v20120130-2120.jar" sourcepath="/NANO_IVY_CACHE/org.slf4j/com.springsource.slf4j.api/1.6.1/com.springsource.slf4j.api-sources-1.6.1.jar"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.util/org.eclipse.virgo.util.osgi.manifest/3.6.0.D-20120917212716/org.eclipse.virgo.util.osgi.manifest-3.6.0.D-20120917212716.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.nano.deployer"/>
- <classpathentry kind="var" path="NANO_IVY_CACHE/org.eclipse.virgo.mirrored/org.eclipse.osgi.services/3.3.0.v20120307-2102/org.eclipse.osgi.services-3.3.0.v20120307-2102.jar" sourcepath="/NANO_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110513/org.eclipse.osgi.services-sources-3.3.0.v20110513.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.nano.core"/>
- <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.nano.deployer.api"/>
- <classpathentry kind="output" path="target/classes"/>
-</classpath>
diff --git a/org.eclipse.virgo.nano.war.deployer/.project b/org.eclipse.virgo.nano.war.deployer/.project
deleted file mode 100644
index 214c6a5..0000000
--- a/org.eclipse.virgo.nano.war.deployer/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.virgo.nano.war.deployer</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ds.core.builder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.PluginNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.virgo.nano.war.deployer/build.properties b/org.eclipse.virgo.nano.war.deployer/build.properties
deleted file mode 100644
index 10a236a..0000000
--- a/org.eclipse.virgo.nano.war.deployer/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.. = src/main/java/,\
- src/main/resources/,\
- src/test/java/,\
- src/test/resources/
-bin.includes = META-INF/,\
- OSGI-INF/
- .
diff --git a/org.eclipse.virgo.nano.war.deployer/build.xml b/org.eclipse.virgo.nano.war.deployer/build.xml
deleted file mode 100644
index 18a064a..0000000
--- a/org.eclipse.virgo.nano.war.deployer/build.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="org.eclipse.virgo.nano.war.deployer">
-
- <property name="findbugs.exclude.file" value="${basedir}/findbugs-exclude.xml"/>
- <property file="${basedir}/../build.properties"/>
- <property file="${basedir}/../build.versions"/>
- <import file="${basedir}/../virgo-build/standard/default.xml"/>
-
-</project>
diff --git a/org.eclipse.virgo.nano.war.deployer/findbugs-exclude.xml b/org.eclipse.virgo.nano.war.deployer/findbugs-exclude.xml
deleted file mode 100644
index 98983db..0000000
--- a/org.eclipse.virgo.nano.war.deployer/findbugs-exclude.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<FindBugsFilter>
- <!-- Exclusions -->
- <Match>
- <Bug pattern="ES_COMPARING_PARAMETER_STRING_WITH_EQ"/>
- <Class name="org.eclipse.virgo.nano.deployer.api.core.module.StandardModule"/>
- <Method name="unwrapNull"/>
- </Match>
-</FindBugsFilter>
diff --git a/org.eclipse.virgo.nano.war.deployer/ivy.xml b/org.eclipse.virgo.nano.war.deployer/ivy.xml
deleted file mode 100644
index 86521a5..0000000
--- a/org.eclipse.virgo.nano.war.deployer/ivy.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ivy-module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd" version="2.0">
-
- <info organisation="${project.organisation}" module="${ant.project.name}"/>
-
- <configurations>
- <include file="${virgo.build.dir}/common/default-ivy-configurations.xml"/>
- </configurations>
-
- <publications>
- <artifact name="${ant.project.name}"/>
- <artifact name="${ant.project.name}-sources" type="src" ext="jar"/>
- </publications>
-
- <dependencies>
- <dependency org="org.eclipse.virgo.mirrored" name="org.eclipse.osgi" rev="${org.eclipse.osgi}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.deployer.api" rev="latest.integration" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.nano" name="org.eclipse.virgo.nano.deployer" rev="latest.integration" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.io" rev="${org.eclipse.virgo.util}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.util" name="org.eclipse.virgo.util.osgi.manifest" rev="${org.eclipse.virgo.util}" conf="compile->runtime"/>
- <dependency org="org.eclipse.gemini" name="org.eclipse.gemini.web.core" rev="${org.eclipse.gemini.web}" conf="compile->runtime"/>
- <dependency org="org.eclipse.virgo.medic" name="org.eclipse.virgo.medic" rev="${org.eclipse.virgo.medic}" conf="compile->runtime"/>
-
- <override org="org.eclipse.virgo.util" rev="${org.eclipse.virgo.util}"/>
- <!-- Allow Equinox to be upgraded point-wise before rippling -->
- <override org="org.eclipse.virgo.mirrored" module="org.eclipse.osgi" rev="${org.eclipse.osgi}"/>
- </dependencies>
-
-</ivy-module>
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/NanoWARDeployerLogEvents.java b/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/NanoWARDeployerLogEvents.java
deleted file mode 100644
index 5913e26..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/NanoWARDeployerLogEvents.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.virgo.nano.war.deployer;
-
-import org.eclipse.virgo.nano.serviceability.LogEventDelegate;
-import org.eclipse.virgo.medic.eventlog.Level;
-import org.eclipse.virgo.medic.eventlog.LogEvent;
-
-public enum NanoWARDeployerLogEvents implements LogEvent {
-
- NANO_INSTALLING(1, Level.INFO), //
- NANO_INSTALLED(2, Level.INFO), //
- NANO_STOPPING(5, Level.INFO), //
- NANO_STOPPED(6, Level.INFO), //
- NANO_UNINSTALLING(7, Level.INFO), //
- NANO_UNINSTALLED(8, Level.INFO), //
- NANO_WEB_STARTING(9, Level.INFO), //
- NANO_WEB_STARTED(10, Level.INFO), //
- NANO_INSTALLING_ERROR(11, Level.ERROR), //
- NANO_STARTING_ERROR(12, Level.ERROR), //
- NANO_UPDATING_ERROR(13, Level.ERROR), //
- NANO_PERSIST_ERROR(14, Level.WARNING), //
- NANO_UPDATING(15, Level.INFO), //
- NANO_UPDATED(16, Level.INFO), //
- NANO_UPDATE_ERROR(17, Level.ERROR), //
- NANO_UNDEPLOY_ERROR(18, Level.ERROR); //
-
- private static final String PREFIX = "DE";
-
- private final LogEventDelegate delegate;
-
- private NanoWARDeployerLogEvents(int code, Level level) {
- this.delegate = new LogEventDelegate(PREFIX, code, level);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getEventCode() {
- return this.delegate.getEventCode();
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Level getLevel() {
- return this.delegate.getLevel();
- }
-}
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WARDeployer.java b/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WARDeployer.java
deleted file mode 100644
index 6ffe817..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WARDeployer.java
+++ /dev/null
@@ -1,719 +0,0 @@
-
-package org.eclipse.virgo.nano.war.deployer;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.jar.Attributes;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-
-import org.eclipse.gemini.web.core.InstallationOptions;
-import org.eclipse.gemini.web.core.WebBundleManifestTransformer;
-import org.eclipse.virgo.medic.eventlog.EventLogger;
-import org.eclipse.virgo.nano.core.KernelConfig;
-import org.eclipse.virgo.nano.deployer.SimpleDeployer;
-import org.eclipse.virgo.nano.deployer.StandardDeploymentIdentity;
-import org.eclipse.virgo.nano.deployer.api.core.DeploymentIdentity;
-import org.eclipse.virgo.nano.deployer.util.BundleInfosUpdater;
-import org.eclipse.virgo.util.io.FileSystemUtils;
-import org.eclipse.virgo.util.io.IOUtils;
-import org.eclipse.virgo.util.io.JarUtils;
-import org.eclipse.virgo.util.io.PathReference;
-import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
-import org.eclipse.virgo.util.osgi.manifest.BundleManifestFactory;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.service.component.ComponentContext;
-import org.osgi.service.packageadmin.PackageAdmin;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-@SuppressWarnings("deprecation")
-public class WARDeployer implements SimpleDeployer {
-
- private static final String WAR = "war";
-
- private static final boolean STATUS_OK = true;
-
- private static final boolean STATUS_ERROR = false;
-
- private static final String PICKUP_DIR = "pickup";
-
- private static final String INSTALL_BY_REFERENCE_PREFIX = "reference:file:";
-
- private static final char SLASH = '/';
-
- private static final char BACKSLASH = '\\';
-
- private static final char DOT = '.';
-
- private static final char NEW_LINE = '\n';
-
- private static final String SUCCESS_MARK = "ok";
-
- private static final String ERROR_MARK = "error";
-
- private static final String OP_DEPLOY = "deploy";
-
- private static final String OP_UNDEPLOY = "undeploy";
-
- private static final String FEEDBACK_FILE_NAME = ".state";
-
- private static final String BUNDLE_ID_RECORD = "bundle-id";
-
- static final String LAST_MODIFIED = "last-modified";
-
- private static final String DELIMITER = "=";
-
- static final String EMPTY_STRING = "";
-
- private static final String WEBAPPS_DIR = "webapps";
-
- private static final String WEBBUNDLE_PROTOCOL = "webbundle";
-
- private static final String FILE_PROTOCOL = "file";
-
- private static final String UNKNOWN = "unknown";
-
- private static final String HEADER_WEB_CONTEXT_PATH = "Web-ContextPath";
-
- // private static final String HEADER_BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName";
-
- private static final String DEFAULT_CONTEXT_PATH = "/";
-
- private static final String ROOT_WAR_NAME = "ROOT";
-
- private static final String PROPERTY_WAB_HEADERS = "WABHeaders";
-
- private static final String PROPERTY_VALUE_WAB_HEADERS_STRICT = "strict";
-
- private static final String PROPERTY_VALUE_WAB_HEADERS_DEFAULTED = "defaulted";
-
- private static final String HEADER_DEFAULT_WAB_HEADERS = "org-eclipse-gemini-web-DefaultWABHeaders";
-
- private static final String WEB_BUNDLE_MODULE_TYPE = "web-bundle";
-
- private EventLogger eventLogger;
-
- private BundleInfosUpdater bundleInfosUpdaterUtil;
-
- private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
- private BundleContext bundleContext;
-
- private PackageAdmin packageAdmin;
-
- private WebBundleManifestTransformer webBundleManifestTransformer;
-
- private long largeFileCopyTimeout = 4000;
-
- private File pickupDir;
-
- private File webAppsDir;
-
- private KernelConfig kernelConfig;
-
- public WARDeployer() {
- warDeployerInternalInit(null);
- }
-
- public WARDeployer(BundleContext bundleContext, PackageAdmin packageAdmin, WebBundleManifestTransformer webBundleManifestTransformer,
- EventLogger eventLogger, KernelConfig kernelConfig) {
- warDeployerInternalInit(bundleContext);
- this.packageAdmin = packageAdmin;
- this.webBundleManifestTransformer = webBundleManifestTransformer;
- this.eventLogger = eventLogger;
- this.kernelConfig = kernelConfig;
- }
-
- public void activate(ComponentContext context) {
- warDeployerInternalInit(context.getBundleContext());
- }
-
- @Override
- public final boolean deploy(URI path) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING, new File(path).toString());
- final String warName = extractWarNameFromString(path.toString());
- final File deployedFile = new File(path);
- final File warDir = new File(this.webAppsDir, warName);
-
- deleteStatusFile(warName, this.pickupDir);
-
- long bundleId = -1L;
- final long lastModified = deployedFile.lastModified();
-
- if (!canWrite(path)) {
- this.logger.error("Cannot open the file " + path + " for writing. The configured timeout is " + this.largeFileCopyTimeout + ".");
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING_ERROR, path);
- return STATUS_ERROR;
- }
- final Bundle installed;
- try {
- // extract the war file to the webapps directory
- JarUtils.unpackTo(new PathReference(deployedFile), new PathReference(warDir));
- // make the manifest transformation in the unpacked location
- transformUnpackedManifest(warDir, warName);
-
- // install the bundle
- installed = this.bundleContext.installBundle(createInstallLocation(warDir));
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING_ERROR, e, path);
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- return STATUS_ERROR;
- }
-
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLED, installed.getSymbolicName(), installed.getVersion());
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_WEB_STARTING, installed.getSymbolicName(), installed.getVersion());
- try {
- installed.start();
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_STARTING_ERROR, e, installed.getSymbolicName(), installed.getVersion());
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- return STATUS_ERROR;
- }
-
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_WEB_STARTED, installed.getSymbolicName(), installed.getVersion());
-
- bundleId = installed.getBundleId();
- // now update bundle's info
- if (this.logger.isInfoEnabled()) {
- this.logger.info("Bundles info will be updated for war with path '" + path + "'.");
- }
-
- try {
- if (this.bundleInfosUpdaterUtil != null && this.bundleInfosUpdaterUtil.isAvailable()) {
- registerToBundlesInfo(installed);
- }
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_PERSIST_ERROR, e, installed.getSymbolicName(), installed.getVersion());
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- return STATUS_ERROR;
- }
-
- createStatusFile(warName, OP_DEPLOY, STATUS_OK, bundleId, lastModified);
- return STATUS_OK;
- }
-
- @Override
- public boolean isDeployFileValid(File file) {
- JarFile jarFile = null;
- try {
- jarFile = new JarFile(file);
- } catch (IOException e) {
- this.logger.error("The deployed file '" + file.getAbsolutePath() + "' is an invalid zip file.");
- return false;
- } finally {
- try {
- if (jarFile != null) {
- jarFile.close();
- }
- } catch (IOException e) {
- // do nothing
- }
- }
- return true;
- }
-
- private String createInstallLocation(final File warDir) {
- return INSTALL_BY_REFERENCE_PREFIX + warDir.getAbsolutePath();
- }
-
- private String extractWarNameFromString(String path) {
- final String warName = path.substring(path.lastIndexOf(SLASH) + 1, path.length() - 4);
- return warName;
- }
-
- @Override
- public final boolean undeploy(Bundle bundle) {
- String bundleLocation = removeTrailingFileSeparator(bundle.getLocation());
- String warPath = extractWarPath(bundleLocation);
- final File warDir = new File(warPath);
- String warName = extractWarName(warPath);
-
- deleteStatusFile(warName, this.pickupDir);
-
- if (bundle != null) {
- try {
- if (this.logger.isInfoEnabled()) {
- this.logger.info("Removing bundle '" + bundle.getSymbolicName() + "' version '" + bundle.getVersion() + "' from bundles.info.");
- }
- if (this.bundleInfosUpdaterUtil != null && this.bundleInfosUpdaterUtil.isAvailable()) {
- unregisterToBundlesInfo(bundle);
- this.logger.info("Successfully removed bundle '" + bundle.getSymbolicName() + "' version '" + bundle.getVersion()
- + "' from bundles.info.");
- } else {
- this.logger.error("BundleInfosUpdater not available. Failed to remove bundle '" + bundle.getSymbolicName() + "' version '"
- + bundle.getVersion() + "' from bundles.info.");
- }
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_STOPPING, bundle.getSymbolicName(), bundle.getVersion());
- bundle.stop();
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_STOPPED, bundle.getSymbolicName(), bundle.getVersion());
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UNINSTALLING, bundle.getSymbolicName(), bundle.getVersion());
- bundle.uninstall();
- FileSystemUtils.deleteRecursively(warDir);
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UNINSTALLED, bundle.getSymbolicName(), bundle.getVersion());
- } catch (BundleException e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UNDEPLOY_ERROR, e, bundle.getSymbolicName(), bundle.getVersion());
- return STATUS_ERROR;
- }
- }
-
- createStatusFile(warName, OP_UNDEPLOY, STATUS_OK, bundle.getBundleId(), bundle.getLastModified());
- return STATUS_OK;
- }
-
- private String extractWarName(String warPath) {
- return warPath.substring(warPath.lastIndexOf(File.separatorChar) + 1, warPath.length());
- }
-
- private String extractWarPath(String bundleLocation) {
- String warPath;
- if (bundleLocation.startsWith(INSTALL_BY_REFERENCE_PREFIX)) {
- warPath = bundleLocation.substring(INSTALL_BY_REFERENCE_PREFIX.length());
- } else {
- warPath = bundleLocation;
- }
- return warPath;
- }
-
- private String removeTrailingFileSeparator(String bundleLocation) {
- if (bundleLocation.endsWith(File.separator)) {
- bundleLocation = bundleLocation.substring(0, bundleLocation.length() - 1);
- }
- return bundleLocation;
- }
-
- @Override
- public final boolean update(URI path) {
- final String warName = extractWarNameFromString(path.toString());
- final File updatedFile = new File(path);
- final File warDir = new File(this.webAppsDir, warName);
-
- if (!warDir.exists()) {
- this.logger.info("Can't update artifact for path '" + path + "'. It is not deployed.");
- }
-
- deleteStatusFile(warName, this.pickupDir);
-
- final long bundleId = -1L;
- final long lastModified = updatedFile.lastModified();
-
- if (!canWrite(path)) {
- this.logger.error("Cannot open the file [" + path + "] for writing. Timeout is [" + this.largeFileCopyTimeout + "].");
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UPDATING_ERROR, path);
- return STATUS_ERROR;
- }
-
- final Bundle bundle = this.bundleContext.getBundle(createInstallLocation(warDir));
- if (bundle != null) {
- try {
- // extract the war file to the webapps directory
- JarUtils.unpackToDestructive(new PathReference(updatedFile), new PathReference(warDir));
- // make the manifest transformation in the unpacked location
- transformUnpackedManifest(warDir, warName);
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UPDATING, bundle.getSymbolicName(), bundle.getVersion());
- bundle.update();
- if (this.packageAdmin != null) {
- this.packageAdmin.refreshPackages(new Bundle[] { bundle });
- this.logger.info("Update of file with path [" + path + "] is successful.");
- }
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UPDATED, bundle.getSymbolicName(), bundle.getVersion());
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_UPDATE_ERROR, e, bundle.getSymbolicName(), bundle.getVersion());
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundleId, lastModified);
- return STATUS_ERROR;
- }
-
- createStatusFile(warName, OP_DEPLOY, STATUS_OK, bundleId, lastModified);
- } else {
- deploy(path);
- }
- return STATUS_OK;
- }
-
- public void setLargeFileCopyTimeout(long timeout) {
- if (this.logger.isInfoEnabled()) {
- this.logger.info("setLargeFileCopyTimeout(" + timeout + ")");
- }
- this.largeFileCopyTimeout = timeout;
- }
-
- private void createStatusFile(String warName, String operation, boolean status, long bundleId, long lastModified) {
- final File stateDir = new File(this.pickupDir, FEEDBACK_FILE_NAME);
- if (!stateDir.exists() && !stateDir.mkdirs()) {
- this.logger.error("Cannot create directory [" + stateDir.getAbsolutePath() + "]. Status file for the operation cannot be created.");
- return;
- }
- final File statusFile = new File(stateDir, warName + DOT + operation + DOT + (status ? SUCCESS_MARK : ERROR_MARK));
- FileWriter fw = null;
- try {
- fw = new FileWriter(statusFile, true);
- fw.write(BUNDLE_ID_RECORD + DELIMITER + bundleId);
- fw.write(NEW_LINE);
- fw.write(LAST_MODIFIED + DELIMITER + lastModified);
- fw.write(NEW_LINE);
- fw.flush();
- } catch (IOException e) {
- this.logger.error("Cannot update the status of operation.", e);
- } finally {
- IOUtils.closeQuietly(fw);
- }
- }
-
- private void deleteStatusFile(String warName, File pickupDir) {
- final File stateDir = new File(pickupDir, FEEDBACK_FILE_NAME);
- if (stateDir.exists()) {
- File statusFile = new File(stateDir, warName + DOT + OP_DEPLOY + DOT + SUCCESS_MARK);
- if (statusFile.exists() && !statusFile.delete()) {
- this.logger.error("Cannot delete file [" + statusFile.getAbsolutePath() + "].");
- }
- statusFile = new File(stateDir, warName + DOT + OP_DEPLOY + DOT + ERROR_MARK);
- if (statusFile.exists() && !statusFile.delete()) {
- this.logger.error("Cannot delete file [" + statusFile.getAbsolutePath() + "].");
- }
- statusFile = new File(stateDir, warName + DOT + OP_UNDEPLOY + DOT + SUCCESS_MARK);
- if (statusFile.exists() && !statusFile.delete()) {
- this.logger.error("Cannot delete file [" + statusFile.getAbsolutePath() + "].");
- }
- statusFile = new File(stateDir, warName + DOT + OP_UNDEPLOY + DOT + ERROR_MARK);
- if (statusFile.exists() && !statusFile.delete()) {
- this.logger.error("Cannot delete file [" + statusFile.getAbsolutePath() + "].");
- }
- }
- }
-
- private boolean canWrite(URI path) {
- int tries = -1;
- boolean isWritable = false;
- // Some big files are copied very slowly, but the event is received
- // immediately.
- // So we will wait 0.5 x 240 i.e. 2 minutes
- final long timeout = this.largeFileCopyTimeout / 500;
- while (tries < timeout) {
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(new File(path));
- isWritable = true;
- break;
- } catch (FileNotFoundException e) {
- if (this.logger.isInfoEnabled()) {
- this.logger.info("File is still locked.", e);
- }
- } finally {
- IOUtils.closeQuietly(fis);
- }
- try {
- Thread.sleep(500);
- } catch (InterruptedException e) {
- this.logger.error("InterruptedException occurred.", e);
- }
- tries++;
- }
- return isWritable;
- }
-
- private final void transformUnpackedManifest(File srcFile, String warName) throws IOException {
- if (srcFile == null) {
- throw new NullPointerException("Source file is null.");
- }
- if (!srcFile.isDirectory() || !srcFile.canRead()) {
- throw new IllegalArgumentException("Source file must be a readable directory [" + srcFile + "].");
- }
- File destFile = new File(srcFile, JarFile.MANIFEST_NAME);
- if (!destFile.exists()) {
- destFile.getParentFile().mkdirs();
- destFile.createNewFile();
- }
- if (!destFile.isFile() || !destFile.canRead()) {
- throw new IllegalArgumentException("Destination file must be a readable file [" + destFile + "].");
- }
-
- FileOutputStream fos = null;
- InputStream mfIS = null;
- try {
- mfIS = new FileInputStream(srcFile + File.separator + JarFile.MANIFEST_NAME);
- BundleManifest manifest = BundleManifestFactory.createBundleManifest(new InputStreamReader(mfIS));
- if (manifest.getModuleType() == null || "web".equalsIgnoreCase(manifest.getModuleType())) {
- boolean strictWABHeaders = getStrictWABHeadersValue();
- if (!strictWABHeaders) {
- manifest.setHeader(HEADER_DEFAULT_WAB_HEADERS, "true");
- }
- manifest.setModuleType(WEB_BUNDLE_MODULE_TYPE);
- InstallationOptions installationOptions = prepareInstallationOptions(strictWABHeaders, warName, manifest);
- boolean isWebBundle = WebBundleUtils.isWebApplicationBundle(manifest);
- this.webBundleManifestTransformer.transform(manifest, srcFile.toURI().toURL(), installationOptions, isWebBundle);
- } else {
- this.logger.info("Skipping transformation of application '" + warName + "' because it is already a web bundle.");
- return;
- }
- fos = new FileOutputStream(destFile);
- toManifest(manifest.toDictionary()).write(fos);
- } finally {
- IOUtils.closeQuietly(fos);
- IOUtils.closeQuietly(mfIS);
- }
- }
-
- private InstallationOptions prepareInstallationOptions(boolean strictWABHeaders, String warName, BundleManifest manifest) {
- Map<String, String> map = new HashMap<String, String>();
- String webContextPathHeader = manifest.getHeader(HEADER_WEB_CONTEXT_PATH);
- if (webContextPathHeader == null || webContextPathHeader.trim().length() == 0) {
- if (warName.equals(ROOT_WAR_NAME)) {
- map.put(HEADER_WEB_CONTEXT_PATH, DEFAULT_CONTEXT_PATH);
- } else {
- map.put(HEADER_WEB_CONTEXT_PATH, warName);
- }
- }
-
- InstallationOptions installationOptions = new InstallationOptions(map);
- installationOptions.setDefaultWABHeaders(!strictWABHeaders);
-
- return installationOptions;
- }
-
- private final Manifest toManifest(Dictionary<String, String> headers) {
- Manifest manifest = new Manifest();
- Attributes attributes = manifest.getMainAttributes();
- Enumeration<String> names = headers.keys();
-
- while (names.hasMoreElements()) {
- String name = names.nextElement();
- String value = headers.get(name);
-
- attributes.putValue(name, value);
- }
- return manifest;
- }
-
- private final void registerToBundlesInfo(Bundle bundle) throws URISyntaxException, IOException, BundleException {
- String location = bundle.getLocation().replace(BACKSLASH, SLASH);
- if (!location.contains(WEBBUNDLE_PROTOCOL)) {
- location = location.replaceAll(" ", "%20");
- String scheme = new URI(location).getScheme();
- if (scheme != null && !scheme.equals(FILE_PROTOCOL)) {
- location = new URI(location).getRawSchemeSpecificPart();
- }
- String symbolicName = bundle.getSymbolicName();
- this.bundleInfosUpdaterUtil.addBundleToBundlesInfo(symbolicName == null ? UNKNOWN : symbolicName, new URI(location),
- bundle.getVersion().toString(), SimpleDeployer.HOT_DEPLOYED_ARTIFACTS_START_LEVEL, true);
- this.bundleInfosUpdaterUtil.updateBundleInfosRepository();
- }
- }
-
- private final void unregisterToBundlesInfo(Bundle bundle) {
- try {
- String location = bundle.getLocation().replace(BACKSLASH, SLASH);
- if (!location.contains(WEBBUNDLE_PROTOCOL)) {
- location = location.replaceAll(" ", "%20");
- String scheme = new URI(location).getScheme();
- if (scheme != null && !scheme.equals(FILE_PROTOCOL)) {
- location = new URI(location).getRawSchemeSpecificPart();
- }
- String symbolicName = bundle.getSymbolicName();
- this.bundleInfosUpdaterUtil.removeBundleFromBundlesInfo(symbolicName == null ? UNKNOWN : symbolicName, new URI(location),
- bundle.getVersion().toString(), SimpleDeployer.HOT_DEPLOYED_ARTIFACTS_START_LEVEL, true);
- this.bundleInfosUpdaterUtil.updateBundleInfosRepository();
- }
- } catch (Exception e) {
- this.logger.error("Cannot update bundles info while unregistering [" + bundle.getSymbolicName() + "].", e);
- }
- }
-
- @Override
- public boolean canServeFileType(String fileType) {
- return fileType.toLowerCase().equals(WAR);
- }
-
- @Override
- public boolean isDeployed(URI path) {
- final String warName = extractWarNameFromString(path.toString());
- final File warDir = new File(this.webAppsDir, warName);
- if (!warDir.exists()) {
- return false;
- }
- if (this.bundleContext.getBundle(createInstallLocation(warDir)) == null) {
- return false;
- }
- return true;
- }
-
- @Override
- public DeploymentIdentity getDeploymentIdentity(URI path) {
- final String warName = extractWarNameFromString(path.toString());
- final File warDir = new File(this.webAppsDir, warName);
- if (!warDir.exists()) {
- return null;
- }
- Bundle bundle = this.bundleContext.getBundle(createInstallLocation(warDir));
- if (bundle == null) {
- return null;
- }
- return new StandardDeploymentIdentity(WAR, bundle.getSymbolicName(), bundle.getVersion().toString());
- }
-
- @Override
- public List<String> getAcceptedFileTypes() {
- List<String> types = new ArrayList<String>();
- types.add(WAR);
- return types;
- }
-
- private void warDeployerInternalInit(BundleContext bundleContext) {
- String kernelHome = System.getProperty("org.eclipse.virgo.kernel.home");
- File kernelHomeFile = new File(kernelHome);
- File bundlesInfoFile = new File(kernelHomeFile, "configuration/org.eclipse.equinox.simpleconfigurator/bundles.info");
- this.pickupDir = new File(kernelHomeFile, PICKUP_DIR);
- this.webAppsDir = new File(kernelHomeFile, WEBAPPS_DIR);
- this.bundleContext = bundleContext;
- this.bundleInfosUpdaterUtil = new BundleInfosUpdater(bundlesInfoFile, kernelHomeFile);
- }
-
- private boolean getStrictWABHeadersValue() {
- boolean strictWABHeaders = true;
- String wabHeadersPropertyValue = null;
- if (this.kernelConfig.getProperty(PROPERTY_WAB_HEADERS) != null) {
- wabHeadersPropertyValue = this.kernelConfig.getProperty(PROPERTY_WAB_HEADERS).toString();
- }
- if (wabHeadersPropertyValue != null) {
- if (PROPERTY_VALUE_WAB_HEADERS_DEFAULTED.equals(wabHeadersPropertyValue)) {
- strictWABHeaders = false;
- this.logger.info("Property '%s' has value [defaulted]", new String[] { PROPERTY_WAB_HEADERS });
- } else if (!PROPERTY_VALUE_WAB_HEADERS_STRICT.equals(wabHeadersPropertyValue)) {
- this.logger.error("Property '%s' has invalid value '%s'", new String[] { PROPERTY_WAB_HEADERS, wabHeadersPropertyValue });
- }
- }
-
- return strictWABHeaders;
- }
-
- public void bindWebBundleManifestTransformer(WebBundleManifestTransformer transformer) {
- this.webBundleManifestTransformer = transformer;
- }
-
- public void unbindWebBundleManifestTransformer(WebBundleManifestTransformer transformer) {
- this.webBundleManifestTransformer = null;
- }
-
- public void bindEventLogger(EventLogger logger) {
- this.eventLogger = logger;
- }
-
- public void unbindEventLogger(EventLogger logger) {
- this.eventLogger = null;
- }
-
- public void bindPackageAdmin(PackageAdmin packageAdmin) {
- this.packageAdmin = packageAdmin;
- }
-
- public void unbindPackageAdmin(PackageAdmin packageAdmin) {
- this.packageAdmin = null;
- }
-
- public void bindKernelConfig(KernelConfig kernelConfig) {
- this.kernelConfig = kernelConfig;
- }
-
- public void unbindKernelConfig(KernelConfig kernelConfig) {
- this.kernelConfig = null;
- }
-
- @Override
- public boolean install(URI uri) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING, new File(uri).toString());
- final String warName = extractWarNameFromString(uri.toString());
- final File deployedFile = new File(uri);
- final File warDir = new File(this.webAppsDir, warName);
- deleteStatusFile(warName, this.pickupDir);
- final long lastModified = deployedFile.lastModified();
-
- if (!canWrite(uri)) {
- this.logger.error("Cannot open the file " + uri + " for writing. The configured timeout is " + this.largeFileCopyTimeout + ".");
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, -1L, lastModified);
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING_ERROR, uri);
- return false;
- }
- final Bundle installed;
- try {
- // extract the war file to the webapps directory
- JarUtils.unpackTo(new PathReference(deployedFile), new PathReference(warDir));
- // make the manifest transformation in the unpacked location
- transformUnpackedManifest(warDir, warName);
- // install the bundle
- installed = this.bundleContext.installBundle(createInstallLocation(warDir));
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLED, installed.getSymbolicName(), installed.getVersion());
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_INSTALLING_ERROR, e, uri);
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, -1L, lastModified);
- return false;
- }
- return true;
- }
-
- @Override
- public boolean start(URI uri) {
- Bundle bundle = getInstalledBundle(uri);
- final String warName = extractWarNameFromString(uri.toString());
- deleteStatusFile(warName, this.pickupDir);
- final long lastModified = new File(uri).lastModified();
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_WEB_STARTING, bundle.getSymbolicName(), bundle.getVersion());
- try {
- bundle.start();
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_STARTING_ERROR, e, bundle.getSymbolicName(), bundle.getVersion());
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundle.getBundleId(), lastModified);
- return STATUS_ERROR;
- }
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_WEB_STARTED, bundle.getSymbolicName(), bundle.getVersion());
-
- // now update bundle's info
- if (!updateBundlesInfo(bundle)) {
- createStatusFile(warName, OP_DEPLOY, STATUS_ERROR, bundle.getBundleId(), lastModified);
- return STATUS_ERROR;
- }
- createStatusFile(warName, OP_DEPLOY, STATUS_OK, bundle.getBundleId(), lastModified);
- return STATUS_OK;
- }
-
- private boolean updateBundlesInfo(Bundle bundle) {
- if (this.logger.isInfoEnabled()) {
- this.logger.info("Bundles info will be updated for web app bundle with simbolic name '" + bundle.getSymbolicName() + "' .");
- }
- try {
- if (this.bundleInfosUpdaterUtil != null && this.bundleInfosUpdaterUtil.isAvailable()) {
- registerToBundlesInfo(bundle);
- }
- } catch (Exception e) {
- this.eventLogger.log(NanoWARDeployerLogEvents.NANO_PERSIST_ERROR, e, bundle.getSymbolicName(), bundle.getVersion());
- return STATUS_ERROR;
- }
- return STATUS_OK;
- }
-
- private Bundle getInstalledBundle(URI path) {
- final String warName = extractWarNameFromString(path.toString());
- final File warDir = new File(this.webAppsDir, warName);
- if (!warDir.exists()) {
- return null;
- }
- return this.bundleContext.getBundle(createInstallLocation(warDir));
- }
-
-}
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WebBundleUtils.java b/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WebBundleUtils.java
deleted file mode 100644
index 6ce7a45..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/java/org/eclipse/virgo/nano/war/deployer/WebBundleUtils.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.virgo.nano.war.deployer;
-
-import org.eclipse.gemini.web.internal.WebContainerUtils;
-import org.eclipse.virgo.util.osgi.manifest.BundleManifest;
-import org.osgi.framework.Constants;
-
-public class WebBundleUtils {
-
- /**
- * Determines whether the given manifest represents a web application bundle. According to the R4.2 Enterprise
- * Specification, this is true if and only if the manifest contains any of the headers in Table 128.3:
- * Bundle-SymbolicName, Bundle-Version, Bundle-ManifestVersion, Import-Package, Web-ContextPath. Note: there is no
- * need to validate the manifest as if it is invalid it will cause an error later.
- *
- * @param manifest the bundle manifest
- * @return <code>true</code> if and only if the given manifest represents a web application bundle
- */
- public static boolean isWebApplicationBundle(BundleManifest manifest) {
- return specifiesBundleSymbolicName(manifest) || specifiesBundleVersion(manifest) || specifiesBundleManifestVersion(manifest)
- || specifiesImportPackage(manifest) || specifiesWebContextPath(manifest);
- }
-
- private static boolean specifiesBundleSymbolicName(BundleManifest manifest) {
- return manifest.getBundleSymbolicName().getSymbolicName() != null;
- }
-
- private static boolean specifiesBundleVersion(BundleManifest manifest) {
- return manifest.getHeader(Constants.BUNDLE_VERSION) != null;
- }
-
- private static boolean specifiesBundleManifestVersion(BundleManifest manifest) {
- return manifest.getBundleManifestVersion() != 1;
- }
-
- private static boolean specifiesImportPackage(BundleManifest manifest) {
- return !manifest.getImportPackage().getImportedPackages().isEmpty();
- }
-
- private static boolean specifiesWebContextPath(BundleManifest manifest) {
- return manifest.getHeader(WebContainerUtils.HEADER_WEB_CONTEXT_PATH) != null;
- }
-}
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/resources/EventLogMessages.properties b/org.eclipse.virgo.nano.war.deployer/src/main/resources/EventLogMessages.properties
deleted file mode 100644
index c7f4f47..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/resources/EventLogMessages.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-#Nano war deployer
-DE0001I = Installing from '{}'.
-DE0002I = Installed web bundle '{}' version '{}'.
-DE0005I = Stopping web bundle '{}' version '{}'.
-DE0006I = Stopped web bundle '{}' version '{}'.
-DE0007I = Uninstalling web bundle '{}' version '{}'.
-DE0008I = Uninstalled web bundle '{}' version '{}'.
-DE0009I = Starting web bundle '{}' version '{}'.
-DE0010I = Started web bundle '{}' version '{}'.
-DE0011E = Failed to install file with path '{}'. See the logs for more information.
-DE0012E = Failed to start web bundle '{}' version '{}'. See the logs for more information.
-DE0013E = Failed to update file with path '{}'. See the logs for more information.
-DE0014W = Failed to persist web bundle '{}' version '{}' in bundles.info. The bundle is available but will be removed after the next restart. Check the logs for more information.
-DE0015I = Updating web bundle '{}' version '{}'.
-DE0016I = Updated web bundle '{}' version '{}'.
-DE0017E = Failed to update web bundle '{}' version '{}'. See the logs for more information.
-DE0018E = Failed to undeploy web bundle '{}' version '{}'. See the logs for more information.
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/resources/OSGI-INF/virgo.nano.war.deployer.component.xml b/org.eclipse.virgo.nano.war.deployer/src/main/resources/OSGI-INF/virgo.nano.war.deployer.component.xml
deleted file mode 100644
index 5f76f9b..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/resources/OSGI-INF/virgo.nano.war.deployer.component.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<component name="virgo.nano.war.deployer.component" immediate="true" xmlns:src="http://www.osgi.org/xmlns/src/v1.1.0">
- <implementation class="org.eclipse.virgo.nano.war.deployer.WARDeployer"/>
-
- <reference name="EventLogger"
- interface="org.eclipse.virgo.medic.eventlog.EventLogger"
- policy="static"
- cardinality="1..1"
- bind="bindEventLogger"
- unbind="unbindEventLogger"/>
-
- <reference name="PackageAdmin"
- interface="org.osgi.service.packageadmin.PackageAdmin"
- policy="static"
- cardinality="1..1"
- bind="bindPackageAdmin"
- unbind="unbindPackageAdmin"/>
-
- <reference name="WBMT"
- interface="org.eclipse.gemini.web.core.WebBundleManifestTransformer"
- policy="static"
- cardinality="1..1"
- bind="bindWebBundleManifestTransformer"
- unbind="unbindWebBundleManifestTransformer"/>
-
- <reference name="KernelConfig"
- interface="org.eclipse.virgo.nano.core.KernelConfig"
- policy="static"
- cardinality="1..1"
- bind="bindKernelConfig"
- unbind="unbindKernelConfig"/>
-
- <service>
- <provide interface="org.eclipse.virgo.nano.deployer.SimpleDeployer"/>
- </service>
-
-</component>
diff --git a/org.eclipse.virgo.nano.war.deployer/src/main/resources/about.html b/org.eclipse.virgo.nano.war.deployer/src/main/resources/about.html
deleted file mode 100644
index c258ef5..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/main/resources/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.virgo.nano.war.deployer/src/test/java/.gitignore b/org.eclipse.virgo.nano.war.deployer/src/test/java/.gitignore
deleted file mode 100644
index e69de29..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/test/java/.gitignore
+++ /dev/null
diff --git a/org.eclipse.virgo.nano.war.deployer/src/test/resources/test/dummy.txt b/org.eclipse.virgo.nano.war.deployer/src/test/resources/test/dummy.txt
deleted file mode 100644
index 9f26b63..0000000
--- a/org.eclipse.virgo.nano.war.deployer/src/test/resources/test/dummy.txt
+++ /dev/null
@@ -1 +0,0 @@
-Foo
\ No newline at end of file
diff --git a/org.eclipse.virgo.nano.war.deployer/template.mf b/org.eclipse.virgo.nano.war.deployer/template.mf
deleted file mode 100644
index a134b7d..0000000
--- a/org.eclipse.virgo.nano.war.deployer/template.mf
+++ /dev/null
@@ -1,17 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Virgo Nano WAR Deployer
-Bundle-SymbolicName: org.eclipse.virgo.nano.war.deployer
-Bundle-Version: ${version}
-Service-Component: OSGI-INF/virgo.nano.war.deployer.component.xml
-Import-Template:
- org.eclipse.virgo.nano.*;version="${version:[=.=.=, =.+1)}",
- org.eclipse.virgo.util.*;version="${org.eclipse.virgo.util:[=.=.=, =.+1)}",
- org.eclipse.virgo.medic.*;version="${org.eclipse.virgo.medic:[=.=.=, =.+1)}",
- org.eclipse.gemini.web.core;version="0",
- org.osgi.framework.*;version="0",
- org.osgi.service.component;version="0",
- org.osgi.service.packageadmin;version="0",
- org.slf4j;version="0"
-Excluded-Exports:
- *