com.sun.enterprise.deployment.deploy.shared
Class MemoryMappedArchive

java.lang.Object
  extended by com.sun.enterprise.deployment.deploy.shared.JarArchive
      extended by com.sun.enterprise.deployment.deploy.shared.MemoryMappedArchive
All Implemented Interfaces:
Archive, ReadableArchive

@Service
@Scoped(value=org.jvnet.hk2.component.PerLookup.class)
public class MemoryMappedArchive
extends JarArchive
implements ReadableArchive

Author:
Jerome Dochez

Field Summary
 
Fields inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
extraData, parentArchive
 
Constructor Summary
protected MemoryMappedArchive()
          Creates a new instance of MemoryMappedArchive
  MemoryMappedArchive(byte[] bits)
           
  MemoryMappedArchive(InputStream is)
          Creates a new instance of MemoryMappedArchive
  MemoryMappedArchive(ReadableArchive source)
           
 
Method Summary
 void close()
          close the abstract archive
 boolean delete()
          delete the archive
 Enumeration entries()
           
 Enumeration entries(Enumeration embeddedArchives)
           
 boolean exists()
           
 boolean exists(String name)
          Returns the existence of the given entry name The file name must be relative to the root of the module.
 long getArchiveSize()
          Get the size of the archive
 byte[] getByteArray()
           
 Collection<String> getDirectories()
           
 InputStream getEntry(String name)
           
 long getEntrySize(String name)
          Returns the entry size for a given entry name or 0 if not known
 JarEntry getJarEntry(String name)
           
 Manifest getManifest()
           
 String getName()
          Returns the name for the archive.
 String getPath()
           
 ReadableArchive getSubArchive(String name)
          create or obtain an embedded archive within this abstraction.
 URI getURI()
           
 void open(URI uri)
           
 boolean renameTo(String name)
          rename the archive
 void setURI(URI uri)
           
 
Methods inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
entries, getExtraData, getParentArchive, isDirectory, removeExtraData, setExtraData, setParentArchive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.glassfish.api.deployment.archive.ReadableArchive
getExtraData, getParentArchive, removeExtraData, setExtraData, setParentArchive
 
Methods inherited from interface org.glassfish.api.deployment.archive.Archive
entries, isDirectory
 

Constructor Detail

MemoryMappedArchive

protected MemoryMappedArchive()
Creates a new instance of MemoryMappedArchive


MemoryMappedArchive

public MemoryMappedArchive(InputStream is)
                    throws IOException
Creates a new instance of MemoryMappedArchive

Throws:
IOException

MemoryMappedArchive

public MemoryMappedArchive(byte[] bits)

MemoryMappedArchive

public MemoryMappedArchive(ReadableArchive source)
                    throws IOException
Throws:
IOException
Method Detail

getByteArray

public byte[] getByteArray()

open

public void open(URI uri)
          throws IOException
Specified by:
open in interface ReadableArchive
Throws:
IOException

close

public void close()
           throws IOException
close the abstract archive

Specified by:
close in interface Archive
Throws:
IOException

delete

public boolean delete()
delete the archive

Specified by:
delete in interface ReadableArchive

entries

public Enumeration entries()
Specified by:
entries in interface Archive
Returns:
an @see java.util.Enumeration of entries in this abstract archive

getDirectories

public Collection<String> getDirectories()
                                  throws IOException
Specified by:
getDirectories in interface Archive
Throws:
IOException

entries

public Enumeration entries(Enumeration embeddedArchives)
Returns:
an @see java.util.Enumeration of entries in this abstract archive, providing the list of embedded archive to not count their entries as part of this archive

exists

public boolean exists()
Specified by:
exists in interface ReadableArchive
Returns:
true if this archive exists

getPath

public String getPath()
Returns:
the archive uri

getArchiveSize

public long getArchiveSize()
                    throws NullPointerException,
                           SecurityException
Get the size of the archive

Specified by:
getArchiveSize in interface Archive
Returns:
tje the size of this archive or -1 on error
Throws:
NullPointerException
SecurityException

getURI

public URI getURI()
Specified by:
getURI in interface Archive

setURI

public void setURI(URI uri)

getSubArchive

public ReadableArchive getSubArchive(String name)
                              throws IOException
create or obtain an embedded archive within this abstraction.

Specified by:
getSubArchive in interface ReadableArchive
Parameters:
name - the name of the embedded archive.
Throws:
IOException

exists

public boolean exists(String name)
               throws IOException
Returns the existence of the given entry name The file name must be relative to the root of the module.

Specified by:
exists in interface ReadableArchive
Overrides:
exists in class JarArchive
Parameters:
name - the file name relative to the root of the module.
Returns:
the existence the given entry name.
Throws:
IOException

getEntry

public InputStream getEntry(String name)
                     throws IOException
Specified by:
getEntry in interface ReadableArchive
Parameters:
name - the entry name
Returns:
a @see java.io.InputStream for an existing entry in the current abstract archive
Throws:
IOException

getJarEntry

public JarEntry getJarEntry(String name)
Specified by:
getJarEntry in class JarArchive

getEntrySize

public long getEntrySize(String name)
Returns the entry size for a given entry name or 0 if not known

Specified by:
getEntrySize in interface ReadableArchive
Parameters:
name - the entry name
Returns:
the entry size

getManifest

public Manifest getManifest()
                     throws IOException
Specified by:
getManifest in interface Archive
Returns:
the manifest information for this abstract archive
Throws:
IOException

renameTo

public boolean renameTo(String name)
rename the archive

Specified by:
renameTo in interface ReadableArchive
Parameters:
name - the archive name

getName

public String getName()
Returns the name for the archive.

For a MemoryMappedArhive there is no name, so an empty string is returned.

Specified by:
getName in interface Archive
Overrides:
getName in class JarArchive
Returns:
the name of the archive


Copyright © 2012. All Rights Reserved.