|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.common.util.CWProject
public final class CWProject
The Project class looks after the source of project files.
These are per user files and as such have a different location
on different operating systems. These are:
Mac OS X | ~/Library/Application Support/JSword |
Win NT/2000/XP/ME/9x | ~/Application Data/JSword (~ is all over the place, but Java figures it out) |
Unix and otherwise | ~/.jsword |
Previously the location was ~/.jsword, which is unfriendly in the Windows and Mac world. If this location is found on Mac or Windows, it will be moved to the new location, if different and possible.
Note: If the Java System property jsword.home is set and it exists and is writable then it will be used instead of the above location. This is useful for USB Drives and other portable implementations of JSword. I is recommended that this name be JSword.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static String |
DIR_NETCACHE
The cache of downloaded files inside the project directory |
private static String |
homeAltDirectory
The JSword user settings directory for Mac and Windows |
private static String |
homeDirectory
The JSword user settings directory |
private static String |
homeProperty
System property for home directory |
private URI[] |
homes
The homes for this application: first is writable, second (if present) is read-only and specified by the system property jsword.home. |
private static CWProject |
instance
The filesystem resources |
private static Logger |
log
The log stream |
private URI |
readHome
The readable home for this application, specified by the system property jsword.home. |
private URI |
writeHome
The writable home for this application. |
Constructor Summary | |
---|---|
private |
CWProject()
Prevent instantiation. |
Method Summary | |
---|---|
private void |
establishProjectHome()
Establishes the user's project directory. |
URI |
getDeprecatedWritableProjectDir()
Get the location where the project directory used to be. |
URI[] |
getProjectResourceDirs()
Get the locations where project resources can be found. |
URI |
getWritableProjectDir()
Get the writable user project directory. |
URI |
getWritablePropertiesURI(String subject)
Get a the URI of a (potentially non-existent) properties file that we can write to. |
URI |
getWriteableProjectSubdir(String subject,
boolean create)
A directory within the project directory. |
static CWProject |
instance()
Accessor for the resource singleton. |
private URI |
migrateUserProjectDir(URI oldPath,
URI newPath)
Migrates the user's project dir, if necessary and possible. |
static void |
setHome(String homeProperty,
String homeDir,
String altHomeDir)
Establish how this project finds it's resources. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final String DIR_NETCACHE
private URI[] homes
private URI writeHome
private URI readHome
private static String homeProperty
private static String homeDirectory
private static String homeAltDirectory
private static CWProject instance
private static final Logger log
Constructor Detail |
---|
private CWProject()
Method Detail |
---|
public static CWProject instance()
public static void setHome(String homeProperty, String homeDir, String altHomeDir)
homeProperty
- a property that is used as the home directory name.
If this property has a value then homeDir and altHomeDir are ignored.
Defaults to jsword.home.homeDir
- the name of the directory to be used for Unix.
Typically this is a hidden directory, that is, it begins with a '.'.
Defaults to .jswordaltHomeDir
- the name of the directory to be used for other OSes. This should not be a hidden directory.
Defaults to JSword.public URI getWritableProjectDir()
public URI[] getProjectResourceDirs()
public URI getDeprecatedWritableProjectDir()
public URI getWritablePropertiesURI(String subject)
subject
- The name (minus the .properties extension)
public URI getWriteableProjectSubdir(String subject, boolean create) throws IOException
subject
- A name for the subdirectory of the Project directory.
IOException
private void establishProjectHome()
Here is the lookup order:
private URI migrateUserProjectDir(URI oldPath, URI newPath)
oldPath
- the path to the old, deprecated locationnewPath
- the path to the new location
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |