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 AEMonitor
private ShareConfigImpl
private ShareManagerImpl.shareScanner
private boolean
private boolean
private List
<ShareManagerListener> private static final LogIDs
static final int
static final int
private static boolean
private boolean
private File
private Map
<String, ShareResourceImpl> protected static ShareManagerImpl
private AEMonitor
protected TOTorrentCreator
private ByteArrayHashMap
<ShareResource> static final String
static final String
Fields inherited from interface com.biglybt.pif.sharing.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 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
void
adding shares can take a long time due to the torrent creation process.protected void
protected void
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
protected URL[]
private boolean
getBooleanProperty
(Map<String, String> properties, String name) protected String
getDebugName
(ShareResource _share) protected String
protected ShareResourceImpl
getResource
(File file) returns null if share not definedprotected ShareConfigImpl
int
static ShareManagerImpl
protected File
getTorrentFile
(ShareItemImpl item) void
boolean
lookupShare
(byte[] torrent_hash) void
parameterChanged
(String name) Called, when a parameter has changed.protected void
protected void
protected void
readTorrent
(ShareItemImpl item) void
void
reportCurrentTask
(String task_description) protected void
void
reportProgress
(int percent_complete) protected void
setPropertyDefaults
(Map<String, String> properties) protected void
setTorrentCreator
(TOTorrentCreator _to_creator) protected boolean
torrentExists
(ShareItemImpl item) protected void
writeTorrent
(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:
initialise
in interfaceShareManager
- Throws:
ShareException
-
isInitialising
public boolean isInitialising()- Specified by:
isInitialising
in interfaceShareManager
-
readAZConfig
protected void readAZConfig() -
parameterChanged
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 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:
addFile
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
addFile
public ShareResourceFile addFile(File file, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addFile
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
getFile
- Throws:
ShareException
-
addDir
- Specified by:
addDir
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
addDir
public ShareResourceDir addDir(File dir, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addDir
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
getDir
- Throws:
ShareException
-
addDirContents
public ShareResourceDirContents addDirContents(File dir, boolean recursive) throws ShareException, ShareResourceDeletionVetoException - Specified by:
addDirContents
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
addDirContents
public ShareResourceDirContents addDirContents(File dir, boolean recursive, Map<String, String> properties) throws ShareException, ShareResourceDeletionVetoException- Specified by:
addDirContents
in interfaceShareManager
- Throws:
ShareException
ShareResourceDeletionVetoException
-
setTorrentCreator
-
setPropertyDefaults
-
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 interfaceShareManager
-
reportProgress
public void reportProgress(int percent_complete) - Specified by:
reportProgress
in interfaceTOTorrentProgressListener
-
reportCurrentTask
- Specified by:
reportCurrentTask
in interfaceTOTorrentProgressListener
-
reportError
-
generate
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-
configDirty
protected void configDirty()
-