Package org.apache.felix.framework.util
Class WeakZipFileFactory
- java.lang.Object
-
- org.apache.felix.framework.util.WeakZipFileFactory
-
public class WeakZipFileFactory extends java.lang.Object
This class implements a factory for creating weak zip files, which behave mostly like a ZipFile, but can be weakly closed to limit the number of open files.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
WeakZipFileFactory.WeakZipFile
This class wraps a ZipFile to making it possible to weakly close it; this means the underlying zip file will be automatically reopened on demand if anyone tries to use it.
-
Field Summary
Fields Modifier and Type Field Description private static int
CLOSED
private Mutex
m_globalMutex
private int
m_limit
private java.util.List<WeakZipFileFactory.WeakZipFile>
m_openFiles
private static SecureAction
m_secureAction
private java.util.List<WeakZipFileFactory.WeakZipFile>
m_zipFiles
private static int
OPEN
private static int
WEAKLY_CLOSED
-
Constructor Summary
Constructors Constructor Description WeakZipFileFactory(int limit)
Constructs a weak zip file factory with the specified file limit.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description WeakZipFileFactory.WeakZipFile
create(java.io.File file)
Factory method used to create weak zip files.(package private) java.util.List<WeakZipFileFactory.WeakZipFile>
getOpenZipZiles()
Only used for testing.(package private) java.util.List<WeakZipFileFactory.WeakZipFile>
getZipZiles()
Only used for testing.
-
-
-
Field Detail
-
WEAKLY_CLOSED
private static final int WEAKLY_CLOSED
- See Also:
- Constant Field Values
-
OPEN
private static final int OPEN
- See Also:
- Constant Field Values
-
CLOSED
private static final int CLOSED
- See Also:
- Constant Field Values
-
m_secureAction
private static final SecureAction m_secureAction
-
m_zipFiles
private final java.util.List<WeakZipFileFactory.WeakZipFile> m_zipFiles
-
m_openFiles
private final java.util.List<WeakZipFileFactory.WeakZipFile> m_openFiles
-
m_globalMutex
private final Mutex m_globalMutex
-
m_limit
private final int m_limit
-
-
Method Detail
-
create
public WeakZipFileFactory.WeakZipFile create(java.io.File file) throws java.io.IOException
Factory method used to create weak zip files.- Parameters:
file
- the target zip file.- Returns:
- the created weak zip file.
- Throws:
java.io.IOException
- if the zip file could not be opened.
-
getZipZiles
java.util.List<WeakZipFileFactory.WeakZipFile> getZipZiles()
Only used for testing.- Returns:
- unclosed weak zip files.
-
getOpenZipZiles
java.util.List<WeakZipFileFactory.WeakZipFile> getOpenZipZiles()
Only used for testing.- Returns:
- open weak zip files.
-
-