langtools/src/jdk.jshell/share/classes/jdk/jshell/execution/LoaderDelegate.java
changeset 39807 ba0ff343d241
child 43132 6a5c69926e60
equal deleted inserted replaced
39806:d3a13ca6013e 39807:ba0ff343d241
       
     1 /*
       
     2  * Copyright (c) 2016, 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.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 package jdk.jshell.execution;
       
    26 
       
    27 import jdk.jshell.spi.ExecutionControl.ClassBytecodes;
       
    28 import jdk.jshell.spi.ExecutionControl.ClassInstallException;
       
    29 import jdk.jshell.spi.ExecutionControl.EngineTerminationException;
       
    30 import jdk.jshell.spi.ExecutionControl.InternalException;
       
    31 import jdk.jshell.spi.ExecutionControl.NotImplementedException;
       
    32 
       
    33 /**
       
    34  * This interface specifies the loading specific subset of
       
    35  * {@link jdk.jshell.spi.ExecutionControl}.  For use in encapsulating the
       
    36  * {@link java.lang.ClassLoader} implementation.
       
    37  */
       
    38 public interface LoaderDelegate {
       
    39 
       
    40     /**
       
    41      * Attempts to load new classes.
       
    42      *
       
    43      * @param cbcs the class name and bytecodes to load
       
    44      * @throws ClassInstallException exception occurred loading the classes,
       
    45      * some or all were not loaded
       
    46      * @throws NotImplementedException if not implemented
       
    47      * @throws EngineTerminationException the execution engine has terminated
       
    48      */
       
    49     void load(ClassBytecodes[] cbcs)
       
    50             throws ClassInstallException, NotImplementedException, EngineTerminationException;
       
    51 
       
    52     /**
       
    53      * Adds the path to the execution class path.
       
    54      *
       
    55      * @param path the path to add
       
    56      * @throws EngineTerminationException the execution engine has terminated
       
    57      * @throws InternalException an internal problem occurred
       
    58      */
       
    59     void addToClasspath(String path)
       
    60             throws EngineTerminationException, InternalException;
       
    61 
       
    62     /**
       
    63      * Sets the execution class path to the specified path.
       
    64      *
       
    65      * @param path the path to add
       
    66      * @throws EngineTerminationException the execution engine has terminated
       
    67      * @throws InternalException an internal problem occurred
       
    68      */
       
    69     void setClasspath(String path)
       
    70             throws EngineTerminationException, InternalException;
       
    71 
       
    72     /**
       
    73      * Finds the class with the specified binary name.
       
    74      *
       
    75      * @param name the binary name of the class
       
    76      * @return the Class Object
       
    77      * @throws ClassNotFoundException if the class could not be found
       
    78      */
       
    79     Class<?> findClass(String name) throws ClassNotFoundException;
       
    80 }