Package com.sun.enterprise.module
Interface Repository
-
- All Known Implementing Classes:
AbstractRepositoryImpl
,CookedLibRepository
,DirectoryBasedRepository
public interface Repository
A Repository instance is an abstraction of a set of accessible modules. Repository can be local or remote and are used to procure modules implementation based on constraints like name or version.- Author:
- Jerome Dochez
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
addListener(RepositoryChangeListener listener)
Add a listener to changes happening to this repository.ModuleDefinition
find(String name, String version)
Finds and returns aDefaultModuleDefinition
instance for a module given the name and version constraints.List<ModuleDefinition>
findAll()
Returns a list of all modules available in this repositoryList<ModuleDefinition>
findAll(String name)
Finds and returns a list of all the available versions of a module given its name.List<URI>
getJarLocations()
Returns the plain jar files installed in this repository.URI
getLocation()
Returns the repository locationString
getName()
Returns the repository namevoid
initialize()
Initialize the repository for use.boolean
removeListener(RepositoryChangeListener listener)
Removes a previously registered listenervoid
shutdown()
Shutdown the repository.
-
-
-
Method Detail
-
getName
String getName()
Returns the repository name- Returns:
- repository name
-
getLocation
URI getLocation()
Returns the repository location- Returns:
- the URI for the repository location
-
find
ModuleDefinition find(String name, String version)
Finds and returns aDefaultModuleDefinition
instance for a module given the name and version constraints.- Parameters:
name
- the requested module nameversion
- the module version. Can be null if the caller doesn't care about the version.- Returns:
- a
DefaultModuleDefinition
or null if not found in this repository.
-
findAll
List<ModuleDefinition> findAll()
Returns a list of all modules available in this repository- Returns:
- a list of available modules
-
findAll
List<ModuleDefinition> findAll(String name)
Finds and returns a list of all the available versions of a module given its name.- Parameters:
name
- the requested module name
-
initialize
void initialize() throws IOException
Initialize the repository for use. This need to be called at least once before any find methods is invoked.- Throws:
IOException
- if an error occur accessing the repository
-
shutdown
void shutdown() throws IOException
Shutdown the repository. After this call return, the find methods cannot be used until initialize() is called again.- Throws:
IOException
- if an error occur accessing the repository
-
getJarLocations
List<URI> getJarLocations()
Returns the plain jar files installed in this repository. Plain jar files are not modules, they do not have the module's metadata and can only be used when referenced from a module dependency list or when added to a class loader directly- Returns:
- jar files location stored in this repository.
-
addListener
boolean addListener(RepositoryChangeListener listener)
Add a listener to changes happening to this repository. Repository can change during the lifetime of an execution (files added/removed/changed)- Parameters:
listener
- implementation listening to this repository changes- Returns:
- true if the listener was added successfully
-
removeListener
boolean removeListener(RepositoryChangeListener listener)
Removes a previously registered listener- Parameters:
listener
- the previously registered listener- Returns:
- true if the listener was successfully unregistered
-
-