Package com.biglybt.core.tag.impl
Class TagManagerImpl
- java.lang.Object
-
- com.biglybt.core.tag.impl.TagManagerImpl
-
- All Implemented Interfaces:
TagManager
,AEDiagnosticsEvidenceGenerator
,DataSourceResolver.DataSourceImporter
,DownloadCompletionListener
public class TagManagerImpl extends java.lang.Object implements TagManager, DownloadCompletionListener, AEDiagnosticsEvidenceGenerator, DataSourceResolver.DataSourceImporter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
TagManagerImpl.LifecycleHandlerImpl
-
Field Summary
Fields Modifier and Type Field Description (package private) java.util.Set<DownloadManager>
active_copy_on_complete
(package private) AsyncDispatcher
async_dispatcher
private TagPropertyTrackerHandler
auto_tracker
private java.util.Map<java.lang.String,java.lang.Object>
config
private java.util.List<java.lang.Object[]>
config_change_queue
private boolean
config_dirty
private static java.lang.String
CONFIG_FILE
private java.lang.ref.WeakReference<java.util.Map<java.lang.String,java.lang.Object>>
config_ref
private TagPropertyConstraintHandler
constraint_handler
private static int
CU_TAG_CHANGE
private static int
CU_TAG_CONTENTS
private static int
CU_TAG_CREATE
private static int
CU_TAG_REMOVE
private FrequencyLimitedDispatcher
dirty_dispatcher
private static boolean
enabled
private CopyOnWriteList<java.lang.Object[]>
feature_listeners
private boolean
js_plugin_install_tried
private java.util.Map<java.lang.Long,TagManagerImpl.LifecycleHandlerImpl>
lifecycle_handlers
private CopyOnWriteList<TagManagerListener>
listeners
(package private) AsyncDispatcher
move_on_assign_dispatcher
private RSSGeneratorPlugin.Provider
rss_generator
private static java.lang.String
RSS_PROVIDER
(package private) java.util.Set<TagBase>
rss_tags
private static TagManagerImpl
singleton
private java.util.Map<java.lang.Integer,TagType>
tag_type_map
(package private) CopyOnWriteList<TagTypeBase>
tag_types
private TagPropertyUntaggedHandler
untagged_handler
-
Constructor Summary
Constructors Modifier Constructor Description private
TagManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addConfigUpdate(int type, TagWithState tag)
void
addTagFeatureListener(int features, TagFeatureListener listener)
void
addTaggableLifecycleListener(long taggable_type, TaggableLifecycleListener listener)
void
addTagManagerListener(TagManagerListener listener, boolean fire_for_existing)
void
addTagType(TagTypeBase tag_type)
private void
applyConfigUpdates(java.util.Map config)
protected void
checkRSSFeeds(TagBase tag, boolean enable)
TagConstraint
compileConstraint(java.lang.String expression)
private void
destroy()
protected java.lang.Object
evalScript(Tag tag, java.lang.String script, DownloadManager dm, java.lang.String intent_key)
protected java.lang.String
explain(Tag tag, TagFeatureProperties.TagProperty property, Taggable taggable)
VuzeFile
exportTags(java.util.List<Tag> tags)
protected void
featureChanged(Tag tag, int feature)
void
generate(IndentWriter writer)
void
generate(IndentWriter writer, TagTypeBase tag_type)
void
generate(IndentWriter writer, TagTypeBase tag_type, TagBase tag)
private java.util.Map<java.lang.String,java.lang.Object>
getConf(TagTypeBase tag_type, boolean create)
private java.util.Map<java.lang.String,java.lang.Object>
getConf(TagTypeBase tag_type, TagBase tag, boolean create)
private java.util.Map<java.lang.String,java.lang.Object>
getConfig()
protected java.util.Set<Tag>
getDependsOnTags(Tag tag)
TaggableResolver
getResolver(long taggable_type)
static TagManagerImpl
getSingleton()
boolean
getTagPublicDefault()
java.util.List<Tag>
getTagsByName(java.lang.String name, boolean is_localized)
java.util.List<Tag>
getTagsForTaggable(int[] tts, Taggable taggable)
java.util.List<Tag>
getTagsForTaggable(int tag_type, Taggable taggable)
java.util.List<Tag>
getTagsForTaggable(Taggable taggable)
protected java.lang.String
getTagStatus(Tag tag)
TagType
getTagType(int tag_type)
java.util.List<TagType>
getTagTypes()
VuzeFile
getVuzeFile(TagBase tag)
java.lang.Object
importDataSource(java.util.Map map)
private Tag
importVuzeFile(java.util.Map content)
private void
init()
boolean
isEnabled()
Tag
lookupTagByUID(long tag_uid)
java.util.List<Tag>
lookupTagsByName(java.lang.String tag_name)
private void
moveOnAssign(DownloadManager dm, java.io.File location, long options)
void
onCompletion(Download d)
Called when a download enters a complete state (previously being incomplete).protected java.lang.Boolean
readBooleanAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Boolean def)
private java.util.Map
readConfig()
protected java.lang.Long
readLongAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Long def)
protected long[]
readLongListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, long[] def)
protected java.util.Map<java.lang.String,java.lang.Object>
readMapAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> def)
protected java.lang.String
readStringAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String def)
protected java.lang.String[]
readStringListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String[] def)
TaggableLifecycleHandler
registerTaggableResolver(TaggableResolver resolver)
protected void
removeConfig(Tag tag)
protected void
removeConfig(TagType tag_type)
void
removeTagFeatureListener(TagFeatureListener listener)
private void
removeTaggable(TaggableResolver resolver, Taggable taggable)
void
removeTaggableLifecycleListener(long taggable_type, TaggableLifecycleListener listener)
void
removeTagManagerListener(TagManagerListener listener)
protected void
removeTagType(TagTypeBase tag_type)
private void
resolverInitialized(TaggableResolver resolver)
protected void
setConf(int tag_type, int tag_id, java.util.Map conf)
private void
setDirty()
void
setProcessingEnabled(boolean enabled)
void
setTagPublicDefault(boolean pub)
protected void
tagChanged(TagWithState tag)
protected void
tagContentsChanged(TagWithState tag)
protected void
tagCreated(TagWithState tag)
void
taggableAdded(TagType tag_type, Tag tag, Taggable tagged)
void
taggableRemoved(TagType tag_type, Tag tag, Taggable tagged)
protected void
tagGroupCreated(TagTypeBase tag_type, TagTypeBase.TagGroupImpl group)
protected void
tagGroupUpdated(TagTypeBase tag_type, TagTypeBase.TagGroupImpl group)
protected void
tagRemoved(TagWithState tag)
protected boolean
writeBooleanAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Boolean value)
private void
writeConfig()
protected boolean
writeLongAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Long value)
protected boolean
writeLongListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, long[] value)
protected void
writeMapAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> value)
protected boolean
writeStringAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String value)
protected boolean
writeStringListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String[] value)
-
-
-
Field Detail
-
CONFIG_FILE
private static final java.lang.String CONFIG_FILE
- See Also:
- Constant Field Values
-
CU_TAG_CREATE
private static final int CU_TAG_CREATE
- See Also:
- Constant Field Values
-
CU_TAG_CHANGE
private static final int CU_TAG_CHANGE
- See Also:
- Constant Field Values
-
CU_TAG_CONTENTS
private static final int CU_TAG_CONTENTS
- See Also:
- Constant Field Values
-
CU_TAG_REMOVE
private static final int CU_TAG_REMOVE
- See Also:
- Constant Field Values
-
enabled
private static final boolean enabled
-
singleton
private static TagManagerImpl singleton
-
tag_types
final CopyOnWriteList<TagTypeBase> tag_types
-
tag_type_map
private final java.util.Map<java.lang.Integer,TagType> tag_type_map
-
RSS_PROVIDER
private static final java.lang.String RSS_PROVIDER
- See Also:
- Constant Field Values
-
rss_tags
final java.util.Set<TagBase> rss_tags
-
active_copy_on_complete
final java.util.Set<DownloadManager> active_copy_on_complete
-
rss_generator
private final RSSGeneratorPlugin.Provider rss_generator
-
async_dispatcher
final AsyncDispatcher async_dispatcher
-
move_on_assign_dispatcher
final AsyncDispatcher move_on_assign_dispatcher
-
dirty_dispatcher
private final FrequencyLimitedDispatcher dirty_dispatcher
-
config
private java.util.Map<java.lang.String,java.lang.Object> config
-
config_ref
private java.lang.ref.WeakReference<java.util.Map<java.lang.String,java.lang.Object>> config_ref
-
config_dirty
private boolean config_dirty
-
config_change_queue
private final java.util.List<java.lang.Object[]> config_change_queue
-
listeners
private final CopyOnWriteList<TagManagerListener> listeners
-
feature_listeners
private final CopyOnWriteList<java.lang.Object[]> feature_listeners
-
lifecycle_handlers
private final java.util.Map<java.lang.Long,TagManagerImpl.LifecycleHandlerImpl> lifecycle_handlers
-
auto_tracker
private TagPropertyTrackerHandler auto_tracker
-
untagged_handler
private TagPropertyUntaggedHandler untagged_handler
-
constraint_handler
private TagPropertyConstraintHandler constraint_handler
-
js_plugin_install_tried
private boolean js_plugin_install_tried
-
-
Method Detail
-
getSingleton
public static TagManagerImpl getSingleton()
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceTagManager
-
init
private void init()
-
setProcessingEnabled
public void setProcessingEnabled(boolean enabled)
- Specified by:
setProcessingEnabled
in interfaceTagManager
-
onCompletion
public void onCompletion(Download d)
Description copied from interface:DownloadCompletionListener
Called when a download enters a complete state (previously being incomplete).- Specified by:
onCompletion
in interfaceDownloadCompletionListener
- Parameters:
d
- Download which has been completed.
-
evalScript
protected java.lang.Object evalScript(Tag tag, java.lang.String script, DownloadManager dm, java.lang.String intent_key)
-
resolverInitialized
private void resolverInitialized(TaggableResolver resolver)
-
removeTaggable
private void removeTaggable(TaggableResolver resolver, Taggable taggable)
-
addTagType
public void addTagType(TagTypeBase tag_type)
-
getTagType
public TagType getTagType(int tag_type)
- Specified by:
getTagType
in interfaceTagManager
-
removeTagType
protected void removeTagType(TagTypeBase tag_type)
-
getTagTypes
public java.util.List<TagType> getTagTypes()
- Specified by:
getTagTypes
in interfaceTagManager
-
moveOnAssign
private void moveOnAssign(DownloadManager dm, java.io.File location, long options)
-
getTagsForTaggable
public java.util.List<Tag> getTagsForTaggable(Taggable taggable)
- Specified by:
getTagsForTaggable
in interfaceTagManager
-
getTagsForTaggable
public java.util.List<Tag> getTagsForTaggable(int tag_type, Taggable taggable)
- Specified by:
getTagsForTaggable
in interfaceTagManager
-
getTagsForTaggable
public java.util.List<Tag> getTagsForTaggable(int[] tts, Taggable taggable)
- Specified by:
getTagsForTaggable
in interfaceTagManager
-
getTagsByName
public java.util.List<Tag> getTagsByName(java.lang.String name, boolean is_localized)
- Specified by:
getTagsByName
in interfaceTagManager
-
lookupTagByUID
public Tag lookupTagByUID(long tag_uid)
- Specified by:
lookupTagByUID
in interfaceTagManager
-
lookupTagsByName
public java.util.List<Tag> lookupTagsByName(java.lang.String tag_name)
- Specified by:
lookupTagsByName
in interfaceTagManager
-
importDataSource
public java.lang.Object importDataSource(java.util.Map map)
- Specified by:
importDataSource
in interfaceDataSourceResolver.DataSourceImporter
-
registerTaggableResolver
public TaggableLifecycleHandler registerTaggableResolver(TaggableResolver resolver)
- Specified by:
registerTaggableResolver
in interfaceTagManager
-
setTagPublicDefault
public void setTagPublicDefault(boolean pub)
- Specified by:
setTagPublicDefault
in interfaceTagManager
-
getTagPublicDefault
public boolean getTagPublicDefault()
- Specified by:
getTagPublicDefault
in interfaceTagManager
-
tagGroupCreated
protected void tagGroupCreated(TagTypeBase tag_type, TagTypeBase.TagGroupImpl group)
-
tagGroupUpdated
protected void tagGroupUpdated(TagTypeBase tag_type, TagTypeBase.TagGroupImpl group)
-
checkRSSFeeds
protected void checkRSSFeeds(TagBase tag, boolean enable)
-
getTagStatus
protected java.lang.String getTagStatus(Tag tag)
-
addTagManagerListener
public void addTagManagerListener(TagManagerListener listener, boolean fire_for_existing)
- Specified by:
addTagManagerListener
in interfaceTagManager
-
removeTagManagerListener
public void removeTagManagerListener(TagManagerListener listener)
- Specified by:
removeTagManagerListener
in interfaceTagManager
-
addTagFeatureListener
public void addTagFeatureListener(int features, TagFeatureListener listener)
- Specified by:
addTagFeatureListener
in interfaceTagManager
-
removeTagFeatureListener
public void removeTagFeatureListener(TagFeatureListener listener)
- Specified by:
removeTagFeatureListener
in interfaceTagManager
-
featureChanged
protected void featureChanged(Tag tag, int feature)
-
getResolver
public TaggableResolver getResolver(long taggable_type)
-
addTaggableLifecycleListener
public void addTaggableLifecycleListener(long taggable_type, TaggableLifecycleListener listener)
- Specified by:
addTaggableLifecycleListener
in interfaceTagManager
-
removeTaggableLifecycleListener
public void removeTaggableLifecycleListener(long taggable_type, TaggableLifecycleListener listener)
- Specified by:
removeTaggableLifecycleListener
in interfaceTagManager
-
tagCreated
protected void tagCreated(TagWithState tag)
-
tagChanged
protected void tagChanged(TagWithState tag)
-
tagRemoved
protected void tagRemoved(TagWithState tag)
-
tagContentsChanged
protected void tagContentsChanged(TagWithState tag)
-
addConfigUpdate
private void addConfigUpdate(int type, TagWithState tag)
-
applyConfigUpdates
private void applyConfigUpdates(java.util.Map config)
-
destroy
private void destroy()
-
setDirty
private void setDirty()
-
readConfig
private java.util.Map readConfig()
-
getConfig
private java.util.Map<java.lang.String,java.lang.Object> getConfig()
-
writeConfig
private void writeConfig()
-
getConf
private java.util.Map<java.lang.String,java.lang.Object> getConf(TagTypeBase tag_type, boolean create)
-
getConf
private java.util.Map<java.lang.String,java.lang.Object> getConf(TagTypeBase tag_type, TagBase tag, boolean create)
-
setConf
protected void setConf(int tag_type, int tag_id, java.util.Map conf)
-
readBooleanAttribute
protected java.lang.Boolean readBooleanAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Boolean def)
-
writeBooleanAttribute
protected boolean writeBooleanAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Boolean value)
-
readLongAttribute
protected java.lang.Long readLongAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Long def)
-
writeLongAttribute
protected boolean writeLongAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.Long value)
-
readStringAttribute
protected java.lang.String readStringAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String def)
-
writeStringAttribute
protected boolean writeStringAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String value)
- Returns:
- Whether attribute was changed from existing value
-
readMapAttribute
protected java.util.Map<java.lang.String,java.lang.Object> readMapAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> def)
-
writeMapAttribute
protected void writeMapAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.util.Map<java.lang.String,java.lang.Object> value)
-
readStringListAttribute
protected java.lang.String[] readStringListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String[] def)
-
writeStringListAttribute
protected boolean writeStringListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, java.lang.String[] value)
-
readLongListAttribute
protected long[] readLongListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, long[] def)
-
writeLongListAttribute
protected boolean writeLongListAttribute(TagTypeBase tag_type, TagBase tag, java.lang.String attr, long[] value)
-
removeConfig
protected void removeConfig(TagType tag_type)
-
removeConfig
protected void removeConfig(Tag tag)
-
importVuzeFile
private Tag importVuzeFile(java.util.Map content)
-
compileConstraint
public TagConstraint compileConstraint(java.lang.String expression)
- Specified by:
compileConstraint
in interfaceTagManager
-
exportTags
public VuzeFile exportTags(java.util.List<Tag> tags)
- Specified by:
exportTags
in interfaceTagManager
-
explain
protected java.lang.String explain(Tag tag, TagFeatureProperties.TagProperty property, Taggable taggable)
-
generate
public void generate(IndentWriter writer)
- Specified by:
generate
in interfaceAEDiagnosticsEvidenceGenerator
-
generate
public void generate(IndentWriter writer, TagTypeBase tag_type)
-
generate
public void generate(IndentWriter writer, TagTypeBase tag_type, TagBase tag)
-
-