incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1179040 - /sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java
Date Wed, 05 Oct 2011 02:11:53 GMT
Author: justin
Date: Wed Oct  5 02:11:53 2011
New Revision: 1179040

URL: http://svn.apache.org/viewvc?rev=1179040&view=rev
Log:
SLING-2229 - removing duplicate class

Modified:
    sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java

Modified: sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java?rev=1179040&r1=1179039&r2=1179040&view=diff
==============================================================================
--- sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java
(original)
+++ sling/trunk/bundles/scripting/api/src/main/java/javax/script/ScriptEngineManager.java
Wed Oct  5 02:11:53 2011
@@ -147,143 +147,4 @@ public class ScriptEngineManager {
             ScriptEngineFactory factory) {
         registeredByExtension.put(extension, factory);
     }
-}
-/*
- * Copyright 2006 - 2008 (C) The original author or authors
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package javax.script;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * This class is copied from the Livetribe 2.0.6 source with one important
- * extension: The Livetribe implementation has the
- * {@link #setGlobalScope(Bindings)} and {@link #getGlobalScope()} methods,
- * which the Sun implementation of this class has {@link #setBindings(Bindings)}
- * and {@link #getBindings()} methods.
- * <p>
- * Another change is to not scan the class loader initially when creating the
- * ScriptEngineManager -- the assumption is that the ScriptEngine registrations
- * are managed inside the framework.
- */
-public class ScriptEngineManager {
-
-    private final Map<String, ScriptEngineFactory> registeredByName = new HashMap<String,
ScriptEngineFactory>();
-
-    private final Map<String, ScriptEngineFactory> registeredByExtension = new HashMap<String,
ScriptEngineFactory>();
-
-    private final Map<String, ScriptEngineFactory> registeredByMimeType = new HashMap<String,
ScriptEngineFactory>();
-
-    private Bindings globalScope;
-
-    public ScriptEngineManager() {
-        this.globalScope = new SimpleBindings();
-    }
-
-    public ScriptEngineManager(
-            @SuppressWarnings("unused") ClassLoader classLoader) {
-        this();
-
-        // nothing more, we just have this method for API compatibility,
-        // but we don't want to read anything from the class loader
-    }
-
-    public Bindings getBindings() {
-        return globalScope;
-    }
-
-    public void setBindings(Bindings globalScope) {
-        if (globalScope == null) {
-            throw new IllegalArgumentException("Global scope cannot be null.");
-        }
-
-        this.globalScope = globalScope;
-    }
-
-    public Bindings getGlobalScope() {
-        return getBindings();
-    }
-
-    public void setGlobalScope(Bindings globalScope) {
-        setBindings(globalScope);
-    }
-
-    public void put(String key, Object value) {
-        globalScope.put(key, value);
-    }
-
-    public Object get(String key) {
-        return globalScope.get(key);
-    }
-
-    public ScriptEngine getEngineByName(String shortName) {
-        ScriptEngineFactory factory = registeredByName.get(shortName);
-        if (factory == null) return null;
-
-        ScriptEngine engine = factory.getScriptEngine();
-
-        engine.setBindings(globalScope, ScriptContext.GLOBAL_SCOPE);
-
-        return engine;
-    }
-
-    public ScriptEngine getEngineByExtension(String extension) {
-        ScriptEngineFactory factory = registeredByExtension.get(extension);
-        if (factory == null) return null;
-
-        ScriptEngine engine = factory.getScriptEngine();
-
-        engine.setBindings(globalScope, ScriptContext.GLOBAL_SCOPE);
-
-        return engine;
-    }
-
-    public ScriptEngine getEngineByMimeType(String mimeType) {
-        ScriptEngineFactory factory = registeredByMimeType.get(mimeType);
-        if (factory == null) return null;
-
-        ScriptEngine engine = factory.getScriptEngine();
-
-        engine.setBindings(globalScope, ScriptContext.GLOBAL_SCOPE);
-
-        return engine;
-    }
-
-    public List<ScriptEngineFactory> getEngineFactories() {
-        // we don't apply discovery, so nothing is returned here !
-        return Collections.emptyList();
-    }
-
-    public void registerEngineName(String name, ScriptEngineFactory factory) {
-        registeredByName.put(name, factory);
-    }
-
-    public void registerEngineMimeType(String type, ScriptEngineFactory factory) {
-        registeredByMimeType.put(type, factory);
-    }
-
-    public void registerEngineExtension(String extension,
-            ScriptEngineFactory factory) {
-        registeredByExtension.put(extension, factory);
-    }
-}
+}
\ No newline at end of file



Mime
View raw message