Package com.biglybt.core.subs.impl
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 long
private int
private List
<SubscriptionImpl.association> private int
private String
private String
private boolean
private String
private int
private byte[]
private int
private final SubscriptionHistoryImpl
private Map
private String
private boolean
private boolean
private boolean
private long
private static ListenerManager
<SubscriptionListener> private final ListenerManager
<SubscriptionListener> private String
private static final int
private static final int
private LightWeightSeed
private int
private SubscriptionManagerImpl
private static final int
private AtomicLong
private static final int
private String
private String
private long
private AtomicLong
private long
private String
private long
private byte[]
private byte[]
private boolean
private String
private Map
private boolean
private boolean
private byte[]
private byte[]
private int
private Map
private boolean
private int
private long
private Map
private Map
private boolean
private int
private int
Fields inherited from interface com.biglybt.core.util.DataSourceResolver.ExportableDataSource
OPT_CAN_MINIMIZE, OPT_ON_TOP
Fields inherited from interface com.biglybt.core.subs.Subscription
ADD_TYPE_CREATE, ADD_TYPE_IMPORT, ADD_TYPE_LOOKUP, AZ_VERSION, VO_FULL, VO_HIDE_HEADER, VUZE_FILE_COMPONENT_SUBSCRIPTION_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
SubscriptionImpl
(SubscriptionManagerImpl _manager, SubscriptionBodyImpl _body, int _add_type, boolean _is_subscribed) protected
SubscriptionImpl
(SubscriptionManagerImpl _manager, String _name, boolean _public, boolean _anonymous, Map _singleton_details, String _json_content, int _add_type) protected
SubscriptionImpl
(SubscriptionManagerImpl _manager, Map map) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAssociation
(byte[] hash) protected boolean
addAssociationSupport
(byte[] hash, boolean internal) void
void
addPotentialAssociation
(String result_id, String key) protected static int
bytesToInt
(byte[] bytes) protected boolean
protected void
cloneWithNewEngine
(Engine engine) protected void
destroy()
protected String
embedEngines
(String json_in) protected static void
embedEngines
(Map map, Engine engine) protected void
engineUpdated
(Engine engine) protected Engine
extractEngine
(Map json_map, long id) protected void
fireChanged
(int reason) protected void
protected void
protected void
generate
(IndentWriter writer) long
int
int
protected SubscriptionImpl.association
protected int
int
long
protected Engine
getEngine
(boolean local_only) protected int
protected int
int
protected Map
getID()
getJSON()
long
getName()
Returns local name if setgetName
(boolean use_local) long
long
void
getPopularity
(SubscriptionPopularityListener listener) protected byte[]
protected Map
protected byte[]
protected static byte[]
getPublicationHash
(Map details) protected static int
getPublicationSize
(Map details) protected static int
getPublicationVersion
(Map details) byte[]
protected boolean
getResults
(boolean include_deleted) shortcut to help plugin interfaceprotected Map
protected boolean
protected boolean
byte[]
protected Map
protected boolean
protected static String
getSkeletonJSON
(Engine engine, int check_interval_mins) protected static String
getSkeletonJSON
(Engine engine, String term, String networks, int check_interval_mins) private int
long
getTagID()
Tag UIDgetURI()
getUserData
(Object key) protected int
getVerifiedPublicationVersion
(Map details) int
int
boolean
hasAssociation
(byte[] hash) protected void
init()
protected static byte[]
intToBytes
(int version) protected void
boolean
boolean
boolean
isMine()
boolean
isPublic()
protected boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
protected void
protected void
void
remove()
void
void
void
reset()
void
protected void
setCachedPopularity
(long pop) void
setCategory
(String _category) void
setCreatorRef
(String ref) void
setDependsOn
(List<Subscription> subs) boolean
setDetails
(String _name, boolean _is_public, String _json) void
setExecuteOnNewResult
(String eonr) protected void
boolean
void
setLocalName
(String str) void
void
void
setPublic
(boolean _is_public) protected void
setPublished
(boolean b) protected void
protected void
protected void
void
setSubscribed
(boolean s) void
setTagID
(long _tag_id) void
setUserData
(Object key, Object data) void
setViewOptions
(int _options) protected void
protected void
protected Map
toMap()
protected void
updateHistoryConfig
(Map _history_map, int reason) protected void
upgrade
(SubscriptionBodyImpl body) protected boolean
verifyPublicationDetails
(Map details) protected void
versionUpdated
(SubscriptionBodyImpl body, boolean json_changed) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.biglybt.core.util.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
-
newest_result_time_next
-
newest_result_time_seq
private volatile long newest_result_time_seq -
newest_result_time
private volatile long newest_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
-
-
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:
exportDataSource
in interfaceDataSourceResolver.ExportableDataSource
-
getScheduleConfig
-
getHistoryConfig
-
updateHistoryConfig
-
upgrade
- Throws:
SubscriptionException
-
init
protected void init() -
isSingleton
public boolean isSingleton() -
getDependsOn
- Specified by:
getDependsOn
in interfaceSubscription
-
setDependsOn
- Specified by:
setDependsOn
in interfaceSubscription
-
getExecuteOnNewResult
- Specified by:
getExecuteOnNewResult
in interfaceSubscription
-
setExecuteOnNewResult
- Specified by:
setExecuteOnNewResult
in interfaceSubscription
-
isSubscriptionTemplate
public boolean isSubscriptionTemplate()- Specified by:
isSubscriptionTemplate
in interfaceSubscription
-
getSubscriptionType
private int getSubscriptionType() -
isSearchTemplate
public boolean isSearchTemplate()- Specified by:
isSearchTemplate
in interfaceSubscription
- Specified by:
isSearchTemplate
in interfaceUtilitiesImpl.PluginSubscription
-
getSingletonDetails
-
getSingletonPublishAttempted
protected boolean getSingletonPublishAttempted() -
setSingletonPublishAttempted
protected void setSingletonPublishAttempted() -
getName
Description copied from interface:Subscription
Returns local name if set- Specified by:
getName
in interfaceSubscription
- Specified by:
getName
in interfaceUtilitiesImpl.PluginSubscription
- Returns:
-
getName
- Specified by:
getName
in interfaceSubscription
-
getURI
- Specified by:
getURI
in interfaceSubscription
-
requestAttention
public void requestAttention()- Specified by:
requestAttention
in interfaceSubscription
-
setLocalName
- Specified by:
setLocalName
in interfaceSubscription
-
setName
- Specified by:
setName
in interfaceSubscription
- Throws:
SubscriptionException
-
getNameEx
- Specified by:
getNameEx
in interfaceSubscription
-
getQueryKey
- Specified by:
getQueryKey
in interfaceSubscription
-
getAddTime
public long getAddTime()- Specified by:
getAddTime
in interfaceSubscription
-
getAddType
public int getAddType()- Specified by:
getAddType
in interfaceSubscription
-
isPublic
public boolean isPublic()- Specified by:
isPublic
in interfaceSubscription
-
isAnonymous
public boolean isAnonymous()- Specified by:
isAnonymous
in interfaceSubscription
-
setPublic
- Specified by:
setPublic
in interfaceSubscription
- Throws:
SubscriptionException
-
getServerPublicationOutstanding
protected boolean getServerPublicationOutstanding() -
setServerPublicationOutstanding
protected void setServerPublicationOutstanding() -
setServerPublished
protected void setServerPublished() -
getServerPublished
protected boolean getServerPublished() -
getJSON
- Specified by:
getJSON
in interfaceSubscription
- Throws:
SubscriptionException
-
setJSON
- Specified by:
setJSON
in interfaceSubscription
- Throws:
SubscriptionException
-
embedEngines
-
embedEngines
-
extractEngine
-
cloneWithNewEngine
- Specified by:
cloneWithNewEngine
in interfaceSubscription
- Throws:
SubscriptionException
-
getEngine
- Specified by:
getEngine
in interfaceSubscription
- Throws:
SubscriptionException
-
getEngine
- Throws:
SubscriptionException
-
engineUpdated
-
setDetails
public boolean setDetails(String _name, boolean _is_public, String _json) throws SubscriptionException - Specified by:
setDetails
in interfaceSubscription
- Throws:
SubscriptionException
-
versionUpdated
-
getPublicKey
public byte[] getPublicKey()- Specified by:
getPublicKey
in interfaceSubscription
-
getShortID
public byte[] getShortID() -
getID
- Specified by:
getID
in interfaceSubscription
- Specified by:
getID
in interfaceUtilitiesImpl.PluginSubscription
-
getPrivateKey
protected byte[] getPrivateKey() -
getFixedRandom
protected int getFixedRandom() -
getVersion
public int getVersion()- Specified by:
getVersion
in interfaceSubscription
-
getAZVersion
public int getAZVersion()- Specified by:
getAZVersion
in interfaceSubscription
-
setHighestUserPromptedVersion
protected void setHighestUserPromptedVersion(int v) -
getHighestUserPromptedVersion
protected int getHighestUserPromptedVersion() -
getHighestVersion
public int getHighestVersion()- Specified by:
getHighestVersion
in interfaceSubscription
-
resetHighestVersion
public void resetHighestVersion()- Specified by:
resetHighestVersion
in interfaceSubscription
-
isMine
public boolean isMine()- Specified by:
isMine
in interfaceSubscription
-
isUpdateable
public boolean isUpdateable()- Specified by:
isUpdateable
in interfaceSubscription
-
isSubscribed
public boolean isSubscribed()- Specified by:
isSubscribed
in interfaceSubscription
-
setSubscribed
public void setSubscribed(boolean s) - Specified by:
setSubscribed
in interfaceSubscription
-
isAutoDownloadSupported
public boolean isAutoDownloadSupported()- Specified by:
isAutoDownloadSupported
in interfaceSubscription
-
getPopularity
- Specified by:
getPopularity
in interfaceSubscription
- Throws:
SubscriptionException
-
getCachedPopularity
public long getCachedPopularity()- Specified by:
getCachedPopularity
in interfaceSubscription
-
setCachedPopularity
protected void setCachedPopularity(long pop) -
getReferer
- Specified by:
getReferer
in interfaceSubscription
-
checkPublish
protected void checkPublish() -
canAutoUpgradeCheck
protected boolean canAutoUpgradeCheck() -
addAssociation
public void addAssociation(byte[] hash) - Specified by:
addAssociation
in interfaceSubscription
-
addAssociationSupport
protected boolean addAssociationSupport(byte[] hash, boolean internal) -
hasAssociation
public boolean hasAssociation(byte[] hash) - Specified by:
hasAssociation
in interfaceSubscription
-
addPotentialAssociation
- Specified by:
addPotentialAssociation
in interfaceSubscription
-
getAssociationCount
public int getAssociationCount()- Specified by:
getAssociationCount
in 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:
setCreatorRef
in interfaceSubscription
-
getCreatorRef
- Specified by:
getCreatorRef
in interfaceSubscription
-
setCategory
- Specified by:
setCategory
in interfaceSubscription
-
getCategory
- Specified by:
getCategory
in interfaceSubscription
-
setTagID
public void setTagID(long _tag_id) - Specified by:
setTagID
in interfaceSubscription
-
getTagID
public long getTagID()Description copied from interface:Subscription
Tag UID- Specified by:
getTagID
in interfaceSubscription
-
getViewOptions
public int getViewOptions()- Specified by:
getViewOptions
in interfaceSubscription
-
setViewOptions
public void setViewOptions(int _options) - Specified by:
setViewOptions
in interfaceSubscription
-
getParent
- Specified by:
getParent
in interfaceSubscription
-
setParent
- Specified by:
setParent
in interfaceSubscription
-
getMetadataMutationIndicator
public long getMetadataMutationIndicator()- Specified by:
getMetadataMutationIndicator
in interfaceSubscription
-
fireChanged
protected void fireChanged(int reason) -
fireDownloaded
protected void fireDownloaded() -
addListener
- Specified by:
addListener
in interfaceSubscription
-
removeListener
- Specified by:
removeListener
in interfaceSubscription
-
getHistory
- Specified by:
getHistory
in interfaceSubscription
-
getManager
- Specified by:
getManager
in interfaceSubscription
-
getVuzeFile
- Specified by:
getVuzeFile
in interfaceSubscription
- Throws:
SubscriptionException
-
getSearchTemplateVuzeFile
- Specified by:
getSearchTemplateVuzeFile
in interfaceSubscription
-
isSearchTemplateImportable
public boolean isSearchTemplateImportable()- Specified by:
isSearchTemplateImportable
in interfaceSubscription
-
destroy
protected void destroy() -
reset
public void reset()- Specified by:
reset
in interfaceSubscription
-
remove
public void remove()- Specified by:
remove
in interfaceSubscription
-
isRemoved
protected boolean isRemoved() -
getResults
Description copied from interface:Subscription
shortcut to help plugin interface- Specified by:
getResults
in interfaceSubscription
- Specified by:
getResults
in interfaceUtilitiesImpl.PluginSubscription
-
invalidateNewestResultTime
protected void invalidateNewestResultTime() -
getNewestResultTime
public long getNewestResultTime()- Specified by:
getNewestResultTime
in interfaceSubscription
-
getNextUpdateTime
public long getNextUpdateTime()- Specified by:
getNextUpdateTime
in interfaceSubscription
-
getFilters
- Specified by:
getFilters
in interfaceSubscription
- Throws:
SubscriptionException
-
setUserData
- Specified by:
setUserData
in interfaceSubscription
-
getUserData
- Specified by:
getUserData
in interfaceSubscription
-
log
-
log
-
getString
- Specified by:
getString
in interfaceSubscription
-
generate
-