All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.netbeans.libs.graalsdk.GraalSDK Maven / Gradle / Ivy

There is a newer version: RELEASE230
Show newest version
/*
 * 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.netbeans.libs.graalsdk;

import java.util.List;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.Context.Builder;
import org.graalvm.polyglot.Engine;
import org.graalvm.polyglot.HostAccess;

/**
 * Integration of NetBeans Scripting
 * API and GraalVM; see the {@link org.netbeans.libs.graalsdk tutorial} for more details.
 * 

Security

*

* By default all the GraalVM engines * (named GraalVM:something) * run in a very restricted, secure sandbox: *

* {@codesnippet org.netbeans.libs.graalsdk.impl.GraalContext#SANDBOX} *

* The languages cannot access local files, ports, etc. They can access public * fields and public methods of objects passed into their scripts (but not * those methods exposed by base {@link Object} class). The scripts can access * elements of Java arrays and {@link List} elements. Methods of a * {@linkplain FunctionalInterface functional interfaces} are callable by the * scripts. *

*

* For some languages such restrictions are too tight. They * need to gain wider access. This can be done by setting allowAllAccess * attribute to {@code true}: *

* {@codesnippet org.netbeans.libs.graalsdk.ScriptingTutorial#allowAllAccess} *

* Once enabled, the {@link HostAccess#ALL} and {@link Builder#allowAllAccess(boolean) allowAllAccess(true)} * is then used to construct the engine's environment. *

*

Polyglot API Access

*

* As a consequence of packaging the GraalVM APIs, it is possible to request this module and gain access to * {@link org.graalvm.polyglot} package directly. Consult {@link Context} and {@link Engine} * classes as a starting points when * accessing the Graal SDK directly. Preferably use only if the * NetBeans Scripting * API wrapper isn't good enough. */ public final class GraalSDK { private GraalSDK() { } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy