org.ow2.util.archive.impl
Class JarArchiveImpl

java.lang.Object
  extended by org.ow2.util.archive.impl.AbsArchiveImpl
      extended by org.ow2.util.archive.impl.JarArchiveImpl
All Implemented Interfaces:
IArchive

public class JarArchiveImpl
extends AbsArchiveImpl
implements IArchive

Creates wrapper around jar file.

Author:
Florent Benoit

Constructor Summary
protected JarArchiveImpl(File file)
          Creates new instance of an EZBArchive for a jar file.
 
Method Summary
 boolean close()
          Close the underlying Resource.
 boolean equals(Object o)
          Is that the given object is equals to our instance.
 Iterator<String> getEntries()
           
 IArchiveMetadata getMetadata()
           
 String getName()
           
 URL getResource(String resourceName)
           
 Iterator<URL> getResources()
           
 Iterator<URL> getResources(String resourceName)
           
 URL getURL()
           
 int hashCode()
          Gets hashcode for this object.
protected  void initMetadata()
          Init metadata by reading the Manifest file.
 String toString()
           
 
Methods inherited from class org.ow2.util.archive.impl.AbsArchiveImpl
readManifest
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JarArchiveImpl

protected JarArchiveImpl(File file)
Creates new instance of an EZBArchive for a jar file.

Parameters:
file - the given jar file.
Method Detail

getName

public String getName()
Specified by:
getName in interface IArchive
Returns:
a description of this archive. This name could be used in logger info.

close

public boolean close()
Close the underlying Resource.

Specified by:
close in interface IArchive
Returns:
Returns true if the close was succesful, false otherwise.

getResource

public URL getResource(String resourceName)
                throws ArchiveException
Specified by:
getResource in interface IArchive
Parameters:
resourceName - The resource name to be looked up.
Returns:
Returns the resource URL if the resource has been found. null otherwise.
Throws:
ArchiveException - if method fails.

getResources

public Iterator<URL> getResources()
                           throws ArchiveException
Specified by:
getResources in interface IArchive
Returns:
Returns an Iterator of Resource's URL.
Throws:
ArchiveException - if method fails.

getResources

public Iterator<URL> getResources(String resourceName)
                           throws ArchiveException
Specified by:
getResources in interface IArchive
Parameters:
resourceName - The resource name to be looked up.
Returns:
Returns an Iterator of matching resources.
Throws:
ArchiveException - if method fails.

getURL

public URL getURL()
           throws ArchiveException
Specified by:
getURL in interface IArchive
Returns:
Returns the resource URL.
Throws:
ArchiveException - if method fails.

equals

public boolean equals(Object o)
Is that the given object is equals to our instance.

Overrides:
equals in class Object
Parameters:
o - the object to compare.
Returns:
true if equals, else false.

hashCode

public int hashCode()
Gets hashcode for this object.

Overrides:
hashCode in class Object
Returns:
hash code.

toString

public String toString()
Overrides:
toString in class AbsArchiveImpl
Returns:
string representation

initMetadata

protected void initMetadata()
                     throws ArchiveException
Init metadata by reading the Manifest file.

Throws:
ArchiveException - if metadata are not initialized

getMetadata

public IArchiveMetadata getMetadata()
Specified by:
getMetadata in interface IArchive
Overrides:
getMetadata in class AbsArchiveImpl
Returns:
the Metadata associated to this archive.

getEntries

public Iterator<String> getEntries()
                            throws ArchiveException
Specified by:
getEntries in interface IArchive
Returns:
all resources name
Throws:
ArchiveException - if error occurs


Copyright © 2007-2012 OW2 Consortium. All Rights Reserved.