org.rhq.plugins.byteman
Class BytemanScriptComponent

java.lang.Object
  extended by org.rhq.plugins.byteman.BytemanScriptComponent
All Implemented Interfaces:
AvailabilityFacet, DeleteResourceFacet, ResourceComponent<BytemanAgentComponent>

public class BytemanScriptComponent
extends Object
implements ResourceComponent<BytemanAgentComponent>, DeleteResourceFacet

Component that represents a script that is deployed in a Byteman agent.

Author:
John Mazzitelli

Constructor Summary
BytemanScriptComponent()
           
 
Method Summary
protected  void addDeployedScript()
          This method will attempt to ensure that the Byteman agent has the managed script loaded.
 void deleteResource()
           
 AvailabilityType getAvailability()
           
 org.jboss.byteman.agent.submit.Submit getBytemanClient()
           
protected  File getManagedScriptFile(String scriptPath)
          This returns a File representation of a managed script found at the given path.
 List<String> getRules()
          Returns a cached copy of all known rules for the script since the last availability check was made.
 void start(ResourceContext<BytemanAgentComponent> context)
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BytemanScriptComponent

public BytemanScriptComponent()
Method Detail

start

public void start(ResourceContext<BytemanAgentComponent> context)
Specified by:
start in interface ResourceComponent<BytemanAgentComponent>

stop

public void stop()
Specified by:
stop in interface ResourceComponent<BytemanAgentComponent>

getAvailability

public AvailabilityType getAvailability()
Specified by:
getAvailability in interface AvailabilityFacet

deleteResource

public void deleteResource()
                    throws Exception
Specified by:
deleteResource in interface DeleteResourceFacet
Throws:
Exception

getRules

public List<String> getRules()
Returns a cached copy of all known rules for the script since the last availability check was made.

Returns:
the last known set of rules that were loaded in the remote Byteman agent. null if a problem occurred attempting to get the scripts

getBytemanClient

public org.jboss.byteman.agent.submit.Submit getBytemanClient()

getManagedScriptFile

protected File getManagedScriptFile(String scriptPath)
This returns a File representation of a managed script found at the given path. This returns null if the given script path is not a script managed by this plugin. Even if scriptPath points to a valid script file, if it is not managed by this plugin, null will be returned.

Parameters:
scriptPath - path to check to see if its a managed script, to be converted to a File if so
Returns:
the File of the managed script, or null if the given path is not a managed script

addDeployedScript

protected void addDeployedScript()
                          throws Exception
This method will attempt to ensure that the Byteman agent has the managed script loaded. If a user created this script resource via RHQ (i.e. using the create-child-facet of the parent resource), then this method will always try to ensure that script is loaded in the Byteman agent. If it isn't, it reloads it. If it is, this method does nothing. If this script resource represents an externally managed script (that is, the script was added to the Byteman agent via some other mechanism, such as Byteman's CLI tool), this method will do nothing - in this case, this resource component will declare the resource's availability as DOWN.

Throws:
Exception


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.