|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jboss.byteman.agent.submit.Submit
public class Submit
A Java API that can be used to submit requests to a remote Byteman agent. This also includes a main routine for use as a command-line utility. This object provides a means by which you communicate with the Byteman agent at runtime allowing loading, reloading, unloading of rules and listing of the current rule set and any successful or failed attempts to inject, parse and typecheck the rules. Note that this class is completely standalone and has no dependencies on any other Byteman class. It can be shipped alone in a client jar to be used as a very small app.
Nested Class Summary | |
---|---|
private class |
Submit.Comm
|
Field Summary | |
---|---|
private java.lang.String |
address
|
static java.lang.String |
DEFAULT_ADDRESS
|
static int |
DEFAULT_PORT
|
private java.io.PrintStream |
out
|
private int |
port
|
Constructor Summary | |
---|---|
Submit()
Create a client that will connect to a Byteman agent on the default host and port and writing output to System.out. |
|
Submit(java.lang.String address,
int port)
Create a client that will connect to a Byteman agent on the given host and port and writing output to System.out. |
|
Submit(java.lang.String address,
int port,
java.io.PrintStream out)
Create a client that will connect to a Byteman agent on the given host and port and writing output to System.out. |
Method Summary | |
---|---|
java.lang.String |
addJarsToBootClassloader(java.util.List<java.lang.String> jarPaths)
This adds the given list of files to the Byteman agent's boot classloader. |
java.lang.String |
addJarsToSystemClassloader(java.util.List<java.lang.String> jarPaths)
This adds the given list of files to the Byteman agent's system classloader. |
java.lang.String |
addRules(java.util.Map<java.lang.String,java.lang.String> rules)
Deprecated. |
java.lang.String |
addRulesFromFiles(java.util.List<java.lang.String> filePaths)
Deploys rules into Byteman, where the rule definitions are found in the local files found at the given paths. |
java.lang.String |
addScripts(java.util.List<ScriptText> scripts)
Deploys rule scripts into Byteman |
private boolean |
confirmRuleFileValidity(java.lang.String path)
|
java.lang.String |
deleteAllRules()
Tells the Byteman agent to delete all rules. |
java.lang.String |
deleteRules(java.util.Map<java.lang.String,java.lang.String> rules)
Deprecated. |
java.lang.String |
deleteRulesFromFiles(java.util.List<java.lang.String> filePaths)
Deletes rules from Byteman, where the rule definitions are found in the local files found at the given paths. |
java.lang.String |
deleteScripts(java.util.List<ScriptText> scripts)
Deletes rules from Byteman. |
java.lang.String |
determineRuleName(java.lang.String ruleDefinition)
Given the content of an individual rule definition, this will return the name of that rule. |
java.lang.String |
getAddress()
|
java.lang.String |
getAgentVersion()
Returns the version of the remote Byteman agent. |
java.util.Map<java.lang.String,java.lang.String> |
getAllRules()
Deprecated. |
java.util.List<ScriptText> |
getAllScripts()
Gets all deployed rules from the agent just as listAllRules() , but will return the rules
organized by script (i.e. |
java.lang.String |
getClientVersion()
Returns the version of this Byteman submit client. |
java.util.List<java.lang.String> |
getLoadedBootClassloaderJars()
Returns a list of jars that were added to the Byteman agent's boot classloader. |
java.util.List<java.lang.String> |
getLoadedSystemClassloaderJars()
Returns a list of jars that were added to the Byteman agent's system classloader. |
int |
getPort()
|
private java.util.List<ScriptText> |
getRulesFromRuleFiles(java.util.List<java.lang.String> filePaths)
|
java.lang.String |
listAllRules()
Tells the Byteman agent to list all deployed rules. |
java.util.Properties |
listSystemProperties()
Returns the system properties set in the Byteman agent VM. |
static void |
main(java.lang.String[] args)
A main routine which submits requests to the Byteman agent utilizing the Java API. |
java.lang.String |
setSystemProperties(java.util.Properties propsToSet)
Sets system properties in the Byteman agent VM. |
java.util.List<java.lang.String> |
splitAllRulesFromScript(java.lang.String scriptContent)
Given the content of a script (which will be one or more rule definitions), this will return each rule definition as an individual string within the returned list. |
java.lang.String |
submitRequest(java.lang.String request)
Submits the generic request string to the Byteman agent for processing. |
private static void |
usage(java.io.PrintStream out,
int exitCode)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_ADDRESS
public static final int DEFAULT_PORT
private final int port
private final java.lang.String address
private java.io.PrintStream out
Constructor Detail |
---|
public Submit()
public Submit(java.lang.String address, int port)
address
- the hostname or IP address of the machine where Byteman agent
is located. If null
, the default host is used.port
- the port that the Byteman agent is listening to.
If 0 or less, the default port is used.public Submit(java.lang.String address, int port, java.io.PrintStream out)
address
- the hostname or IP address of the machine where Byteman agent
is located. If null
, the default host is used.port
- the port that the Byteman agent is listening to.
If 0 or less, the default port is used.Method Detail |
---|
public java.lang.String getAddress()
public int getPort()
host
.public java.lang.String getAgentVersion() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.lang.String getClientVersion() throws java.lang.Exception
null
if unknown
java.lang.Exception
- if the request failedpublic java.lang.String deleteAllRules() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.lang.String listAllRules() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.util.List<ScriptText> getAllScripts() throws java.lang.Exception
listAllRules()
, but will return the rules
organized by script (i.e. rule file). Each "script",
or rule file, has a set of rules associated with it.
java.lang.Exception
- if the request failed@Deprecated public java.util.Map<java.lang.String,java.lang.String> getAllRules() throws java.lang.Exception
java.lang.Exception
public java.util.List<java.lang.String> splitAllRulesFromScript(java.lang.String scriptContent) throws java.lang.Exception
getAllScripts()
in case you need the scripts' individual rules.
scriptContent
- the actual content of a script (i.e. the rule definitions)
java.lang.Exception
public java.lang.String determineRuleName(java.lang.String ruleDefinition) throws java.lang.Exception
ruleDefinition
- the actual content of an individual rule
null
if it could not be determined
java.lang.Exception
public java.lang.String addJarsToBootClassloader(java.util.List<java.lang.String> jarPaths) throws java.lang.Exception
jarPaths
- the paths to the library .jar files that will be loaded
java.lang.Exception
- if the request failedpublic java.lang.String addJarsToSystemClassloader(java.util.List<java.lang.String> jarPaths) throws java.lang.Exception
jarPaths
- the paths to the library .jar files that will be loaded
java.lang.Exception
- if the request failedpublic java.util.List<java.lang.String> getLoadedBootClassloaderJars() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.util.List<java.lang.String> getLoadedSystemClassloaderJars() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.lang.String addRulesFromFiles(java.util.List<java.lang.String> filePaths) throws java.lang.Exception
filePaths
- the local files containing the rule definitions to be deployed
to Byteman
java.lang.Exception
- if the request failedpublic java.lang.String addScripts(java.util.List<ScriptText> scripts) throws java.lang.Exception
scripts
- scripts to be deployed to Byteman
java.lang.Exception
- if the request failed@Deprecated public java.lang.String addRules(java.util.Map<java.lang.String,java.lang.String> rules) throws java.lang.Exception
rules
-
java.lang.Exception
public java.lang.String deleteRulesFromFiles(java.util.List<java.lang.String> filePaths) throws java.lang.Exception
filePaths
- the local files containing the rule definitions to be deleted
from Byteman
java.lang.Exception
- if the request failedpublic java.lang.String deleteScripts(java.util.List<ScriptText> scripts) throws java.lang.Exception
scripts
- rule scripts to be deleted from Byteman
java.lang.Exception
- if the request failed@Deprecated public java.lang.String deleteRules(java.util.Map<java.lang.String,java.lang.String> rules) throws java.lang.Exception
rules
-
java.lang.Exception
public java.lang.String setSystemProperties(java.util.Properties propsToSet) throws java.lang.Exception
propsToSet
- system properties to set in the Byteman agent VM
java.lang.Exception
- if the request failedpublic java.util.Properties listSystemProperties() throws java.lang.Exception
java.lang.Exception
- if the request failedpublic java.lang.String submitRequest(java.lang.String request) throws java.lang.Exception
request
- the request to submit
java.lang.Exception
- if the request failedprivate java.util.List<ScriptText> getRulesFromRuleFiles(java.util.List<java.lang.String> filePaths) throws java.lang.Exception
java.lang.Exception
private boolean confirmRuleFileValidity(java.lang.String path)
public static void main(java.lang.String[] args)
args
- see #usage(int)
for a description of the allowed argumentsprivate static void usage(java.io.PrintStream out, int exitCode)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |