ca.sqlpower.architect.profile
Interface ProfileManager

All Known Implementing Classes:
ProfileManagerImpl

public interface ProfileManager

An interface for classes that create and keep track of ProfileResults. For now it can only be a list of TableProfileResults; some day we might want to make it a generic type.


Method Summary
 void addProfileChangeListener(ProfileChangeListener listener)
          Adds a ProfileChangeListener to this ProfileManager.
 java.util.Collection<java.util.concurrent.Future<TableProfileResult>> asynchCreateProfiles(java.util.Collection<SQLTable> tables)
          Creates TableProfileResult objects for each of the tables in the given list, then adds them to this ProfileManager in an unpopulated state.
 void clear()
          Removes all contents of the list of TableProfileResults that this ProfileManager keeps track of and fires a ProfileChanged event.
 void close()
          Closes the Executor service.
 TableProfileResult createProfile(SQLTable table)
          Creates a new profile result for the given table, and adds it to this ProfileManager.
 TableProfileCreator getCreator()
          Returns the current profile creator in use.
 ProfileSettings getDefaultProfileSettings()
          Returns the current default settings for new profile runs in this Profile Manager.
 java.util.List<TableProfileCreator> getProfileCreators()
          Returns a list of the different types of profile creators.
 java.util.List<TableProfileResult> getResults()
          Returns an unmodifiable snapshot of the list of all TableProfileResults that this ProfileManager keeps track of.
 java.util.List<TableProfileResult> getResults(SQLTable t)
          Returns an unmodifiable list of all TableProfileResults for the given table.
 boolean removeProfile(TableProfileResult victim)
          Removes a single TableProfileResult from the List of TableProfileResults that this ProfileManager keeps track of.
 void removeProfileChangeListener(ProfileChangeListener listener)
          Removes a ProfileChangeListener to this ProfileManager.
 java.util.concurrent.Future<TableProfileResult> scheduleProfile(TableProfileResult result)
          Schedules a profile to be populated on a separate worker thread.
 void setCreator(TableProfileCreator tpc)
          Sets the profile manager to use the given profile creator.
 void setDefaultProfileSettings(ProfileSettings settings)
          Sets the defaults for new profiles created by this profile manager.
 void setProcessingOrder(java.util.List<TableProfileResult> tpr)
          Modifies the order in which profile results will be calculated.
 

Method Detail

getResults

java.util.List<TableProfileResult> getResults()
Returns an unmodifiable snapshot of the list of all TableProfileResults that this ProfileManager keeps track of. You may get multiple ProfileResults for one table since you are allowed to have multiple profiles of a single table that come from different times the profiling was done.


getResults

java.util.List<TableProfileResult> getResults(SQLTable t)
Returns an unmodifiable list of all TableProfileResults for the given table. You may get multiple ProfileResults for one table since you are allowed to have multiple profiles of a single table that come from different times the profiling was done. Returns an empty list if there are no profiles for the given table.


createProfile

TableProfileResult createProfile(SQLTable table)
                                 throws java.sql.SQLException,
                                        ArchitectException
Creates a new profile result for the given table, and adds it to this ProfileManager. The act of adding a profile causes this ProfileManager to fire a profileAdded event.

This method operates synchronously, so it will not return until the profile has been created (which could be several seconds to several minutes). For use from a Swing GUI, consider asynchCreateProfiles(Collection).

Parameters:
tables - The database table(s) you want to profile.
Throws:
java.sql.SQLException
ArchitectException

asynchCreateProfiles

java.util.Collection<java.util.concurrent.Future<TableProfileResult>> asynchCreateProfiles(java.util.Collection<SQLTable> tables)
Creates TableProfileResult objects for each of the tables in the given list, then adds them to this ProfileManager in an unpopulated state. Then starts a new worker thread which will populate the results one after the other. It is likely that none of the profiles will be populated yet by the time this method returns.


scheduleProfile

java.util.concurrent.Future<TableProfileResult> scheduleProfile(TableProfileResult result)
Schedules a profile to be populated on a separate worker thread. You will not normally need to call this method, since it is done for you by asynchCreateProfiles(Collection). The use case is for re-trying profile results that have been canceled by the user before they managed to fully populate.

Parameters:
result - The result object to reschedule for profiling. It must already be owned by this profile manager, and must not be in the process of profiling, and also not already finished profiling.

removeProfile

boolean removeProfile(TableProfileResult victim)
Removes a single TableProfileResult from the List of TableProfileResults that this ProfileManager keeps track of. If the remove was successful then this method will fire a ProfileRemoved event and return true.


clear

void clear()
Removes all contents of the list of TableProfileResults that this ProfileManager keeps track of and fires a ProfileChanged event.


getDefaultProfileSettings

ProfileSettings getDefaultProfileSettings()
Returns the current default settings for new profile runs in this Profile Manager.


setDefaultProfileSettings

void setDefaultProfileSettings(ProfileSettings settings)
Sets the defaults for new profiles created by this profile manager.


addProfileChangeListener

void addProfileChangeListener(ProfileChangeListener listener)
Adds a ProfileChangeListener to this ProfileManager.


removeProfileChangeListener

void removeProfileChangeListener(ProfileChangeListener listener)
Removes a ProfileChangeListener to this ProfileManager.


setProcessingOrder

void setProcessingOrder(java.util.List<TableProfileResult> tpr)
Modifies the order in which profile results will be calculated.

Parameters:
tpr - A list of pending profile results that were already part of this profile manager, but have not been calculated yet.

close

void close()
Closes the Executor service. This stops it from running any further jobs.


getProfileCreators

java.util.List<TableProfileCreator> getProfileCreators()
Returns a list of the different types of profile creators.

Returns:
a List of the possible profile creators

getCreator

TableProfileCreator getCreator()
Returns the current profile creator in use.

Returns:
the currently used profile creator object

setCreator

void setCreator(TableProfileCreator tpc)
Sets the profile manager to use the given profile creator.

Parameters:
tpc - the profile creator to use, must not be null.


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