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 Object
- implements ShareManager, TOTorrentProgressListener, ParameterListener, AEDiagnosticsEvidenceGenerator
Method Summary |
ShareResourceDir |
addDir(File dir)
|
ShareResourceDir |
addDir(File dir,
Map<String,String> properties)
|
ShareResourceDir |
addDir(ShareResourceDirContentsImpl parent,
File dir,
boolean personal,
Map<String,String> properties)
|
ShareResourceDirContents |
addDirContents(File dir,
boolean recursive)
|
ShareResourceDirContents |
addDirContents(File dir,
boolean recursive,
Map<String,String> properties)
|
ShareResourceFile |
addFile(File file)
|
ShareResourceFile |
addFile(File file,
Map<String,String> properties)
|
protected ShareResourceFile |
addFile(ShareResourceDirContentsImpl parent,
File file,
boolean personal,
Map<String,String> properties)
|
protected ShareResource |
addFileOrDir(ShareResourceDirContentsImpl parent,
File file,
int type,
boolean personal,
Map<String,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(Map map)
|
void |
generate(IndentWriter writer)
|
protected void |
generate(IndentWriter writer,
ShareResourceDirContents node)
|
protected boolean |
getAddHashes()
|
protected URL[] |
getAnnounceURLs()
|
protected String |
getDebugName(ShareResource _share)
|
ShareResourceDir |
getDir(File file)
|
ShareResourceFile |
getFile(File file)
|
protected String |
getNewTorrentLocation()
|
protected ShareResourceImpl |
getResource(File file)
|
ShareResource |
getShare(File file_or_dir)
returns null if share not defined |
protected ShareConfigImpl |
getShareConfig()
|
ShareResource[] |
getShares()
|
static ShareManagerImpl |
getSingleton()
|
protected File |
getTorrentFile(ShareItemImpl item)
|
void |
initialise()
|
boolean |
isInitialising()
|
void |
parameterChanged(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(String task_description)
|
protected void |
reportError(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 String TORRENT_STORE
- See Also:
- Constant Field Values
TORRENT_SUBSTORE
public static final 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(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(Map map)
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)
torrentExists
protected boolean torrentExists(ShareItemImpl item)
getTorrentFile
protected File getTorrentFile(ShareItemImpl item)
getAnnounceURLs
protected URL[] getAnnounceURLs()
throws ShareException
- Throws:
ShareException
getAddHashes
protected boolean getAddHashes()
getShares
public ShareResource[] getShares()
- Specified by:
getShares
in interface ShareManager
getResource
protected ShareResourceImpl getResource(File file)
throws ShareException
- Throws:
ShareException
getShare
public ShareResource getShare(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(File file)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addFile
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addFile
public ShareResourceFile addFile(File file,
Map<String,String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addFile
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addFile
protected ShareResourceFile addFile(ShareResourceDirContentsImpl parent,
File file,
boolean personal,
Map<String,String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
getFile
public ShareResourceFile getFile(File file)
throws ShareException
- Throws:
ShareException
addDir
public ShareResourceDir addDir(File dir)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDir
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDir
public ShareResourceDir addDir(File dir,
Map<String,String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDir
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDir
public ShareResourceDir addDir(ShareResourceDirContentsImpl parent,
File dir,
boolean personal,
Map<String,String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
getDir
public ShareResourceDir getDir(File file)
throws ShareException
- Throws:
ShareException
addFileOrDir
protected ShareResource addFileOrDir(ShareResourceDirContentsImpl parent,
File file,
int type,
boolean personal,
Map<String,String> properties)
throws ShareException,
ShareResourceDeletionVetoException
- Throws:
ShareException
ShareResourceDeletionVetoException
addDirContents
public ShareResourceDirContents addDirContents(File dir,
boolean recursive)
throws ShareException,
ShareResourceDeletionVetoException
- Specified by:
addDirContents
in interface ShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
addDirContents
public ShareResourceDirContents addDirContents(File dir,
boolean recursive,
Map<String,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(String task_description)
- Specified by:
reportCurrentTask
in interface TOTorrentProgressListener
reportError
protected void reportError(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 String getDebugName(ShareResource _share)