org.xnap.io
Class Library

java.lang.Object
  extended by org.xnap.io.Library
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class Library
extends java.lang.Object
implements java.beans.PropertyChangeListener


Field Summary
static java.lang.String FILENAME
          The name of the file where the library is stored.
static int VERSION
          The current version of the library.
 
Constructor Summary
Library()
           
 
Method Summary
 void addListListener(ListListener listener)
          Listener is notified when a new file is added.
 void addMetaInfoProvider(MetaInfoProvider provider)
          Provider is notified when a file is added or not uptodate.
 MetaInfoFile get(java.io.File file)
          Returns a MetaInfoFile object if file is part of library.
 MetaInfoFile get(int index)
          Returns a file by index.
 MetaInfoFile get(java.lang.String filename, int index)
          Returns file at index and compares it to the given filename.
static Library getInstance()
           
 int indexOf(java.io.File file)
           
 boolean isPartOfRepository(java.io.File file)
          Returns false, if file is the incomplete folder or its name starts with a dot.
 boolean isRead()
           
 boolean isShared(java.io.File file)
          Returns true, if file is part of repository and shared.
 boolean isUpdateRunning()
           
 void propertyChange(java.beans.PropertyChangeEvent e)
           
 void removeListListener(ListListener listener)
          Removes listener.
 void removeMetaInfoProvider(MetaInfoProvider provider)
          Removes provider.
 MetaInfoFile[] search(java.lang.String searchText)
           
 java.io.File[] search(java.lang.String searchText, long filesize)
           
 void setStatusListener(StatusListener newValue)
           
 int size()
           
 void updateLater()
          Updates the repository.
 void updateStatus()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILENAME

public static java.lang.String FILENAME
The name of the file where the library is stored.


VERSION

public static int VERSION
The current version of the library.

Constructor Detail

Library

public Library()
Method Detail

getInstance

public static Library getInstance()

addListListener

public void addListListener(ListListener listener)
Listener is notified when a new file is added.


addMetaInfoProvider

public void addMetaInfoProvider(MetaInfoProvider provider)
Provider is notified when a file is added or not uptodate.


get

public MetaInfoFile get(int index)
Returns a file by index. It is save to call this function with index <= size() because the library never shrinks.

Returns:
null, if the file was removed from library; the file located at index, otherwise

get

public MetaInfoFile get(java.io.File file)
Returns a MetaInfoFile object if file is part of library.

Returns:
null, if the file is not part of library; the file, otherwise

get

public MetaInfoFile get(java.lang.String filename,
                        int index)
Returns file at index and compares it to the given filename. If filenames match returns the file.

Returns:
null, if file was not found; the file, otherwise

indexOf

public int indexOf(java.io.File file)

isShared

public boolean isShared(java.io.File file)
Returns true, if file is part of repository and shared.


isRead

public boolean isRead()

isPartOfRepository

public boolean isPartOfRepository(java.io.File file)
Returns false, if file is the incomplete folder or its name starts with a dot.


isUpdateRunning

public boolean isUpdateRunning()

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Specified by:
propertyChange in interface java.beans.PropertyChangeListener

removeListListener

public void removeListListener(ListListener listener)
Removes listener.


removeMetaInfoProvider

public void removeMetaInfoProvider(MetaInfoProvider provider)
Removes provider.


search

public MetaInfoFile[] search(java.lang.String searchText)
Returns:
always returns a valid array

search

public java.io.File[] search(java.lang.String searchText,
                             long filesize)

size

public int size()

updateLater

public void updateLater()
Updates the repository.


setStatusListener

public void setStatusListener(StatusListener newValue)

updateStatus

public void updateStatus()


Copyright © 2001-2005 XNap Team. All Rights Reserved.