org.rhq.core.domain.plugin
Class AbstractPlugin

java.lang.Object
  extended by org.rhq.core.domain.plugin.AbstractPlugin
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Plugin, ServerPlugin

public class AbstractPlugin
extends Object
implements Serializable

Base plugin implementation that agent and server plugin implementations extend.

See Also:
Serialized Form

Field Summary
static String TABLE_NAME
           
 
Constructor Summary
AbstractPlugin()
           
AbstractPlugin(int id, String name, String path, String displayName, boolean enabled, PluginStatusType status, String description, String help, String md5, String version, String ampsVersion, PluginDeploymentType deployment, long ctime, long mtime)
          Constructor that can build the full object except for the content byte array.
AbstractPlugin(String name, String path)
          Constructor for Plugin.
AbstractPlugin(String name, String path, byte[] content)
          Constructor for Plugin.
AbstractPlugin(String name, String path, String md5)
          Constructor for Plugin.
 
Method Summary
 boolean equals(Object obj)
           
 String getAmpsVersion()
           
 byte[] getContent()
          Returns the actual content of the plugin file.
 long getCtime()
          See the javadoc of getMtime() for information about this field and its relationship with "mtime".
 PluginDeploymentType getDeployment()
          Indicates how the plugin gets deployed (e.g. running in the agent or in the server).
 String getDescription()
           
 String getDisplayName()
           
 String getHelp()
           
 int getId()
           
 String getMd5()
           
 String getMD5()
           
 long getMtime()
          The "mtime" of the plugin has slightly different semantics than other "mtime" values found elsewhere.
 String getName()
           
 String getPath()
          Returns the actual name of the plugin jar.
 PluginStatusType getStatus()
           
 String getVersion()
           
 int hashCode()
           
 boolean isEnabled()
           
 void setAmpsVersion(String ampsVersion)
           
 void setContent(byte[] content)
           
 void setCtime(long ctime)
           
 void setDeployment(PluginDeploymentType deployment)
           
 void setDescription(String description)
           
 void setDisplayName(String displayName)
           
 void setEnabled(boolean enabled)
           
 void setHelp(String help)
           
 void setId(int id)
           
 void setMd5(String md5)
           
 void setMD5(String md5)
           
 void setMtime(long mtime)
          This entity does not automatically update the "mtime" when it is updated via a PreUpdate annotation, therefore, the owner of this entity needs to explicitly call this setter in order to set the "mtime".
 void setName(String name)
           
 void setPath(String path)
          Ensure that the path being set does not include any directory names.
 void setStatus(PluginStatusType status)
           
 void setVersion(String version)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TABLE_NAME

public static final String TABLE_NAME
See Also:
Constant Field Values
Constructor Detail

AbstractPlugin

public AbstractPlugin()

AbstractPlugin

public AbstractPlugin(String name,
                      String path)
Constructor for Plugin.

Parameters:
name - the logical name of the plugin
path - the actual filename of the plugin jar (see getPath())

AbstractPlugin

public AbstractPlugin(String name,
                      String path,
                      String md5)
Constructor for Plugin. Note that this allows you to provide an MD5 without providing the plugin's actual content. If you wish to persist this entity in the database, you should either provide the content or update the entity later by streaming the file content to the content column.

Parameters:
name - the logical name of the plugin
path - the actual filename of the plugin jar (see getPath())
md5 - the MD5 hash string of the plugin jar contents

AbstractPlugin

public AbstractPlugin(String name,
                      String path,
                      byte[] content)
Constructor for Plugin.

Parameters:
name - the logical name of the plugin
path - the actual filename of the plugin jar (see getPath())
content - the actual jar file contents (the MD5 hash string will be generated from this)

AbstractPlugin

public AbstractPlugin(int id,
                      String name,
                      String path,
                      String displayName,
                      boolean enabled,
                      PluginStatusType status,
                      String description,
                      String help,
                      String md5,
                      String version,
                      String ampsVersion,
                      PluginDeploymentType deployment,
                      long ctime,
                      long mtime)
Constructor that can build the full object except for the content byte array. This is used mainly for the named queries that want to return a Plugin object but does not eagerly load in the content array.

Method Detail

getId

public int getId()

setId

public void setId(int id)

getName

public String getName()

setName

public void setName(String name)

getCtime

public long getCtime()
See the javadoc of getMtime() for information about this field and its relationship with "mtime".

Returns:
the time when this entity was persisted

setCtime

public void setCtime(long ctime)

getMtime

public long getMtime()
The "mtime" of the plugin has slightly different semantics than other "mtime" values found elsewhere. The "mtime" will typically be the time that the content field was modified, not necessarily the time when any field was modified. In other words, look at "mtime" if you want to know when the actual plugin content was last updated. Note that this "mtime" may in fact be the last modified time of the plugin file from which the content came from - this means mtime may actually be earlier in time than "ctime" (in the case when the plugin jar file was last touched prior to this entity being created). Note that the "ctime" field semantics remains the same as always, it is the time when this entity was originally created.

Returns:
mtime of the content

setMtime

public void setMtime(long mtime)
This entity does not automatically update the "mtime" when it is updated via a PreUpdate annotation, therefore, the owner of this entity needs to explicitly call this setter in order to set the "mtime". You normally set this value to the last modified time of the plugin jar that provided this plugin entity's content.

Parameters:
mtime -

getDisplayName

public String getDisplayName()

setDisplayName

public void setDisplayName(String displayName)

getDescription

public String getDescription()

setDescription

public void setDescription(String description)

isEnabled

public boolean isEnabled()

setEnabled

public void setEnabled(boolean enabled)

getStatus

public PluginStatusType getStatus()

setStatus

public void setStatus(PluginStatusType status)

getHelp

public String getHelp()

setHelp

public void setHelp(String help)

getVersion

public String getVersion()

setVersion

public void setVersion(String version)

getAmpsVersion

public String getAmpsVersion()

setAmpsVersion

public void setAmpsVersion(String ampsVersion)

getMd5

public String getMd5()

setMd5

public void setMd5(String md5)

getMD5

public String getMD5()

setMD5

public void setMD5(String md5)

getPath

public String getPath()
Returns the actual name of the plugin jar. This is not the absolute path, in fact, it does not include any directory paths. It is strictly the name of the plugin jar as found on the file system (aka the filename).

Returns:
plugin filename

setPath

public void setPath(String path)
Ensure that the path being set does not include any directory names. The plugin path is the filename. See getPath().

Parameters:
path - the filename of the plugin, not including directory names

getDeployment

public PluginDeploymentType getDeployment()
Indicates how the plugin gets deployed (e.g. running in the agent or in the server).

Returns:
plugin deployment type

setDeployment

public void setDeployment(PluginDeploymentType deployment)

getContent

public byte[] getContent()
Returns the actual content of the plugin file. Be careful calling this in an entity context - the entire plugin file content will be loaded in memory (which may trigger an OutOfMemoryError if the file is very large).

Returns:
the content of the plugin file

setContent

public void setContent(byte[] content)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


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