org.entityfs.jar
Class JarFileSystemBuilder

java.lang.Object
  extended by org.entityfs.impl.AbstractFileSystemBuilder<T>
      extended by org.entityfs.impl.impl.AbstractFileSystemBuilderImpl<JarFileSystemBuilder>
          extended by org.entityfs.jar.JarFileSystemBuilder
All Implemented Interfaces:
FileSystemBuilder<JarFileSystemBuilder>

public class JarFileSystemBuilder
extends AbstractFileSystemBuilderImpl<JarFileSystemBuilder>

This is a builder class for building read only Jar file-backed file systems.

A limitation of the Jar file system is that it must be built upon a Jar file in a file-backed file system. This is because Java's JarFile class only can be built from a File object.

The Jar file system must be closed when it is not needed anymore. If a file entity is used for the jar file, it is locked for reading by the Jar file system. The lock is released when the file system is closed.

Since:
1.0
Author:
Karl Gustafsson

Field Summary
 
Fields inherited from interface org.entityfs.FileSystemBuilder
DEFAULT_BUFFER_SIZE
 
Constructor Summary
JarFileSystemBuilder()
          Create a builder with default settings: LogAdapter: DefaultLogAdapter.DEFAULT_ADAPTER EntityValidityControlStrategy: null (no one else should have write access to the backend)
 
Method Summary
protected  AdapterFactory createAdapterFactory()
           
protected  FileSystemImplementation createFileSystem(SupportObjects fso, FileSystemDelegate fsd)
           
protected  FileSystemDelegate createFileSystemDelegate(FileSystemAdapter fsa)
           
 boolean isLockingSupported()
          Does the file system being built support locking?
protected  boolean isReadOnly()
           
 JarFileSystemBuilder setJarFile(EFile f)
          Set the Jar file.
 JarFileSystemBuilder setJarFile(File f)
          Set the Jar file.
 JarFileSystemBuilder setJarFile(JarFile f)
          Set the Jar file.
protected  Collection<String> validate()
           
 
Methods inherited from class org.entityfs.impl.impl.AbstractFileSystemBuilderImpl
create, createDefaultChildEntityManagerFactory, enableEvents, getChildEntityManagerFactory, getEventManager, isFileSystemSupportedByAllCapabilities, setChildEntityManagerFactory, setEventManager
 
Methods inherited from class org.entityfs.impl.AbstractFileSystemBuilder
addCapabilityProvider, addCapabilityProviders, disableAccessControls, disableEntityValidityControls, enableLocking, getAccessController, getBufferSize, getCapabilityProviders, getCapabilityProvidersInternal, getEntityValidityControlStrategy, getLockAcquiringStrategy, getLockAdapterFactory, getLockCommandExecutor, getLogAdapter, getName, getThis, setAccessController, setBufferSize, setEntityValidityControlStrategy, setLockAcquiringStrategy, setLockAdapterFactory, setLockCommandExecutor, setLogAdapter, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarFileSystemBuilder

public JarFileSystemBuilder()
Create a builder with default settings:

Method Detail

setJarFile

public JarFileSystemBuilder setJarFile(File f)
Set the Jar file.

Parameters:
f - The Jar file.
Returns:
this.

setJarFile

public JarFileSystemBuilder setJarFile(EFile f)
                                throws IllegalArgumentException
Set the Jar file.

Parameters:
f - The Jar file.
Returns:
this.
Throws:
IllegalArgumentException - If the file is not in a file-backed file system.

setJarFile

public JarFileSystemBuilder setJarFile(JarFile f)
Set the Jar file.

Parameters:
f - The Jar file.
Returns:
this.

isLockingSupported

public boolean isLockingSupported()
Description copied from interface: FileSystemBuilder
Does the file system being built support locking?

Returns:
false.
See Also:
FileSystemBuilder.enableLocking()

validate

protected Collection<String> validate()
Overrides:
validate in class AbstractFileSystemBuilder<JarFileSystemBuilder>

isReadOnly

protected boolean isReadOnly()
Specified by:
isReadOnly in class AbstractFileSystemBuilderImpl<JarFileSystemBuilder>
Returns:
true, always.

createAdapterFactory

protected AdapterFactory createAdapterFactory()
Specified by:
createAdapterFactory in class AbstractFileSystemBuilderImpl<JarFileSystemBuilder>

createFileSystemDelegate

protected FileSystemDelegate createFileSystemDelegate(FileSystemAdapter fsa)
Specified by:
createFileSystemDelegate in class AbstractFileSystemBuilderImpl<JarFileSystemBuilder>

createFileSystem

protected FileSystemImplementation createFileSystem(SupportObjects fso,
                                                    FileSystemDelegate fsd)
Specified by:
createFileSystem in class AbstractFileSystemBuilderImpl<JarFileSystemBuilder>