Class JarResourceLoader
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLogEnabled
-
- org.codehaus.plexus.resource.loader.AbstractResourceLoader
-
- org.codehaus.plexus.resource.loader.JarResourceLoader
-
- All Implemented Interfaces:
org.codehaus.plexus.logging.LogEnabled
,ResourceLoader
@Component(role=ResourceLoader.class, hint="jar", instantiationStrategy="per-lookup") public class JarResourceLoader extends AbstractResourceLoader
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map
entryDirectory
Maps entries to the parent JAR File (key = the entry *excluding* plain directories, value = the JAR URL).static java.lang.String
ID
private boolean
initializeCalled
private java.util.Map<java.lang.String,JarHolder>
jarfiles
Maps JAR URLs to the actual JAR (key = the JAR URL, value = the JAR).-
Fields inherited from class org.codehaus.plexus.resource.loader.AbstractResourceLoader
paths
-
Fields inherited from interface org.codehaus.plexus.resource.loader.ResourceLoader
ROLE
-
-
Constructor Summary
Constructors Constructor Description JarResourceLoader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addEntries(java.util.Map entries)
Copy all the entries into the entryDirectory.void
addSearchPath(java.lang.String path)
private void
closeJar(java.lang.String path)
Closes a Jar file and set its URLConnection to null.PlexusResource
getResource(java.lang.String source)
Get an InputStream so that the Runtime can build a template with it.void
initialize()
private void
loadJar(java.lang.String path)
-
Methods inherited from class org.codehaus.plexus.resource.loader.AbstractResourceLoader
getResourceAsInputStream
-
-
-
-
Field Detail
-
ID
public static final java.lang.String ID
- See Also:
- Constant Field Values
-
entryDirectory
private java.util.Map entryDirectory
Maps entries to the parent JAR File (key = the entry *excluding* plain directories, value = the JAR URL).
-
jarfiles
private java.util.Map<java.lang.String,JarHolder> jarfiles
Maps JAR URLs to the actual JAR (key = the JAR URL, value = the JAR).
-
initializeCalled
private boolean initializeCalled
-
-
Method Detail
-
initialize
public void initialize() throws org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
- Throws:
org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException
-
loadJar
private void loadJar(java.lang.String path)
-
closeJar
private void closeJar(java.lang.String path)
Closes a Jar file and set its URLConnection to null.
-
addEntries
private void addEntries(java.util.Map entries)
Copy all the entries into the entryDirectory. It will overwrite any duplicate keys.
-
getResource
public PlexusResource getResource(java.lang.String source) throws ResourceNotFoundException
Get an InputStream so that the Runtime can build a template with it.- Parameters:
source
- name of template to get- Returns:
- InputStream containing the template
- Throws:
ResourceNotFoundException
- if template not found in the file template path.
-
addSearchPath
public void addSearchPath(java.lang.String path)
- Specified by:
addSearchPath
in interfaceResourceLoader
- Overrides:
addSearchPath
in classAbstractResourceLoader
-
-