Modifier and Type | Method and Description |
---|---|
Engine.Builder |
allowExperimentalOptions(boolean enabled)
Allow experimental options to be used for instruments and engine options.
|
Engine |
build()
Creates a new engine instance from the configuration provided in the builder.
|
Engine.Builder |
err(OutputStream err)
Sets the standard error stream to be used for this engine.
|
Engine.Builder |
in(InputStream in)
Sets the standard input stream to be used for this engine.
|
Engine.Builder |
logHandler(Handler logHandler)
Installs a new logging
Handler . |
Engine.Builder |
logHandler(OutputStream logOut)
Installs a new logging
Handler using given OutputStream . |
Engine.Builder |
option(String key,
String value)
|
Engine.Builder |
options(Map<String,String> options)
Shortcut for setting multiple
options using a map. |
Engine.Builder |
out(OutputStream out)
Sets the standard output stream to be used for this engine.
|
Engine.Builder |
sandbox(SandboxPolicy policy)
Sets a code sandbox policy to an engine.
|
Engine.Builder |
serverTransport(MessageTransport serverTransport)
Take over transport of message communication with a server peer.
|
Engine.Builder |
useSystemProperties(boolean enabled)
Specifies whether the engine should use
system
properties if no explicit option is set . |
public Engine.Builder out(OutputStream out)
public Engine.Builder err(OutputStream err)
public Engine.Builder in(InputStream in)
public Engine.Builder allowExperimentalOptions(boolean enabled)
false
(the default),
then passing an experimental option results in an IllegalArgumentException
when
the context is built.public Engine.Builder useSystemProperties(boolean enabled)
system
properties
if no explicit option is set
. The default
value is true
indicating that the system properties should be used. System
properties are looked up with the prefix "polyglot" in order to disambiguate
existing system properties. For example, for the option with the key
"js.ECMACompatiblity"
, the system property
"polyglot.js.ECMACompatiblity"
is read. Invalid options specified using
system properties will cause the build
method to fail using an
IllegalArgumentException
. System properties are read once when the engine is
built and are never updated after that.enabled
- if true
system properties will be used as options.To specify option values directly.
,
To build the engine instance.
public Engine.Builder option(String key, String value)
engine
, language
or instrument
.
If one of the set option keys or values is invalid then an
IllegalArgumentException
is thrown when the engine is built
. The
given key and value must not be null
.
public Engine.Builder sandbox(SandboxPolicy policy)
SandboxPolicy.TRUSTED
, there are no restrictions to the engine configuration.SandboxPolicy
public Engine.Builder options(Map<String,String> options)
options
using a map. All
values of the provided map must be non-null.options
- a map options.To set a single option.
public Engine.Builder serverTransport(MessageTransport serverTransport)
MessageTransport
to virtualize a transport of messages to a
server endpoint.
MessageTransport.open(java.net.URI, org.graalvm.polyglot.io.MessageEndpoint)
corresponds to accept of a server socket.serverTransport
- an implementation of message transport interceptorMessageTransport
public Engine.Builder logHandler(Handler logHandler)
Handler
. The logger's Level
configuration is done
using the Engine's options
. The level option key has the
following format: log.languageId.loggerName.level
or
log.instrumentId.loggerName.level
. The value is either the name of pre-defined
Level
constant or a numeric Level
value. If not explicitly set in options
the level is inherited from the parent logger.
Examples of setting log level options:
builder.option("log.level","FINE");
sets the FINE level
to all
TruffleLogger
s.
builder.option("log.js.level","FINE");
sets the FINE level
to
JavaScript TruffleLogger
s.
builder.option("log.js.com.oracle.truffle.js.parser.JavaScriptLanguage.level","FINE");
sets the FINE level
to TruffleLogger
for the
JavaScriptLanguage
class.
logHandler
- the Handler
to use for logging in engine's Context
s.
The passed logHandler
is closed when the engine is
closed
.Engine.Builder
public Engine.Builder logHandler(OutputStream logOut)
Handler
using given OutputStream
. The logger's
Level
configuration is done using the Engine's
options
. The level option key has the following format:
log.languageId.loggerName.level
or log.instrumentId.loggerName.level
. The
value is either the name of pre-defined Level
constant or a numeric Level
value. If not explicitly set in options the level is inherited from the parent logger.
Examples of setting log level options:
builder.option("log.level","FINE");
sets the FINE level
to all
TruffleLogger
s.
builder.option("log.js.level","FINE");
sets the FINE level
to
JavaScript TruffleLogger
s.
builder.option("log.js.com.oracle.truffle.js.parser.JavaScriptLanguage.level","FINE");
sets the FINE level
to TruffleLogger
for the
JavaScriptLanguage
class.
logOut
- the OutputStream
to use for logging in engine's Context
s.
The passed logOut
stream is closed when the engine is
closed
.Engine.Builder
public Engine build()