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 java.lang.Object
implements ShareResource


Field Summary
protected  java.util.Map attributes
           
protected  java.util.List change_listeners
           
protected  java.util.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, java.util.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)
           
 java.lang.String getAttribute(TorrentAttribute attribute)
           
 TorrentAttribute[] getAttributes()
          get the defined attributes for this resource
 ShareResource[] getChildren()
           
protected  byte[] getFingerPrint(java.io.File file)
           
protected  void getFingerPrintSupport(java.lang.StringBuffer buffer, java.io.File file, java.util.Set ignore_set)
           
protected  java.lang.String getNewTorrentLocation()
           
 ShareResourceDirContents getParent()
           
 java.io.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(java.util.Map map)
           
 void setAttribute(TorrentAttribute attribute, java.lang.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 java.util.Map attributes

change_listeners

protected java.util.List change_listeners

deletion_listeners

protected java.util.List deletion_listeners
Constructor Detail

ShareResourceImpl

protected ShareResourceImpl(ShareManagerImpl _manager,
                            int _type)

ShareResourceImpl

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

serialiseResource

protected void serialiseResource(java.util.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,
                         java.lang.String value)
Specified by:
setAttribute in interface ShareResource

getAttribute

public java.lang.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(java.io.File file)
                         throws ShareException
Throws:
ShareException

getFingerPrintSupport

protected void getFingerPrintSupport(java.lang.StringBuffer buffer,
                                     java.io.File file,
                                     java.util.Set ignore_set)
                              throws ShareException
Throws:
ShareException

getNewTorrentLocation

protected java.lang.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 java.io.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