You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by kw...@apache.org on 2020/08/11 15:46:48 UTC

[jackrabbit-filevault] 01/01: JCRVLT-465 only use declarative services 1.3

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch bugfix/JCRVLT-465-use-ds13
in repository https://gitbox.apache.org/repos/asf/jackrabbit-filevault.git

commit f8019997679f793ffb96b9f849c32dcb872c9908
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Tue Aug 11 17:46:31 2020 +0200

    JCRVLT-465 only use declarative services 1.3
---
 parent/pom.xml                                         |  2 ++
 .../jackrabbit/vault/rcp/impl/RcpTaskManagerImpl.java  | 18 +++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/parent/pom.xml b/parent/pom.xml
index a14e600..26e606d 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -145,6 +145,8 @@ Bundle-Category: jackrabbit
 -snapshot: SNAPSHOT
 # export all versioned packages except for conditional ones (https://github.com/bndtools/bnd/issues/3721#issuecomment-579026778)
 -exportcontents: ${removeall;${packages;VERSIONED};${packages;CONDITIONAL}}
+# support only DS 1.3 (https://github.com/bndtools/bnd/pull/3121/files)
+-dsannotations-options: version;maximum=1.3.0
                                 ]]></bnd>
                             </configuration>
                         </execution>
diff --git a/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpTaskManagerImpl.java b/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpTaskManagerImpl.java
index 4381a6a..0c63c1c 100644
--- a/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpTaskManagerImpl.java
+++ b/vault-rcp/src/main/java/org/apache/jackrabbit/vault/rcp/impl/RcpTaskManagerImpl.java
@@ -87,19 +87,22 @@ public class RcpTaskManagerImpl implements RcpTaskManager {
 
     SortedMap<String, RcpTaskImpl> tasks;
 
-    private final File dataFile;
+    private File dataFile;
 
     private final ObjectMapper mapper = new ObjectMapper();
     
     private Configuration configuration;
     
-    private final ConfigurationAdmin configurationAdmin;
+    @Reference
+    ConfigurationAdmin configurationAdmin;
 
     /** the serialized tasks which have been processed (for detecting relevant updates) */
     private String serializedTasks;
-
+    
+    
+    
     @Activate
-    public RcpTaskManagerImpl(BundleContext bundleContext, @Reference ConfigurationAdmin configurationAdmin, Map <String, Object> newConfigProperties) throws IOException {
+    void activate(BundleContext bundleContext, Map <String, Object> newConfigProperties) throws IOException {
         mapper.configure(MapperFeature.PROPAGATE_TRANSIENT_MARKER, true);
         mapper.addMixIn(RepositoryAddress.class, RepositoryAddressMixin.class);
         SimpleModule module = new SimpleModule();
@@ -109,7 +112,6 @@ public class RcpTaskManagerImpl implements RcpTaskManager {
         mapper.addMixIn(SimpleCredentials.class, SimpleCredentialsMixin.class);
         mapper.addMixIn(ConnectionOptions.class, ConnectionOptionsMixin.class);
         this.dataFile = bundleContext.getDataFile(TASKS_DATA_FILE_NAME);
-        this.configurationAdmin = configurationAdmin;
         this.configuration = configurationAdmin.getConfiguration(PID);
         try {
             tasks = loadTasks((String)newConfigProperties.get(PROP_TASKS_SERIALIZATION), dataFile);
@@ -119,6 +121,12 @@ public class RcpTaskManagerImpl implements RcpTaskManager {
         }
     }
 
+    // constructor, currently only used for testing
+    public RcpTaskManagerImpl(BundleContext bundleContext, ConfigurationAdmin configurationAdmin, Map <String, Object> newConfigProperties) throws IOException {
+        this.configurationAdmin = configurationAdmin;
+        activate(bundleContext, newConfigProperties);
+    }
+
     @Deactivate
     void deactivate() throws IOException, RepositoryException {
         log.info("RcpTaskManager deactivated. Stopping running tasks...");