Class ExternalContentTransformation
- java.lang.Object
-
- org.eclipse.epsilon.picto.transformers.ExternalContentTransformation
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]argsprotected booleanhasRunprotected PathlogFileprotected PathoutputFileprotected StringprocessOutputprotected Stringprogramprotected byte[]resultprotected intresultCodeprotected Durationtimeout
-
Constructor Summary
Constructors Modifier Constructor Description protectedExternalContentTransformation(String program, Object... arguments)ExternalContentTransformation(Path outputFile, String program, Object... arguments)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]call()static PathcreateTempFile(String extension, byte... contents)Convenience method for temporary files used in intermediate transformations.String[]getArgs()IOExceptiongetException()PathgetLogFile()PathgetOutputFile()StringgetProcessOutput()StringgetProgram()byte[]getResult()intgetResultCode()DurationgetTimeout()static StringresolveNodeProgram(String program)voidrun()protected voidscreenRun()voidsetLogFile(Path logFile)voidsetOutputFile(Path outputFile)voidsetTimeout(Duration timeout)
-
-
-
Field Detail
-
program
protected final String program
-
args
protected final String[] args
-
timeout
protected Duration timeout
-
logFile
protected Path logFile
-
outputFile
protected Path outputFile
-
resultCode
protected int resultCode
-
hasRun
protected boolean hasRun
-
result
protected byte[] result
-
processOutput
protected String processOutput
-
-
Method Detail
-
createTempFile
public static Path createTempFile(String extension, byte... contents) throws IOException
Convenience method for temporary files used in intermediate transformations.- Parameters:
extension- The file extension.contents- The initial contents of the file. May be null.- Returns:
- The absolute path of the temporary file.
- Throws:
IOException- If the temp file couldn't be created.
-
resolveNodeProgram
public static String resolveNodeProgram(String program)
- Parameters:
program- The Node.js program name.- Returns:
- The absolute path of the command needed to invoke the program.
-
getResultCode
public int getResultCode()
-
screenRun
protected void screenRun() throws IllegalStateException- Throws:
IllegalStateException
-
getResult
public byte[] getResult() throws IOException- Throws:
IOException
-
call
public byte[] call() throws IOException- Specified by:
callin interfaceCallable<byte[]>- Throws:
IOException
-
getException
public IOException getException()
-
getLogFile
public Path getLogFile()
-
setLogFile
public void setLogFile(Path logFile)
-
getOutputFile
public Path getOutputFile()
-
setOutputFile
public void setOutputFile(Path outputFile)
-
getTimeout
public Duration getTimeout()
-
setTimeout
public void setTimeout(Duration timeout)
-
getProgram
public String getProgram()
-
getArgs
public String[] getArgs()
-
getProcessOutput
public String getProcessOutput()
- Returns:
- The stdout of the invoked program.
- Throws:
IllegalStateException- If the program hasn't been run yet.
-
-