public class Submit
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private class |
Submit.Comm |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
address |
static java.lang.String |
DEFAULT_ADDRESS |
static int |
DEFAULT_PORT |
private java.io.PrintStream |
out |
private int |
port |
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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) |
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
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.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 unknownjava.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 rulenull
if it could not be determinedjava.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 loadedjava.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 loadedjava.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 Bytemanjava.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 Bytemanjava.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 Bytemanjava.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 Bytemanjava.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 VMjava.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 submitjava.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)