Package com.biglybt.core.subs.impl
Class SubscriptionManagerImpl
- java.lang.Object
-
- com.biglybt.core.subs.impl.SubscriptionManagerImpl
-
- All Implemented Interfaces:
SubscriptionManager
,AEDiagnosticsEvidenceGenerator
,DataSourceResolver.DataSourceImporter
,UtilitiesImpl.PluginSubscriptionManager
public class SubscriptionManagerImpl extends java.lang.Object implements SubscriptionManager, DataSourceResolver.DataSourceImporter, AEDiagnosticsEvidenceGenerator
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
SubscriptionManagerImpl.downloadListener
private static class
SubscriptionManagerImpl.searchMatcher
(package private) static interface
SubscriptionManagerImpl.subsLookupListener
-
Field Summary
Fields Modifier and Type Field Description private static int
ASSOC_CHECK_PERIOD
private static int
ASSOC_CHECK_TICKS
private static int
ASSOC_PUBLISH_PERIOD
private static int
ASSOC_PUBLISH_TICKS
private AsyncDispatcher
async_dispatcher
private java.util.LinkedList<BuddyPluginBeta.ChatInstance>
chat_assoc_done
private static int
CHAT_CHECK_PERIOD
private static int
CHAT_CHECK_TICKS
private java.util.Set<java.lang.String>
chat_st_done
private AsyncDispatcher
chat_write_dispatcher
private static java.lang.String
CONFIG_ACTIVATE_ON_CHANGE
private static java.lang.String
CONFIG_ADD_HASHES
private static java.lang.String
CONFIG_AUTO_MARK_READ
private static java.lang.String
CONFIG_AUTO_START_DLS
private static java.lang.String
CONFIG_AUTO_START_MAX_MB
private static java.lang.String
CONFIG_AUTO_START_MIN_MB
private static java.lang.String
CONFIG_DEF_CHECK_MINS
private boolean
config_dirty
private static java.lang.String
CONFIG_DL_RATE_LIMITS
private static java.lang.String
CONFIG_DL_SUBS_ENABLE
private static java.lang.String
CONFIG_ENABLE_SEARCH
private static java.lang.String
CONFIG_FILE
private static java.lang.String
CONFIG_HIDE_SEARCH_TEMPLATES
private static java.lang.String
CONFIG_MAX_RESULTS
private static java.lang.String
CONFIG_RSS_ENABLE
private Core
core
private static int
DELETE_UNUSED_AFTER_MILLIS
private DHTPluginInterface
dht_plugin_public
private java.util.regex.Pattern
exclusion_pattern
private java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicInteger>
imported_sids
private CopyOnWriteList<SubscriptionManagerListener>
listeners
private AEDiagnosticsLogger
logger
private static java.lang.String
LOGGER_NAME
private boolean
meta_search_listener_added
private boolean
periodic_lookup_in_progress
private java.util.List<java.lang.Object[]>
potential_associations
private java.util.Map<HashWrapper,java.lang.Object[]>
potential_associations2
private java.util.Map<HashWrapper,java.lang.Object[]>
potential_associations3
private static boolean
pre_initialised
private int
priority_lookup_pending
private static int
PUB_ASSOC_CONC_MAX
private static int
PUB_SLEEPING_ASSOC_CONC_MAX
private int
publish_associations_active
private boolean
publish_next_asyc_pending
private boolean
publish_subscription_active
private static int
random_seed
private java.util.Map<SubscriptionImpl,java.lang.Object[]>
result_cache
private SubscriptionRSSFeed
rss_publisher
private SubscriptionSchedulerImpl
scheduler
private static int
SERVER_PUB_CHECK_PERIOD
private static int
SERVER_PUB_CHECK_TICKS
private static int
SET_SELECTED_FIRST_TICK
private static int
SET_SELECTED_PERIOD
private static int
SET_SELECTED_TICKS
private static SubscriptionManagerImpl
singleton
private static java.lang.Object
SP_CONSEC_FAIL
private static java.lang.Object
SP_LAST_ATTEMPTED
private boolean
started
private static java.lang.Object
SUBS_CHAT_KEY
private java.util.List<SubscriptionImpl>
subscriptions
private TorrentAttribute
ta_category
private TorrentAttribute
ta_networks
private TorrentAttribute
ta_subs_download
private TorrentAttribute
ta_subs_download_rd
private TorrentAttribute
ta_subscription_info
private static int
TIDY_POT_ASSOC_PERIOD
private static int
TIDY_POT_ASSOC_TICKS
private static int
TIMER_PERIOD
-
Constructor Summary
Constructors Modifier Constructor Description protected
SubscriptionManagerImpl(boolean stand_alone)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(SubscriptionManagerListener listener)
protected void
addMetaSearchListener()
protected void
addPotentialAssociation(SubscriptionImpl subs, java.lang.String result_id, java.lang.String key)
protected void
addPrepareTrigger(byte[] hash, Subscription[] subs, SubscriptionResult[] results)
protected SubscriptionImpl
addSubscription(SubscriptionImpl subs)
protected boolean
askIfCanUpgrade(SubscriptionImpl subs, int new_version)
protected void
associationAdded(SubscriptionImpl subscription, byte[] association_hash)
protected void
associationLookupComplete()
private void
assocOK(SubscriptionImpl subs, SubscriptionImpl.association assoc)
protected void
changeSubscription(SubscriptionImpl subs)
protected void
checkInitialDownload(SubscriptionImpl subs)
protected void
checkMaxResults(int max)
protected void
checkPotentialAssociations(byte[] hash, java.lang.String key)
protected void
checkServerPublications(java.util.List subs)
protected void
checkSingletonPublish(SubscriptionImpl subs)
protected void
checkStuff(int ticks)
protected void
checkUpgrade(SubscriptionImpl sub)
protected void
checkURL(java.net.URL url)
protected void
configDirty()
protected void
configDirty(SubscriptionImpl subs)
Subscription
create(java.lang.String name, boolean public_subs, java.lang.String json)
Subscription
createFromURI(java.lang.String uri)
Subscription
createRSS(java.lang.String name, java.net.URL url, int check_interval_mins, boolean is_anonymous, java.util.Map user_data)
Subscription
createRSS(java.lang.String name, java.net.URL url, int check_interval_mins, java.util.Map user_data)
Subscription
createSingletonRSS(java.lang.String name, java.net.URL url, int check_interval_mins, boolean is_anon)
protected Subscription
createSingletonRSSSupport(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon, int add_type, boolean subscribe)
protected SubscriptionImpl
createSingletonSubscription(java.util.Map singleton_details, int add_type, boolean subscribe)
protected java.util.Map
decodeSubscriptionDetails(byte[] data)
private boolean
downloadIsIgnored(Download download)
private void
downloadSubscription(java.lang.String description, byte[] association_hash, byte[] torrent_hash, byte[] sid, int version, int size, SubscriptionManagerImpl.subsLookupListener listener)
private void
downloadSubscription(java.lang.String description, TOTorrent torrent, java.net.InetSocketAddress peer, byte[] subs_id, int version, java.lang.String name, SubscriptionManagerImpl.downloadListener listener)
protected java.lang.Object[]
downloadTorrent(byte[] hash, int update_size)
protected byte[]
encodeSubscriptionDetails(SubscriptionImpl subs)
void
generate(IndentWriter writer)
boolean
getActivateSubscriptionOnChange()
boolean
getAddHashDirs()
int
getAutoDownloadMarkReadAfterDays()
boolean
getAutoStartDownloads()
int
getAutoStartMaxMB()
int
getAutoStartMinMB()
int
getDefaultCheckFrequencyMins()
protected Engine
getEngine(SubscriptionImpl subs, java.util.Map json_map, boolean local_only)
private byte[]
getKeyBytes(java.lang.String key)
int
getKnownSubscriptionCount()
Subscription[]
getKnownSubscriptions(byte[] hash)
Cached view of hash's subsSubscription[]
getLinkedSubscriptions(byte[] hash)
private AEDiagnosticsLogger
getLogger()
protected MagnetPlugin
getMagnetPlugin()
int
getMaxNonDeletedResults()
protected void
getPopularity(SubscriptionImpl subs, SubscriptionPopularityListener listener)
protected void
getPopularityFromDHT(SubscriptionImpl subs, SubscriptionPopularityListener listener, boolean sync)
protected void
getPopularitySupport(DHTPluginInterface dht_plugin, SubscriptionImpl subs, SubscriptionPopularityListener _listener, boolean sync)
private int
getPublishRemainingCount()
java.lang.String
getRateLimits()
protected java.io.File
getResultsFile(SubscriptionImpl subs)
java.lang.String
getRSSLink()
SubscriptionScheduler
getScheduler()
protected java.lang.Object[]
getSearchTemplateVuzeFile(SubscriptionImpl sub)
static SubscriptionManager
getSingleton(boolean stand_alone)
protected java.util.Map
getSingletonMap(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon)
Subscription
getSubscriptionByID(java.lang.String id)
int
getSubscriptionCount(boolean subscribed_only)
protected int
getSubscriptionDownloadCount()
protected SubscriptionImpl
getSubscriptionFromName(java.lang.String name)
protected SubscriptionImpl
getSubscriptionFromPlatform(byte[] sid, boolean is_anon, int add_type)
protected SubscriptionImpl
getSubscriptionFromSID(byte[] sid)
protected SubscriptionImpl
getSubscriptionFromVuzeFile(byte[] sid, int add_type, VuzeFile vf)
protected SubscriptionImpl
getSubscriptionFromVuzeFile(byte[] sid, int add_type, java.io.File file)
protected SubscriptionImpl
getSubscriptionFromVuzeFileContent(byte[] sid, int add_type, java.lang.String content)
Subscription[]
getSubscriptions()
Subscription[]
getSubscriptions(boolean subscribed_only)
protected java.io.File
getSubsDir()
protected java.lang.String
getUniqueName(java.lang.String name)
protected java.io.File
getVuzeFile(SubscriptionImpl subs)
boolean
hideSearchTemplates()
java.lang.Object
importDataSource(java.util.Map<java.lang.String,java.lang.Object> map)
Subscription
importSubscription(int type, java.util.Map map, boolean warn_user)
protected void
initialise()
protected void
initWithCore(Core _core)
boolean
isRSSPublishEnabled()
boolean
isSearchEnabled()
boolean
isSearchTemplateImportable(SubscriptionImpl sub)
boolean
isSubsDownloadEnabled()
protected boolean
isVisible(SubscriptionImpl subs)
private void
loadConfig()
protected java.util.LinkedHashMap<java.lang.String,SubscriptionResultImpl>
loadResults(SubscriptionImpl subs)
void
log(java.lang.String s)
void
log(java.lang.String s, java.lang.Throwable e)
protected void
lookupAssociations(boolean high_priority)
SubscriptionAssociationLookup
lookupAssociations(byte[] hash, SubscriptionLookupListener listener)
SubscriptionAssociationLookup
lookupAssociations(byte[] hash, java.lang.String description, SubscriptionLookupListener listener)
Full lookupSubscriptionAssociationLookup
lookupAssociations(byte[] hash, java.lang.String description, java.lang.String[] networks, SubscriptionLookupListener listener)
private SubscriptionAssociationLookup
lookupAssociations(DHTPluginInterface dht_plugin, byte[] hash, java.lang.String description, SubscriptionLookupListener listener)
protected SubscriptionAssociationLookup
lookupAssociationsSupport(DHTPluginInterface dht_plugin, byte[] hash, java.lang.String description, SubscriptionLookupListener _listener)
protected SubscriptionImpl
lookupSingletonRSS(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon)
private void
lookupSubscription(java.lang.String description, byte[] association_hash, byte[] sid, int version, boolean is_anon, SubscriptionManagerImpl.subsLookupListener listener)
private java.util.List<SubscriptionResult>
matchSubscriptionResults(SubscriptionManagerImpl.searchMatcher matcher)
static void
preInitialise()
protected void
prepareDownload(Download download, Subscription[] subscriptions, SubscriptionResult[] results)
private void
publishAssociation(SubscriptionImpl subs, SubscriptionImpl.association assoc)
private boolean
publishAssociations()
private void
publishNextAssociation()
protected void
publishSubscription(SubscriptionImpl subs)
protected void
publishSubscriptions()
protected void
recordAssociations(byte[] association_hash, SubscriptionImpl[] subscriptions, boolean full_lookup)
protected boolean
recordAssociationsSupport(byte[] association_hash, SubscriptionImpl[] subscriptions, boolean full_lookup)
protected boolean
recoverSubscriptionUpdate(Download download, java.util.Map rd)
protected void
removeDownload(Download download, boolean remove_data)
void
removeListener(SubscriptionManagerListener listener)
protected void
removePrepareTrigger(byte[] hash)
protected void
removeSubscription(SubscriptionImpl subs)
void
requestSubscription(SearchProvider sp, java.util.Map<java.lang.String,java.lang.Object> search_parameters)
void
requestSubscription(java.net.URL url, java.util.Map<java.lang.String,java.lang.Object> options)
protected void
saveConfig()
protected void
saveResults(SubscriptionImpl subs, SubscriptionResultImpl[] results)
SearchInstance
searchSubscriptions(java.util.Map<java.lang.String,java.lang.Object> search_parameters, SearchObserver observer)
private void
searchTemplateOK(SubscriptionImpl subs, Download download)
private DHTPluginInterface
selectDHTPlugin(SubscriptionImpl subs)
private DHTPluginInterface
selectDHTPlugin(Download download)
private DHTPluginInterface
selectDHTPlugin(java.lang.String[] networks)
protected void
selectSubscription(SubscriptionImpl subs)
void
setActivateSubscriptionOnChange(boolean b)
void
setAddHashDirs(boolean b)
void
setAutoDownloadMarkReadAfterDays(int days)
void
setAutoStartDownloads(boolean auto_start)
void
setAutoStartMaxMB(int mb)
void
setAutoStartMinMB(int mb)
protected void
setCategoryOnExisting(SubscriptionImpl subscription, java.lang.String old_category, java.lang.String new_category)
void
setDefaultCheckFrequencyMins(int def)
void
setMaxNonDeletedResults(int max)
void
setRateLimits(java.lang.String limits)
void
setRSSPublishEnabled(boolean enabled)
void
setSearchEnabled(boolean enabled)
protected void
setSelected(SubscriptionImpl sub)
protected void
setSelected(java.util.List subs)
void
setSubsDownloadEnabled(boolean enabled)
protected boolean
shouldAutoStart(Torrent torrent)
Subscription
subscribeToRSS(java.lang.String name, java.net.URL url, int interval, boolean is_public, java.lang.String creator_ref)
Subscription
subscribeToSubscription(java.lang.String uri)
protected boolean
subscriptionExists(Download download, SubscriptionImpl subs)
protected void
subscriptionUpdated()
protected void
tidyPotentialAssociations()
protected void
updatePopularityFromDHT(SubscriptionImpl subs, boolean sync)
protected void
updatePublicSubscription(SubscriptionImpl subs)
protected void
updateSubscription(SubscriptionImpl subs, int new_version)
protected void
updateSubscription(SubscriptionImpl subs, int update_version, byte[] update_hash, int update_size)
protected void
updateSubscription(SubscriptionImpl subs, int new_version, TOTorrent torrent, java.net.InetSocketAddress peer)
protected void
updateSubscription(SubscriptionImpl subs, Download download, java.io.File torrent_file, java.io.File data_file)
protected void
updateSubscription(SubscriptionImpl subs, java.io.File data_location)
private void
waitForChat(BuddyPluginBeta.ChatInstance chat, AERunnable runnable)
-
-
-
Field Detail
-
CONFIG_FILE
private static final java.lang.String CONFIG_FILE
- See Also:
- Constant Field Values
-
LOGGER_NAME
private static final java.lang.String LOGGER_NAME
- See Also:
- Constant Field Values
-
CONFIG_DEF_CHECK_MINS
private static final java.lang.String CONFIG_DEF_CHECK_MINS
- See Also:
- Constant Field Values
-
CONFIG_MAX_RESULTS
private static final java.lang.String CONFIG_MAX_RESULTS
- See Also:
- Constant Field Values
-
CONFIG_AUTO_START_DLS
private static final java.lang.String CONFIG_AUTO_START_DLS
- See Also:
- Constant Field Values
-
CONFIG_AUTO_START_MIN_MB
private static final java.lang.String CONFIG_AUTO_START_MIN_MB
- See Also:
- Constant Field Values
-
CONFIG_AUTO_START_MAX_MB
private static final java.lang.String CONFIG_AUTO_START_MAX_MB
- See Also:
- Constant Field Values
-
CONFIG_AUTO_MARK_READ
private static final java.lang.String CONFIG_AUTO_MARK_READ
- See Also:
- Constant Field Values
-
CONFIG_ADD_HASHES
private static final java.lang.String CONFIG_ADD_HASHES
- See Also:
- Constant Field Values
-
CONFIG_RSS_ENABLE
private static final java.lang.String CONFIG_RSS_ENABLE
- See Also:
- Constant Field Values
-
CONFIG_ENABLE_SEARCH
private static final java.lang.String CONFIG_ENABLE_SEARCH
- See Also:
- Constant Field Values
-
CONFIG_HIDE_SEARCH_TEMPLATES
private static final java.lang.String CONFIG_HIDE_SEARCH_TEMPLATES
- See Also:
- Constant Field Values
-
CONFIG_DL_SUBS_ENABLE
private static final java.lang.String CONFIG_DL_SUBS_ENABLE
- See Also:
- Constant Field Values
-
CONFIG_DL_RATE_LIMITS
private static final java.lang.String CONFIG_DL_RATE_LIMITS
- See Also:
- Constant Field Values
-
CONFIG_ACTIVATE_ON_CHANGE
private static final java.lang.String CONFIG_ACTIVATE_ON_CHANGE
- See Also:
- Constant Field Values
-
DELETE_UNUSED_AFTER_MILLIS
private static final int DELETE_UNUSED_AFTER_MILLIS
- See Also:
- Constant Field Values
-
PUB_ASSOC_CONC_MAX
private static final int PUB_ASSOC_CONC_MAX
-
PUB_SLEEPING_ASSOC_CONC_MAX
private static final int PUB_SLEEPING_ASSOC_CONC_MAX
- See Also:
- Constant Field Values
-
singleton
private static SubscriptionManagerImpl singleton
-
pre_initialised
private static boolean pre_initialised
-
random_seed
private static final int random_seed
-
started
private boolean started
-
TIMER_PERIOD
private static final int TIMER_PERIOD
- See Also:
- Constant Field Values
-
ASSOC_CHECK_PERIOD
private static final int ASSOC_CHECK_PERIOD
- See Also:
- Constant Field Values
-
ASSOC_CHECK_TICKS
private static final int ASSOC_CHECK_TICKS
- See Also:
- Constant Field Values
-
ASSOC_PUBLISH_PERIOD
private static final int ASSOC_PUBLISH_PERIOD
- See Also:
- Constant Field Values
-
ASSOC_PUBLISH_TICKS
private static final int ASSOC_PUBLISH_TICKS
- See Also:
- Constant Field Values
-
CHAT_CHECK_PERIOD
private static final int CHAT_CHECK_PERIOD
- See Also:
- Constant Field Values
-
CHAT_CHECK_TICKS
private static final int CHAT_CHECK_TICKS
- See Also:
- Constant Field Values
-
SERVER_PUB_CHECK_PERIOD
private static final int SERVER_PUB_CHECK_PERIOD
- See Also:
- Constant Field Values
-
SERVER_PUB_CHECK_TICKS
private static final int SERVER_PUB_CHECK_TICKS
- See Also:
- Constant Field Values
-
TIDY_POT_ASSOC_PERIOD
private static final int TIDY_POT_ASSOC_PERIOD
- See Also:
- Constant Field Values
-
TIDY_POT_ASSOC_TICKS
private static final int TIDY_POT_ASSOC_TICKS
- See Also:
- Constant Field Values
-
SET_SELECTED_PERIOD
private static final int SET_SELECTED_PERIOD
- See Also:
- Constant Field Values
-
SET_SELECTED_FIRST_TICK
private static final int SET_SELECTED_FIRST_TICK
- See Also:
- Constant Field Values
-
SET_SELECTED_TICKS
private static final int SET_SELECTED_TICKS
- See Also:
- Constant Field Values
-
SP_LAST_ATTEMPTED
private static final java.lang.Object SP_LAST_ATTEMPTED
-
SP_CONSEC_FAIL
private static final java.lang.Object SP_CONSEC_FAIL
-
core
private Core core
-
dht_plugin_public
private volatile DHTPluginInterface dht_plugin_public
-
subscriptions
private java.util.List<SubscriptionImpl> subscriptions
-
config_dirty
private boolean config_dirty
-
publish_associations_active
private int publish_associations_active
-
publish_next_asyc_pending
private boolean publish_next_asyc_pending
-
publish_subscription_active
private boolean publish_subscription_active
-
ta_subs_download
private TorrentAttribute ta_subs_download
-
ta_subs_download_rd
private TorrentAttribute ta_subs_download_rd
-
ta_subscription_info
private TorrentAttribute ta_subscription_info
-
ta_category
private TorrentAttribute ta_category
-
ta_networks
private TorrentAttribute ta_networks
-
periodic_lookup_in_progress
private boolean periodic_lookup_in_progress
-
priority_lookup_pending
private int priority_lookup_pending
-
listeners
private CopyOnWriteList<SubscriptionManagerListener> listeners
-
scheduler
private SubscriptionSchedulerImpl scheduler
-
potential_associations
private java.util.List<java.lang.Object[]> potential_associations
-
potential_associations2
private java.util.Map<HashWrapper,java.lang.Object[]> potential_associations2
-
potential_associations3
private java.util.Map<HashWrapper,java.lang.Object[]> potential_associations3
-
meta_search_listener_added
private boolean meta_search_listener_added
-
exclusion_pattern
private java.util.regex.Pattern exclusion_pattern
-
rss_publisher
private SubscriptionRSSFeed rss_publisher
-
logger
private AEDiagnosticsLogger logger
-
result_cache
private java.util.Map<SubscriptionImpl,java.lang.Object[]> result_cache
-
async_dispatcher
private AsyncDispatcher async_dispatcher
-
SUBS_CHAT_KEY
private static final java.lang.Object SUBS_CHAT_KEY
-
imported_sids
private java.util.Map<java.lang.String,java.util.concurrent.atomic.AtomicInteger> imported_sids
-
chat_write_dispatcher
private AsyncDispatcher chat_write_dispatcher
-
chat_st_done
private java.util.Set<java.lang.String> chat_st_done
-
chat_assoc_done
private java.util.LinkedList<BuddyPluginBeta.ChatInstance> chat_assoc_done
-
-
Method Detail
-
preInitialise
public static void preInitialise()
-
getSingleton
public static SubscriptionManager getSingleton(boolean stand_alone)
-
initialise
protected void initialise()
-
initWithCore
protected void initWithCore(Core _core)
-
getSearchTemplateVuzeFile
protected java.lang.Object[] getSearchTemplateVuzeFile(SubscriptionImpl sub)
-
isSearchTemplateImportable
public boolean isSearchTemplateImportable(SubscriptionImpl sub)
-
searchSubscriptions
public SearchInstance searchSubscriptions(java.util.Map<java.lang.String,java.lang.Object> search_parameters, SearchObserver observer) throws SearchException
- Throws:
SearchException
-
matchSubscriptionResults
private java.util.List<SubscriptionResult> matchSubscriptionResults(SubscriptionManagerImpl.searchMatcher matcher)
-
checkMaxResults
protected void checkMaxResults(int max)
-
getScheduler
public SubscriptionScheduler getScheduler()
- Specified by:
getScheduler
in interfaceSubscriptionManager
-
isRSSPublishEnabled
public boolean isRSSPublishEnabled()
- Specified by:
isRSSPublishEnabled
in interfaceSubscriptionManager
-
setRSSPublishEnabled
public void setRSSPublishEnabled(boolean enabled)
- Specified by:
setRSSPublishEnabled
in interfaceSubscriptionManager
-
isSearchEnabled
public boolean isSearchEnabled()
- Specified by:
isSearchEnabled
in interfaceSubscriptionManager
-
setSearchEnabled
public void setSearchEnabled(boolean enabled)
- Specified by:
setSearchEnabled
in interfaceSubscriptionManager
-
hideSearchTemplates
public boolean hideSearchTemplates()
- Specified by:
hideSearchTemplates
in interfaceSubscriptionManager
-
isSubsDownloadEnabled
public boolean isSubsDownloadEnabled()
- Specified by:
isSubsDownloadEnabled
in interfaceSubscriptionManager
-
setSubsDownloadEnabled
public void setSubsDownloadEnabled(boolean enabled)
- Specified by:
setSubsDownloadEnabled
in interfaceSubscriptionManager
-
setRateLimits
public void setRateLimits(java.lang.String limits)
- Specified by:
setRateLimits
in interfaceSubscriptionManager
-
getRateLimits
public java.lang.String getRateLimits()
- Specified by:
getRateLimits
in interfaceSubscriptionManager
-
setActivateSubscriptionOnChange
public void setActivateSubscriptionOnChange(boolean b)
- Specified by:
setActivateSubscriptionOnChange
in interfaceSubscriptionManager
-
getActivateSubscriptionOnChange
public boolean getActivateSubscriptionOnChange()
- Specified by:
getActivateSubscriptionOnChange
in interfaceSubscriptionManager
-
getRSSLink
public java.lang.String getRSSLink()
- Specified by:
getRSSLink
in interfaceSubscriptionManager
-
create
public Subscription create(java.lang.String name, boolean public_subs, java.lang.String json) throws SubscriptionException
- Specified by:
create
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
createSingletonRSS
public Subscription createSingletonRSS(java.lang.String name, java.net.URL url, int check_interval_mins, boolean is_anon) throws SubscriptionException
- Specified by:
createSingletonRSS
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
createFromURI
public Subscription createFromURI(java.lang.String uri) throws SubscriptionException
- Specified by:
createFromURI
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
lookupSingletonRSS
protected SubscriptionImpl lookupSingletonRSS(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon) throws SubscriptionException
- Throws:
SubscriptionException
-
createSingletonRSSSupport
protected Subscription createSingletonRSSSupport(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon, int add_type, boolean subscribe) throws SubscriptionException
- Throws:
SubscriptionException
-
getUniqueName
protected java.lang.String getUniqueName(java.lang.String name)
-
getSingletonMap
protected java.util.Map getSingletonMap(java.lang.String name, java.net.URL url, boolean is_public, int check_interval_mins, boolean is_anon) throws SubscriptionException
- Throws:
SubscriptionException
-
createSingletonSubscription
protected SubscriptionImpl createSingletonSubscription(java.util.Map singleton_details, int add_type, boolean subscribe) throws SubscriptionException
- Throws:
SubscriptionException
-
requestSubscription
public void requestSubscription(java.net.URL url, java.util.Map<java.lang.String,java.lang.Object> options)
- Specified by:
requestSubscription
in interfaceUtilitiesImpl.PluginSubscriptionManager
-
requestSubscription
public void requestSubscription(SearchProvider sp, java.util.Map<java.lang.String,java.lang.Object> search_parameters) throws SubscriptionException
- Specified by:
requestSubscription
in interfaceUtilitiesImpl.PluginSubscriptionManager
- Throws:
SubscriptionException
-
createRSS
public Subscription createRSS(java.lang.String name, java.net.URL url, int check_interval_mins, java.util.Map user_data) throws SubscriptionException
- Specified by:
createRSS
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
createRSS
public Subscription createRSS(java.lang.String name, java.net.URL url, int check_interval_mins, boolean is_anonymous, java.util.Map user_data) throws SubscriptionException
- Specified by:
createRSS
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
checkURL
protected void checkURL(java.net.URL url) throws SubscriptionException
- Throws:
SubscriptionException
-
addSubscription
protected SubscriptionImpl addSubscription(SubscriptionImpl subs)
-
addMetaSearchListener
protected void addMetaSearchListener()
-
changeSubscription
protected void changeSubscription(SubscriptionImpl subs)
-
selectSubscription
protected void selectSubscription(SubscriptionImpl subs)
-
removeSubscription
protected void removeSubscription(SubscriptionImpl subs)
-
updatePublicSubscription
protected void updatePublicSubscription(SubscriptionImpl subs)
-
checkSingletonPublish
protected void checkSingletonPublish(SubscriptionImpl subs) throws SubscriptionException
- Throws:
SubscriptionException
-
checkServerPublications
protected void checkServerPublications(java.util.List subs)
-
checkStuff
protected void checkStuff(int ticks)
-
importSubscription
public Subscription importSubscription(int type, java.util.Map map, boolean warn_user) throws SubscriptionException
- Throws:
SubscriptionException
-
getSubscriptions
public Subscription[] getSubscriptions()
- Specified by:
getSubscriptions
in interfaceSubscriptionManager
-
getSubscriptions
public Subscription[] getSubscriptions(boolean subscribed_only)
- Specified by:
getSubscriptions
in interfaceSubscriptionManager
- Specified by:
getSubscriptions
in interfaceUtilitiesImpl.PluginSubscriptionManager
-
getSubscriptionCount
public int getSubscriptionCount(boolean subscribed_only)
- Specified by:
getSubscriptionCount
in interfaceSubscriptionManager
-
getSubscriptionFromName
protected SubscriptionImpl getSubscriptionFromName(java.lang.String name)
-
getSubscriptionByID
public Subscription getSubscriptionByID(java.lang.String id)
- Specified by:
getSubscriptionByID
in interfaceSubscriptionManager
-
importDataSource
public java.lang.Object importDataSource(java.util.Map<java.lang.String,java.lang.Object> map)
- Specified by:
importDataSource
in interfaceDataSourceResolver.DataSourceImporter
-
getSubscriptionFromSID
protected SubscriptionImpl getSubscriptionFromSID(byte[] sid)
-
getSubsDir
protected java.io.File getSubsDir() throws java.io.IOException
- Throws:
java.io.IOException
-
getVuzeFile
protected java.io.File getVuzeFile(SubscriptionImpl subs) throws java.io.IOException
- Throws:
java.io.IOException
-
getResultsFile
protected java.io.File getResultsFile(SubscriptionImpl subs) throws java.io.IOException
- Throws:
java.io.IOException
-
getKnownSubscriptionCount
public int getKnownSubscriptionCount()
- Specified by:
getKnownSubscriptionCount
in interfaceSubscriptionManager
-
getKnownSubscriptions
public Subscription[] getKnownSubscriptions(byte[] hash)
Description copied from interface:SubscriptionManager
Cached view of hash's subs- Specified by:
getKnownSubscriptions
in interfaceSubscriptionManager
- Returns:
-
subscriptionExists
protected boolean subscriptionExists(Download download, SubscriptionImpl subs)
-
downloadIsIgnored
private boolean downloadIsIgnored(Download download)
-
isVisible
protected boolean isVisible(SubscriptionImpl subs)
-
getLinkedSubscriptions
public Subscription[] getLinkedSubscriptions(byte[] hash)
- Specified by:
getLinkedSubscriptions
in interfaceSubscriptionManager
-
lookupAssociations
protected void lookupAssociations(boolean high_priority)
-
associationLookupComplete
protected void associationLookupComplete()
-
setSelected
protected void setSelected(java.util.List subs)
-
checkUpgrade
protected void checkUpgrade(SubscriptionImpl sub)
-
setSelected
protected void setSelected(SubscriptionImpl sub)
-
checkInitialDownload
protected void checkInitialDownload(SubscriptionImpl subs)
-
lookupAssociations
public SubscriptionAssociationLookup lookupAssociations(byte[] hash, java.lang.String description, java.lang.String[] networks, SubscriptionLookupListener listener) throws SubscriptionException
- Specified by:
lookupAssociations
in interfaceSubscriptionManager
- Throws:
SubscriptionException
-
lookupAssociations
public SubscriptionAssociationLookup lookupAssociations(byte[] hash, SubscriptionLookupListener listener) throws SubscriptionException
- Specified by:
lookupAssociations
in interfaceSubscriptionManager
- Returns:
- Throws:
SubscriptionException
-
lookupAssociations
public SubscriptionAssociationLookup lookupAssociations(byte[] hash, java.lang.String description, SubscriptionLookupListener listener) throws SubscriptionException
Description copied from interface:SubscriptionManager
Full lookup- Specified by:
lookupAssociations
in interfaceSubscriptionManager
- Returns:
- Throws:
SubscriptionException
-
lookupAssociations
private SubscriptionAssociationLookup lookupAssociations(DHTPluginInterface dht_plugin, byte[] hash, java.lang.String description, SubscriptionLookupListener listener) throws SubscriptionException
- Throws:
SubscriptionException
-
lookupAssociationsSupport
protected SubscriptionAssociationLookup lookupAssociationsSupport(DHTPluginInterface dht_plugin, byte[] hash, java.lang.String description, SubscriptionLookupListener _listener) throws SubscriptionException
- Throws:
SubscriptionException
-
getPopularity
protected void getPopularity(SubscriptionImpl subs, SubscriptionPopularityListener listener) throws SubscriptionException
- Throws:
SubscriptionException
-
getPopularityFromDHT
protected void getPopularityFromDHT(SubscriptionImpl subs, SubscriptionPopularityListener listener, boolean sync)
-
updatePopularityFromDHT
protected void updatePopularityFromDHT(SubscriptionImpl subs, boolean sync)
-
getPopularitySupport
protected void getPopularitySupport(DHTPluginInterface dht_plugin, SubscriptionImpl subs, SubscriptionPopularityListener _listener, boolean sync)
-
lookupSubscription
private void lookupSubscription(java.lang.String description, byte[] association_hash, byte[] sid, int version, boolean is_anon, SubscriptionManagerImpl.subsLookupListener listener)
-
getSubscriptionFromPlatform
protected SubscriptionImpl getSubscriptionFromPlatform(byte[] sid, boolean is_anon, int add_type) throws SubscriptionException
- Throws:
SubscriptionException
-
getSubscriptionFromVuzeFile
protected SubscriptionImpl getSubscriptionFromVuzeFile(byte[] sid, int add_type, java.io.File file) throws SubscriptionException
- Throws:
SubscriptionException
-
getSubscriptionFromVuzeFileContent
protected SubscriptionImpl getSubscriptionFromVuzeFileContent(byte[] sid, int add_type, java.lang.String content) throws SubscriptionException
- Throws:
SubscriptionException
-
getSubscriptionFromVuzeFile
protected SubscriptionImpl getSubscriptionFromVuzeFile(byte[] sid, int add_type, VuzeFile vf) throws SubscriptionException
- Throws:
SubscriptionException
-
downloadSubscription
private void downloadSubscription(java.lang.String description, byte[] association_hash, byte[] torrent_hash, byte[] sid, int version, int size, SubscriptionManagerImpl.subsLookupListener listener)
-
getSubscriptionDownloadCount
protected int getSubscriptionDownloadCount()
-
associationAdded
protected void associationAdded(SubscriptionImpl subscription, byte[] association_hash)
-
addPotentialAssociation
protected void addPotentialAssociation(SubscriptionImpl subs, java.lang.String result_id, java.lang.String key)
-
checkPotentialAssociations
protected void checkPotentialAssociations(byte[] hash, java.lang.String key)
-
tidyPotentialAssociations
protected void tidyPotentialAssociations()
-
recordAssociations
protected void recordAssociations(byte[] association_hash, SubscriptionImpl[] subscriptions, boolean full_lookup)
-
addPrepareTrigger
protected void addPrepareTrigger(byte[] hash, Subscription[] subs, SubscriptionResult[] results)
-
removePrepareTrigger
protected void removePrepareTrigger(byte[] hash)
-
prepareDownload
protected void prepareDownload(Download download, Subscription[] subscriptions, SubscriptionResult[] results)
-
recordAssociationsSupport
protected boolean recordAssociationsSupport(byte[] association_hash, SubscriptionImpl[] subscriptions, boolean full_lookup)
-
searchTemplateOK
private void searchTemplateOK(SubscriptionImpl subs, Download download)
-
assocOK
private void assocOK(SubscriptionImpl subs, SubscriptionImpl.association assoc)
-
waitForChat
private void waitForChat(BuddyPluginBeta.ChatInstance chat, AERunnable runnable)
-
publishAssociations
private boolean publishAssociations()
-
getPublishRemainingCount
private int getPublishRemainingCount()
-
publishAssociation
private void publishAssociation(SubscriptionImpl subs, SubscriptionImpl.association assoc)
-
publishNextAssociation
private void publishNextAssociation()
-
subscriptionUpdated
protected void subscriptionUpdated()
-
publishSubscriptions
protected void publishSubscriptions()
-
publishSubscription
protected void publishSubscription(SubscriptionImpl subs)
-
updateSubscription
protected void updateSubscription(SubscriptionImpl subs, int new_version)
-
encodeSubscriptionDetails
protected byte[] encodeSubscriptionDetails(SubscriptionImpl subs) throws java.io.IOException
- Throws:
java.io.IOException
-
decodeSubscriptionDetails
protected java.util.Map decodeSubscriptionDetails(byte[] data) throws java.io.IOException
- Throws:
java.io.IOException
-
updateSubscription
protected void updateSubscription(SubscriptionImpl subs, int update_version, byte[] update_hash, int update_size)
-
downloadTorrent
protected java.lang.Object[] downloadTorrent(byte[] hash, int update_size)
-
downloadSubscription
private void downloadSubscription(java.lang.String description, TOTorrent torrent, java.net.InetSocketAddress peer, byte[] subs_id, int version, java.lang.String name, SubscriptionManagerImpl.downloadListener listener)
-
updateSubscription
protected void updateSubscription(SubscriptionImpl subs, int new_version, TOTorrent torrent, java.net.InetSocketAddress peer)
-
askIfCanUpgrade
protected boolean askIfCanUpgrade(SubscriptionImpl subs, int new_version)
-
recoverSubscriptionUpdate
protected boolean recoverSubscriptionUpdate(Download download, java.util.Map rd)
-
updateSubscription
protected void updateSubscription(SubscriptionImpl subs, Download download, java.io.File torrent_file, java.io.File data_file)
-
removeDownload
protected void removeDownload(Download download, boolean remove_data)
-
updateSubscription
protected void updateSubscription(SubscriptionImpl subs, java.io.File data_location)
-
getMagnetPlugin
protected MagnetPlugin getMagnetPlugin()
-
getEngine
protected Engine getEngine(SubscriptionImpl subs, java.util.Map json_map, boolean local_only) throws SubscriptionException
- Throws:
SubscriptionException
-
loadResults
protected java.util.LinkedHashMap<java.lang.String,SubscriptionResultImpl> loadResults(SubscriptionImpl subs)
-
setCategoryOnExisting
protected void setCategoryOnExisting(SubscriptionImpl subscription, java.lang.String old_category, java.lang.String new_category)
-
getDefaultCheckFrequencyMins
public int getDefaultCheckFrequencyMins()
- Specified by:
getDefaultCheckFrequencyMins
in interfaceSubscriptionManager
-
setDefaultCheckFrequencyMins
public void setDefaultCheckFrequencyMins(int def)
- Specified by:
setDefaultCheckFrequencyMins
in interfaceSubscriptionManager
-
getMaxNonDeletedResults
public int getMaxNonDeletedResults()
- Specified by:
getMaxNonDeletedResults
in interfaceSubscriptionManager
-
setMaxNonDeletedResults
public void setMaxNonDeletedResults(int max)
- Specified by:
setMaxNonDeletedResults
in interfaceSubscriptionManager
-
getAutoStartDownloads
public boolean getAutoStartDownloads()
- Specified by:
getAutoStartDownloads
in interfaceSubscriptionManager
-
setAutoStartDownloads
public void setAutoStartDownloads(boolean auto_start)
- Specified by:
setAutoStartDownloads
in interfaceSubscriptionManager
-
getAutoStartMinMB
public int getAutoStartMinMB()
- Specified by:
getAutoStartMinMB
in interfaceSubscriptionManager
-
setAutoStartMinMB
public void setAutoStartMinMB(int mb)
- Specified by:
setAutoStartMinMB
in interfaceSubscriptionManager
-
getAutoStartMaxMB
public int getAutoStartMaxMB()
- Specified by:
getAutoStartMaxMB
in interfaceSubscriptionManager
-
setAutoStartMaxMB
public void setAutoStartMaxMB(int mb)
- Specified by:
setAutoStartMaxMB
in interfaceSubscriptionManager
-
getAutoDownloadMarkReadAfterDays
public int getAutoDownloadMarkReadAfterDays()
- Specified by:
getAutoDownloadMarkReadAfterDays
in interfaceSubscriptionManager
-
setAutoDownloadMarkReadAfterDays
public void setAutoDownloadMarkReadAfterDays(int days)
- Specified by:
setAutoDownloadMarkReadAfterDays
in interfaceSubscriptionManager
-
getAddHashDirs
public boolean getAddHashDirs()
- Specified by:
getAddHashDirs
in interfaceSubscriptionManager
-
setAddHashDirs
public void setAddHashDirs(boolean b)
- Specified by:
setAddHashDirs
in interfaceSubscriptionManager
-
shouldAutoStart
protected boolean shouldAutoStart(Torrent torrent)
-
saveResults
protected void saveResults(SubscriptionImpl subs, SubscriptionResultImpl[] results)
-
loadConfig
private void loadConfig()
-
configDirty
protected void configDirty(SubscriptionImpl subs)
-
configDirty
protected void configDirty()
-
saveConfig
protected void saveConfig()
-
getKeyBytes
private byte[] getKeyBytes(java.lang.String key)
-
getLogger
private AEDiagnosticsLogger getLogger()
-
log
public void log(java.lang.String s, java.lang.Throwable e)
-
log
public void log(java.lang.String s)
-
addListener
public void addListener(SubscriptionManagerListener listener)
- Specified by:
addListener
in interfaceSubscriptionManager
-
removeListener
public void removeListener(SubscriptionManagerListener listener)
- Specified by:
removeListener
in interfaceSubscriptionManager
-
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-
selectDHTPlugin
private DHTPluginInterface selectDHTPlugin(SubscriptionImpl subs)
-
selectDHTPlugin
private DHTPluginInterface selectDHTPlugin(Download download)
-
selectDHTPlugin
private DHTPluginInterface selectDHTPlugin(java.lang.String[] networks)
-
subscribeToSubscription
public Subscription subscribeToSubscription(java.lang.String uri) throws java.lang.Exception
- Specified by:
subscribeToSubscription
in interfaceSubscriptionManager
- Throws:
java.lang.Exception
-
subscribeToRSS
public Subscription subscribeToRSS(java.lang.String name, java.net.URL url, int interval, boolean is_public, java.lang.String creator_ref) throws java.lang.Exception
- Specified by:
subscribeToRSS
in interfaceSubscriptionManager
- Throws:
java.lang.Exception
-
-