org.gudy.azureus2.pluginsimpl.local.sharing
Class ShareManagerImpl
java.lang.Object
org.gudy.azureus2.pluginsimpl.local.sharing.ShareManagerImpl
- All Implemented Interfaces:
- ParameterListener, TOTorrentProgressListener, AEDiagnosticsEvidenceGenerator, ShareManager
public class ShareManagerImpl
- extends java.lang.Object
- implements ShareManager, TOTorrentProgressListener, ParameterListener, AEDiagnosticsEvidenceGenerator
Method Summary |
ShareResourceDir |
addDir(java.io.File dir)
|
ShareResourceDir |
addDir(java.io.File dir,
java.util.Map<java.lang.String,java.lang.String> properties)
|
ShareResourceDir |
addDir(ShareResourceDirContentsImpl parent,
java.io.File dir,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
|
ShareResourceDirContents |
addDirContents(java.io.File dir,
boolean recursive)
|
ShareResourceDirContents |
addDirContents(java.io.File dir,
boolean recursive,
java.util.Map<java.lang.String,java.lang.String> properties)
|
ShareResourceFile |
addFile(java.io.File file)
|
ShareResourceFile |
addFile(java.io.File file,
java.util.Map<java.lang.String,java.lang.String> properties)
|
protected ShareResourceFile |
addFile(ShareResourceDirContentsImpl parent,
java.io.File file,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
|
protected ShareResource |
addFileOrDir(ShareResourceDirContentsImpl parent,
java.io.File file,
int type,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
|
void |
addListener(ShareManagerListener l)
|
void |
cancelOperation()
adding shares can take a long time due to the torrent creation process. |
protected void |
checkConsistency()
|
protected void |
delete(ShareResourceImpl resource,
boolean fire_listeners)
|
protected void |
deleteTorrent(ShareItemImpl item)
|
protected void |
deserialiseResource(java.util.Map map)
|
void |
generate(IndentWriter writer)
|
protected void |
generate(IndentWriter writer,
ShareResourceDirContents node)
|
protected boolean |
getAddHashes()
|
protected java.net.URL[] |
getAnnounceURLs()
|
protected java.lang.String |
getDebugName(ShareResource _share)
|
ShareResourceDir |
getDir(java.io.File file)
|
ShareResourceFile |
getFile(java.io.File file)
|
protected java.lang.String |
getNewTorrentLocation()
|
protected ShareResourceImpl |
getResource(java.io.File file)
|
ShareResource |
getShare(java.io.File file_or_dir)
returns null if share not defined |
protected ShareConfigImpl |
getShareConfig()
|
ShareResource[] |
getShares()
|
static ShareManagerImpl |
getSingleton()
|
protected java.io.File |
getTorrentFile(ShareItemImpl item)
|
void |
initialise()
|
boolean |
isInitialising()
|
void |
parameterChanged(java.lang.String name)
Called, when a parameter has changed. |
protected void |
readAZConfig()
|
protected void |
readAZConfigSupport()
|
protected void |
readTorrent(ShareItemImpl item)
|
void |
removeListener(ShareManagerListener l)
|
void |
reportCurrentTask(java.lang.String task_description)
|
protected void |
reportError(java.lang.Throwable e)
|
void |
reportProgress(int percent_complete)
|
protected void |
scanShares()
|
protected void |
setTorrentCreator(TOTorrentCreator _to_creator)
|
protected boolean |
torrentExists(ShareItemImpl item)
|
protected void |
writeTorrent(ShareItemImpl item)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TORRENT_STORE
public static final java.lang.String TORRENT_STORE
- See Also:
- Constant Field Values
TORRENT_SUBSTORE
public static final java.lang.String TORRENT_SUBSTORE
- See Also:
- Constant Field Values
MAX_FILES_PER_DIR
public static final int MAX_FILES_PER_DIR
- See Also:
- Constant Field Values
MAX_DIRS
public static final int MAX_DIRS
- See Also:
- Constant Field Values
singleton
protected static ShareManagerImpl singleton
this_mon
protected AEMonitor this_mon
to_creator
protected TOTorrentCreator to_creator
ShareManagerImpl
protected ShareManagerImpl()
throws ShareException
- Throws:
ShareException
getSingleton
public static ShareManagerImpl getSingleton()
throws ShareException
- Throws:
ShareException
initialise
public void initialise()
throws ShareException
- Specified by:
initialise
in interface ShareManager
- Throws:
ShareException
isInitialising
public boolean isInitialising()
- Specified by:
isInitialising
in interface ShareManager
readAZConfig
protected void readAZConfig()
parameterChanged
public void parameterChanged(java.lang.String name)
- Description copied from interface:
ParameterListener
- Called, when a parameter has changed.
The listener could only react if the parameter name is relevant.
Or the listener can just read all parameters again.
- Specified by:
parameterChanged
in interface ParameterListener
- Parameters:
name
- the name of the parameter that has changed
readAZConfigSupport
protected void readAZConfigSupport()
getShareConfig
protected ShareConfigImpl getShareConfig()
checkConsistency
protected void checkConsistency()
throws ShareException
- Throws:
ShareException
deserialiseResource
protected void deserialiseResource(java.util.Map map)
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)
torrentExists
protected boolean torrentExists(ShareItemImpl item)
getTorrentFile
protected java.io.File getTorrentFile(ShareItemImpl item)
getAnnounceURLs
protected java.net.URL[] getAnnounceURLs()
throws ShareException
- Throws:
ShareException
getAddHashes
protected boolean getAddHashes()
getShares
public ShareResource[] getShares()
- Specified by:
getShares
in interface ShareManager
getResource
protected ShareResourceImpl getResource(java.io.File file)
throws ShareException
- Throws:
ShareException
getShare
public ShareResource getShare(java.io.File file_or_dir)
- Description copied from interface:
ShareManager
- returns null if share not defined
- Specified by:
getShare
in interface ShareManager
- Returns:
addFile
public ShareResourceFile addFile(java.io.File file)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addFile
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addFile
public ShareResourceFile addFile(java.io.File file,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addFile
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addFile
protected ShareResourceFile addFile(ShareResourceDirContentsImpl parent,
java.io.File file,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
getFile
public ShareResourceFile getFile(java.io.File file)
throws ShareException
- Throws:
ShareException
addDir
public ShareResourceDir addDir(java.io.File dir)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDir
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDir
public ShareResourceDir addDir(java.io.File dir,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDir
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDir
public ShareResourceDir addDir(ShareResourceDirContentsImpl parent,
java.io.File dir,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
getDir
public ShareResourceDir getDir(java.io.File file)
throws ShareException
- Throws:
ShareException
addFileOrDir
protected ShareResource addFileOrDir(ShareResourceDirContentsImpl parent,
java.io.File file,
int type,
boolean personal,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
addDirContents
public ShareResourceDirContents addDirContents(java.io.File dir,
boolean recursive)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDirContents
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDirContents
public ShareResourceDirContents addDirContents(java.io.File dir,
boolean recursive,
java.util.Map<java.lang.String,java.lang.String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDirContents
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
delete
protected void delete(ShareResourceImpl resource,
boolean fire_listeners)
throws ShareException
- Throws:
ShareException
scanShares
protected void scanShares()
throws ShareException
- Throws:
ShareException
setTorrentCreator
protected void setTorrentCreator(TOTorrentCreator _to_creator)
cancelOperation
public void cancelOperation()
- Description copied from interface:
ShareManager
- adding shares can take a long time due to the torrent creation process. The current
activity can be interrupted by calling this function, in which case the original
activity will fail with a ShareException
- Specified by:
cancelOperation
in interface ShareManager
reportProgress
public void reportProgress(int percent_complete)
- Specified by:
reportProgress
in interface TOTorrentProgressListener
reportCurrentTask
public void reportCurrentTask(java.lang.String task_description)
- Specified by:
reportCurrentTask
in interface TOTorrentProgressListener
reportError
protected void reportError(java.lang.Throwable e)
addListener
public void addListener(ShareManagerListener l)
- Specified by:
addListener
in interface ShareManager
removeListener
public void removeListener(ShareManagerListener l)
- Specified by:
removeListener
in interface ShareManager
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interface AEDiagnosticsEvidenceGenerator
generate
protected void generate(IndentWriter writer,
ShareResourceDirContents node)
getDebugName
protected java.lang.String getDebugName(ShareResource _share)