|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.actf.validation.javapp.launch.ValidationLauncher
public abstract class ValidationLauncher
a launcher used to launch and simultaneously validate Java rich-client applications. The primary
purpose of this launcher is to form the command line that launches the AOP-based validation of a Java application. A Java application
may be launched via either a main(String[])
method of a Java class or via an
executable file, which is platform dependent. The sole criterion of the executable is that
it must provide a way for this launcher to pass arguments to its underlying JVM.
Currently, ACTF supports AspectJ AOP.
Nested Class Summary | |
---|---|
protected class |
ValidationLauncher.Path
|
Field Summary | |
---|---|
protected ValidationLauncher.Path |
aopPath
|
protected ValidationLauncher.Path |
bootClasspath
|
protected ValidationLauncher.Path |
bootClasspath_a
|
protected ValidationLauncher.Path |
bootClasspath_p
|
protected ValidationLauncher.Path |
classpath
|
static String |
DISTINCT_JVM_KEY
system property to indicate distinct JVM (i.e. running apart from Eclipse environment |
static String |
EXTERNAL_JVM_DUMP
system property indicating location of dump from launched JVM |
static String |
JAVA_HOME_KEY
|
protected IConfiguration |
valConfig
|
Constructor Summary | |
---|---|
ValidationLauncher(String executableName)
create a new launcher using the specified executable. |
|
ValidationLauncher(String executableName,
String aopFilename)
create a validation launcher. |
|
ValidationLauncher(String executableName,
String aopFilename,
String workingDir)
create a validation launcher. |
Method Summary | |
---|---|
void |
addJvmArgument(String swtch,
String value)
add an argument to be passed to the JVM. |
void |
addLaunchListener(ILaunchListener listener)
add a LaunchListener to be notified when the start or completion of a launch takes place or when a launch has somehow measurably progressed. |
void |
addReportListener(IReportListener listener)
add a ReportListener to be notified of report-related events |
void |
addSystemProperties(Map props)
add all of the system properties contained in the map |
void |
addSystemProperty(String key,
String value)
add a system property to be added to the arguments to the JVM launched by this process. |
String[] |
allJvmArguments()
returns all the JVM arguments held by this launcher. |
protected String[] |
allSystemProperties()
get the registered system properties, each as a string prepared for the command line. |
void |
appendToClasspath(String path)
append the given path to the formed classpath for the launcher. |
protected void |
configureResourceServer()
|
protected void |
fireLaunchCompletedEvent()
|
protected void |
fireLaunchInitiatedEvent()
|
protected void |
fireLaunchProgressedEvent()
|
String |
getClasspath()
return the classpath |
protected String |
getExecutableName()
|
protected String |
getExecutionArguments()
return the execution arguments |
protected String |
getJavaPath()
get the fully-qualified path to the java executable. |
protected String |
getJvmSubstitutionParameter()
return the JVM substitution parameter |
Process |
getProcess()
Return the process object that has been launched. |
protected String |
getSystemProperty(String key)
|
String |
getWorkingDirectory()
return the working directory for the process launched |
protected boolean |
isUsingJava14()
return whether or not this launcher is using a JVM of version 1.4.2. |
void |
launch()
called to launch the AOP-based validation of the Java application. |
static int |
launchExternalProcess(String[] exec,
File workingDir,
String out,
String err)
launch an external OS process |
static int |
launchExternalProcess(String[] exec,
File workingDir,
String out,
String err,
ValidationLauncher launcher)
launch an external OS process |
protected void |
launchProcess()
launches a process for running/validating the application. |
void |
prepareForLaunch()
prepares for the launch by adding system properties used by ACTF and starting the ResourceServer . |
void |
prependToClasspath(String path)
prepend the given path to the formed classpath for the launcher. |
protected void |
processSwtResources(ValidationLauncher.Path classPath,
ValidationLauncher.Path libPath)
process the SWT .jar and .dll files. |
protected String |
quoteString(String str)
quote the given string |
void |
removeLaunchListener(ILaunchListener listener)
remove the specified listener from the list of listeners to be notified when launch events take place. |
void |
removeReportListener(IReportListener listener)
remove the specified listener from the list of listeners to be notified when report events take place. |
void |
setClasspath(String cp)
set the classpath used by this launcher. |
void |
setExecutionArguments(String args)
set the execution arguments for the application being launched/validated. |
void |
setJvmSubstitutionParameter(String jvmSub)
set the JVM substitution parameter to be used by this launcher. |
void |
setProcess(Process p)
Once get the process, set the process object to be the process that been launched. |
void |
setUsingJava14(boolean java14)
set whether or not this launcher is using a JVM v. 1.4.2. |
void |
setWorkingDirectory(String dir)
set the working directory. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String JAVA_HOME_KEY
public static final String DISTINCT_JVM_KEY
public static final String EXTERNAL_JVM_DUMP
protected ValidationLauncher.Path aopPath
protected ValidationLauncher.Path bootClasspath_p
protected ValidationLauncher.Path bootClasspath_a
protected ValidationLauncher.Path bootClasspath
protected ValidationLauncher.Path classpath
protected IConfiguration valConfig
Constructor Detail |
---|
public ValidationLauncher(String executableName)
executableName
- - name of executableValidationLauncher(String, String)
public ValidationLauncher(String executableName, String aopFilename)
executableName
- - name of executableaopFilename
- - name of AOP file specifying aspects, pointcuts, and/or binding advicepublic ValidationLauncher(String executableName, String aopFilename, String workingDir)
executableName
- - name of executableaopFilename
- - AOP file containing bindings, aspects, pointcuts, etc.workingDir
- - working directorysetWorkingDirectory(String)
Method Detail |
---|
public void setProcess(Process p)
p
- processpublic Process getProcess()
protected void configureResourceServer()
public void addReportListener(IReportListener listener)
listener
- - listener to be called upon report eventpublic void removeReportListener(IReportListener listener)
listener
- - listener to be removedpublic void addLaunchListener(ILaunchListener listener)
listener
- - listener to be called upon launch eventpublic void removeLaunchListener(ILaunchListener listener)
listener
- - listener to be removedpublic void addJvmArgument(String swtch, String value)
null
.
Note: The JVM arguments -classpath/-cp, -Xbootclasspath and its variants, and system properties should not be added in this way.
swtch
- - JVM switchvalue
- - value of switch or null
if switch is to occur
on the command line without an argumentaddSystemProperty(String, String)
public void addSystemProperty(String key, String value)
key
- value
- public void addSystemProperties(Map props)
props
- - system properties with keys and values of type java.lang.String
public String getWorkingDirectory()
setWorkingDirectory(String)
public void setWorkingDirectory(String dir) throws IllegalArgumentException
dir
- - working directory (may not be null
)
IllegalArgumentException
- if specified directory already exists as a file or
if the specified directory does not exist and cannot be createdprotected String getJvmSubstitutionParameter()
setJvmSubstitutionParameter(String)
public void setJvmSubstitutionParameter(String jvmSub)
For example, if we are to validate the Eclipse workbench, we must pass arguments to the JVM launched by eclipse.exe on the Windows platform. The execution arguments for this launcher, then, must include:
-vmargs
so that ACTF knows where on the command line to place the JVM arguments. This argument may be left null
for launchers launching Java classes.
jvmSub
- - substitution parameter for this launcherprotected String getExecutableName()
protected String getExecutionArguments()
setExecutionArguments(String)
public void setExecutionArguments(String args)
null
, then these arguments are taken
as arguments to the executable being launched. For cases in which the JVM substitution parameter
is null
, it is assumed that a standard Java class is being launched and that
these arguments are being passed to the main(String[])
method.
args
- - execution argumentssetJvmSubstitutionParameter(String)
public String getClasspath()
public void setClasspath(String cp)
The specified classpath must be a legitimate set of paths with the syntax specified of the underlying operating system.
cp
- - classpath for JVMprependToClasspath(String)
,
appendToClasspath(String)
public void prependToClasspath(String path)
setClasspath
or appendToClasspath
methods, a new classpath is formed.
path
- - path to prependsetClasspath(String)
,
appendToClasspath(String)
public void appendToClasspath(String path)
setClasspath
or prependToClasspath
methods, a new classpath is formed.
path
- - path to appendsetClasspath(String)
,
prependToClasspath(String)
protected boolean isUsingJava14()
true
if JVM being launched by this process is 1.4.2,
false
otherwisesetUsingJava14(boolean)
public void setUsingJava14(boolean java14)
false
(the default), the JVM being used is assumed
to be version 1.5.0 or higher. In this case, the 'javaagent' command line
option will be used to take advantage of the instrumentation capabilities of JDK 5.0 and
higher whereas earlier versions must rely upon manipulating the system class loader or the bytecode of java.lang.ClassLoader
to effect weaving of aspect code.
java14
- - set to true
if JVM is version 1.4.2 onlypublic void launch()
LaunchEvent
object and fires a launchInitiated
event
launchProcess
method
LaunchEvent
object
launchCompleted
event
protected void launchProcess() throws Exception
preLaunch()
, and launches the JVM.
Exception
public void prepareForLaunch() throws Exception
ResourceServer
.
Clients may overwrite, but should always call super.prepareForLaunch()
.
Exception
protected void fireLaunchInitiatedEvent()
protected void fireLaunchCompletedEvent()
protected void fireLaunchProgressedEvent()
protected String getJavaPath()
protected String getSystemProperty(String key)
protected String[] allSystemProperties()
null
, it is not included in the returned string.
protected String quoteString(String str)
str
-
""str""
protected void processSwtResources(ValidationLauncher.Path classPath, ValidationLauncher.Path libPath) throws IOException
classPath
- - classpath to be modifiedlibPath
- - library path to be modified
IOException
public String[] allJvmArguments()
addJvmArgument
method
public static int launchExternalProcess(String[] exec, File workingDir, String out, String err)
exec
- - command line to be executedworkingDir
- - working directoryout
- - destination of output of processerr
- - destination for error stream from process
public static int launchExternalProcess(String[] exec, File workingDir, String out, String err, ValidationLauncher launcher)
exec
- - command line to be executedworkingDir
- - working directoryout
- - destination of output of processerr
- - destination for error stream from processlauncher
- - launcher launching process
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |