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.
-
-
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(java.lang.String name, java.lang.String version)
Finds and returns aDefaultModuleDefinition
instance for a module given the name and version constraints.java.util.List<ModuleDefinition>
findAll()
Returns a list of all modules available in this repositoryjava.util.List<ModuleDefinition>
findAll(java.lang.String name)
Finds and returns a list of all the available versions of a module given its name.java.util.List<java.net.URI>
getJarLocations()
Returns the plain jar files installed in this repository.java.net.URI
getLocation()
Returns the repository locationjava.lang.String
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
java.lang.String getName()
Returns the repository name- Returns:
- repository name
-
getLocation
java.net.URI getLocation()
Returns the repository location- Returns:
- the URI for the repository location
-
find
ModuleDefinition find(java.lang.String name, java.lang.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
java.util.List<ModuleDefinition> findAll()
Returns a list of all modules available in this repository- Returns:
- a list of available modules
-
findAll
java.util.List<ModuleDefinition> findAll(java.lang.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 java.io.IOException
Initialize the repository for use. This need to be called at least once before any find methods is invoked.- Throws:
java.io.IOException
- if an error occur accessing the repository
-
shutdown
void shutdown() throws java.io.IOException
Shutdown the repository. After this call return, the find methods cannot be used until initialize() is called again.- Throws:
java.io.IOException
- if an error occur accessing the repository
-
getJarLocations
java.util.List<java.net.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
-
-