Class BundleCache
java.lang.Object
org.apache.felix.framework.cache.BundleCache
This class, combined with BundleArchive, and concrete BundleRevision subclasses, implement the Felix bundle cache. It is possible to configure the default behavior of this class by passing properties into Felix' constructor. The configuration properties for this class are (properties starting with "felix" are specific to Felix, while those starting with "org.osgi" are standard OSGi properties):
- felix.cache.filelimit - The integer value of this string sets an upper limit on how many files the cache will open. The default value is zero, which means there is no limit.
- org.osgi.framework.storage - Sets the directory to use as the bundle cache; by default bundle cache directory is felix-cache in the current working directory. The value should be a valid directory name. The directory name can be either absolute or relative. Relative directory names are relative to the current working directory. The specified directory will be created if it does not exist.
- felix.cache.rootdir - Sets the root directory to use to calculate the bundle cache directory for relative directory names. If org.osgi.framework.storage is set to a relative name, by default it is relative to the current working directory. If this property is set, then it will be calculated as being relative to the specified root directory.
- felix.cache.locking - Enables or disables bundle cache locking, which is used to prevent concurrent access to the bundle cache. This is enabled by default, but on older/smaller JVMs file channel locking is not available; set this property to false to disable it.
- felix.cache.bufsize - Sets the buffer size to be used by the cache; the default value is 4096. The integer value of this string provides control over the size of the internal buffer of the disk cache for performance reasons.
For specific information on how to configure the Felix framework, refer to the Felix framework usage documentation.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static int(package private) static final Stringstatic final Stringprivate static final Stringstatic final Stringprivate static final Stringstatic final Stringprivate static final Stringstatic final Stringstatic final Stringprivate final Mapprivate final Objectprivate final Loggerprivate static final SecureActionprivate final WeakZipFileFactory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static voidcopyStreamToFile(InputStream is, File outputFile) This method copies an input stream to the specified file.create(long id, int startLevel, String location, InputStream is) voiddelete()(package private) static booleandeleteDirectoryTree(File target) private static booleandeleteDirectoryTreeRecursive(File target) private static FiledetermineCacheDir(Map configMap) (package private) static SecureActiongetSystemBundleDataFile(String fileName) Provides the system bundle access to its private storage area; this special case is necessary since the system bundle is not really a bundle and therefore must be treated in a special way.voidrelease()
-
Field Details
-
CACHE_BUFSIZE_PROP
- See Also:
-
CACHE_ROOTDIR_PROP
- See Also:
-
CACHE_LOCKING_PROP
- See Also:
-
CACHE_FILELIMIT_PROP
- See Also:
-
CACHE_SINGLEBUNDLEFILE_PROP
- See Also:
-
BUFSIZE
protected static transient int BUFSIZE -
CACHE_DIR_NAME
- See Also:
-
CACHE_ROOTDIR_DEFAULT
- See Also:
-
CACHE_LOCK_NAME
- See Also:
-
BUNDLE_DIR_PREFIX
- See Also:
-
m_secureAction
-
m_logger
-
m_configMap
-
m_zipFactory
-
m_lock
-
-
Constructor Details
-
BundleCache
-
-
Method Details
-
release
public void release() -
getSecureAction
-
delete
-
getArchives
- Throws:
Exception
-
create
public BundleArchive create(long id, int startLevel, String location, InputStream is) throws Exception - Throws:
Exception
-
getSystemBundleDataFile
Provides the system bundle access to its private storage area; this special case is necessary since the system bundle is not really a bundle and therefore must be treated in a special way.- Parameters:
fileName- the name of the file in the system bundle's private area.- Returns:
- a File object corresponding to the specified file name.
- Throws:
Exception- if any error occurs.
-
copyStreamToFile
This method copies an input stream to the specified file.- Parameters:
is- the input stream to copy.outputFile- the file to which the input stream should be copied.- Throws:
IOException
-
deleteDirectoryTree
-
determineCacheDir
-
deleteDirectoryTreeRecursive
-