|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Profileable
A class that implements Profileable
can be configured in various ways
to alter its behaviour and functionality, and this configuration can be
recorded as a user Profile
.
For each implementation of Profileable
, there must be a
corresponding subclass of Profile
. This is the subclass that is
returned by the createProfile(File)
and loadProfile(File)
methods. For example, Backend
uses the ProfileJokeGeneration
class, whereas CloudFrontend
uses the ProfileCloudFrontend
class.
Probably the two most important methods are getProfile()
and
setProfile(Profile, boolean)
. The getProfile()
method
returns the currently used Profile
, so should be called when
attempting to find out the various option settings the current user has
chosen. Conversely, the setProfile(Profile, boolean)
method makes the
given Profile
the current used one.
Most of the methods defined here will be used by the ProfileManager
class.
Method Summary | |
---|---|
boolean |
createProfile(File directory)
Instantiates a 'default' profile and saves it in the specified user directory. |
Profile |
getProfile()
Returns the Profile currently being used by this
Profileable . |
String |
getProfileFilename()
Returns the filename used to specify the profile filename. |
Profile |
loadProfile(File directory)
Loads the Profile associated with this Profileable from
the specified directory and returns it. |
boolean |
setProfile(Profile profile,
boolean repeat)
Attempts to use the given Profile . |
Method Detail |
---|
String getProfileFilename()
Profile
s, and they are all
stored in the same user directory, the profile filenames must be unique.
Convention is to use a .profile
file extension, e.g.
'jokegeneration.profile'
, 'lexical.profile'
,
'clouds.profile'
, etc..
Profile getProfile()
Profile
currently being used by this
Profileable
.
Profile
boolean setProfile(Profile profile, boolean repeat)
Profile
.
The repeat
parameter determines whether it is the first time a
profile is being set for the current user during this session (e.g. from
the login screen) or not (e.g. after changing options in the control
panel). This allows the Profileable
to perform initial-specific
setup during the first time, e.g. for the SQL-based backend to reset the
exclusion tables.
This is also the method where any transient data structures or variables that are dependent on the current profile should be updated.
Returns true
if successful, false
otherwise.
profile
- The profile to be usedrepeat
- whether this is the first time a profile is being set for the
current user during this session
boolean createProfile(File directory)
ProfileManager.getUserDirectory(String)
.
Profile loadProfile(File directory)
Profile
associated with this Profileable
from
the specified directory and returns it. Assumes that the directory has
been created, and that it contains a file whose name is the same as that
given by getProfileFilename()
. Note that it doesn't actually
use/set the returned Profile
-- call
setProfile(Profile, boolean)
for that.
Really this should be a static method, but Java interfaces cannot specify static methods.
directory
- The directory containing the profile (and associated files)
Profile
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |