|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.util.Project
public final class Project
The Project class looks after the source of project files.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
static String |
DIR_NETCACHE
The cache of downloaded files inside the project directory |
static String |
DIR_PROJECT
The JSword user settings directory |
private URL |
home
The home for this application |
private static Project |
instance
The filesystem resources |
private static Logger |
log
The log stream |
Constructor Summary | |
---|---|
private |
Project()
Prevent Instansiation. |
Method Summary | |
---|---|
URL |
getTempScratchSpace(String subject,
boolean create)
When we need a directory to write stuff to. |
URL |
getWritablePropertiesURL(String subject)
Get a the URL of a (potentially non-existant) properties file that we can write to. |
static Project |
instance()
Accessor for the resource singleton. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DIR_NETCACHE
public static final String DIR_PROJECT
private URL home
private static final Logger log
private static Project instance
Constructor Detail |
---|
private Project()
The biggest job is trying to work out which resource bundle to load to work out where the config and data files are stored. We construct a name from the projectname, hostname and any other info and then try to use that.
Method Detail |
---|
public static Project instance()
public URL getWritablePropertiesURL(String subject)
subject
- The name (minus the .properties extension)
public URL getTempScratchSpace(String subject, boolean create) throws IOException
This directory should be used as a cache for something that could also be got at runtime by some other means.
So it is not for config data, and not for program files. If someone were to delete all the files in this directory while you weren't looking then life should not stop, but should carry on albeit with a slower service.
This method may well return null if we are running in a restricted environment, so callers of this method should be prepared for that eventuallity too.
As a result of these limitations it could be OK to use File
in
place of URL
(which is the norm for this project), however there
doesn't seem to be a good reason to relax this rule here.
subject
- A moniker for the are to write to. This will be converted into a directory name.
IOException
|
Copyright ? 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |