Data Request Broker
2-3-release

fr.gael.drb.impl.zip
Class ZipNode

java.lang.Object
  extended by fr.gael.drb.DrbDefaultNodesChangeProducer
      extended by fr.gael.drb.DrbAbstractNode
          extended by fr.gael.drb.impl.DrbNodeImpl
              extended by fr.gael.drb.impl.zip.ZipNode
All Implemented Interfaces:
DrbMutableNode, DrbNode, DrbNodesChangeListener, DrbNodesChangeProducer, EventListener

public class ZipNode
extends DrbNodeImpl

This class is used to Zip Node implementation.


Field Summary
 
Fields inherited from interface fr.gael.drb.DrbItem
ATTRIBUTE_ITEM, NODE_ITEM, UNDEFINED_ITEM, VALUE_ITEM
 
Constructor Summary
protected ZipNode(ZipFileNode zipfilen, ZipEntry zipentry, DrbNode parent, ZipEntry[] children)
          Builds a new zipFile from a ZipFileNode and a zipEntry.
 
Method Summary
 boolean allowsMultiOccurrence()
          Check if this node may have multiple occurrence
 boolean equals(Object obj)
          Indicates whether this node is "equal to" to another node.
 DrbAttributeList getAttributes()
          The attributes of the node The file nodes node have no specific attribute and this operation returns therefore a nullvalue at each call.
 DrbNodeList getChildren()
          The children of the current node.
 Object getImpl(Class api)
          Provide other implementation.
 String getName()
          Name of the node.
 DrbNode getParent()
          The parent of the current node.
protected  ZipEntry getZipEntry()
          Get the zip entry of the zip file
protected  ZipFileNode getZipFileNode()
          Get the zip file node
 boolean hasChild()
          Checks if any child exists.
 boolean hasImpl(Class api)
          Checks any implementation.
 
Methods inherited from class fr.gael.drb.impl.DrbNodeImpl
close, createAttribute, createNode, flush, getProvider
 
Methods inherited from class fr.gael.drb.DrbAbstractNode
appendChild, appendReference, getAttribute, getChildAt, getChildrenCount, getContent, getFirstChild, getIndex, getItemType, getLastChild, getNamedChild, getNamespaceBindings, getNamespaceURI, getNextSibling, getOccurrence, getPath, getPreviousSibling, getRoot, getValue, getValueType, getXPathName, getXPathName, insertChild, removeChild, rename, replaceChild, setAttributes, setNamespaceBindings, setNamespaceURI, setValue, toString
 
Methods inherited from class fr.gael.drb.DrbDefaultNodesChangeProducer
addNodesChangeListener, getListenerList, nodesChanged, nodesInserted, nodesRemoved, removeNodesChangeListener, setListenerList, structureChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZipNode

protected ZipNode(ZipFileNode zipfilen,
                  ZipEntry zipentry,
                  DrbNode parent,
                  ZipEntry[] children)
Builds a new zipFile from a ZipFileNode and a zipEntry.

Parameters:
zipfilen - the zip file node
parent - The parent of this node
zipentry - the zip entry
children - the list of children
Method Detail

equals

public boolean equals(Object obj)
Indicates whether this node is "equal to" to another node. See Object.equals() for the general contract of this method.

Overrides:
equals in class DrbAbstractNode
Parameters:
obj - another value.
Returns:
true if this object is the same as the obj argument

getName

public String getName()
Name of the node. Returns the name of the node. This name is the canonical name of the node. It does not contains any prefix, path and location part. This name clearly identifies the node in its parent depending only from its occurence number and its index. All nodes provided by an implementation is named. Therefore this operation never returns null value. An empty string is however allowed if the node is unique (e.g. non named root node).

Overrides:
getName in class DrbAbstractNode
Returns:
The name of the node.

allowsMultiOccurrence

public boolean allowsMultiOccurrence()
Check if this node may have multiple occurrence

Overrides:
allowsMultiOccurrence in class DrbAbstractNode
Returns:
true if the children may have a multiple occurrence and false otherwise.

hasChild

public boolean hasChild()
Checks if any child exists. Returns wheter the current node has at least a child.

Overrides:
hasChild in class DrbAbstractNode
Returns:
true if this node has any children, false otherwise.

getChildren

public DrbNodeList getChildren()
The children of the current node. This operation returns all entries in the ZIP archive.

Specified by:
getChildren in class DrbAbstractNode
Returns:
The list of children if any or null otherwise.

hasImpl

public boolean hasImpl(Class api)
Checks any implementation.

Overrides:
hasImpl in class DrbNodeImpl
Parameters:
api - the class
Returns:
false.

getImpl

public Object getImpl(Class api)
Provide other implementation.

Overrides:
getImpl in class DrbNodeImpl
Parameters:
api - the class
Returns:
null.

getZipEntry

protected ZipEntry getZipEntry()
Get the zip entry of the zip file

Returns:
the zip entry

getZipFileNode

protected ZipFileNode getZipFileNode()
Get the zip file node

Returns:
the zip file node

getParent

public DrbNode getParent()
The parent of the current node. The base node (the one of the underlying implementation) is always returned.

Specified by:
getParent in class DrbAbstractNode
Returns:
A reference to the parent node if any or null otherwise.

getAttributes

public final DrbAttributeList getAttributes()
The attributes of the node The file nodes node have no specific attribute and this operation returns therefore a nullvalue at each call. The attributes are:

The following table specifies the attributes that are available for a file. No atribute is provided optionally. The type of the attribute are expressed using the type identifer of the fr.gael.drb.value.Value class.

Name Description Value Type
size the length of the file in bytes. If the file is a directory, the size is equal to 0. UNSIGNED_LONG_ID
ratio the percentage of compression. If the file is a directory, the percentage of compression is equal to 0. It corresponds to the size divided by compressed size STRING_ID
size compressed the length of the file compressed in bytes. If the file is a directory, the size is equal to 0. UNSIGNED_LONG_ID

Overrides:
getAttributes in class DrbAbstractNode
Returns:
The list of all the attributs if any or null otherwise.

Data Request Broker - DRB API®
2-3-release

Copyright© 2001-2009 GAEL Consultant. All rights reserved. Use is subject to license terms .