org.gudy.azureus2.pluginsimpl.local.sharing
Class ShareResourceImpl

java.lang.Object
  extended by org.gudy.azureus2.pluginsimpl.local.sharing.ShareResourceImpl
All Implemented Interfaces:
ShareResource
Direct Known Subclasses:
ShareResourceDirContentsImpl, ShareResourceFileOrDirImpl

public abstract class ShareResourceImpl
extends Object
implements ShareResource


Field Summary
protected  Map attributes
           
protected  List change_listeners
           
protected  List deletion_listeners
           
protected static BrokenMd5Hasher hasher
           
protected  ShareManagerImpl manager
           
protected  ShareResourceDirContents parent
           
protected  int type
           
 
Fields inherited from interface org.gudy.azureus2.plugins.sharing.ShareResource
ST_DIR, ST_DIR_CONTENTS, ST_FILE
 
Constructor Summary
protected ShareResourceImpl(ShareManagerImpl _manager, int _type)
           
protected ShareResourceImpl(ShareManagerImpl _manager, int _type, Map _map)
           
 
Method Summary
 void addChangeListener(ShareResourceListener l)
           
 void addDeletionListener(ShareResourceWillBeDeletedListener l)
           
abstract  boolean canBeDeleted()
           
protected abstract  void checkConsistency()
           
 void delete()
           
 void delete(boolean force)
           
 void delete(boolean force, boolean fire_listeners)
           
protected abstract  void deleteInternal()
           
protected  void deleteTorrent(ShareItemImpl item)
           
 String getAttribute(TorrentAttribute attribute)
           
 TorrentAttribute[] getAttributes()
          get the defined attributes for this resource
 ShareResource[] getChildren()
           
protected  byte[] getFingerPrint(File file)
           
protected  void getFingerPrintSupport(StringBuffer buffer, File file, Set ignore_set)
           
protected  String getNewTorrentLocation()
           
 ShareResourceDirContents getParent()
           
 File getTorrentFile(ShareItemImpl item)
           
 int getType()
           
protected  void inheritAttributes(ShareResourceImpl source)
           
 boolean isPersistent()
           
protected  void readTorrent(ShareItemImpl item)
           
 void removeChangeListener(ShareResourceListener l)
           
 void removeDeletionListener(ShareResourceWillBeDeletedListener l)
           
protected  void serialiseResource(Map map)
           
 void setAttribute(TorrentAttribute attribute, String value)
           
protected  void setParent(ShareResourceDirContents _parent)
           
protected  void writeTorrent(ShareItemImpl item)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.gudy.azureus2.plugins.sharing.ShareResource
getName, getProperties
 

Field Detail

hasher

protected static BrokenMd5Hasher hasher

manager

protected ShareManagerImpl manager

type

protected int type

parent

protected ShareResourceDirContents parent

attributes

protected Map attributes

change_listeners

protected List change_listeners

deletion_listeners

protected List deletion_listeners
Constructor Detail

ShareResourceImpl

protected ShareResourceImpl(ShareManagerImpl _manager,
                            int _type)

ShareResourceImpl

protected ShareResourceImpl(ShareManagerImpl _manager,
                            int _type,
                            Map _map)
Method Detail

serialiseResource

protected void serialiseResource(Map map)

getParent

public ShareResourceDirContents getParent()
Specified by:
getParent in interface ShareResource

setParent

protected void setParent(ShareResourceDirContents _parent)

getChildren

public ShareResource[] getChildren()

getType

public int getType()
Specified by:
getType in interface ShareResource

setAttribute

public void setAttribute(TorrentAttribute attribute,
                         String value)
Specified by:
setAttribute in interface ShareResource

getAttribute

public String getAttribute(TorrentAttribute attribute)
Specified by:
getAttribute in interface ShareResource
Returns:
null if no value defined

getAttributes

public TorrentAttribute[] getAttributes()
Description copied from interface: ShareResource
get the defined attributes for this resource

Specified by:
getAttributes in interface ShareResource
Returns:

inheritAttributes

protected void inheritAttributes(ShareResourceImpl source)

delete

public void delete()
            throws ShareException,
                   ShareResourceDeletionVetoException
Specified by:
delete in interface ShareResource
Throws:
ShareException
ShareResourceDeletionVetoException

delete

public void delete(boolean force)
            throws ShareException,
                   ShareResourceDeletionVetoException
Specified by:
delete in interface ShareResource
Throws:
ShareException
ShareResourceDeletionVetoException

delete

public void delete(boolean force,
                   boolean fire_listeners)
            throws ShareException,
                   ShareResourceDeletionVetoException
Throws:
ShareException
ShareResourceDeletionVetoException

canBeDeleted

public abstract boolean canBeDeleted()
                              throws ShareResourceDeletionVetoException
Specified by:
canBeDeleted in interface ShareResource
Throws:
ShareResourceDeletionVetoException

isPersistent

public boolean isPersistent()
Specified by:
isPersistent in interface ShareResource

deleteInternal

protected abstract void deleteInternal()

getFingerPrint

protected byte[] getFingerPrint(File file)
                         throws ShareException
Throws:
ShareException

getFingerPrintSupport

protected void getFingerPrintSupport(StringBuffer buffer,
                                     File file,
                                     Set ignore_set)
                              throws ShareException
Throws:
ShareException

getNewTorrentLocation

protected String getNewTorrentLocation()
                                throws ShareException
Throws:
ShareException

writeTorrent

protected void writeTorrent(ShareItemImpl item)
                     throws ShareException
Throws:
ShareException

readTorrent

protected void readTorrent(ShareItemImpl item)
                    throws ShareException
Throws:
ShareException

deleteTorrent

protected void deleteTorrent(ShareItemImpl item)

getTorrentFile

public File getTorrentFile(ShareItemImpl item)

checkConsistency

protected abstract void checkConsistency()
                                  throws ShareException
Throws:
ShareException

addChangeListener

public void addChangeListener(ShareResourceListener l)
Specified by:
addChangeListener in interface ShareResource

removeChangeListener

public void removeChangeListener(ShareResourceListener l)
Specified by:
removeChangeListener in interface ShareResource

addDeletionListener

public void addDeletionListener(ShareResourceWillBeDeletedListener l)
Specified by:
addDeletionListener in interface ShareResource

removeDeletionListener

public void removeDeletionListener(ShareResourceWillBeDeletedListener l)
Specified by:
removeDeletionListener in interface ShareResource