org.glassfish.api.deployment.archive
Interface Archive

All Known Subinterfaces:
ReadableArchive, WritableArchive
All Known Implementing Classes:
ReadableArchiveAdapter

public interface Archive

This interface is an abstraction for accessing a module archive.

Author:
Jerome Dochez

Method Summary
 void close()
          closes this archive and releases all resources
 java.util.Enumeration<java.lang.String> entries()
          Returns an enumeration of the module file entries.
 java.util.Enumeration<java.lang.String> entries(java.lang.String prefix)
          Returns an enumeration of the module file entries with the specified prefix.
 long getArchiveSize()
          Returns the size of the archive.
 java.util.Collection<java.lang.String> getDirectories()
          Returns the enumeration of first level directories in this archive
 java.util.jar.Manifest getManifest()
          Returns the manifest information for this archive
 java.lang.String getName()
          Returns the name of the archive.
 java.net.URI getURI()
          Returns the path used to create or open the underlying archive
 boolean isDirectory(java.lang.String name)
          Returns true if the entry is a directory or a plain file
 

Method Detail

close

void close()
           throws java.io.IOException
closes this archive and releases all resources

Throws:
java.io.IOException

entries

java.util.Enumeration<java.lang.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.

Returns:
an enumeration of the archive file entries.

entries

java.util.Enumeration<java.lang.String> entries(java.lang.String prefix)
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.

Parameters:
prefix - the prefix of entries to be included
Returns:
an enumeration of the archive file entries.

getDirectories

java.util.Collection<java.lang.String> getDirectories()
                                                      throws java.io.IOException
Returns the enumeration of first level directories in this archive

Returns:
enumeration of directories under the root of this archive
Throws:
java.io.IOException

isDirectory

boolean isDirectory(java.lang.String name)
Returns true if the entry is a directory or a plain file

Parameters:
name - name is one of the entries returned by entries()
Returns:
true if the entry denoted by the passed name is a directory

getManifest

java.util.jar.Manifest getManifest()
                                   throws java.io.IOException
Returns the manifest information for this archive

Returns:
the manifest info
Throws:
java.io.IOException

getURI

java.net.URI getURI()
Returns the path used to create or open the underlying archive

TODO: abstraction breakage: Several callers, most notably DeploymentContext.getSourceDir() implementation, assumes that this URI is an URL, and in fact file URL.

If this needs to be URL, use of URI is misleading. And furthermore, if its needs to be a file URL, this should be File.

Returns:
the path for this archive.

getArchiveSize

long getArchiveSize()
                    throws java.lang.SecurityException
Returns the size of the archive.

Returns:
long indicating the size of the archive
Throws:
java.lang.SecurityException

getName

java.lang.String getName()
Returns the name of the archive.

Implementations should not return null.

Returns:
the name of the archive


Copyright © 2012 GlassFish Community. All Rights Reserved.