Author: cziegeler
Date: Wed Mar 2 15:31:44 2011
New Revision: 1076254
URL: http://svn.apache.org/viewvc?rev=1076254&view=rev
Log:
SLING-2011 : Support start levels for bundles
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
URL:
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java?rev=1076254&r1=1076253&r2=1076254&view=diff
==============================================================================
---
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
(original)
+++
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/api/InstallableResource.java
Wed Mar 2 15:31:44 2011
@@ -87,6 +87,14 @@ public class InstallableResource {
*/
public static final String BUNDLE_START_LEVEL = "bundle.startlevel";
+ /**
+ * Optional parameter in the dictionary if a resource (not a dict) is
installed.
+ * This parameter might be used by the installation task for any purpose
like
+ * bundle start level etc.
+ * @since 3.1
+ */
+ public static final String INSTALLATION_HINT = "installation.hint";
+
/** Default resource priority */
public static final int DEFAULT_PRIORITY = 100;
Modified:
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
URL:
http://svn.apache.org/viewvc/sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java?rev=1076254&r1=1076253&r2=1076254&view=diff
==============================================================================
---
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
(original)
+++
sling/trunk/installer/core/src/main/java/org/apache/sling/installer/core/impl/tasks/BundleInstallTask.java
Wed Mar 2 15:31:44 2011
@@ -44,8 +44,17 @@ public class BundleInstallTask extends A
*/
public void execute(final InstallationContext ctx) {
int startLevel = 0;
- final Object providedLevel = (this.getResource().getDictionary() !=
null
- ?
this.getResource().getDictionary().get(InstallableResource.BUNDLE_START_LEVEL)
: null);
+ final Object providedLevel;
+
+ if (this.getResource().getDictionary() != null) {
+ if (
this.getResource().getDictionary().get(InstallableResource.BUNDLE_START_LEVEL)
!= null ) {
+ providedLevel =
this.getResource().getDictionary().get(InstallableResource.BUNDLE_START_LEVEL);
+ } else {
+ providedLevel =
this.getResource().getDictionary().get(InstallableResource.INSTALLATION_HINT);
+ }
+ } else {
+ providedLevel = null;
+ }
if ( providedLevel != null ) {
if ( providedLevel instanceof Number ) {
startLevel = ((Number)providedLevel).intValue();
Modified:
sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
URL:
http://svn.apache.org/viewvc/sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java?rev=1076254&r1=1076253&r2=1076254&view=diff
==============================================================================
---
sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
(original)
+++
sling/trunk/installer/providers/jcr/src/main/java/org/apache/sling/installer/provider/jcr/impl/FileNodeConverter.java
Wed Mar 2 15:31:44 2011
@@ -18,6 +18,8 @@ package org.apache.sling.installer.provi
import java.io.IOException;
import java.io.InputStream;
+import java.util.Dictionary;
+import java.util.Hashtable;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
@@ -78,6 +80,8 @@ public class FileNodeConverter implement
throw new IOException("Missing " + JCR_CONTENT_DATA + "
property");
}
- return new InstallableResource(path, is, null, digest, null, priority);
+ final Dictionary<String, Object> dict = new Hashtable<String,
Object>();
+ dict.put(InstallableResource.INSTALLATION_HINT,
n.getParent().getName());
+ return new InstallableResource(path, is, dict, digest, null, priority);
}
}
\ No newline at end of file