org.jboss.varia.process
Class ChildProcessService

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.varia.process.ChildProcessService
All Implemented Interfaces:
MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , Service (src) , ServiceMBean (src)

public class ChildProcessService
extends ServiceMBeanSupport (src)

A service to manage a child process.


Nested Class Summary
protected static class ChildProcessService.ReaderLoggerAdapter (src)
           
 
Field Summary
protected  java.lang.Process childProcess
          The child, we are so proud.
protected  java.lang.String commandLine
          The command line of the process to execute.
protected  java.util.Properties env
          The environment for the process.
protected  ChildProcessService.ReaderLoggerAdapter (src) errorAdapter
          The input adapter, which takes the process' STDERR and turns them into logger calls.
protected  ChildProcessService.ReaderLoggerAdapter (src) inputAdapter
          The input adapter, which takes the process' STDOUT and turns them into logger calls.
protected  java.lang.String loggerAdapterName
          The name of the logger adapter for the child process' streams.
protected  java.io.File workingDir
          The working directory of the process.
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
ChildProcessService()
           
 
Method Summary
 java.lang.String getCommandLine()
           
 java.util.Properties getEnvironment()
           
 java.lang.Integer getExitValue()
           
 java.lang.String getLoggerAdapterName()
           
 java.io.File getWorkingDirectory()
           
protected  java.lang.String[] makeEnvArray(java.util.Properties props)
           
 void setCommandLine(java.lang.String commandLine)
           
 void setEnvironment(java.util.Properties env)
           
 void setLoggerAdapterName(java.lang.String name)
           
 void setWorkingDirectory(java.io.File dir)
           
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getName, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

commandLine

protected java.lang.String commandLine
The command line of the process to execute.


env

protected java.util.Properties env
The environment for the process.


workingDir

protected java.io.File workingDir
The working directory of the process.


childProcess

protected java.lang.Process childProcess
The child, we are so proud.


loggerAdapterName

protected java.lang.String loggerAdapterName
The name of the logger adapter for the child process' streams.


inputAdapter

protected ChildProcessService.ReaderLoggerAdapter (src)  inputAdapter
The input adapter, which takes the process' STDOUT and turns them into logger calls.


errorAdapter

protected ChildProcessService.ReaderLoggerAdapter (src)  errorAdapter
The input adapter, which takes the process' STDERR and turns them into logger calls.

Constructor Detail

ChildProcessService

public ChildProcessService()
Method Detail

setCommandLine

public void setCommandLine(java.lang.String commandLine)

getCommandLine

public java.lang.String getCommandLine()

setEnvironment

public void setEnvironment(java.util.Properties env)

getEnvironment

public java.util.Properties getEnvironment()

setWorkingDirectory

public void setWorkingDirectory(java.io.File dir)

getWorkingDirectory

public java.io.File getWorkingDirectory()

getExitValue

public java.lang.Integer getExitValue()

setLoggerAdapterName

public void setLoggerAdapterName(java.lang.String name)

getLoggerAdapterName

public java.lang.String getLoggerAdapterName()

makeEnvArray

protected java.lang.String[] makeEnvArray(java.util.Properties props)

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception