public class Submit extends Object
Modifier and Type | Field | Description |
---|---|---|
static String |
DEFAULT_ADDRESS |
|
static int |
DEFAULT_PORT |
Constructor | 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(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(String address,
int port,
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 | Description |
---|---|---|
String |
addJarsToBootClassloader(List<String> jarPaths) |
This adds the given list of files to the Byteman agent's boot
classloader.
|
String |
addJarsToSystemClassloader(List<String> jarPaths) |
This adds the given list of files to the Byteman agent's system
classloader.
|
String |
addRules(Map<String,String> rules) |
Deprecated.
|
String |
addRulesFromFiles(List<String> filePaths) |
Deploys rules into Byteman, where the rule definitions are found in the
local files found at the given paths.
|
String |
addRulesFromResources(List<InputStream> resourceStreams) |
Deploys rules into Byteman, where the rule definitions are found in the
given streams.
|
String |
addScripts(List<ScriptText> scripts) |
Deploys rule scripts into Byteman
|
String |
deleteAllRules() |
Tells the Byteman agent to delete all rules.
|
String |
deleteRules(Map<String,String> rules) |
Deprecated.
|
String |
deleteRulesFromFiles(List<String> filePaths) |
Deletes rules from Byteman, where the rule definitions are found in the
local files found at the given paths.
|
String |
deleteRulesFromResources(List<InputStream> resourceStreams) |
Deletes rules from Byteman, where the rule definitions are found in the
given streams.
|
String |
deleteScripts(List<ScriptText> scripts) |
Deletes rules from Byteman.
|
String |
determineRuleName(String ruleDefinition) |
Given the content of an individual rule definition, this will
return the name of that rule.
|
String |
getAddress() |
|
String |
getAgentVersion() |
Returns the version of the remote Byteman agent.
|
Map<String,String> |
getAllRules() |
Deprecated.
|
List<ScriptText> |
getAllScripts() |
Gets all deployed rules from the agent just as
listAllRules() , but will return the rules
organized by script (i.e. |
String |
getClientVersion() |
Returns the version of this Byteman submit client.
|
List<String> |
getLoadedBootClassloaderJars() |
Returns a list of jars that were added to the Byteman agent's boot classloader.
|
List<String> |
getLoadedSystemClassloaderJars() |
Returns a list of jars that were added to the Byteman agent's system classloader.
|
int |
getPort() |
|
String |
listAllRules() |
Tells the Byteman agent to list all deployed rules.
|
Properties |
listSystemProperties() |
Returns the system properties set in the Byteman agent VM.
|
static void |
main(String[] args) |
A main routine which submits requests to the Byteman agent utilizing the Java API.
|
String |
setSystemProperties(Properties propsToSet) |
Sets system properties in the Byteman agent VM.
|
List<String> |
splitAllRulesFromScript(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.
|
String |
submitRequest(String request) |
Submits the generic request string to the Byteman agent for processing.
|
public static final String DEFAULT_ADDRESS
public static final int DEFAULT_PORT
public Submit()
public Submit(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(String address, int port, 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.out
- the print stream used for writing outputpublic String getAddress()
public int getPort()
host
.public String getAgentVersion() throws Exception
Exception
- if the request failedpublic String getClientVersion() throws Exception
null
if unknownException
- if the request failedpublic String deleteAllRules() throws Exception
Exception
- if the request failedpublic String listAllRules() throws Exception
Exception
- if the request failedpublic List<ScriptText> getAllScripts() throws 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.Exception
- if the request failed@Deprecated public Map<String,String> getAllRules() throws Exception
Exception
- if the request failedpublic List<String> splitAllRulesFromScript(String scriptContent) throws Exception
getAllScripts()
in case you need the scripts' individual rules.scriptContent
- the actual content of a script (i.e. the rule definitions)Exception
- if an string processing error occurspublic String determineRuleName(String ruleDefinition) throws Exception
ruleDefinition
- the actual content of an individual rulenull
if it could not be determinedException
- if the name cannot be determinedpublic String addJarsToBootClassloader(List<String> jarPaths) throws Exception
jarPaths
- the paths to the library .jar files that will be loadedException
- if the request failedpublic String addJarsToSystemClassloader(List<String> jarPaths) throws Exception
jarPaths
- the paths to the library .jar files that will be loadedException
- if the request failedpublic List<String> getLoadedBootClassloaderJars() throws Exception
Exception
- if the request failedpublic List<String> getLoadedSystemClassloaderJars() throws Exception
Exception
- if the request failedpublic String addRulesFromFiles(List<String> filePaths) throws Exception
filePaths
- the local files containing the rule definitions to be deployed
to BytemanException
- if the request failedpublic String addRulesFromResources(List<InputStream> resourceStreams) throws Exception
resourceStreams
- input streams containing the rule definitions to be deployed
to BytemanException
- if the request failedpublic String addScripts(List<ScriptText> scripts) throws Exception
scripts
- scripts to be deployed to BytemanException
- if the request failed@Deprecated public String addRules(Map<String,String> rules) throws Exception
rules
- the rules to be addedException
- if the request failedpublic String deleteRulesFromFiles(List<String> filePaths) throws Exception
filePaths
- the local files containing the rule definitions to be deleted
from BytemanException
- if the request failedpublic String deleteRulesFromResources(List<InputStream> resourceStreams) throws Exception
resourceStreams
- the URLS to files containing the rule definitions to be deleted
from BytemanException
- if the request failedpublic String deleteScripts(List<ScriptText> scripts) throws Exception
scripts
- rule scripts to be deleted from BytemanException
- if the request failed@Deprecated public String deleteRules(Map<String,String> rules) throws Exception
rules
- the rules to be deletedException
- if the request failedpublic String setSystemProperties(Properties propsToSet) throws Exception
propsToSet
- system properties to set in the Byteman agent VMException
- if the request failedpublic Properties listSystemProperties() throws Exception
Exception
- if the request failedpublic String submitRequest(String request) throws Exception
request
- the request to submitException
- if the request failedpublic static void main(String[] args)
args
- see usage(PrintStream, int)
for a description of the allowed argumentsCopyright © 2018. All rights reserved.