Enum DslCompiler
- java.lang.Object
-
- java.lang.Enum<DslCompiler>
-
- com.dslplatform.compiler.client.parameters.DslCompiler
-
- All Implemented Interfaces:
CompileParameter,ParameterParser,java.io.Serializable,java.lang.Comparable<DslCompiler>
public enum DslCompiler extends java.lang.Enum<DslCompiler> implements CompileParameter, ParameterParser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classDslCompiler.ByteStreamstatic classDslCompiler.ParseErrorstatic classDslCompiler.ParseResultstatic classDslCompiler.RuleInfostatic classDslCompiler.SyntaxConceptstatic classDslCompiler.SyntaxTypestatic classDslCompiler.TokenParser
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.StringDSL_COMPILER_SOCKETprivate static java.nio.charset.CharsetUTF_8
-
Constructor Summary
Constructors Modifier Constructor Description privateDslCompiler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck(Context context)static voidcheckForLatestVersion(Context context, java.io.File path, java.io.File compilerPath, java.io.File compiler)static java.util.Map<java.lang.String,java.lang.String>compile(Context context, java.lang.String target, java.util.List<java.lang.String> settings, java.lang.String namespace, java.lang.String version, DatabaseInfo dbInfo, java.util.List<java.io.File> dsls, java.lang.String library, java.lang.String configuration)private static voiddownloadCompiler(Context context, java.io.File path, java.io.File compilerPath, java.io.File compiler, boolean failOnError)java.lang.StringgetAlias()private static DslCompiler.ByteStreamgetByteStream(Context context)java.lang.StringgetDetailedDescription()java.lang.StringgetShortDescription()java.lang.StringgetUsage()private static booleanhasWhitespace(java.lang.String input)static java.io.FilelookupDefaultPath(Context context)static Either<java.lang.String>migration(Context context, DatabaseInfo dbInfo, java.util.List<java.io.File> currentDsls)static Either<java.lang.Boolean>parse(Context context, java.util.List<java.io.File> dsls)private static voidpreparePreviousDsl(Context context, DatabaseInfo dbInfo, java.util.List<java.lang.String> arguments)private static booleanpromptUserMonoRetry(Context context)private static intreadInt(byte[] buf)voidrun(Context context)private static Either<byte[]>runCompiler(Context context, java.util.List<java.lang.String> arguments)private static Either<byte[]>runCompilerFile(Context context, java.io.File compiler, java.util.List<java.lang.String> arguments)private static Either<byte[]>runCompilerSocket(Context context, java.net.Socket socket, java.util.List<java.lang.String> arguments)static Either<DslCompiler.TokenParser>setupServer(Context context, java.io.File compiler)private static Either<java.lang.Process>startServerMode(Context context, java.io.File compiler, int port)private static booleantestCompiler(Context context, java.io.File path)Either<java.lang.Boolean>tryParse(java.lang.String name, java.lang.String value, Context context)static DslCompilervalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static DslCompiler[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final DslCompiler INSTANCE
-
-
Field Detail
-
UTF_8
private static final java.nio.charset.Charset UTF_8
-
DSL_COMPILER_SOCKET
private static final java.lang.String DSL_COMPILER_SOCKET
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static DslCompiler[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (DslCompiler c : DslCompiler.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static DslCompiler valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getAlias
public java.lang.String getAlias()
- Specified by:
getAliasin interfaceCompileParameter
-
getUsage
public java.lang.String getUsage()
- Specified by:
getUsagein interfaceCompileParameter
-
compile
public static java.util.Map<java.lang.String,java.lang.String> compile(Context context, java.lang.String target, java.util.List<java.lang.String> settings, java.lang.String namespace, java.lang.String version, DatabaseInfo dbInfo, java.util.List<java.io.File> dsls, java.lang.String library, java.lang.String configuration) throws ExitException
- Throws:
ExitException
-
runCompiler
private static Either<byte[]> runCompiler(Context context, java.util.List<java.lang.String> arguments) throws ExitException
- Throws:
ExitException
-
readInt
private static int readInt(byte[] buf)
-
setupServer
public static Either<DslCompiler.TokenParser> setupServer(Context context, java.io.File compiler)
-
startServerMode
private static Either<java.lang.Process> startServerMode(Context context, java.io.File compiler, int port)
-
hasWhitespace
private static boolean hasWhitespace(java.lang.String input)
-
runCompilerSocket
private static Either<byte[]> runCompilerSocket(Context context, java.net.Socket socket, java.util.List<java.lang.String> arguments) throws ExitException
- Throws:
ExitException
-
getByteStream
private static DslCompiler.ByteStream getByteStream(Context context)
-
runCompilerFile
private static Either<byte[]> runCompilerFile(Context context, java.io.File compiler, java.util.List<java.lang.String> arguments) throws ExitException
- Throws:
ExitException
-
migration
public static Either<java.lang.String> migration(Context context, DatabaseInfo dbInfo, java.util.List<java.io.File> currentDsls) throws ExitException
- Throws:
ExitException
-
preparePreviousDsl
private static void preparePreviousDsl(Context context, DatabaseInfo dbInfo, java.util.List<java.lang.String> arguments) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
public static Either<java.lang.Boolean> parse(Context context, java.util.List<java.io.File> dsls) throws ExitException
- Throws:
ExitException
-
lookupDefaultPath
public static java.io.File lookupDefaultPath(Context context) throws ExitException
- Throws:
ExitException
-
tryParse
public Either<java.lang.Boolean> tryParse(java.lang.String name, java.lang.String value, Context context)
- Specified by:
tryParsein interfaceParameterParser
-
check
public boolean check(Context context) throws ExitException
- Specified by:
checkin interfaceCompileParameter- Throws:
ExitException
-
checkForLatestVersion
public static void checkForLatestVersion(Context context, java.io.File path, java.io.File compilerPath, java.io.File compiler) throws ExitException
- Throws:
ExitException
-
downloadCompiler
private static void downloadCompiler(Context context, java.io.File path, java.io.File compilerPath, java.io.File compiler, boolean failOnError) throws ExitException
- Throws:
ExitException
-
testCompiler
private static boolean testCompiler(Context context, java.io.File path) throws ExitException
- Throws:
ExitException
-
run
public void run(Context context)
- Specified by:
runin interfaceCompileParameter
-
getShortDescription
public java.lang.String getShortDescription()
- Specified by:
getShortDescriptionin interfaceCompileParameter
-
getDetailedDescription
public java.lang.String getDetailedDescription()
- Specified by:
getDetailedDescriptionin interfaceCompileParameter
-
promptUserMonoRetry
private static boolean promptUserMonoRetry(Context context)
-
-