You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:43:04 UTC
[sling-org-apache-sling-installer-factory-subsystems] 07/10: Start
subsystem, once installed and handle snapshot updates
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.installer.factory.subsystems-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-factory-subsystems.git
commit 40daebcbefbecde2fa09db0412d8d72e5856e757
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Oct 10 13:19:21 2014 +0000
Start subsystem, once installed and handle snapshot updates
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/installer/factories/subsystems@1630891 13f79535-47bb-0310-9956-ffa450edef68
---
.../factories/subsystems/impl/InstallSubsystemTask.java | 3 ++-
.../factories/subsystems/impl/SubsystemInstaller.java | 13 ++++++++++++-
.../factories/subsystems/impl/UpdateSubsystemTask.java | 1 +
3 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java
index 3f1e10f..230272c 100644
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java
+++ b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/InstallSubsystemTask.java
@@ -45,7 +45,8 @@ public class InstallSubsystemTask extends InstallTask {
ctx.log("Installing new subsystem from {}", tr);
try {
- this.rootSubsystem.install(tr.getURL(), tr.getInputStream());
+ final Subsystem sub = this.rootSubsystem.install(tr.getURL(), tr.getInputStream());
+ sub.start();
ctx.addTaskToCurrentCycle(new ChangeStateTask(this.getResourceGroup(), ResourceState.INSTALLED));
} catch (final IOException e) {
ctx.log("Unable to install subsystem {} : {}", tr, e);
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
index ea47728..3b29961 100644
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
+++ b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/SubsystemInstaller.java
@@ -186,8 +186,10 @@ public class SubsystemInstaller
if (compare < 0) {
// installed version is lower -> update
result = new UpdateSubsystemTask(toActivate, this.bundleContext, ref, this.rootSubsystem);
+ } else if ( compare == 0 && isSnapshot(newVersion) ) {
+ // same version but snapshot -> update
+ result = new UpdateSubsystemTask(toActivate, this.bundleContext, ref, this.rootSubsystem);
} else {
- // TODO - support SNAPSHOT?
logger.debug("{} is not installed, subsystem with same or higher version is already installed: {}", info, newVersion);
result = new ChangeStateTask(toActivate, ResourceState.IGNORED);
}
@@ -303,4 +305,13 @@ public class SubsystemInstaller
}
return null;
}
+
+ private static final String MAVEN_SNAPSHOT_MARKER = "SNAPSHOT";
+
+ /**
+ * Check if the version is a snapshot version
+ */
+ public static boolean isSnapshot(final Version v) {
+ return v.toString().indexOf(MAVEN_SNAPSHOT_MARKER) >= 0;
+ }
}
diff --git a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java
index 3da254b..cb6939c 100644
--- a/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java
+++ b/src/main/java/org/apache/sling/installer/factories/subsystems/impl/UpdateSubsystemTask.java
@@ -57,6 +57,7 @@ public class UpdateSubsystemTask extends InstallTask {
try {
subsystem = this.bundleContext.getService(this.subsystemReference);
if ( subsystem != null ) {
+ subsystem.stop();
subsystem.uninstall();
ctx.addTaskToCurrentCycle(new InstallSubsystemTask(this.getResourceGroup(), this.rootSubsystem));
} else {
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.