|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.apploader.prefs.PrefsManager
A PrefsManager holds the RDF preferences data for the current setup. It has places to attach listeners, if we ever decide to have a pref editor, but currently the RDF model (Jena 1.6) doesn't support events, so they aren't called. The basic idea is "system prefs < user prefs < file < command line". For example, if the system says that all bounding boxes are red, but the user prefers blue, it will select blue, unless the file says these bounding boxes should be green, in which case they are unless the user specifies another color on the command line. So, the question is, how are the prefs files discovered? The current idea is "default location < system property < java property ". Right now file and cli aren't implemented. The idea for file is to perhaps have an RDF element in the header or something. As for the command line, we would set a map of command line options to properties or something, and then pass the system argument array to a method.
Field Summary | |
com.hp.hpl.jena.rdf.model.Model |
model
The sink for all the preferences. |
Constructor Summary | |
PrefsManager()
Create a new preference manager with no preferences and the default logger. |
Method Summary | |
void |
addLeftoverAction(java.lang.Runnable R)
Adds an action to be executed after the current event is finished being sent out to all listeners. |
void |
addListener(ModelListener ml)
Adds a listener for changes to the triplestore. |
void |
addPrefix(java.lang.String prefix,
java.lang.String uri)
Adds the given namespace short-name (prefix). |
void |
changeTemporary(com.hp.hpl.jena.rdf.model.Model toRemove,
com.hp.hpl.jena.rdf.model.Model toAdd)
Change data in the temporary triplestore. |
void |
changeUser(com.hp.hpl.jena.rdf.model.Model toRemove,
com.hp.hpl.jena.rdf.model.Model toAdd)
Changes the user preferences model. |
AppLoader |
getCore()
Gets the associated core bean. |
com.hp.hpl.jena.rdf.model.Model |
getFile()
|
com.hp.hpl.jena.rdf.model.Resource |
getLocalizedResource(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p)
From the list of subject-verb-objects, get the first object that has an undo:forLanguage property whose object is the current user's preferred language. |
java.lang.String |
getLocalizedString(com.hp.hpl.jena.rdf.model.Resource r,
com.hp.hpl.jena.rdf.model.Property p)
Tries to get the localized version or r's property p. |
java.util.logging.Logger |
getLogger()
Gets the error logger associated with the preference manager. |
OptionsManager |
getOptionsManager()
Gets the associated command-line options manager bean. |
com.hp.hpl.jena.rdf.model.Model |
getSystem()
|
java.net.URI |
getSystemDirectory()
Gets the system directory, if defined. |
com.hp.hpl.jena.rdf.model.Model |
getTemporary()
|
com.hp.hpl.jena.rdf.model.Model |
getUser()
|
java.net.URI |
getUserDirectory()
Gets the user directory, if defined. |
static boolean |
isXMLFormat(java.io.Reader r)
Checks to see if the file begins with an xml processing directive, eg <? |
static boolean |
isXMLFormat(java.net.URI fileName)
Checks to see if the file begins with an xml processing directive, eg <? |
void |
loadUserPrefs()
Loads the se triplestore from a n n3 file. |
void |
removeListener(ModelListener ml)
Removes a listener for changes to the triplestore. |
void |
serializeUserPrefs()
Save the iser model to the user.n3 file. |
void |
setCore(AppLoader loader)
Sets the associated Limn3 core. |
void |
setLogger(java.util.logging.Logger logger)
Sets the error logger associated with the preference manager. |
void |
setSystemPrefs(java.net.URI filename)
Resets the system prefs to the contents of the given uri. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public com.hp.hpl.jena.rdf.model.Model model
Constructor Detail |
public PrefsManager()
Method Detail |
public void setCore(AppLoader loader)
loader
- the core beanpublic AppLoader getCore()
public void addPrefix(java.lang.String prefix, java.lang.String uri)
prefix
- the new prefixuri
- the uri that will use the prefixpublic java.lang.String getLocalizedString(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Property p) throws com.hp.hpl.jena.rdf.model.RDFException
r
- the resouce on which to checkp
- the property name to check
com.hp.hpl.jena.rdf.model.RDFException
- if the property takes a non-literal value, for examplepublic com.hp.hpl.jena.rdf.model.Resource getLocalizedResource(com.hp.hpl.jena.rdf.model.Resource r, com.hp.hpl.jena.rdf.model.Property p)
r
- the resource that takes a localizable propertyp
- the property to search for
getLocalizedString(Resource, Property)
,
LAL.lang
public java.net.URI getSystemDirectory() throws PreferenceException
PreferenceException
public java.net.URI getUserDirectory() throws PreferenceException
PreferenceException
public void serializeUserPrefs()
public void loadUserPrefs() throws PreferenceException
PreferenceException
public void setSystemPrefs(java.net.URI filename) throws PreferenceException
filename
- the location of the system prefs
PreferenceException
- if there is a problem while loadingpublic void addListener(ModelListener ml)
ml
- the listener to addpublic void removeListener(ModelListener ml)
ml
- the listener to removepublic void addLeftoverAction(java.lang.Runnable R)
R
- the action to performpublic OptionsManager getOptionsManager()
public void changeUser(com.hp.hpl.jena.rdf.model.Model toRemove, com.hp.hpl.jena.rdf.model.Model toAdd)
toRemove
- triples to remove from the user preferences triplestoretoAdd
- triples to add to the user preferences triplestorepublic void changeTemporary(com.hp.hpl.jena.rdf.model.Model toRemove, com.hp.hpl.jena.rdf.model.Model toAdd)
toRemove
- triples to removetoAdd
- triples to addpublic static boolean isXMLFormat(java.net.URI fileName) throws java.io.IOException
<?xml?>
. This method does not check to see that the
file is well-formed, or even if the processing directive is good, just
that the first non-whitespace characters are "<?xml".
fileName
- The file to check for xml processing directive
true
if the directive was found.
java.io.IOException
- if there is an error while reading the file, eg
FileNotFoundExceptionpublic static boolean isXMLFormat(java.io.Reader r) throws java.io.IOException
<?xml?>
. This method does not check to see that the
file is well-formed, or even if the processing directive is good, just
that the first non-whitespace characters are "<?xml". Note that this
calls mark and reset on the stream. So, the stream has to be in the
starting position before and will be put back in after.
r
- the source to check for xml processing directive
true
if the directive was found.
java.io.IOException
- if there is an error while reading the file, eg
FileNotFoundException
java.lang.IllegalArgumentException
- if the Reader doesn't support mark and resetpublic java.util.logging.Logger getLogger()
public void setLogger(java.util.logging.Logger logger)
logger
- the new loggerpublic com.hp.hpl.jena.rdf.model.Model getFile()
public com.hp.hpl.jena.rdf.model.Model getSystem()
public com.hp.hpl.jena.rdf.model.Model getTemporary()
public com.hp.hpl.jena.rdf.model.Model getUser()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |