org.oddjob.jobs
Class LaunchJob

java.lang.Object
  extended by org.oddjob.jobs.LaunchJob
All Implemented Interfaces:
Serializable, Runnable

public class LaunchJob
extends Object
implements Runnable, Serializable

Description

Launch an application via it's main method. The application is launched in same JVM as Oddjob, but in it's own class loader.

Example

An Oddjob the launches Oddjob. args[0] is org.oddjob.Main, args[1] is the oddjob home directory. The classes directory is included in the class path for the log4j.properties file otherwise Log4j would attempt to use one from ClassLoader.getSystemLoader() which will be the original application class loader.
<oddjob id="this">
    <job>
        <launch className="${this.args[1]}">
            <args>
                <list>
                    <values>
                        <value value="-nb"/>
                        <value value="-f"/>
                        <value value="${this.args[0]}/test/conf/echo-class-loader.xml"/>
                    </values>
                </list>
            </args>
            <classLoader>
                <url-class-loader noInherit="true">
                    <files>
                        <files files="${this.args[0]}/lib/*.jar">
                            <list>
                                <file file="${this.args[0]}/opt/classes"/>
                            </list>
                        </files>
                    </files>
                </url-class-loader>
            </classLoader>
        </launch>
    </job>
</oddjob>
See Also:
Serialized Form
Author:
rob

Constructor Summary
LaunchJob()
           
 
Method Summary
 String[] getArgs()
           
 ClassLoader getClassLoader()
           
 String getClassName()
           
 String getName()
           
 void run()
           
 void setArgs(String[] args)
           
 void setClassLoader(ClassLoader classLoader)
           
 void setClassName(String className)
           
 void setName(String name)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LaunchJob

public LaunchJob()
Method Detail

run

public void run()
Specified by:
run in interface Runnable

getClassLoader

public ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(ClassLoader classLoader)

Property: classLoader

Description: The class loader in which to find the main class.

Required: Yes.


getClassName

public String getClassName()

setClassName

public void setClassName(String className)

Property: className

Description: The name of the class that contains the main method.

Required: Yes.


getArgs

public String[] getArgs()

setArgs

public void setArgs(String[] args)

Property: args

Description: The arguments to pass to main.

Required: No.


getName

public String getName()

setName

public void setName(String name)

toString

public String toString()
Overrides:
toString in class Object