|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.enterprise.module.common_impl.AbstractRepositoryImpl
public abstract class AbstractRepositoryImpl
Partial implementation of Repository
that statically enumerates all ModuleDefinition
upfront.
Field Summary | |
---|---|
protected List<RepositoryChangeListener> |
listeners
|
Constructor Summary | |
---|---|
AbstractRepositoryImpl(String name,
URI location)
|
Method Summary | |
---|---|
protected void |
add(ModuleDefinition def)
|
protected void |
addLibrary(URI location)
|
boolean |
addListener(RepositoryChangeListener listener)
Add a listener to changes happening to this repository. |
ModuleDefinition |
find(String name,
String version)
Finds and returns a DefaultModuleDefinition instance
for a module given the name and version constraints. |
List<ModuleDefinition> |
findAll()
Returns a list of all modules available in this repository |
List<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 location |
String |
getName()
Returns the repository name |
void |
initialize()
Initialize the repository for use. |
protected ModuleDefinition |
loadJar(File jar)
Loads a jar file and builds a ModuleDefinition . |
protected abstract void |
loadModuleDefs(Map<ModuleId,ModuleDefinition> moduleDefs,
List<URI> libraries)
Called from initialize() to load all ModuleDefinition s and libraries defintions |
protected ModuleDefinition |
newModuleDefinition(File jar,
Attributes attr)
Extensibility point for subclasses to create a different instance of ModuleDefinition . |
protected void |
remove(ModuleDefinition def)
|
protected void |
removeLibrary(URI location)
|
boolean |
removeListener(RepositoryChangeListener listener)
Removes a previously registered listener |
void |
shutdown()
Shutdown the repository. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected List<RepositoryChangeListener> listeners
Constructor Detail |
---|
public AbstractRepositoryImpl(String name, URI location)
Method Detail |
---|
public String getName()
Repository
getName
in interface Repository
public URI getLocation()
Repository
getLocation
in interface Repository
public ModuleDefinition find(String name, String version)
Repository
DefaultModuleDefinition
instance
for a module given the name and version constraints.
find
in interface Repository
name
- the requested module nameversion
- the module version. Can be null if the caller doesn't care about the version.
DefaultModuleDefinition
or null if not found
in this repository.public List<ModuleDefinition> findAll()
Repository
findAll
in interface Repository
public List<ModuleDefinition> findAll(String name)
Repository
findAll
in interface Repository
name
- the requested module namepublic void initialize() throws IOException
Repository
initialize
in interface Repository
IOException
- if an error occur accessing the repositoryprotected abstract void loadModuleDefs(Map<ModuleId,ModuleDefinition> moduleDefs, List<URI> libraries) throws IOException
initialize()
to load all ModuleDefinition
s and libraries defintions
IOException
protected ModuleDefinition loadJar(File jar) throws IOException
ModuleDefinition
.
The system allows ModuleDefinition
s to be built in any way,
but in practice module jars need to be built in a way agnostic
to Repository
implementations (so that same module could
be used in different Repository
s), so it makes sense
to try to stick to the "common" loading scheme.
jar
- Either a jar file or a directory that has the same structure as a jar file.
IOException
protected void add(ModuleDefinition def)
protected void remove(ModuleDefinition def)
protected void addLibrary(URI location)
protected void removeLibrary(URI location)
public void shutdown() throws IOException
Repository
shutdown
in interface Repository
IOException
- if an error occur accessing the repositorypublic String toString()
toString
in class Object
public List<URI> getJarLocations()
getJarLocations
in interface Repository
public boolean addListener(RepositoryChangeListener listener)
addListener
in interface Repository
listener
- implementation listening to this repository changes
public boolean removeListener(RepositoryChangeListener listener)
removeListener
in interface Repository
listener
- the previously registered listener
protected ModuleDefinition newModuleDefinition(File jar, Attributes attr) throws IOException
ModuleDefinition
.
jar
- The module jar file for which ModuleDefinition
will be created.
Never null.
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |