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

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

@Service(name="jar")
@Scoped(value=org.jvnet.hk2.component.PerLookup.class)
public class OutputJarArchive
extends JarArchive
implements WritableArchive

Provides an implementation of the Archive that maps to a Jar file @see java.util.jar.JarFile

Author:
Jerome Dochez

Field Summary
protected  ZipOutputStream jos
           
 
Fields inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
extraData, parentArchive
 
Constructor Summary
OutputJarArchive()
           
 
Method Summary
 void close()
          close the abstract archive
 void closeEntry()
          closes the current entry
 void closeEntry(WritableArchive subArchive)
          Close a previously returned sub archive
 void create(URI path)
          creates a new abstract archive with the given path
 WritableArchive createSubArchive(String name)
           
 Enumeration entries()
           
 Enumeration entries(Enumeration embeddedArchives)
           
 long getArchiveSize()
          Get the size of the archive
 Collection<String> getDirectories()
           
protected  JarEntry getJarEntry(String entryName)
           
 Manifest getManifest()
           
 URI getURI()
          Returns the path used to create or open the underlyong archive
 OutputStream putNextEntry(String name)
           
 
Methods inherited from class com.sun.enterprise.deployment.deploy.shared.JarArchive
entries, exists, getExtraData, getName, 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.Archive
entries, getName, isDirectory
 

Field Detail

jos

protected ZipOutputStream jos
Constructor Detail

OutputJarArchive

public OutputJarArchive()
Method Detail

getArchiveSize

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

Specified by:
getArchiveSize in interface Archive
Returns:
-1 because this is getting created
Throws:
NullPointerException
SecurityException

close

public void close()
           throws IOException
close the abstract archive

Specified by:
close in interface Archive
Throws:
IOException

getJarEntry

protected JarEntry getJarEntry(String entryName)
Specified by:
getJarEntry in class JarArchive

create

public void create(URI path)
            throws IOException
creates a new abstract archive with the given path

Specified by:
create in interface WritableArchive
Parameters:
path - the path to create the archive
Throws:
IOException

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

getManifest

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

getURI

public URI getURI()
Returns the path used to create or open the underlyong archive

Specified by:
getURI in interface Archive
Returns:
the path for this archive.

createSubArchive

public WritableArchive createSubArchive(String name)
                                 throws IOException
Specified by:
createSubArchive in interface WritableArchive
Throws:
IOException

closeEntry

public void closeEntry(WritableArchive subArchive)
                throws IOException
Close a previously returned sub archive

Specified by:
closeEntry in interface WritableArchive
Parameters:
subArchive - output stream to close
Throws:
IOException

putNextEntry

public OutputStream putNextEntry(String name)
                          throws IOException
Specified by:
putNextEntry in interface WritableArchive
Parameters:
name - the entry name
Throws:
IOException

closeEntry

public void closeEntry()
                throws IOException
closes the current entry

Specified by:
closeEntry in interface WritableArchive
Throws:
IOException


Copyright © 2012 GlassFish Community. All Rights Reserved.