Class ShareResourceImpl
- java.lang.Object
-
- com.biglybt.pifimpl.local.sharing.ShareResourceImpl
-
- All Implemented Interfaces:
ShareResource
- Direct Known Subclasses:
ShareResourceDirContentsImpl
,ShareResourceFileOrDirImpl
public abstract class ShareResourceImpl extends java.lang.Object implements ShareResource
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map
attributes
protected java.util.List
change_listeners
private boolean
deleted
protected java.util.List
deletion_listeners
protected static BrokenMd5Hasher
hasher
protected ShareManagerImpl
manager
protected ShareResourceDirContents
parent
protected int
type
-
Fields inherited from interface com.biglybt.pif.sharing.ShareResource
ST_DIR, ST_DIR_CONTENTS, ST_FILE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
ShareResourceImpl(ShareManagerImpl _manager, int _type)
protected
ShareResourceImpl(ShareManagerImpl _manager, int _type, java.util.Map _map)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description 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 void
deleteInternal()
protected void
deleteTorrent(ShareItemImpl item)
protected void
fireChangeEvent(int type, boolean internal, java.lang.Object data)
java.lang.String
getAttribute(TorrentAttribute attribute)
TorrentAttribute[]
getAttributes()
get the defined attributes for this resourceShareResource[]
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
isDeleted()
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 com.biglybt.pif.sharing.ShareResource
getName, getProperties, setProperties
-
-
-
-
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
-
deleted
private volatile boolean deleted
-
-
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 interfaceShareResource
-
setParent
protected void setParent(ShareResourceDirContents _parent)
-
getChildren
public ShareResource[] getChildren()
-
getType
public int getType()
- Specified by:
getType
in interfaceShareResource
-
setAttribute
public void setAttribute(TorrentAttribute attribute, java.lang.String value)
- Specified by:
setAttribute
in interfaceShareResource
-
fireChangeEvent
protected void fireChangeEvent(int type, boolean internal, java.lang.Object data)
-
getAttribute
public java.lang.String getAttribute(TorrentAttribute attribute)
- Specified by:
getAttribute
in interfaceShareResource
- 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 interfaceShareResource
- Returns:
-
inheritAttributes
protected void inheritAttributes(ShareResourceImpl source)
-
delete
public void delete() throws ShareException, ShareResourceDeletionVetoException
- Specified by:
delete
in interfaceShareResource
- Throws:
ShareException
ShareResourceDeletionVetoException
-
delete
public void delete(boolean force) throws ShareException, ShareResourceDeletionVetoException
- Specified by:
delete
in interfaceShareResource
- Throws:
ShareException
ShareResourceDeletionVetoException
-
delete
public void delete(boolean force, boolean fire_listeners) throws ShareException, ShareResourceDeletionVetoException
-
canBeDeleted
public abstract boolean canBeDeleted() throws ShareResourceDeletionVetoException
- Specified by:
canBeDeleted
in interfaceShareResource
- Throws:
ShareResourceDeletionVetoException
-
isDeleted
public boolean isDeleted()
- Specified by:
isDeleted
in interfaceShareResource
-
isPersistent
public boolean isPersistent()
- Specified by:
isPersistent
in interfaceShareResource
-
deleteInternal
protected 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 interfaceShareResource
-
removeChangeListener
public void removeChangeListener(ShareResourceListener l)
- Specified by:
removeChangeListener
in interfaceShareResource
-
addDeletionListener
public void addDeletionListener(ShareResourceWillBeDeletedListener l)
- Specified by:
addDeletionListener
in interfaceShareResource
-
removeDeletionListener
public void removeDeletionListener(ShareResourceWillBeDeletedListener l)
- Specified by:
removeDeletionListener
in interfaceShareResource
-
-