Package org.glassfish.internal.embedded
Class ScatteredArchive
- java.lang.Object
-
- org.glassfish.api.deployment.archive.ReadableArchiveAdapter
-
- org.glassfish.internal.embedded.ScatteredArchive
-
- All Implemented Interfaces:
Archive
,ReadableArchive
public class ScatteredArchive extends ReadableArchiveAdapter
Abstraction for a scattered archive (parts disseminated in various directories)- Author:
- Jerome Dochez
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ScatteredArchive.Builder
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
closes this archive and releases all resourcesEnumeration<String>
entries()
Returns an enumeration of the module file entries.Enumeration<String>
entries(String s)
Returns an enumeration of the module file entries with the specified prefix.boolean
exists(String name)
Returns whether or not a file by that name exists The file name must be relative to the root of the module.Iterable<URL>
getClassPath()
Get the classpath URLsCollection<String>
getDirectories()
Returns the enumeration of first level directories in this archiveInputStream
getEntry(String arg)
Returns the InputStream for the given entry name The file name must be relative to the root of the module.long
getEntrySize(String arg)
Returns the entry size for a given entry name or 0 if not knownFile
getFile(String name)
Manifest
getManifest()
Returns the manifest information for this archiveString
getName()
Returns the name of the archive.File
getResourcesDir()
URI
getURI()
Returns the path used to create or open the underlying archiveString
toString()
ScatteredArchive.Builder.type
type()
Returns the archive type-
Methods inherited from class org.glassfish.api.deployment.archive.ReadableArchiveAdapter
addArchiveMetaData, delete, exists, getArchiveMetaData, getArchiveSize, getExtraData, getParentArchive, getSubArchive, isDirectory, open, removeArchiveMetaData, removeExtraData, renameTo, setExtraData, setParentArchive
-
-
-
-
Method Detail
-
getClassPath
public Iterable<URL> getClassPath()
Get the classpath URLs- Returns:
- A read-only copy of the classpath URL Collection
-
getResourcesDir
public File getResourcesDir()
- Returns:
- The resources directory
-
getEntry
public InputStream getEntry(String arg) throws IOException
Returns the InputStream for the given entry name The file name must be relative to the root of the module.- Parameters:
arg
- the file name relative to the root of the module.- Returns:
- the InputStream for the given entry name or null if not found.
- Throws:
IOException
-
getEntrySize
public long getEntrySize(String arg)
Description copied from interface:ReadableArchive
Returns the entry size for a given entry name or 0 if not known- Specified by:
getEntrySize
in interfaceReadableArchive
- Overrides:
getEntrySize
in classReadableArchiveAdapter
- Parameters:
arg
- the entry name- Returns:
- the entry size
-
exists
public boolean exists(String name) throws IOException
Returns whether or not a file by that name exists The file name must be relative to the root of the module.- Parameters:
name
- the file name relative to the root of the module.- Returns:
- does the file exist?
- Throws:
IOException
-
entries
public Enumeration<String> entries()
Returns an enumeration of the module file entries. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.Currently under construction
- Specified by:
entries
in interfaceArchive
- Overrides:
entries
in classReadableArchiveAdapter
- Returns:
- an enumeration of the archive file entries.
-
getManifest
public Manifest getManifest() throws IOException
Returns the manifest information for this archive- Returns:
- the manifest info
- Throws:
IOException
-
getURI
public URI getURI()
Returns the path used to create or open the underlying archive TODO: abstraction breakage: Several callers, most notablyDeploymentContext.getSourceDir()
implementation, assumes that this URI is an URL, and in fact file URL. If this needs to be URL, use ofURI
is misleading. And furthermore, if its needs to be a file URL, this should beFile
.- Returns:
- the path for this archive.
-
getName
public String getName()
Returns the name of the archive. Implementations should not return null.- Returns:
- the name of the archive
-
type
public ScatteredArchive.Builder.type type()
Returns the archive type- Returns:
- the archive type
-
entries
public Enumeration<String> entries(String s)
Returns an enumeration of the module file entries with the specified prefix. All elements in the enumeration are of type String. Each String represents a file name relative to the root of the module.Currently Not Supported
- Specified by:
entries
in interfaceArchive
- Overrides:
entries
in classReadableArchiveAdapter
- Parameters:
s
- the prefix of entries to be included- Returns:
- an enumeration of the archive file entries.
-
getDirectories
public Collection<String> getDirectories() throws IOException
Description copied from interface:Archive
Returns the enumeration of first level directories in this archive- Specified by:
getDirectories
in interfaceArchive
- Overrides:
getDirectories
in classReadableArchiveAdapter
- Returns:
- enumeration of directories under the root of this archive
- Throws:
IOException
-
close
public void close() throws IOException
Description copied from interface:Archive
closes this archive and releases all resources- Specified by:
close
in interfaceArchive
- Overrides:
close
in classReadableArchiveAdapter
- Throws:
IOException
-
-