org.rhq.core.domain.configuration
Class AbstractConfigurationUpdate

java.lang.Object
  extended by org.rhq.core.domain.configuration.AbstractConfigurationUpdate
Direct Known Subclasses:
AbstractGroupConfigurationUpdate, AbstractResourceConfigurationUpdate

public abstract class AbstractConfigurationUpdate
extends Object


Field Summary
protected  Configuration configuration
           
protected  long createdTime
           
protected  String errorMessage
           
protected  long modifiedTime
           
protected  ConfigurationUpdateStatus status
           
protected  String subjectName
           
 
Constructor Summary
protected AbstractConfigurationUpdate()
           
protected AbstractConfigurationUpdate(String subjectName)
           
 
Method Summary
protected  void appendToStringInternals(StringBuilder str)
          Subclasses can override this to add things it wants to see in the toString.
 boolean equals(Object obj)
           
 Configuration getConfiguration()
          Contains the entire configuration that was submitted as the new configuration for a resource.
 long getCreatedTime()
          The time this entity was originally created; in other words, when the request was originally made.
 long getDuration()
          The duration of the configuration update request which simply is the difference between the getCreatedTime() and the getModifiedTime().
 String getErrorMessage()
          If not null, this is an error message (possibly a full stack trace) to indicate the overall error that occurred when the configuration update failed.
 long getModifiedTime()
          The time this entity was last modified.
 ConfigurationUpdateStatus getStatus()
          The status of the request which indicates that the request is either still in progress, or it has completed and either succeeded or failed.
 String getSubjectName()
          For auditing purposes, this method tells you the username of the person that created the request.
 int hashCode()
           
 void setConfiguration(Configuration configuration)
           
 void setErrorMessage(String errorMessage)
          Calling this method with a non-null error message implies that the request's status is ConfigurationUpdateStatus.FAILURE.
 void setErrorMessageFromThrowable(Throwable t)
          Convienence method that sets the error message to the given throwable's stack trace dump.
 void setStatus(ConfigurationUpdateStatus status)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

configuration

protected Configuration configuration

status

protected ConfigurationUpdateStatus status

errorMessage

protected String errorMessage

subjectName

protected String subjectName

createdTime

protected long createdTime

modifiedTime

protected long modifiedTime
Constructor Detail

AbstractConfigurationUpdate

protected AbstractConfigurationUpdate()

AbstractConfigurationUpdate

protected AbstractConfigurationUpdate(String subjectName)
Method Detail

getConfiguration

public Configuration getConfiguration()
Contains the entire configuration that was submitted as the new configuration for a resource. If the update request failed, this configuration will contain properties whose error messages are non-null - this can be used to find out which properties were invalid and why.

Returns:
the new configuration for the updated resource

setConfiguration

public void setConfiguration(Configuration configuration)

getStatus

public ConfigurationUpdateStatus getStatus()
The status of the request which indicates that the request is either still in progress, or it has completed and either succeeded or failed.

Returns:
the request status

setStatus

public void setStatus(ConfigurationUpdateStatus status)

getErrorMessage

public String getErrorMessage()
If not null, this is an error message (possibly a full stack trace) to indicate the overall error that occurred when the configuration update failed. This will normally be null unless the status indicates a ConfigurationUpdateStatus.FAILURE.

If the update failed because one or more configuration property values were invalid, then you can also examine the error messages in each of the failed properties to find out more specific details about the errors for each invalid property.

Returns:
overall error that occurred

setErrorMessage

public void setErrorMessage(String errorMessage)
Calling this method with a non-null error message implies that the request's status is ConfigurationUpdateStatus.FAILURE. The inverse is not true - that is, if you set the error message to null, the status is left as-is; it will not assume that a null error message means the status is successful.

Parameters:
errorMessage -

setErrorMessageFromThrowable

public void setErrorMessageFromThrowable(Throwable t)
Convienence method that sets the error message to the given throwable's stack trace dump. If the given throwable is null, the error message will be set to null as if passing null to setErrorMessage(String).

Parameters:
t - throwable whose message and stack trace will make up the error message (may be null)

getSubjectName

public String getSubjectName()
For auditing purposes, this method tells you the username of the person that created the request. This is not a relationship to an actual Subject because we want to maintain the audit trail, even if a Subject has been deleted from the database.

If the configuration update was automatically detected by the plugin (that is, was not initiated by a JBoss ON user; for example, someone modified a configuration file on disk), this will return null as an indication that we don't know who modified it

Returns:
the actual name string of the submitter of the request

getCreatedTime

public long getCreatedTime()
The time this entity was originally created; in other words, when the request was originally made.

Returns:
creation time

getModifiedTime

public long getModifiedTime()
The time this entity was last modified. This is the last time the status was updated. If the status has never been updated, this will be the created time.

Returns:
last modified time

getDuration

public long getDuration()
The duration of the configuration update request which simply is the difference between the getCreatedTime() and the getModifiedTime(). If the request hasn't completed yet, this will be the difference between the current time and the created time.

Returns:
the duration of time that the request took or is taking to complete

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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

toString

public String toString()
Overrides:
toString in class Object

appendToStringInternals

protected void appendToStringInternals(StringBuilder str)
Subclasses can override this to add things it wants to see in the toString.

Parameters:
str - the builder to append strings to


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.