Class ShareManagerImpl
java.lang.Object
com.biglybt.pifimpl.local.sharing.ShareManagerImpl
- All Implemented Interfaces:
ParameterListener, TOTorrentProgressListener, AEDiagnosticsEvidenceGenerator, ShareManager
public class ShareManagerImpl
extends Object
implements ShareManager, TOTorrentProgressListener, ParameterListener, AEDiagnosticsEvidenceGenerator
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate URL[]private static AEMonitorprivate ShareConfigImplprivate ShareManagerImpl.shareScannerprivate booleanprivate booleanprivate List<ShareManagerListener> private static final LogIDsstatic final intstatic final intprivate static booleanprivate booleanprivate Fileprivate Map<String, ShareResourceImpl> protected static ShareManagerImplprivate AEMonitorprotected TOTorrentCreatorprivate ByteArrayHashMap<ShareResource> static final Stringstatic final StringFields inherited from interface ShareManager
PR_NETWORKS, PR_PERSISTENT, PR_PERSONAL, PR_TAGS, PR_USER_DATA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddDir(ShareResourceDirContentsImpl parent, File dir, boolean personal, Map<String, String> properties) addDirContents(File dir, boolean recursive) addDirContents(File dir, boolean recursive, Map<String, String> properties) protected ShareResourceFileaddFile(ShareResourceDirContentsImpl parent, File file, boolean personal, Map<String, String> properties) protected ShareResourceaddFileOrDir(ShareResourceDirContentsImpl parent, File file, int type, boolean personal, Map<String, String> properties) voidvoidadding shares can take a long time due to the torrent creation process.protected voidprotected voidprotected voiddelete(ShareResourceImpl resource, boolean fire_listeners) protected voiddeleteTorrent(ShareItemImpl item) protected voiddeserialiseResource(Map map) voidgenerate(IndentWriter writer) protected voidgenerate(IndentWriter writer, ShareResourceDirContents node) protected booleanprotected URL[]private booleangetBooleanProperty(Map<String, String> properties, String name) protected StringgetDebugName(ShareResource _share) protected Stringprotected ShareResourceImplgetResource(File file) returns null if share not definedprotected ShareConfigImplintstatic ShareManagerImplprotected FilegetTorrentFile(ShareItemImpl item) voidbooleanlookupShare(byte[] torrent_hash) voidparameterChanged(String name) Called, when a parameter has changed.protected voidprotected voidprotected voidreadTorrent(ShareItemImpl item) voidvoidreportCurrentTask(String task_description) protected voidvoidreportProgress(int percent_complete) protected voidsetPropertyDefaults(Map<String, String> properties) protected voidsetTorrentCreator(TOTorrentCreator _to_creator) protected booleantorrentExists(ShareItemImpl item) protected voidwriteTorrent(ShareItemImpl item)
-
Field Details
-
LOGID
-
TORRENT_STORE
- See Also:
-
TORRENT_SUBSTORE
- See Also:
-
MAX_FILES_PER_DIR
public static final int MAX_FILES_PER_DIR- See Also:
-
MAX_DIRS
public static final int MAX_DIRS- See Also:
-
singleton
-
class_mon
-
this_mon
-
to_creator
-
initialised
private volatile boolean initialised -
initialising
private volatile boolean initialising -
announce_urls
-
config
-
torrent_map
-
current_scanner
-
scanning
private boolean scanning -
listeners
-
-
Constructor Details
-
ShareManagerImpl
- Throws:
ShareException
-
-
Method Details
-
getSingleton
- Throws:
ShareException
-
initialise
- Specified by:
initialisein interfaceShareManager- Throws:
ShareException
-
isInitialising
public boolean isInitialising()- Specified by:
isInitialisingin interfaceShareManager
-
readAZConfig
protected void readAZConfig() -
parameterChanged
Description copied from interface:ParameterListenerCalled, 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:
parameterChangedin interfaceParameterListener- Parameters:
name- the name of the parameter that has changed
-
readAZConfigSupport
protected void readAZConfigSupport() -
checkConsistency
- Throws:
ShareException
-
deserialiseResource
-
getNewTorrentLocation
- Throws:
ShareException
-
getAnnounceURLs
- Throws:
ShareException
-
getAddHashes
protected boolean getAddHashes() -
getResource
- Throws:
ShareException
-
getBooleanProperty
-
addFile
public ShareResourceFile addFile(File file) throws ShareException, ShareResourceDeletionVetoException - Specified by:
addFilein interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
addFile
public ShareResourceFile addFile(File file, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addFilein interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
getFile
- Throws:
ShareException
-
addDir
- Specified by:
addDirin interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
addDir
public ShareResourceDir addDir(File dir, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addDirin interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
getDir
- Throws:
ShareException
-
addDirContents
public ShareResourceDirContents addDirContents(File dir, boolean recursive) throws ShareException, ShareResourceDeletionVetoException - Specified by:
addDirContentsin interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
addDirContents
public ShareResourceDirContents addDirContents(File dir, boolean recursive, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addDirContentsin interfaceShareManager- Throws:
ShareExceptionShareResourceDeletionVetoException
-
setTorrentCreator
-
setPropertyDefaults
-
cancelOperation
public void cancelOperation()Description copied from interface:ShareManageradding 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:
cancelOperationin interfaceShareManager
-
reportProgress
public void reportProgress(int percent_complete) - Specified by:
reportProgressin interfaceTOTorrentProgressListener
-
reportCurrentTask
- Specified by:
reportCurrentTaskin interfaceTOTorrentProgressListener
-
reportError
-
generate
- Specified by:
generatein interfaceAEDiagnosticsEvidenceGenerator
-
configDirty
protected void configDirty()
-