You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Rahul Akolkar <ra...@gmail.com> on 2009/07/31 23:42:04 UTC

Re: [JEXL] svn commit: r799482

On Thu, Jul 30, 2009 at 9:27 PM, <se...@apache.org> wrote:
> Author: sebb
> Date: Fri Jul 31 01:27:49 2009
> New Revision: 799482
>
> URL: http://svn.apache.org/viewvc?rev=799482&view=rev
> Log:
> The Jexl Script engine factory
>
> Added:
>    commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngineFactory.java   (with props)
>
> Added: commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngineFactory.java
> URL: http://svn.apache.org/viewvc/commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngineFactory.java?rev=799482&view=auto
> ==============================================================================
> --- commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngineFactory.java (added)
> +++ commons/proper/jexl/branches/2.0/src/java/org/apache/commons/jexl/scripting/JexlScriptEngineFactory.java Fri Jul 31 01:27:49 2009
> @@ -0,0 +1,141 @@
> +/*
> + * 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 org.apache.commons.jexl.scripting;
> +
> +import java.util.Arrays;
> +import java.util.Collections;
> +import java.util.List;
> +
> +import javax.script.ScriptEngine;
> +import javax.script.ScriptEngineFactory;
> +
> +/**
> + * Implements the Jexl ScriptEngineFactory for JSF-223.
> + * <p>
> + * See
> + * <a href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Java Scripting API</a>
> + * Javadoc.
> + */
> +public class JexlScriptEngineFactory implements ScriptEngineFactory {
> +
> +    private static final List<String> extensions = Collections.unmodifiableList(
> +            Arrays.asList("jexl"));
> +
> +    private final List<String> mimeTypes = Collections.unmodifiableList(
> +            Arrays.asList("application/x-jexl"));
> +
> +    private final List<String> names = Collections.unmodifiableList(
> +            Arrays.asList( "jexl" ));
> +
<snip/>

The correct casing for the name is uppercase (JEXL). See the Commons
JEXL homepage for instance, though we've been inconsistent in Java
class names, logo etc. Having said that, and given that script engine
names are case sensitive, I suggest that at the least we register
"jexl", "Jexl" and "JEXL" (the last being the correct one, the first
two being common).


> +    /** {@inheritDoc} */
> +    public String getEngineName() {
> +        return "Jexl Engine";
> +    }
<snap/>

Here, I'd say "JEXL Engine".


> +
> +    /** {@inheritDoc} */
> +    public String getEngineVersion() {
> +        return "1.0";
> +    }
> +
<snip/>

Perhaps add a comment in Javadoc that this should be upgraded when
there are functional changes to this class?


> +    /** {@inheritDoc} */
> +    public List<String> getExtensions() {
> +        return extensions;
> +    }
> +
> +    /** {@inheritDoc} */
> +    public String getLanguageName() {
> +        return "Jexl";
> +    }
> +
<snap/>

I'd go with uppercase here too.

-Rahul

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org