Class SubscriptionImpl
java.lang.Object
com.biglybt.core.subs.impl.SubscriptionImpl
- All Implemented Interfaces:
Subscription, DataSourceResolver.ExportableDataSource, UtilitiesImpl.PluginSubscription
public class SubscriptionImpl
extends Object
implements Subscription, DataSourceResolver.ExportableDataSource
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate longprivate intprivate List<SubscriptionImpl.association> private intprivate Stringprivate Stringprivate booleanprivate static AsyncDispatcherprivate Stringprivate intprivate byte[]private intprivate final SubscriptionHistoryImplprivate Mapprivate Stringprivate booleanprivate booleanprivate booleanprivate longprivate longprivate static ListenerManager<SubscriptionListener> private final ListenerManager<SubscriptionListener> private Stringprivate static final intprivate static final intprivate LightWeightSeedprivate intprivate SubscriptionManagerImplprivate static final intprivate AtomicLongprivate static final intprivate Stringprivate Stringprivate Stringprivate longprivate byte[]private byte[]private booleanprivate Stringprivate Mapprivate booleanprivate booleanprivate byte[]private byte[]private intprivate Mapprivate booleanprivate intprivate longprivate Mapprivate Mapprivate booleanprivate intprivate intFields inherited from interface DataSourceResolver.ExportableDataSource
OPT_CAN_MINIMIZE, OPT_ON_TOPFields inherited from interface Subscription
ADD_TYPE_CREATE, ADD_TYPE_IMPORT, ADD_TYPE_LOOKUP, AZ_VERSION, VO_FULL, VO_HIDE_HEADER, VUZE_FILE_COMPONENT_SUBSCRIPTION_KEY -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedSubscriptionImpl(SubscriptionManagerImpl _manager, SubscriptionBodyImpl _body, int _add_type, boolean _is_subscribed) protectedSubscriptionImpl(SubscriptionManagerImpl _manager, String _name, boolean _public, boolean _anonymous, Map _singleton_details, String _json_content, int _add_type) protectedSubscriptionImpl(SubscriptionManagerImpl _manager, Map map) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAssociation(byte[] hash) protected booleanaddAssociationSupport(byte[] hash, boolean internal) voidvoidaddPotentialAssociation(String result_id, String key) protected static intbytesToInt(byte[] bytes) protected booleanprotected voidcloneWithNewEngine(Engine engine) protected voiddestroy()protected StringembedEngines(String json_in) protected static voidembedEngines(Map map, Engine engine) protected voidengineUpdated(Engine engine) protected EngineextractEngine(Map json_map, long id) protected voidfireChanged(int reason) protected voidfireChanged(int reason, boolean persistent) protected voidprotected voidprotected voidgenerate(IndentWriter writer) longintintprotected SubscriptionImpl.associationprotected intintlongprotected EnginegetEngine(boolean local_only) protected intprotected intintprotected MapgetID()getJSON()longgetName()Returns local name if setgetName(boolean use_local) longlongvoidgetPopularity(SubscriptionPopularityListener listener) protected byte[]protected Mapprotected byte[]protected static byte[]getPublicationHash(Map details) protected static intgetPublicationSize(Map details) protected static intgetPublicationVersion(Map details) byte[]protected booleangetResults(boolean include_deleted) shortcut to help plugin interfaceprotected Mapprotected booleanprotected booleanbyte[]protected Mapprotected booleanprotected static StringgetSkeletonJSON(Engine engine, int check_interval_mins) protected static StringgetSkeletonJSON(Engine engine, String term, String networks, int check_interval_mins) private intlonggetTagID()Tag UIDgetURI()getUserData(Object key) protected intgetVerifiedPublicationVersion(Map details) intintbooleanhasAssociation(byte[] hash) protected voidinit()protected static byte[]intToBytes(int version) booleanbooleanbooleanisMine()booleanisPublic()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanprotected voidprotected voidvoidremove()voidvoidvoidreset()voidprotected voidsetCachedPopularity(long pop) voidsetCategory(String _category) voidsetCreatorRef(String ref) voidsetDependsOn(List<Subscription> subs) booleansetDetails(String _name, boolean _is_public, String _json) voidsetExecuteOnNewResult(String eonr) protected voidbooleanvoidsetLocalName(String str) voidprotected voidsetNewestUnreadResultTime(long t) voidvoidsetPublic(boolean _is_public) protected voidsetPublished(boolean b) protected voidprotected voidprotected voidvoidsetSubscribed(boolean s) voidsetTagID(long _tag_id) voidsetUserData(Object key, Object data) voidsetViewOptions(int _options) protected voidprotected voidprotected MaptoMap()protected voidupdateHistoryConfig(Map _history_map, int reason) protected voidupgrade(SubscriptionBodyImpl body) protected booleanverifyPublicationDetails(Map details) protected voidversionUpdated(SubscriptionBodyImpl body, boolean json_changed) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataSourceResolver.ExportableDataSource
getBooleanOption
-
Field Details
-
MAX_ASSOCIATIONS
private static final int MAX_ASSOCIATIONS -
MIN_RECENT_ASSOC_TO_RETAIN
private static final int MIN_RECENT_ASSOC_TO_RETAIN- See Also:
-
manager
-
public_key
private byte[] public_key -
private_key
private byte[] private_key -
name
-
name_ex
-
version
private int version -
az_version
private int az_version -
is_public
private boolean is_public -
is_anonymous
private boolean is_anonymous -
subscription_type
private volatile int subscription_type -
singleton_details
-
hash
private byte[] hash -
sig
private byte[] sig -
sig_data_size
private int sig_data_size -
add_type
private int add_type -
add_time
private long add_time -
is_subscribed
private boolean is_subscribed -
highest_prompted_version
private int highest_prompted_version -
short_id
private byte[] short_id -
id
-
associations
-
fixed_random
private int fixed_random -
popularity
private long popularity -
last_auto_upgrade_check
private long last_auto_upgrade_check -
published
private boolean published -
server_published
private boolean server_published -
server_publication_outstanding
private boolean server_publication_outstanding -
singleton_sp_attempted
private boolean singleton_sp_attempted -
local_name
-
lws
-
lws_skip_check
private int lws_skip_check -
destroyed
private boolean destroyed -
history_map
-
schedule_map
-
user_data
-
history
-
referer
-
verify_cache_details
-
verify_cache_result
private boolean verify_cache_result -
creator_ref
-
category
-
tag_id
private long tag_id -
view_options
private int view_options -
parent
-
depends_on
-
exec_on_new_result
-
latest_unread_result_time
private volatile long latest_unread_result_time -
md_mutator
-
LT_SUBSCRIPTION_CHANGED
private static final int LT_SUBSCRIPTION_CHANGED- See Also:
-
LT_SUBSCRIPTION_DOWNLOADED
private static final int LT_SUBSCRIPTION_DOWNLOADED- See Also:
-
listener_aggregator
-
listeners
-
disp
-
-
Constructor Details
-
SubscriptionImpl
protected SubscriptionImpl(SubscriptionManagerImpl _manager, String _name, boolean _public, boolean _anonymous, Map _singleton_details, String _json_content, int _add_type) throws SubscriptionException - Throws:
SubscriptionException
-
SubscriptionImpl
- Throws:
IOException
-
SubscriptionImpl
protected SubscriptionImpl(SubscriptionManagerImpl _manager, SubscriptionBodyImpl _body, int _add_type, boolean _is_subscribed) throws SubscriptionException - Throws:
SubscriptionException
-
-
Method Details
-
intToBytes
protected static byte[] intToBytes(int version) -
bytesToInt
protected static int bytesToInt(byte[] bytes) -
getSkeletonJSON
-
getSkeletonJSON
-
syncFromBody
- Throws:
SubscriptionException
-
syncToBody
- Throws:
SubscriptionException
-
toMap
- Throws:
IOException
-
fromMap
- Throws:
IOException
-
exportDataSource
- Specified by:
exportDataSourcein interfaceDataSourceResolver.ExportableDataSource
-
getScheduleConfig
-
getHistoryConfig
-
updateHistoryConfig
-
upgrade
- Throws:
SubscriptionException
-
init
protected void init() -
isSingleton
public boolean isSingleton() -
getDependsOn
- Specified by:
getDependsOnin interfaceSubscription
-
setDependsOn
- Specified by:
setDependsOnin interfaceSubscription
-
getExecuteOnNewResult
- Specified by:
getExecuteOnNewResultin interfaceSubscription
-
setExecuteOnNewResult
- Specified by:
setExecuteOnNewResultin interfaceSubscription
-
isSubscriptionTemplate
public boolean isSubscriptionTemplate()- Specified by:
isSubscriptionTemplatein interfaceSubscription
-
getSubscriptionType
private int getSubscriptionType() -
isSearchTemplate
public boolean isSearchTemplate()- Specified by:
isSearchTemplatein interfaceSubscription- Specified by:
isSearchTemplatein interfaceUtilitiesImpl.PluginSubscription
-
getSingletonDetails
-
getSingletonPublishAttempted
protected boolean getSingletonPublishAttempted() -
setSingletonPublishAttempted
protected void setSingletonPublishAttempted() -
getName
Description copied from interface:SubscriptionReturns local name if set- Specified by:
getNamein interfaceSubscription- Specified by:
getNamein interfaceUtilitiesImpl.PluginSubscription- Returns:
-
getName
- Specified by:
getNamein interfaceSubscription
-
getURI
- Specified by:
getURIin interfaceSubscription
-
requestAttention
public void requestAttention()- Specified by:
requestAttentionin interfaceSubscription
-
setLocalName
- Specified by:
setLocalNamein interfaceSubscription
-
setName
- Specified by:
setNamein interfaceSubscription- Throws:
SubscriptionException
-
getNameEx
- Specified by:
getNameExin interfaceSubscription
-
getQueryKey
- Specified by:
getQueryKeyin interfaceSubscription
-
getAddTime
public long getAddTime()- Specified by:
getAddTimein interfaceSubscription
-
getAddType
public int getAddType()- Specified by:
getAddTypein interfaceSubscription
-
isPublic
public boolean isPublic()- Specified by:
isPublicin interfaceSubscription
-
isAnonymous
public boolean isAnonymous()- Specified by:
isAnonymousin interfaceSubscription
-
setPublic
- Specified by:
setPublicin interfaceSubscription- Throws:
SubscriptionException
-
getServerPublicationOutstanding
protected boolean getServerPublicationOutstanding() -
setServerPublicationOutstanding
protected void setServerPublicationOutstanding() -
setServerPublished
protected void setServerPublished() -
getServerPublished
protected boolean getServerPublished() -
getJSON
- Specified by:
getJSONin interfaceSubscription- Throws:
SubscriptionException
-
setJSON
- Specified by:
setJSONin interfaceSubscription- Throws:
SubscriptionException
-
embedEngines
-
embedEngines
-
extractEngine
-
cloneWithNewEngine
- Specified by:
cloneWithNewEnginein interfaceSubscription- Throws:
SubscriptionException
-
getEngine
- Specified by:
getEnginein interfaceSubscription- Throws:
SubscriptionException
-
getEngine
- Throws:
SubscriptionException
-
engineUpdated
-
setDetails
public boolean setDetails(String _name, boolean _is_public, String _json) throws SubscriptionException - Specified by:
setDetailsin interfaceSubscription- Throws:
SubscriptionException
-
versionUpdated
-
getPublicKey
public byte[] getPublicKey()- Specified by:
getPublicKeyin interfaceSubscription
-
getShortID
public byte[] getShortID() -
getID
- Specified by:
getIDin interfaceSubscription- Specified by:
getIDin interfaceUtilitiesImpl.PluginSubscription
-
getPrivateKey
protected byte[] getPrivateKey() -
getFixedRandom
protected int getFixedRandom() -
getVersion
public int getVersion()- Specified by:
getVersionin interfaceSubscription
-
getAZVersion
public int getAZVersion()- Specified by:
getAZVersionin interfaceSubscription
-
setHighestUserPromptedVersion
protected void setHighestUserPromptedVersion(int v) -
getHighestUserPromptedVersion
protected int getHighestUserPromptedVersion() -
getHighestVersion
public int getHighestVersion()- Specified by:
getHighestVersionin interfaceSubscription
-
resetHighestVersion
public void resetHighestVersion()- Specified by:
resetHighestVersionin interfaceSubscription
-
isMine
public boolean isMine()- Specified by:
isMinein interfaceSubscription
-
isUpdateable
public boolean isUpdateable()- Specified by:
isUpdateablein interfaceSubscription
-
isSubscribed
public boolean isSubscribed()- Specified by:
isSubscribedin interfaceSubscription
-
setSubscribed
public void setSubscribed(boolean s) - Specified by:
setSubscribedin interfaceSubscription
-
isAutoDownloadSupported
public boolean isAutoDownloadSupported()- Specified by:
isAutoDownloadSupportedin interfaceSubscription
-
getPopularity
- Specified by:
getPopularityin interfaceSubscription- Throws:
SubscriptionException
-
getCachedPopularity
public long getCachedPopularity()- Specified by:
getCachedPopularityin interfaceSubscription
-
setCachedPopularity
protected void setCachedPopularity(long pop) -
getReferer
- Specified by:
getRefererin interfaceSubscription
-
checkPublish
protected void checkPublish() -
canAutoUpgradeCheck
protected boolean canAutoUpgradeCheck() -
addAssociation
public void addAssociation(byte[] hash) - Specified by:
addAssociationin interfaceSubscription
-
addAssociationSupport
protected boolean addAssociationSupport(byte[] hash, boolean internal) -
hasAssociation
public boolean hasAssociation(byte[] hash) - Specified by:
hasAssociationin interfaceSubscription
-
addPotentialAssociation
- Specified by:
addPotentialAssociationin interfaceSubscription
-
getAssociationCount
public int getAssociationCount()- Specified by:
getAssociationCountin interfaceSubscription
-
getAssociationForPublish
-
getAssociationsRemainingForPublish
protected int getAssociationsRemainingForPublish() -
getPublished
protected boolean getPublished() -
setPublished
protected void setPublished(boolean b) -
getVerifiedPublicationVersion
-
getPublicationVersion
-
getPublicationHash
protected byte[] getPublicationHash() -
getPublicationHash
-
getPublicationSize
-
getPublicationDetails
-
verifyPublicationDetails
-
setCreatorRef
- Specified by:
setCreatorRefin interfaceSubscription
-
getCreatorRef
- Specified by:
getCreatorRefin interfaceSubscription
-
setCategory
- Specified by:
setCategoryin interfaceSubscription
-
getCategory
- Specified by:
getCategoryin interfaceSubscription
-
setTagID
public void setTagID(long _tag_id) - Specified by:
setTagIDin interfaceSubscription
-
getTagID
public long getTagID()Description copied from interface:SubscriptionTag UID- Specified by:
getTagIDin interfaceSubscription
-
getViewOptions
public int getViewOptions()- Specified by:
getViewOptionsin interfaceSubscription
-
setViewOptions
public void setViewOptions(int _options) - Specified by:
setViewOptionsin interfaceSubscription
-
getParent
- Specified by:
getParentin interfaceSubscription
-
setParent
- Specified by:
setParentin interfaceSubscription
-
getMetadataMutationIndicator
public long getMetadataMutationIndicator()- Specified by:
getMetadataMutationIndicatorin interfaceSubscription
-
fireChanged
protected void fireChanged(int reason) -
fireChanged
protected void fireChanged(int reason, boolean persistent) -
fireDownloaded
protected void fireDownloaded() -
addListener
- Specified by:
addListenerin interfaceSubscription
-
removeListener
- Specified by:
removeListenerin interfaceSubscription
-
getHistory
- Specified by:
getHistoryin interfaceSubscription
-
getManager
- Specified by:
getManagerin interfaceSubscription
-
getVuzeFile
- Specified by:
getVuzeFilein interfaceSubscription- Throws:
SubscriptionException
-
getSearchTemplateVuzeFile
- Specified by:
getSearchTemplateVuzeFilein interfaceSubscription
-
isSearchTemplateImportable
public boolean isSearchTemplateImportable()- Specified by:
isSearchTemplateImportablein interfaceSubscription
-
destroy
protected void destroy() -
reset
public void reset()- Specified by:
resetin interfaceSubscription
-
remove
public void remove()- Specified by:
removein interfaceSubscription
-
isRemoved
public boolean isRemoved()- Specified by:
isRemovedin interfaceSubscription
-
getResults
Description copied from interface:Subscriptionshortcut to help plugin interface- Specified by:
getResultsin interfaceSubscription- Specified by:
getResultsin interfaceUtilitiesImpl.PluginSubscription
-
setNewestUnreadResultTime
protected void setNewestUnreadResultTime(long t) -
getNewestUnreadResultTime
public long getNewestUnreadResultTime()- Specified by:
getNewestUnreadResultTimein interfaceSubscription
-
getNextUpdateTime
public long getNextUpdateTime()- Specified by:
getNextUpdateTimein interfaceSubscription
-
getFilters
- Specified by:
getFiltersin interfaceSubscription- Throws:
SubscriptionException
-
setUserData
- Specified by:
setUserDatain interfaceSubscription
-
getUserData
- Specified by:
getUserDatain interfaceSubscription
-
log
-
log
-
getString
- Specified by:
getStringin interfaceSubscription
-
generate
-