jdk/test/java/util/ServiceLoader/modules/src/pearscript/org/pear/PearScriptEngineFactory.java
changeset 45759 8327d73befff
parent 45758 b2a0122861f5
parent 45741 ee4958177e69
child 45760 4aa6ef7f2ac4
equal deleted inserted replaced
45758:b2a0122861f5 45759:8327d73befff
     1 /*
       
     2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
       
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       
     4  *
       
     5  * This code is free software; you can redistribute it and/or modify it
       
     6  * under the terms of the GNU General Public License version 2 only, as
       
     7  * published by the Free Software Foundation.
       
     8  *
       
     9  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    12  * version 2 for more details (a copy is included in the LICENSE file that
       
    13  * accompanied this code).
       
    14  *
       
    15  * You should have received a copy of the GNU General Public License version
       
    16  * 2 along with this work; if not, write to the Free Software Foundation,
       
    17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    18  *
       
    19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    20  * or visit www.oracle.com if you need additional information or have any
       
    21  * questions.
       
    22  */
       
    23 
       
    24 package org.pear;
       
    25 
       
    26 import java.util.Arrays;
       
    27 import java.util.List;
       
    28 import javax.script.ScriptEngine;
       
    29 import javax.script.ScriptEngineFactory;
       
    30 
       
    31 public class PearScriptEngineFactory implements ScriptEngineFactory {
       
    32 
       
    33     public PearScriptEngineFactory() { }
       
    34 
       
    35     public static PearScriptEngineFactory provider() {
       
    36         throw new RuntimeException("Should not be called");
       
    37     }
       
    38 
       
    39     @Override
       
    40     public String getEngineName() {
       
    41         return "PearScriptEngine";
       
    42     }
       
    43 
       
    44     @Override
       
    45     public String getEngineVersion() {
       
    46         return "1.0";
       
    47     }
       
    48 
       
    49     @Override
       
    50     public List<String> getExtensions() {
       
    51         return Arrays.asList("pear");
       
    52     }
       
    53 
       
    54     @Override
       
    55     public List<String> getMimeTypes() {
       
    56         return Arrays.asList("application/x-pearscript");
       
    57     }
       
    58 
       
    59     @Override
       
    60     public List<String> getNames() {
       
    61         return Arrays.asList("PearScript");
       
    62     }
       
    63 
       
    64     @Override
       
    65     public String getLanguageName() {
       
    66         return "PearScript";
       
    67     }
       
    68 
       
    69     @Override
       
    70     public String getLanguageVersion() {
       
    71         return "1.0";
       
    72     }
       
    73 
       
    74     @Override
       
    75     public Object getParameter(String key) {
       
    76         return null;
       
    77     }
       
    78 
       
    79     @Override
       
    80     public String getMethodCallSyntax(String obj, String m, String... args) {
       
    81         throw new RuntimeException();
       
    82     }
       
    83 
       
    84     @Override
       
    85     public String getOutputStatement(String toDisplay) {
       
    86         throw new RuntimeException();
       
    87     }
       
    88 
       
    89     @Override
       
    90     public String getProgram(String... statements) {
       
    91         throw new RuntimeException();
       
    92     }
       
    93 
       
    94     @Override
       
    95     public ScriptEngine getScriptEngine() {
       
    96         return new PearScript();
       
    97     }
       
    98 }