info.aduna.spectacle
Class ProfileManager

java.lang.Object
  extended by info.aduna.spectacle.ProfileManager

public class ProfileManager
extends Object

An ProfileManager manages a list of Profiles. It acts as a container of Profiles and also takes care of their persistency.


Field Summary
static String PROFILE_PREFIX
           
 
Constructor Summary
ProfileManager()
           
 
Method Summary
 boolean _removeRefreshSchedule(String profileID, String schedule)
           
 void addNewProfile(Profile profile)
          Adds an Profile not previously added to this ProfileManager.
 void addProfileManagerListener(ProfileManagerListener listener)
           
 void addRefreshSchedule(String profileID, String schedule, Spectacle spectacle)
          Adds an auto-refresh schedule for the profile with the specified ID.
 void close()
          Closes all the managed Profiles.
 Profile createProfile(String id, String name, String modelUri)
           
 void destroy()
           
 String getJobID(String profileID)
           
 Profile getProfile(String id)
          Returns the Profile with the specified ID.
 File getProfileFile()
          Returns the File that contains the Profile definitions.
 List<Profile> getProfiles()
          Returns an unmodifiable List containing all Profile objects.
 List<String> getRefreshSchedules(String profileID)
          Gets the auto-refresh schedules for the profile with the specified ID.
 org.quartz.Scheduler getScheduler()
           
 void init()
           
 void load(InitializationListener listener, Spectacle spectacle)
          Loads and initializes the set of defined Profiles.
 void notifyProfileDefinitionChanged(Profile profile)
           
 boolean refreshInProgress(String profileID)
           
 void removeProfile(Profile profile, boolean removeData)
           
 void removeProfileManagerListener(ProfileManagerListener listener)
           
 void removeRefreshSchedule(String profileID, String schedule)
          Removes the auto-refresh schedule for the profile with the specified ID.
 void save()
          Saves the IDs, types and data dirs of all Profiles.
 void scheduleRefresh(String profileID, Spectacle spectacle)
          Schedules an immediate refresh of the specified profile.
 void setDataDir(File dataDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROFILE_PREFIX

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

ProfileManager

public ProfileManager()
Method Detail

setDataDir

public void setDataDir(File dataDir)

init

public void init()

getScheduler

public org.quartz.Scheduler getScheduler()

destroy

public void destroy()

getProfileFile

public File getProfileFile()
Returns the File that contains the Profile definitions. This does not have to be an existing file yet.


load

public void load(InitializationListener listener,
                 Spectacle spectacle)
          throws IOException
Loads and initializes the set of defined Profiles. After this the list of Profiles can be retrieved.

Throws:
IOException

save

public void save()
          throws IOException
Saves the IDs, types and data dirs of all Profiles. Note that the remaining configuration data of each Profile is not stored here, use the Profile's store method for that.

Throws:
IOException

addProfileManagerListener

public void addProfileManagerListener(ProfileManagerListener listener)

removeProfileManagerListener

public void removeProfileManagerListener(ProfileManagerListener listener)

notifyProfileDefinitionChanged

public void notifyProfileDefinitionChanged(Profile profile)

addNewProfile

public void addNewProfile(Profile profile)
                   throws IOException
Adds an Profile not previously added to this ProfileManager. The Profile is given an ID and initialized by this method.

Throws:
IOException

removeProfile

public void removeProfile(Profile profile,
                          boolean removeData)
                   throws IOException
Throws:
IOException

getProfiles

public List<Profile> getProfiles()
Returns an unmodifiable List containing all Profile objects.


getProfile

public Profile getProfile(String id)
Returns the Profile with the specified ID.

Parameters:
id - The ID of a profile.
Returns:
The requested Profile, or null in case the manager does not have any info profile with the specified ID.

getRefreshSchedules

public List<String> getRefreshSchedules(String profileID)
Gets the auto-refresh schedules for the profile with the specified ID.

Parameters:
profileID - The ID of a profile.
Returns:
A unmodifiable List of String objects, representing schedule expressions.

addRefreshSchedule

public void addRefreshSchedule(String profileID,
                               String schedule,
                               Spectacle spectacle)
                        throws ParseException,
                               IOException
Adds an auto-refresh schedule for the profile with the specified ID. Both parameter should have non-null values.

Parameters:
profileID - The ID of a profile.
schedule - The new schedule.
Throws:
ParseException
IOException

removeRefreshSchedule

public void removeRefreshSchedule(String profileID,
                                  String schedule)
                           throws IOException
Removes the auto-refresh schedule for the profile with the specified ID.

Parameters:
profileID - The ID of a profile.
Throws:
IOException

_removeRefreshSchedule

public boolean _removeRefreshSchedule(String profileID,
                                      String schedule)

scheduleRefresh

public void scheduleRefresh(String profileID,
                            Spectacle spectacle)
Schedules an immediate refresh of the specified profile.

Parameters:
profileID - The ID of a profile.

refreshInProgress

public boolean refreshInProgress(String profileID)

getJobID

public String getJobID(String profileID)

close

public void close()
           throws IOException
Closes all the managed Profiles. An IOException is thrown when one or more Profiles threw an IOException. In any case all Profiles will be requested to close. The output of the indivudual IOExceptions are logged.

Throws:
IOException

createProfile

public Profile createProfile(String id,
                             String name,
                             String modelUri)
Parameters:
id -
name -
modelUri -
Returns:


Copyright © 1997-2008 Aduna. All Rights Reserved.