org.objectweb.easybeans.deployable.archive
Class EZBJarArchiveImpl

java.lang.Object
  extended by org.objectweb.easybeans.deployable.archive.EZBJarArchiveImpl
All Implemented Interfaces:
EZBArchive

public class EZBJarArchiveImpl
extends java.lang.Object
implements EZBArchive

Creates wrapper around jar file.

Author:
Florent Benoit

Field Summary
private  java.io.File file
          Internal resource used as archive.
private  java.util.jar.JarFile jarFile
          Internal resource used as archive.
 
Constructor Summary
protected EZBJarArchiveImpl(java.io.File file)
          Creates new instance of an EZBArchive for a jar file.
 
Method Summary
 boolean close()
          Close the underlying Resource.
 boolean equals(java.lang.Object o)
          Is that the given object is equals to our instance.
 java.lang.String getName()
           
 java.net.URL getResource(java.lang.String resourceName)
           
 java.util.Iterator<java.net.URL> getResources()
           
 java.util.Iterator<java.net.URL> getResources(java.lang.String resourceName)
           
 java.net.URL getURL()
           
 int hashCode()
          Gets hashcode for this object.
private  void init()
          Init an archive and create the associated jar file object.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

jarFile

private java.util.jar.JarFile jarFile
Internal resource used as archive.


file

private java.io.File file
Internal resource used as archive.

Constructor Detail

EZBJarArchiveImpl

protected EZBJarArchiveImpl(java.io.File file)
Creates new instance of an EZBArchive for a jar file.

Parameters:
file - the given jar file.
Method Detail

init

private void init()
           throws EZBArchiveException
Init an archive and create the associated jar file object. Close() method needs to be called !.

Throws:
EZBArchiveException - if init fails

getName

public java.lang.String getName()
Specified by:
getName in interface EZBArchive
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 EZBArchive
Returns:
Returns true if the close was succesful, false otherwise.

getResource

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

getResources

public java.util.Iterator<java.net.URL> getResources()
                                              throws EZBArchiveException
Specified by:
getResources in interface EZBArchive
Returns:
Returns an Iterator of Resource's URL.
Throws:
EZBArchiveException - if method fails.

getResources

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

getURL

public java.net.URL getURL()
                    throws EZBArchiveException
Specified by:
getURL in interface EZBArchive
Returns:
Returns the resource URL.
Throws:
EZBArchiveException - if method fails.

equals

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

Overrides:
equals in class java.lang.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 java.lang.Object
Returns:
hash code.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
string representation