org.openide.modules 7.31

org.openide.modules
Class Places

java.lang.Object
  extended by org.openide.modules.Places

public abstract class Places
extends Object

Provides access to standard file locations.

This class should be used for limited purposes only. You might instead want to use:

Since:
7.26

Constructor Summary
protected Places()
          Constructor for those who believe to know where getCacheDirectory() or getUserDirectory() is.
 
Method Summary
protected abstract  File findCacheDirectory()
          The cache directory to return from getCacheDirectory().
protected abstract  File findUserDirectory()
          Finds location of a user directory to return from getUserDirectory().
static File getCacheDirectory()
          Locates the NetBeans cache directory.
static File getCacheSubdirectory(String path)
          Convenience method to get a particular subdirectory within getCacheDirectory().
static File getCacheSubfile(String path)
          Convenience method to get a particular file within getCacheDirectory().
static File getUserDirectory()
          Locates the NetBeans user directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Places

protected Places()
Constructor for those who believe to know where getCacheDirectory() or getUserDirectory() is. Register your subclass via ServiceProvider annotation.

Method Detail

getUserDirectory

public static File getUserDirectory()
Locates the NetBeans user directory. This may be used to persist valuable files for which the system filesystem (FileUtil.getConfigFile) is inappropriate due its being virtual. Each module is responsible for using sufficiently unique filenames within this directory. The system property #USER_DIR_PROP is used for compatibility.

Returns:
a directory location (need not yet exist), or null if unconfigured

getCacheDirectory

public static File getCacheDirectory()
Locates the NetBeans cache directory. This may be used to store pure performance caches - files which could be safely deleted, since they would be automatically recreated on demand. Each module is responsible for using sufficiently unique filenames within this directory. $userdir/var/cache/ is used as a default when getUserDirectory() is configured. As a final fallback, a location in the system temporary directory will be returned.

Returns:
a directory location (never null but need not yet exist)
See Also:
getCacheSubdirectory(java.lang.String), getCacheSubfile(java.lang.String)

getCacheSubdirectory

public static File getCacheSubdirectory(String path)
Convenience method to get a particular subdirectory within getCacheDirectory(). The directory will be created if it does not yet exist (but a warning logged if permissions do not allow this).

Parameters:
path - a subdirectory path such as stuff or mymodule/stuff (/ permitted even on Windows)
Returns:
a directory of that name within the general cache directory

getCacheSubfile

public static File getCacheSubfile(String path)
Convenience method to get a particular file within getCacheDirectory(). The parent directory will be created if it does not yet exist (but a warning logged if permissions do not allow this); the file itself will not be automatically created.

Parameters:
path - a file path such as stuff.ser or mymodule/stuff.ser (/ permitted even on Windows)
Returns:
a file of that name within the general cache directory

findCacheDirectory

protected abstract File findCacheDirectory()
The cache directory to return from getCacheDirectory(). If null the caches will be placed below getUserDirectory().

Returns:
the file to use for caches or null
Since:
7.26

findUserDirectory

protected abstract File findUserDirectory()
Finds location of a user directory to return from getUserDirectory().

Returns:
the user directory or null if no user directory is supposed to be used
Since:
7.26

org.openide.modules 7.31

Built on May 25 2012.  |  Portions Copyright 1997-2012 Oracle. All rights reserved.