public class Install
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private boolean |
addToBoot |
private java.lang.String |
agentJar |
private static java.lang.String |
BYTEMAN_HOME_ENV_VAR
environment variable used to idenitfy the location of the installed byteman release.
|
private static java.lang.String |
BYTEMAN_HOME_SYSTEM_PROP
System property used to idenitfy the location of the installed byteman release.
|
private static java.lang.String |
BYTEMAN_PREFIX |
private java.lang.String |
host |
private java.lang.String |
id |
private int |
port |
private java.lang.String |
props |
private VirtualMachine |
vm |
| Modifier | Constructor and Description |
|---|---|
private |
Install()
only this class creates instances
|
private |
Install(java.lang.String pid,
boolean addToBoot,
java.lang.String host,
int port,
java.lang.String[] properties)
only this class creates instances
|
| Modifier and Type | Method and Description |
|---|---|
private void |
attach()
attach to the Java process identified by the process id supplied on the command line
|
static VMInfo[] |
availableVMs() |
static java.lang.String |
getSystemProperty(java.lang.String id,
java.lang.String property)
attach to the virtual machine identified by id and return the value of the named property.
|
private void |
injectAgent()
get the attached process to upload and install the agent jar using whatever agent options were
configured on the command line
|
static void |
install(java.lang.String pid,
boolean addToBoot,
java.lang.String host,
int port,
java.lang.String[] properties) |
private void |
locateAgent()
check for environment setting BYTEMAN_HOME and use it to identify the location of
the byteman agent jar.
|
void |
locateAgentFromClasspath() |
void |
locateAgentFromHomeDir(java.lang.String bmHome) |
static void |
main(java.lang.String[] args)
main routine for use from command line
Install [-h host] [-p port] [-b] pid
see method
usage(int) for details of the command syntax |
private void |
parseArgs(java.lang.String[] args)
check the supplied arguments and stash away te relevant data
|
private static void |
usage(int exitValue)
print usage information and exit with a specific exit code
|
private java.lang.String agentJar
private java.lang.String id
private int port
private java.lang.String host
private boolean addToBoot
private java.lang.String props
private VirtualMachine vm
private static final java.lang.String BYTEMAN_PREFIX
private static final java.lang.String BYTEMAN_HOME_SYSTEM_PROP
private static final java.lang.String BYTEMAN_HOME_ENV_VAR
private Install()
private Install(java.lang.String pid,
boolean addToBoot,
java.lang.String host,
int port,
java.lang.String[] properties)
public static void main(java.lang.String[] args)
usage(int) for details of the command syntaxargs - the command optionspublic static void install(java.lang.String pid,
boolean addToBoot,
java.lang.String host,
int port,
java.lang.String[] properties)
throws java.lang.IllegalArgumentException,
java.io.FileNotFoundException,
java.io.IOException,
AttachNotSupportedException,
AgentLoadException,
AgentInitializationException
pid - the process id of the JVM into which the agent should be installed or 0 for this JVMaddToBoot - true if the agent jar should be installed into the bootstrap classpathhost - the hostname to be used by the agent listener or null for localhostport - the port to be used by the agent listener or 0 for the default portproperties - an array of System properties to be installed by the agent with optional values e.g.
values such as "org.jboss.byteman.verbose" or "org.jboss.byteman.dump.generated.classes.directory=./dump"java.lang.IllegalArgumentException - if any of the arguments is invalidjava.io.FileNotFoundException - if the agent jar cannot be found using the environment variable BYTEMAN_HOME
or the System property org.jboss.byteman.home and cannot be located in the current classpathjava.io.IOException - if the byteman jar cannot be opened or uploaded to the requested JVMAttachNotSupportedException - if the requested JVM cannot be attached toAgentLoadException - if an error occurs during upload of the agent into the JVMAgentInitializationException - if the agent fails to initialize after loading. this almost always
indicates that the agent is already loaded into the JVMpublic static VMInfo[] availableVMs()
public static java.lang.String getSystemProperty(java.lang.String id,
java.lang.String property)
id - the id of the machine to attach toproperty - the proeprty to be retrievedprivate void parseArgs(java.lang.String[] args)
args - the value supplied to mainprivate void locateAgent()
throws java.io.IOException
java.io.IOExceptionpublic void locateAgentFromHomeDir(java.lang.String bmHome)
throws java.io.IOException
java.io.IOExceptionpublic void locateAgentFromClasspath()
throws java.io.IOException
java.io.IOExceptionprivate void attach()
throws AttachNotSupportedException,
java.io.IOException,
java.lang.IllegalArgumentException
AttachNotSupportedExceptionjava.io.IOExceptionjava.lang.IllegalArgumentExceptionprivate void injectAgent()
throws AgentLoadException,
AgentInitializationException,
java.io.IOException
AgentLoadExceptionAgentInitializationExceptionjava.io.IOExceptionprivate static void usage(int exitValue)
exitValue - the value to be supplied to the exit call