Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-08-17 16:43:22 +0000
committerChristopher Frost2012-08-17 16:43:22 +0000
commit6f76e47b2a8693fddf1b7ddfed8ec3152aa311dc (patch)
treed4b8d37ca65808faa9416ecf968b4a866e8b9edd
parent31da1f987715dd0918754c741b3a5d817d39d3e8 (diff)
parentf03a3e6d21e342ecbec4a25b21c2515cb109f0ea (diff)
downloadorg.eclipse.virgo.kernel-6f76e47b2a8693fddf1b7ddfed8ec3152aa311dc.tar.gz
org.eclipse.virgo.kernel-6f76e47b2a8693fddf1b7ddfed8ec3152aa311dc.tar.xz
org.eclipse.virgo.kernel-6f76e47b2a8693fddf1b7ddfed8ec3152aa311dc.zip
Merge branch 'master' of ssh://git.eclipse.org/gitroot/virgo/org.eclipse.virgo.kernel
-rw-r--r--org.eclipse.virgo.kernel.deployer/.classpath2
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java12
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactGraphInclosure.java9
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java37
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStore.java3
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifact.java5
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactGraphInclosure.java8
-rw-r--r--org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java11
8 files changed, 49 insertions, 38 deletions
diff --git a/org.eclipse.virgo.kernel.deployer/.classpath b/org.eclipse.virgo.kernel.deployer/.classpath
index 3912c9a4..3c80b7f9 100644
--- a/org.eclipse.virgo.kernel.deployer/.classpath
+++ b/org.eclipse.virgo.kernel.deployer/.classpath
@@ -51,7 +51,7 @@
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.services"/>
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.virgo.kernel.artifact"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.mirrored/org.eclipse.equinox.event/1.2.100.v20111010-1614/org.eclipse.equinox.event-1.2.100.v20111010-1614.jar"/>
- <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/3.6.0.D-20120813142056/org.eclipse.virgo.nano.deployer.api-3.6.0.D-20120813142056.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/3.5.0.D-20120615071853/org.eclipse.virgo.nano.deployer.api-sources-3.5.0.D-20120615071853.jar"/>
+ <classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/3.6.0.D-20120813142056/org.eclipse.virgo.nano.deployer.api-3.6.0.D-20120813142056.jar" sourcepath="/KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.api/3.6.0.D-20120813142056/org.eclipse.virgo.nano.deployer.api-sources-3.6.0.D-20120813142056.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.deployer.hot/3.6.0.D-20120813142056/org.eclipse.virgo.nano.deployer.hot-3.6.0.D-20120813142056.jar"/>
<classpathentry kind="var" path="KERNEL_IVY_CACHE/org.eclipse.virgo.nano/org.eclipse.virgo.nano.core/3.6.0.D-20120813142056/org.eclipse.virgo.nano.core-3.6.0.D-20120813142056.jar"/>
<classpathentry kind="var" path="KERNEL_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="/KERNEL_IVY_CACHE/org.eclipse.osgi/org.eclipse.osgi.services/3.3.0.v20110513/org.eclipse.osgi.services-sources-3.3.0.v20110513.jar"/>
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
index 261ff930..0e9b2f69 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/deployer/core/internal/PipelinedApplicationDeployer.java
@@ -147,7 +147,7 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
InstallArtifact existingArtifact = this.ram.get(normalisedUri);
if (existingArtifact != null) {
- DeploymentIdentity refreshedIdentity = updateAndRefreshExistingArtifact(normalisedUri, existingArtifact);
+ DeploymentIdentity refreshedIdentity = refreshExistingArtifact(normalisedUri, existingArtifact);
if (refreshedIdentity != null) {
return refreshedIdentity;
}
@@ -223,12 +223,12 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
this.ram.delete(deploymentIdentity);
}
- private DeploymentIdentity updateAndRefreshExistingArtifact(URI normalisedLocation, InstallArtifact existingArtifact) throws DeploymentException {
+ private DeploymentIdentity refreshExistingArtifact(URI normalisedLocation, InstallArtifact existingArtifact) throws DeploymentException {
String oldType = existingArtifact.getType();
String oldName = existingArtifact.getName();
Version oldVersion = existingArtifact.getVersion();
- DeploymentIdentity deploymentIdentity = updateAndRefresh(normalisedLocation, existingArtifact);
+ DeploymentIdentity deploymentIdentity = refreshArtifact(normalisedLocation, existingArtifact);
if (deploymentIdentity != null) {
return deploymentIdentity;
}
@@ -268,10 +268,8 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
return deploymentIdentity;
}
- private DeploymentIdentity updateAndRefresh(URI location, InstallArtifact installArtifact) throws DeploymentException {
+ private DeploymentIdentity refreshArtifact(URI location, InstallArtifact installArtifact) throws DeploymentException {
DeploymentIdentity deploymentIdentity = null;
- this.installArtifactGraphInclosure.updateStagingArea(new File(location),
- new ArtifactIdentity(installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), installArtifact.getScopeName()));
if (installArtifact.refresh()) {
this.deploymentListener.refreshed(location);
@@ -456,8 +454,6 @@ final class PipelinedApplicationDeployer implements ApplicationDeployer, Applica
DeploymentIdentity originalDeploymentIdentity = getDeploymentIdentity(installArtifact);
deploymentIdentity = originalDeploymentIdentity;
try {
- this.installArtifactGraphInclosure.updateStagingArea(new File(normalisedLocation), new ArtifactIdentity(
- installArtifact.getType(), installArtifact.getName(), installArtifact.getVersion(), installArtifact.getScopeName()));
// Attempt to refresh the artifact and escalate to redeploy if this fails.
if (refreshInternal(symbolicName, installArtifact)) {
this.deploymentListener.refreshed(normalisedLocation);
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactGraphInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactGraphInclosure.java
index 5365e68f..ae5a63d0 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactGraphInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/InstallArtifactGraphInclosure.java
@@ -57,13 +57,4 @@ public interface InstallArtifactGraphInclosure {
*/
GraphNode<InstallArtifact> recoverInstallGraph(ArtifactIdentity identity, File location);
- /**
- * Update the copy of the given artefact in the deploy area.
- *
- * @param sourceLocation the location of the artefact to be updated
- * @param identity the identity of the artifact to be updated
- * @throws DeploymentException
- */
- void updateStagingArea(File sourceLocation, ArtifactIdentity identity) throws DeploymentException;
-
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
index e45cd615..fea83e22 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/AbstractInstallArtifact.java
@@ -588,6 +588,10 @@ public abstract class AbstractInstallArtifact implements GraphAssociableInstallA
private void failRefresh(Exception ex) {
this.artifactStorage.rollBack();
+ issueFailedRefreshMessage(ex);
+ }
+
+ public void issueFailedRefreshMessage(Exception ex) {
if (ex == null) {
this.eventLogger.log(DeployerLogEvents.REFRESH_FAILED, getType(), getName(), getVersion());
} else {
@@ -595,7 +599,38 @@ public abstract class AbstractInstallArtifact implements GraphAssociableInstallA
}
}
- protected abstract boolean doRefresh() throws DeploymentException;
+ protected boolean doRefresh() throws DeploymentException {
+ return false;
+ }
+
+ public boolean refresh(String symbolicName) throws DeploymentException {
+ try {
+ this.isRefreshing = true;
+ this.eventLogger.log(DeployerLogEvents.REFRESHING, getType(), getName(), getVersion());
+
+ boolean refreshed = doRefresh(symbolicName);
+
+ if (refreshed) {
+ this.eventLogger.log(DeployerLogEvents.REFRESHED, getType(), getName(), getVersion());
+ } else {
+ issueFailedRefreshMessage(null);
+ }
+
+ return refreshed;
+ } catch (DeploymentException de) {
+ issueFailedRefreshMessage(de);
+ throw de;
+ } catch (RuntimeException re) {
+ issueFailedRefreshMessage(re);
+ throw re;
+ } finally {
+ this.isRefreshing = false;
+ }
+ }
+
+ protected boolean doRefresh(String symbolicName) throws DeploymentException {
+ return false;
+ }
/**
* {@inheritDoc}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStore.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStore.java
index 711f6c0e..954a1939 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStore.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ArtifactStore.java
@@ -22,6 +22,9 @@ import org.eclipse.virgo.util.io.PathReference;
* An implementation of this interface may expose a single current path and save the artifact by moving it, it may
* create a series of paths without moving the artifact, or it may use another approach.
* <p />
+ * Note that instances of this interface may be stateful, so only a single instance should be used to manage the
+ * disk storage for a particular artifact.
+ * <p />
* <strong>Concurrent Semantics</strong><br />
* Implementations of this interface need not be thread safe.
*/
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifact.java
index 8c5924a4..ff521eb7 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/ParPlanInstallArtifact.java
@@ -212,6 +212,11 @@ final class ParPlanInstallArtifact extends StandardPlanInstallArtifact {
*/
@Override
public boolean refresh(String symbolicName) throws DeploymentException {
+ return super.refresh(symbolicName);
+ }
+
+ @Override
+ protected boolean doRefresh(String symbolicName) throws DeploymentException {
InstallArtifact childToRefresh = findChild(symbolicName);
if (childToRefresh == null) {
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactGraphInclosure.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactGraphInclosure.java
index e804aee5..9ceed442 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactGraphInclosure.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardInstallArtifactGraphInclosure.java
@@ -129,12 +129,4 @@ public final class StandardInstallArtifactGraphInclosure implements InstallArtif
}
}
- /**
- * {@inheritDoc}
- */
- @Override
- public void updateStagingArea(File sourceFile, ArtifactIdentity identity) throws DeploymentException {
- this.artifactStorageFactory.create(sourceFile, identity).synchronize();
- }
-
}
diff --git a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
index d8b52a1e..c6f97501 100644
--- a/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
+++ b/org.eclipse.virgo.kernel.deployer/src/main/java/org/eclipse/virgo/kernel/install/artifact/internal/StandardPlanInstallArtifact.java
@@ -208,17 +208,6 @@ public class StandardPlanInstallArtifact extends AbstractInstallArtifact impleme
/**
* {@inheritDoc}
*/
- public boolean refresh(String symbolicName) throws DeploymentException {
- return false;
- }
-
- protected boolean doRefresh() {
- return false;
- }
-
- /**
- * {@inheritDoc}
- */
public boolean refreshScope() {
return this.refreshHandler.refresh(this);
}

Back to the top