incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1166480 - in /sling/trunk: bundles/scripting/core/pom.xml bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java launchpad/builder/src/main/bundles/list.xml
Date Thu, 08 Sep 2011 00:48:53 GMT
Author: justin
Date: Thu Sep  8 00:48:53 2011
New Revision: 1166480

URL: http://svn.apache.org/viewvc?rev=1166480&view=rev
Log:
SLING-2208 - supporting array for javax.script.name in SlingBindingsProvider

Modified:
    sling/trunk/bundles/scripting/core/pom.xml
    sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java
    sling/trunk/launchpad/builder/src/main/bundles/list.xml

Modified: sling/trunk/bundles/scripting/core/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/pom.xml?rev=1166480&r1=1166479&r2=1166480&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/core/pom.xml (original)
+++ sling/trunk/bundles/scripting/core/pom.xml Thu Sep  8 00:48:53 2011
@@ -61,6 +61,9 @@
                             org.apache.sling.scripting.core.impl,
                             org.apache.sling.scripting.core.impl.helper
                         </Private-Package>
+                        <Embed-Dependency>
+                            org.apache.sling.commons.osgi;inline="org/apache/sling/commons/osgi/PropertiesUtil.*"
+                        </Embed-Dependency>
                     </instructions>
                 </configuration>
             </plugin>
@@ -100,6 +103,12 @@
         </dependency>
         <dependency>
             <groupId>org.apache.sling</groupId>
+            <artifactId>org.apache.sling.commons.osgi</artifactId>
+            <version>2.1.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.api</artifactId>
             <version>2.1.0</version>
             <scope>provided</scope>

Modified: sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java?rev=1166480&r1=1166479&r2=1166480&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java
(original)
+++ sling/trunk/bundles/scripting/core/src/main/java/org/apache/sling/scripting/core/impl/SlingScriptAdapterFactory.java
Thu Sep  8 00:48:53 2011
@@ -31,6 +31,7 @@ import javax.script.ScriptEngineManager;
 import org.apache.sling.api.adapter.AdapterFactory;
 import org.apache.sling.api.resource.Resource;
 import org.apache.sling.commons.mime.MimeTypeProvider;
+import org.apache.sling.commons.osgi.PropertiesUtil;
 import org.apache.sling.scripting.api.BindingsValuesProvider;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -223,23 +224,28 @@ public class SlingScriptAdapterFactory i
 
         @SuppressWarnings("unchecked")
         public Object addingService(final ServiceReference ref) {
-            final String engineName = (String) ref.getProperty(ScriptEngine.NAME);
+            final String[] engineNames = PropertiesUtil
+                    .toStringArray(ref.getProperty(ScriptEngine.NAME), new String[0]);
             final Object serviceId = ref.getProperty(Constants.SERVICE_ID);
             Object service = bundleContext.getService(ref);
-            if ( service != null ) {
+            if (service != null) {
                 if (service instanceof Map) {
                     service = new MapWrappingBindingsValuesProvider((Map<String, Object>)
service);
                 }
-                if (engineName == null || ANY_ENGINE.contains(engineName.toUpperCase()))
{
+                if (engineNames.length == 0) {
+                    genericBindingsValuesProviders.put(serviceId, (BindingsValuesProvider)
service);
+                } else if (engineNames.length == 1 && ANY_ENGINE.contains(engineNames[0].toUpperCase()))
{
                     genericBindingsValuesProviders.put(serviceId, (BindingsValuesProvider)
service);
                 } else {
-                    Map<Object, BindingsValuesProvider> langProviders = langBindingsValuesProviders.get(engineName);
-                    if (langProviders == null) {
-                        langProviders = new ConcurrentHashMap<Object, BindingsValuesProvider>();
-                        langBindingsValuesProviders.put(engineName, langProviders);
-                    }
+                    for (String engineName : engineNames) {
+                        Map<Object, BindingsValuesProvider> langProviders = langBindingsValuesProviders.get(engineName);
+                        if (langProviders == null) {
+                            langProviders = new ConcurrentHashMap<Object, BindingsValuesProvider>();
+                            langBindingsValuesProviders.put(engineName, langProviders);
+                        }
 
-                    langProviders.put(serviceId, (BindingsValuesProvider) service);
+                        langProviders.put(serviceId, (BindingsValuesProvider) service);
+                    }
                 }
             }
             return service;

Modified: sling/trunk/launchpad/builder/src/main/bundles/list.xml
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/builder/src/main/bundles/list.xml?rev=1166480&r1=1166479&r2=1166480&view=diff
==============================================================================
--- sling/trunk/launchpad/builder/src/main/bundles/list.xml (original)
+++ sling/trunk/launchpad/builder/src/main/bundles/list.xml Thu Sep  8 00:48:53 2011
@@ -160,7 +160,7 @@
         <bundle>
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.scripting.core</artifactId>
-            <version>2.0.18</version>
+            <version>2.0.19-SNAPSHOT</version>
         </bundle>
         <bundle>
             <groupId>org.apache.sling</groupId>



Mime
View raw message