sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From romb...@apache.org
Subject [sling-org-apache-sling-scripting-sightly-js-provider] 17/24: SLING-4940 - Add the Sling ScriptCache configuration applied by o.a.s.s.sightly.js.provider to the provisioning model
Date Tue, 07 Nov 2017 10:11:33 GMT
This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.js.provider-1.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-js-provider.git

commit b4e6f7ee40203a2ae17f2d1de0122ab2f090b7be
Author: Radu Cotescu <radu@apache.org>
AuthorDate: Mon Aug 10 14:09:01 2015 +0000

    SLING-4940 - Add the Sling ScriptCache configuration applied by o.a.s.s.sightly.js.provider
to the provisioning model
    
    * moved script cache configuration to provisioning model
    * updated dependencies for the Sightly JS Use provider to released versions
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/bundles/scripting/sightly/js-use-provider@1695078
13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |  8 +---
 .../scripting/sightly/js/impl/JsUseProvider.java   | 44 ----------------------
 2 files changed, 1 insertion(+), 51 deletions(-)

diff --git a/pom.xml b/pom.xml
index 78931b2..6fc5b88 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,13 +97,7 @@
         <dependency>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.api</artifactId>
-            <version>2.1.9-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.sling</groupId>
-            <artifactId>org.apache.sling.scripting.core</artifactId>
-            <version>2.0.31-SNAPSHOT</version>
+            <version>2.1.8</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
diff --git a/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java b/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java
index 51cc57d..4ce28bc 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/js/impl/JsUseProvider.java
@@ -18,12 +18,6 @@
  ******************************************************************************/
 package org.apache.sling.scripting.sightly.js.impl;
 
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Dictionary;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Set;
 import javax.script.Bindings;
 import javax.script.ScriptEngine;
 import javax.script.ScriptEngineManager;
@@ -32,13 +26,10 @@ import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferencePolicy;
 import org.apache.felix.scr.annotations.Service;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.api.resource.ResourceResolver;
 import org.apache.sling.api.scripting.SlingScriptHelper;
-import org.apache.sling.commons.osgi.PropertiesUtil;
-import org.apache.sling.scripting.api.ScriptCache;
 import org.apache.sling.scripting.sightly.SightlyException;
 import org.apache.sling.scripting.sightly.js.impl.async.AsyncContainer;
 import org.apache.sling.scripting.sightly.js.impl.async.AsyncExtractor;
@@ -48,11 +39,6 @@ import org.apache.sling.scripting.sightly.render.RenderContext;
 import org.apache.sling.scripting.sightly.use.ProviderOutcome;
 import org.apache.sling.scripting.sightly.use.UseProvider;
 import org.osgi.framework.Constants;
-import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
-import org.osgi.service.component.ComponentContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Use provider for JavaScript Use-API objects.
@@ -76,10 +62,6 @@ import org.slf4j.LoggerFactory;
 public class JsUseProvider implements UseProvider {
 
     private static final String JS_ENGINE_NAME = "javascript";
-    private static final String SCRIPT_CACHE_PID = "org.apache.sling.scripting.core.impl.ScriptCacheImpl";
-    private static final String SCRIPT_CACHE_ADDITIONAL_EXTENSIONS = "org.apache.sling.scripting.cache.additional_extensions";
-
-    private static final Logger LOGGER = LoggerFactory.getLogger(JsUseProvider.class);
     private static final JsValueAdapter jsValueAdapter = new JsValueAdapter(new AsyncExtractor());
 
     @Reference
@@ -88,9 +70,6 @@ public class JsUseProvider implements UseProvider {
     @Reference
     private SlyBindingsValuesProvider slyBindingsValuesProvider = null;
 
-    @Reference
-    private ConfigurationAdmin configurationAdmin = null;
-
     @Override
     public ProviderOutcome provide(String identifier, RenderContext renderContext, Bindings
arguments) {
         Bindings globalBindings = renderContext.getBindings();
@@ -118,27 +97,4 @@ public class JsUseProvider implements UseProvider {
             }
         }
     }
-
-    @SuppressWarnings({"unused", "unchecked"})
-    protected void activate(ComponentContext componentContext) {
-        try {
-            Configuration configuration = configurationAdmin.getConfiguration(SCRIPT_CACHE_PID);
-            Dictionary properties = configuration.getProperties();
-            if (properties == null) {
-                properties = new Hashtable(1);
-            }
-            String[] additionalExtensions = PropertiesUtil.toStringArray(properties.get(SCRIPT_CACHE_ADDITIONAL_EXTENSIONS));
-            Set<String> extensionsSet = new HashSet<String>(1);
-            if (additionalExtensions != null) {
-                extensionsSet = new HashSet<String>(Arrays.asList(additionalExtensions));
-            }
-            extensionsSet.add(Utils.JS_EXTENSION);
-            properties.put(SCRIPT_CACHE_ADDITIONAL_EXTENSIONS, extensionsSet.toArray(new
String[extensionsSet.size()]));
-            configuration.setBundleLocation(null);
-            configuration.update(properties);
-        } catch (IOException e) {
-            LOGGER.error("Unable to retrieve " + SCRIPT_CACHE_PID + " configuration. The
Script Cache will not invalidate JavaScript file" +
-                    " changes (e.g. files with the .js extension).");
-        }
-    }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <commits@sling.apache.org>.

Mime
View raw message