ca.sqlpower.architect.profile
Class AbstractProfileResult<T extends SQLObject>

java.lang.Object
  extended by ca.sqlpower.architect.profile.AbstractProfileResult<T>
Type Parameters:
T - The type of DatabaseObject this profile pertains to. For example, SQLTable or SQLColumn.
All Implemented Interfaces:
ProfileResult<T>, java.lang.Comparable<AbstractProfileResult>
Direct Known Subclasses:
ColumnProfileResult, TableProfileResult

public abstract class AbstractProfileResult<T extends SQLObject>
extends java.lang.Object
implements java.lang.Comparable<AbstractProfileResult>, ProfileResult<T>

Base class for storing profile results that relate to a database object. Provides mostly bookkeeping information and the infrastructure for event support. Subclasses extend this class by providing additional attributes that make sense for the type of object they profile.


Constructor Summary
AbstractProfileResult(T profiledObject)
          Creates a new ProfileResult which will hold profile data about the given SQL Object.
 
Method Summary
 void addProfileResultListener(ProfileResultListener listener)
          Add a ProfileResultListener that should be notified of changes in the status of this ProfileResult's progress during a profile operation
 int compareTo(AbstractProfileResult o)
          Compares this Profile Result based on the following attributes, in the following priority: The profiled object's database name The profiled object's catalog name The profiled object's schema name The profiled object's table name The profiled object's column name The profile's createEndTime The profile's createStartTime If any of those attributes are null or not applicable, they will count as coming before any non-null value.
 boolean equals(java.lang.Object obj)
          Tests for equality with obj.
protected  void fireProfileCancelled()
           
protected  void fireProfileFinished()
           
protected  void fireProfileStarted()
           
 long getCreateEndTime()
          Returns the date and time that this ProfileResult finished profiling the profiled object.
 long getCreateStartTime()
          Returns the date and time that this ProfileResult started profiling the profiled object.
 java.lang.Exception getException()
          Returns the Exception that occured during the profiling of the profiled object.
 T getProfiledObject()
          Returns the SQLObject that is profiled by this ProfileResult.
 ProfileSettings getSettings()
           
 long getTimeToCreate()
          Returns the time it took to create this ProfileResult in milliseconds.
 int hashCode()
          Generates a hash code consistent with the equals() method.
 void removeProfileResultListener(ProfileResultListener listener)
          Remove a ProfileResultListener from this ProfileResult's collection of ProfileResultListeners
 void setCreateEndTime(long createEndTime)
           
 void setCreateStartTime(long createStartTime)
           
 void setException(java.lang.Exception ex)
          If an exception is encountered while populating this profile result, it should be stored here for later inspection by client code.
 void setSettings(ProfileSettings settings)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractProfileResult

public AbstractProfileResult(T profiledObject)
Creates a new ProfileResult which will hold profile data about the given SQL Object.

Parameters:
profiledObject - The object that this profile data refers to. Must not be null.
Method Detail

getProfiledObject

public T getProfiledObject()
Description copied from interface: ProfileResult
Returns the SQLObject that is profiled by this ProfileResult.

Specified by:
getProfiledObject in interface ProfileResult<T extends SQLObject>

getCreateStartTime

public long getCreateStartTime()
Description copied from interface: ProfileResult
Returns the date and time that this ProfileResult started profiling the profiled object.

Specified by:
getCreateStartTime in interface ProfileResult<T extends SQLObject>

setCreateStartTime

public void setCreateStartTime(long createStartTime)

getTimeToCreate

public long getTimeToCreate()
Description copied from interface: ProfileResult
Returns the time it took to create this ProfileResult in milliseconds.

Specified by:
getTimeToCreate in interface ProfileResult<T extends SQLObject>

setCreateEndTime

public void setCreateEndTime(long createEndTime)

getCreateEndTime

public long getCreateEndTime()
Description copied from interface: ProfileResult
Returns the date and time that this ProfileResult finished profiling the profiled object.

Specified by:
getCreateEndTime in interface ProfileResult<T extends SQLObject>

getException

public java.lang.Exception getException()
Description copied from interface: ProfileResult
Returns the Exception that occured during the profiling of the profiled object. If this method returns null then the profiled object is not done populating yet or it has sucessfully populated without throwing an Exception.

Specified by:
getException in interface ProfileResult<T extends SQLObject>

setException

public void setException(java.lang.Exception ex)
If an exception is encountered while populating this profile result, it should be stored here for later inspection by client code.


compareTo

public final int compareTo(AbstractProfileResult o)
Compares this Profile Result based on the following attributes, in the following priority:
  1. The profiled object's database name
  2. The profiled object's catalog name
  3. The profiled object's schema name
  4. The profiled object's table name
  5. The profiled object's column name
  6. The profile's createEndTime
  7. The profile's createStartTime
If any of those attributes are null or not applicable, they will count as coming before any non-null value.

Specified by:
compareTo in interface java.lang.Comparable<AbstractProfileResult>
Parameters:
o - Another ProfileResult to compare with.
Returns:
-1 if this comes before o; 0 if this and o are the same; 1 if this comes after o.

equals

public final boolean equals(java.lang.Object obj)
Tests for equality with obj. To be considered equal, obj must be a subtype of ProfileResult and compareTo(obj) must return 0.

Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Generates a hash code consistent with the equals() method.

Overrides:
hashCode in class java.lang.Object

getSettings

public ProfileSettings getSettings()

setSettings

public void setSettings(ProfileSettings settings)

addProfileResultListener

public void addProfileResultListener(ProfileResultListener listener)
Description copied from interface: ProfileResult
Add a ProfileResultListener that should be notified of changes in the status of this ProfileResult's progress during a profile operation

Specified by:
addProfileResultListener in interface ProfileResult<T extends SQLObject>

removeProfileResultListener

public void removeProfileResultListener(ProfileResultListener listener)
Description copied from interface: ProfileResult
Remove a ProfileResultListener from this ProfileResult's collection of ProfileResultListeners

Specified by:
removeProfileResultListener in interface ProfileResult<T extends SQLObject>

fireProfileStarted

protected final void fireProfileStarted()

fireProfileFinished

protected final void fireProfileFinished()

fireProfileCancelled

protected final void fireProfileCancelled()


Copyright © 2003-2007 SQL Power Group Inc. www.sqlpower.ca