|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.servlet.GenericServlet
javax.servlet.http.HttpServlet
info.sswap.api.servlet.AbstractSSWAPServlet
info.sswap.ontologies.exec.impl.ExecImpl
public class ExecImpl
Implementation for ExecServlet.
ExecServlet,
Serialized Form| Field Summary | |
|---|---|
private static int |
BLOCK_SIZ
Limits on user-supplied arguments: size, length, and number |
private static int |
EOF
|
private java.lang.String |
hotboxPath
Optional "hotboxPath" as defined in web.xml. |
(package private) HotboxPoller |
hotboxPoller
The hotbox poller; may be null if not invoked |
private static int |
MAX_ARG_LENGTH
|
private static long |
MAX_BLOCKS
|
private static int |
MAX_NUM_ARGS
|
private java.lang.String |
rdgPath
"RDGPath" as defined in web.xml. |
private static long |
serialVersionUID
|
private java.io.File |
tmpDir
Temporary working directory (TWD) for the executed process. |
| Fields inherited from class info.sswap.api.servlet.AbstractSSWAPServlet |
|---|
remoteServiceURI, RRG_RETRIEVAL_SUFFIX |
| Constructor Summary | |
|---|---|
ExecImpl()
|
|
| Method Summary | |
|---|---|
private void |
close(java.io.OutputStream stdin,
java.io.InputStream stdout,
java.io.InputStream stderr)
Close streams to release resources and flush output. |
private void |
fillPipe(java.io.InputStream inputStream,
java.io.OutputStream stdin)
Byte-count limited transferring of bytes from the inputStream to the outputStream. |
java.lang.String[] |
getCommandLine(java.lang.String commandLineStr)
Basic parsing and sanity checking of the command line. |
private java.lang.String |
getStrValue(SSWAPNode sswapNode,
java.net.URI ontologyPredicate)
Get a String value from a property. |
protected void |
handleRequest(RIG rig)
This method is marked protected solely for package access
purposes and should not be called directly nor overridden. |
void |
init(javax.servlet.ServletConfig servletConfig)
Internal initialization for HttpServlet. |
boolean |
isRunning()
Check if the hotbox poller is running. |
void |
setEnvironment(java.util.Map<java.lang.String,java.lang.String> env)
Set the process' execution environment. |
void |
setInterval(int sleepSeconds)
Set the delay interval between directory scans. |
void |
start()
Start the hotbox directory polling. |
private java.lang.Process |
startProcess(java.lang.String[] commandLine)
Start the process. |
void |
stop()
Stop the hotbox directory polling. |
private void |
validateArgs(java.lang.String[] args)
Simple argument sanity checking. |
| Methods inherited from class info.sswap.api.servlet.AbstractSSWAPServlet |
|---|
doGet, doPost, getTimeout, setTimeout |
| Methods inherited from class javax.servlet.http.HttpServlet |
|---|
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service |
| Methods inherited from class javax.servlet.GenericServlet |
|---|
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
private static final int BLOCK_SIZ
private static final long MAX_BLOCKS
private static final int EOF
private static final int MAX_ARG_LENGTH
private static final int MAX_NUM_ARGS
private java.lang.String rdgPath
private java.lang.String hotboxPath
HotboxPoller hotboxPoller
private java.io.File tmpDir
| Constructor Detail |
|---|
public ExecImpl()
| Method Detail |
|---|
public void init(javax.servlet.ServletConfig servletConfig)
throws javax.servlet.ServletException
public solely for package access purposes and should not be
called directly nor overridden.
init in interface javax.servlet.Servletinit in class AbstractSSWAPServletservletConfig - the ServletConfig object of the servlet
javax.servlet.ServletException - on a servlet configuration errorSSWAP,
ServletConfigprotected final void handleRequest(RIG rig)
protected solely for package access
purposes and should not be called directly nor overridden.
handleRequest in class AbstractSSWAPServletrig - RIG invoking the service. This RIG
should be edited and will become the basis for the
RRG returned by the service. Best practice is to
leave most of the RIG untouched, modifying only
the SSWAPObject subgraphs.RIG,
RRG,
RequestEntityTooLargeException,
ClientException
public java.lang.String[] getCommandLine(java.lang.String commandLineStr)
throws TooManyArgumentsException,
ArgumentTooLongException
Exec
getCommandLine in interface ExeccommandLineStr - a concatenation of the RDG's
exec:command and the RIG's
exec:args.
TooManyArgumentsException - if the number of arguments exceeds a preset maximum
ArgumentTooLongException - if an argument exceeds a preset maximumpublic void setEnvironment(java.util.Map<java.lang.String,java.lang.String> env)
Exec
setEnvironment in interface Execenv - the default environment ProcessBuilder
environmentProcessBuilder.environment()
private java.lang.String getStrValue(SSWAPNode sswapNode,
java.net.URI ontologyPredicate)
sswapNode - individual with the propertyontologyPredicate - predicate of the property
private java.lang.Process startProcess(java.lang.String[] commandLine)
throws java.io.IOException
commandLine - the command and its arguments to be executed
java.io.IOException - on any error to execute the process
private void validateArgs(java.lang.String[] args)
throws TooManyArgumentsException,
ArgumentTooLongException
args - array of arguments, not including the command itself
TooManyArgumentsException - if the number of arguments exceeds a preset maximum
ArgumentTooLongException - if the length of any argument exceeds a preset maximum
private void fillPipe(java.io.InputStream inputStream,
java.io.OutputStream stdin)
throws java.io.IOException
inputStream - data to readstdin - stream to write
java.io.IOException - on any error
private void close(java.io.OutputStream stdin,
java.io.InputStream stdout,
java.io.InputStream stderr)
stdin - output stream accepting data as input to send to process to executestdout - input stream for reading data from executed processstderr - input stream for reading error messages from executed processpublic void start()
HotboxPoller
start in interface HotboxPollerpublic void setInterval(int sleepSeconds)
HotboxPoller
setInterval in interface HotboxPollersleepSeconds - number of seconds to wait between pollingpublic void stop()
HotboxPoller
stop in interface HotboxPollerpublic boolean isRunning()
HotboxPoller
isRunning in interface HotboxPoller
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||