Class ExternalContentTransformation
- java.lang.Object
-
- org.eclipse.epsilon.picto.transformers.ExternalContentTransformation
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
args
protected boolean
hasRun
protected Path
logFile
protected Path
outputFile
protected String
processOutput
protected String
program
protected byte[]
result
protected int
resultCode
protected Duration
timeout
-
Constructor Summary
Constructors Modifier Constructor Description protected
ExternalContentTransformation(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 Path
createTempFile(String extension, byte... contents)
Convenience method for temporary files used in intermediate transformations.String[]
getArgs()
IOException
getException()
Path
getLogFile()
Path
getOutputFile()
String
getProcessOutput()
String
getProgram()
byte[]
getResult()
int
getResultCode()
Duration
getTimeout()
static String
resolveNodeProgram(String program)
void
run()
protected void
screenRun()
void
setLogFile(Path logFile)
void
setOutputFile(Path outputFile)
void
setTimeout(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:
call
in 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.
-
-