Top Description Fields Constructors Methods
com.sun.enterprise.module.common_impl

public Class DirectoryBasedRepository

extends AbstractRepositoryImpl
Class Inheritance
Imports
com.sun.enterprise.module.ModuleDefinition, .RepositoryChangeListener, java.io.File, .FileNotFoundException, .IOException, .FileFilter, java.net.URI, java.util.HashMap, .LinkedList, .List, .Map, .Timer, .TimerTask, java.util.concurrent.locks.ReentrantLock

This class is a directory based repository implementation. This mean that all jar file residing a particular directory will be elligible to be added to this repository instance. Jar File will need to be compliant with the module definition spec which mean have a manifest file with the correct elements OR a separate manifest file with the same file name with a .mf extension.
Author
Jerome Dochez

Field Summary

Modifier and TypeField and Description
private final int
private boolean
private final ReentrantLock
protected final File
private List<File>
private Timer
Inherited from com.sun.enterprise.module.common_impl.AbstractRepositoryImpl:
listeners

Constructor Summary

AccessConstructor and Description
public
DirectoryBasedRepository(String name, File repository)

Creates a new instance of DirectoryBasedRepository

public
DirectoryBasedRepository(String name, File repository, boolean isTimerThreadDaemon)

Method Summary

Modifier and TypeMethod and Description
public boolean
private void
private void
protected boolean
isDisabled(File jar)

Checks the xyz.disabled file for xyz.jar and return true if the file exists.

protected void
loadModuleDefs(Map<ModuleId, ModuleDefinition> moduleDefs, List<URI> libraries)

Implements abstract com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.loadModuleDefs.

Called from initialize() to load all ModuleDefinitions and libraries defintions

public void
Inherited from com.sun.enterprise.module.common_impl.AbstractRepositoryImpl:
addaddLibraryfindfindAllfindAllgetJarLocationsgetLocationgetNameinitializeloadJarnewModuleDefinitionremoveremoveLibraryremoveListenertoString

Field Detail

intervalInMsback to summary
private final int intervalInMs
isTimerThreadDaemonback to summary
private boolean isTimerThreadDaemon
lockback to summary
private final ReentrantLock lock

Hides com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.lock.

repositoryback to summary
protected final File repository
subDirectoriesback to summary
private List<File> subDirectories
timerback to summary
private Timer timer

Constructor Detail

DirectoryBasedRepositoryback to summary
public DirectoryBasedRepository(String name, File repository)

Creates a new instance of DirectoryBasedRepository

DirectoryBasedRepositoryback to summary
public DirectoryBasedRepository(String name, File repository, boolean isTimerThreadDaemon)

Method Detail

addListenerback to summary
public boolean addListener(RepositoryChangeListener listener)

Overrides com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.addListener.

Implements com.sun.enterprise.module.Repository.addListener.

Doc from com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.addListener.

Add a listener to changes happening to this repository. Repository can change during the lifetime of an execution (files added/removed/changed)

Annotations
@Override
directoryChangedback to summary
private void directoryChanged()
initializeSubDirectoriesback to summary
private void initializeSubDirectories()
isDisabledback to summary
protected boolean isDisabled(File jar)

Checks the xyz.disabled file for xyz.jar and return true if the file exists.

loadModuleDefsback to summary
protected void loadModuleDefs(Map<ModuleId, ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException

Implements abstract com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.loadModuleDefs.

Doc from com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.loadModuleDefs.

Called from initialize() to load all ModuleDefinitions and libraries defintions

shutdownback to summary
public void shutdown() throws IOException

Overrides com.sun.enterprise.module.common_impl.AbstractRepositoryImpl.shutdown.

Implements com.sun.enterprise.module.Repository.shutdown.

Doc from com.sun.enterprise.module.Repository.shutdown.

Shutdown the repository. After this call return, the find methods cannot be used until initialize() is called again.

Annotations
@Override
Exceptions
IOException:
if an error occur accessing the repository