You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by cz...@apache.org on 2020/03/07 14:24:11 UTC
[sling-org-apache-sling-installer-core] branch master updated:
@releng Move serializer impl into separate package
This is an automated email from the ASF dual-hosted git repository.
cziegeler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-installer-core.git
The following commit(s) were added to refs/heads/master by this push:
new 06e1670 @releng Move serializer impl into separate package
06e1670 is described below
commit 06e1670a16ab8b3db3e51aaeca75302af6381aad
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Sat Mar 7 15:23:48 2020 +0100
@releng Move serializer impl into separate package
---
.../serializer/ConfigurationSerializerFactory.java | 6 +-
.../installer/core/impl/OsgiInstallerImpl.java | 10 ++-
.../ConfigConfigurationSerializer.java | 2 +-
.../JsonConfigurationSerializer.java | 2 +-
.../PropertiesConfigurationSerializer.java | 2 +-
.../core/impl/tasks/BundleTaskCreator.java | 82 ++++++++++++----------
6 files changed, 53 insertions(+), 51 deletions(-)
diff --git a/src/main/java/org/apache/sling/installer/api/serializer/ConfigurationSerializerFactory.java b/src/main/java/org/apache/sling/installer/api/serializer/ConfigurationSerializerFactory.java
index 4efe552..48b59f3 100644
--- a/src/main/java/org/apache/sling/installer/api/serializer/ConfigurationSerializerFactory.java
+++ b/src/main/java/org/apache/sling/installer/api/serializer/ConfigurationSerializerFactory.java
@@ -18,9 +18,9 @@
*/
package org.apache.sling.installer.api.serializer;
-import org.apache.sling.installer.core.impl.ConfigConfigurationSerializer;
-import org.apache.sling.installer.core.impl.JsonConfigurationSerializer;
-import org.apache.sling.installer.core.impl.PropertiesConfigurationSerializer;
+import org.apache.sling.installer.core.impl.serializer.ConfigConfigurationSerializer;
+import org.apache.sling.installer.core.impl.serializer.JsonConfigurationSerializer;
+import org.apache.sling.installer.core.impl.serializer.PropertiesConfigurationSerializer;
import org.jetbrains.annotations.NotNull;
public class ConfigurationSerializerFactory {
diff --git a/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java b/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
index e97a021..dde3da7 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/OsgiInstallerImpl.java
@@ -1369,12 +1369,10 @@ implements OsgiInstaller, ResourceChangeListener, RetryHandler, InfoProvider, Ru
final List<ServiceReference<UpdateHandler>> references = this.updateHandlerTracker.getSortedServiceReferences();
for(final ServiceReference ref : references) {
final String[] supportedSchemes = Converters.standardConverter()
- .convert(ref.getProperty(UpdateHandler.PROPERTY_SCHEMES)).defaultValue(null).to(String[].class);
- if ( supportedSchemes != null ) {
- for(final String support : supportedSchemes ) {
- if ( scheme.equals(support) ) {
- return this.updateHandlerTracker.getService(ref);
- }
+ .convert(ref.getProperty(UpdateHandler.PROPERTY_SCHEMES)).to(String[].class);
+ for (final String support : supportedSchemes) {
+ if (scheme.equals(support)) {
+ return this.updateHandlerTracker.getService(ref);
}
}
}
diff --git a/src/main/java/org/apache/sling/installer/core/impl/ConfigConfigurationSerializer.java b/src/main/java/org/apache/sling/installer/core/impl/serializer/ConfigConfigurationSerializer.java
similarity index 95%
rename from src/main/java/org/apache/sling/installer/core/impl/ConfigConfigurationSerializer.java
rename to src/main/java/org/apache/sling/installer/core/impl/serializer/ConfigConfigurationSerializer.java
index 6be1aff..ced6744 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/ConfigConfigurationSerializer.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/serializer/ConfigConfigurationSerializer.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.installer.core.impl;
+package org.apache.sling.installer.core.impl.serializer;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/src/main/java/org/apache/sling/installer/core/impl/JsonConfigurationSerializer.java b/src/main/java/org/apache/sling/installer/core/impl/serializer/JsonConfigurationSerializer.java
similarity index 97%
rename from src/main/java/org/apache/sling/installer/core/impl/JsonConfigurationSerializer.java
rename to src/main/java/org/apache/sling/installer/core/impl/serializer/JsonConfigurationSerializer.java
index b24970c..7d364d9 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/JsonConfigurationSerializer.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/serializer/JsonConfigurationSerializer.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.installer.core.impl;
+package org.apache.sling.installer.core.impl.serializer;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/src/main/java/org/apache/sling/installer/core/impl/PropertiesConfigurationSerializer.java b/src/main/java/org/apache/sling/installer/core/impl/serializer/PropertiesConfigurationSerializer.java
similarity index 96%
rename from src/main/java/org/apache/sling/installer/core/impl/PropertiesConfigurationSerializer.java
rename to src/main/java/org/apache/sling/installer/core/impl/serializer/PropertiesConfigurationSerializer.java
index 54dbf42..dac5877 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/PropertiesConfigurationSerializer.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/serializer/PropertiesConfigurationSerializer.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.sling.installer.core.impl;
+package org.apache.sling.installer.core.impl.serializer;
import java.io.IOException;
import java.io.OutputStream;
diff --git a/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java b/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
index 1ea5d5b..42ea981 100644
--- a/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
+++ b/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleTaskCreator.java
@@ -236,51 +236,55 @@ public class BundleTaskCreator
// highest version
final BundleInfo info = this.getBundleInfo(symbolicName, null);
- // check if we should start the bundle as we installed it in the previous run
- if (info == null) {
- // bundle is not installed yet: install
- result = new BundleInstallTask(resourceList, this.taskSupport);
- } else if ( BundleUtil.isBundleStart(toActivate) ) {
- result = new BundleStartTask(resourceList, info.id, this.taskSupport);
- } else {
- boolean doUpdate = false;
+ // check if we should start the bundle as we installed it in the previous run
+ if (info == null) {
+ // bundle is not installed yet: install
+ result = new BundleInstallTask(resourceList, this.taskSupport);
+ } else if (BundleUtil.isBundleStart(toActivate)) {
+ result = new BundleStartTask(resourceList, info.id, this.taskSupport);
+ } else {
+ boolean doUpdate = false;
- final int compare = info.version.compareTo(newVersion);
- if (compare < 0) {
- // installed version is lower -> update
- doUpdate = true;
- } else if (compare > 0) {
- final String forceVersion = (String) toActivate.getAttribute(FORCE_INSTALL_VERSION);
- if ( forceVersion != null && info.version.compareTo(new Version(forceVersion)) == 0 ) {
+ final int compare = info.version.compareTo(newVersion);
+ if (compare < 0) {
+ // installed version is lower -> update
doUpdate = true;
- } else {
- logger.debug("Bundle " + info.symbolicName + " " + newVersion
+ } else if (compare > 0) {
+ final String forceVersion = (String) toActivate.getAttribute(FORCE_INSTALL_VERSION);
+ if (forceVersion != null && info.version.compareTo(new Version(forceVersion)) == 0) {
+ doUpdate = true;
+ } else {
+ logger.debug("Bundle " + info.symbolicName + " " + newVersion
+ " is not installed, bundle with higher version is already installed.");
- }
- } else if (compare == 0 && BundleInfo.isSnapshot(newVersion)) {
+ }
+ } else if (compare == 0 && BundleInfo.isSnapshot(newVersion)) {
- // installed, same version but SNAPSHOT
- doUpdate = true;
- }
- if (doUpdate) {
+ // installed, same version but SNAPSHOT
+ doUpdate = true;
+ }
+ if (doUpdate) {
- logger.debug("Scheduling update of {}", toActivate);
- // check if this is the system bundle
- if ( Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName) ) {
- result = new SystemBundleUpdateTask(resourceList, this.taskSupport);
- // check if this is a installer update
- } else if ( isInstallerCoreBundle ) {
- result = new InstallerBundleUpdateTask(resourceList, this.taskSupport);
+ logger.debug("Scheduling update of {}", toActivate);
+ // check if this is the system bundle
+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) {
+ result = new SystemBundleUpdateTask(resourceList, this.taskSupport);
+ // check if this is a installer update
+ } else if (isInstallerCoreBundle) {
+ result = new InstallerBundleUpdateTask(resourceList, this.taskSupport);
+ } else {
+ result = new BundleUpdateTask(resourceList, this.taskSupport);
+ }
+ } else if (compare == 0 && (isInstallerCoreBundle
+ || Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName))) {
+ // the installer core bundle / system bundle has been updated, just set state
+ result = new ChangeStateTask(resourceList, ResourceState.INSTALLED,
+ "This is the system bundle, therefore nothing was actually done!");
} else {
- result = new BundleUpdateTask(resourceList, this.taskSupport);
- }
- } else if ( compare == 0 && (isInstallerCoreBundle || Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) ) {
- // the installer core bundle / system bundle has been updated, just set state
- result = new ChangeStateTask(resourceList, ResourceState.INSTALLED, "This is the system bundle, therefore nothing was actually done!");
- } else {
- String message = MessageFormat.format("Nothing to install for {0}, same or newer version {1} already installed.", toActivate, newVersion);
- logger.debug(message);
- result = new ChangeStateTask(resourceList, ResourceState.IGNORED, message);
+ String message = MessageFormat.format(
+ "Nothing to install for {0}, same or newer version {1} already installed.",
+ toActivate, newVersion);
+ logger.debug(message);
+ result = new ChangeStateTask(resourceList, ResourceState.IGNORED, message);
}
}
}