Package com.biglybt.core.metasearch.impl
Class EngineImpl
java.lang.Object
com.biglybt.core.metasearch.impl.EngineImpl
- All Implemented Interfaces:
Engine
- Direct Known Subclasses:
PluginEngine
,WebEngine
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private static final int
private List
private long
private boolean
private long
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
protected static final String
(package private) static boolean
private MetaSearchImpl
private String
private float
private float
private List
private int
private boolean
private int
private int
private byte[]
private int
private String
private Map
private int
Fields inherited from interface com.biglybt.core.metasearch.Engine
AUTO_DL_SUPPORTED_NO, AUTO_DL_SUPPORTED_UNKNOWN, AUTO_DL_SUPPORTED_YES, AZ_VERSION, CT_AUDIO, CT_GAME, CT_VIDEO, ENGINE_SOURCE_LOCAL, ENGINE_SOURCE_RSS, ENGINE_SOURCE_STRS, ENGINE_SOURCE_UNKNOWN, ENGINE_SOURCE_VUZE, ENGINE_TYPE_JSON, ENGINE_TYPE_PLUGIN, ENGINE_TYPE_REGEX, ENGINE_TYPE_RSS, ENGINE_TYPE_STRS, FIELD_ASSET_DATE, FIELD_CATEGORY, FIELD_CDPLINK, FIELD_COMMENTS, FIELD_CONTENT_TYPE, FIELD_DATE, FIELD_DISCARD, FIELD_DOWNLOADBTNLINK, FIELD_DRMKEY, FIELD_HASH, FIELD_IDS, FIELD_NAME, FIELD_NAMES, FIELD_PEERS, FIELD_PLAYLINK, FIELD_PRIVATE, FIELD_RANK, FIELD_SEEDS, FIELD_SIZE, FIELD_SUPERSEEDS, FIELD_TORRENTLINK, FIELD_VOTES, FIELD_VOTES_DOWN, SC_BATCH_PERIOD, SC_FORCE_FULL, SC_REMOVE_DUP_HASH, SC_SOURCE, SEL_STATE_AUTO_SELECTED, SEL_STATE_DESELECTED, SEL_STATE_FORCE_DESELECTED, SEL_STATE_MANUAL_SELECTED, SEL_STATE_STRINGS, VUZE_FILE_COMPONENT_ENGINE_KEY
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
EngineImpl
(MetaSearchImpl _meta_search, int _type, long _id, long _last_updated, float _rank_bias, String _name) protected
EngineImpl
(MetaSearchImpl meta_search, int type, long id, long last_updated, float rank_bias, String name, JSONObject map) protected
EngineImpl
(MetaSearchImpl _meta_search, Map map) -
Method Summary
Modifier and TypeMethodDescriptionvoid
protected void
allocateUID
(long id) float
applyRankBias
(float _rank) void
protected void
protected void
protected void
void
delete()
protected void
exportBEncodedMappings
(Map map, String name, List mappings) protected void
exportJSONMappings
(JSONObject res, String str, List l, boolean level_1) protected void
exportToBencodedMap
(Map map, boolean generic) protected void
exportToVuzeFile
(boolean generic) void
exportToVuzeFile
(File target) int
int
protected File
long
getId()
protected long
long
protected boolean
getLocalBoolean
(String key, boolean def) private String
protected long
getLocalLong
(String key, long def) protected String
getLocalString
(String key) protected MetaSearchImpl
getName()
float
float
int
int
getString
(boolean full) int
getType()
getUID()
protected int
protected String
protected Object
getUserData
(Object key) int
protected List
importBEncodedMappings
(Map map, String name) protected static EngineImpl
importFromBEncodedMap
(MetaSearchImpl meta_search, Map map) static Engine
importFromJSONString
(MetaSearchImpl meta_search, int type, long id, long last_updated, float rank_bias, String name, String content) protected List
importJSONMappings
(JSONObject map, String str, boolean level_1) boolean
isActive()
boolean
boolean
isMine()
boolean
isPublic()
protected void
protected void
protected Result[]
mapResults
(Result[] results) void
void
reset()
resets to initial state (e.g.boolean
sameLogicAs
(Engine other) Tests for sameness in terms of function (ignores id, selection state etc)Result[]
search
(SearchParameter[] params, Map context, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) protected Result[]
searchAndMap
(SearchParameter[] params, Map context, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) protected abstract Result[]
searchSupport
(SearchParameter[] params, Map searchContext, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) protected void
setDefaultUpdateCheckSecs
(int secs) protected void
setId
(long _id) protected void
setLastUpdateCheck
(long when) protected void
setLocalBoolean
(String key, boolean value) protected void
setLocalLong
(String key, long value) protected void
setLocalString
(String key, String value) protected void
setLocalUpdateCheckSecs
(int secs) void
setMine
(boolean mine) protected void
void
setPreferredDelta
(float delta) protected void
setPublic
(boolean p) void
setRankBias
(float _rank_bias) void
setSelectionState
(int state) void
setSource
(int _source) protected void
protected void
setUpdateURL
(String url) protected void
setUserData
(Object key, Object value) protected void
setVersion
(int _v) protected int
vuzeFieldToID
(String field) protected String
vuzeIDToField
(int id) 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.metasearch.Engine
exportToBencodedMap, exportToBencodedMap, getDownloadLinkCSS, getIcon, getNameEx, getReferer, isAnonymous, isShareable, supportsContext, supportsField
-
Field Details
-
DEFAULT_UPDATE_CHECK_SECS
private static final int DEFAULT_UPDATE_CHECK_SECS- See Also:
-
logging_enabled
static boolean logging_enabled -
LD_COOKIES
- See Also:
-
LD_ETAG
- See Also:
-
LD_LAST_MODIFIED
- See Also:
-
LD_LAST_UPDATE_CHECK
- See Also:
-
LD_UPDATE_CHECK_SECS
- See Also:
-
LD_CREATED_BY_ME
- See Also:
-
LD_AUTO_DL_SUPPORTED
- See Also:
-
LD_LINK_IS_TORRENT
- See Also:
-
meta_search
-
type
private int type -
id
private long id -
last_updated
private long last_updated -
name
-
uid
private byte[] uid -
version
private int version -
is_public
private boolean is_public -
az_version
private int az_version -
selection_state
private int selection_state -
selection_state_recorded
private boolean selection_state_recorded -
source
private int source -
rank_bias
private float rank_bias -
preferred_count
private float preferred_count -
first_level_mapping
-
second_level_mapping
-
update_url
-
update_check_default_secs
private int update_check_default_secs -
user_data
-
-
Constructor Details
-
EngineImpl
protected EngineImpl(MetaSearchImpl _meta_search, int _type, long _id, long _last_updated, float _rank_bias, String _name) -
EngineImpl
- Throws:
IOException
-
EngineImpl
protected EngineImpl(MetaSearchImpl meta_search, int type, long id, long last_updated, float rank_bias, String name, JSONObject map) throws IOException - Throws:
IOException
-
-
Method Details
-
importFromBEncodedMap
protected static EngineImpl importFromBEncodedMap(MetaSearchImpl meta_search, Map map) throws IOException - Throws:
IOException
-
importFromJSONString
public static Engine importFromJSONString(MetaSearchImpl meta_search, int type, long id, long last_updated, float rank_bias, String name, String content) throws IOException - Throws:
IOException
-
exportToBencodedMap
- Throws:
IOException
-
exportToJSONObject
- Throws:
IOException
-
importJSONMappings
- Throws:
IOException
-
exportJSONMappings
-
importBEncodedMappings
- Throws:
IOException
-
exportBEncodedMappings
- Throws:
IOException
-
exportToJSONString
- Specified by:
exportToJSONString
in interfaceEngine
- Throws:
IOException
-
getAZVersion
public int getAZVersion()- Specified by:
getAZVersion
in interfaceEngine
-
getVersion
public int getVersion()- Specified by:
getVersion
in interfaceEngine
-
setVersion
protected void setVersion(int _v) -
getUID
-
setUID
-
allocateUID
protected void allocateUID(long id) -
sameLogicAs
Description copied from interface:Engine
Tests for sameness in terms of function (ignores id, selection state etc)- Specified by:
sameLogicAs
in interfaceEngine
- Returns:
-
search
public Result[] search(SearchParameter[] params, Map context, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) throws SearchException - Specified by:
search
in interfaceEngine
- Throws:
SearchException
-
searchAndMap
protected Result[] searchAndMap(SearchParameter[] params, Map context, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) throws SearchException - Throws:
SearchException
-
mapResults
-
searchSupport
protected abstract Result[] searchSupport(SearchParameter[] params, Map searchContext, int desired_max_matches, int absolute_max_matches, String headers, ResultListener listener) throws SearchException - Throws:
SearchException
-
delete
public void delete() -
getMetaSearch
-
vuzeFieldToID
-
vuzeIDToField
-
getType
public int getType() -
setId
protected void setId(long _id) -
getId
public long getId() -
getLastUpdated
public long getLastUpdated()- Specified by:
getLastUpdated
in interfaceEngine
-
getName
-
setName
-
isActive
public boolean isActive() -
isPublic
public boolean isPublic() -
setPublic
protected void setPublic(boolean p) -
getSelectionState
public int getSelectionState()- Specified by:
getSelectionState
in interfaceEngine
-
setSelectionState
public void setSelectionState(int state) - Specified by:
setSelectionState
in interfaceEngine
-
isAuthenticated
public boolean isAuthenticated()- Specified by:
isAuthenticated
in interfaceEngine
-
recordSelectionState
public void recordSelectionState()- Specified by:
recordSelectionState
in interfaceEngine
-
checkSelectionStateRecorded
public void checkSelectionStateRecorded()- Specified by:
checkSelectionStateRecorded
in interfaceEngine
-
getSource
public int getSource() -
setSource
public void setSource(int _source) -
getRankBias
public float getRankBias()- Specified by:
getRankBias
in interfaceEngine
-
setRankBias
public void setRankBias(float _rank_bias) - Specified by:
setRankBias
in interfaceEngine
-
setPreferredDelta
public void setPreferredDelta(float delta) - Specified by:
setPreferredDelta
in interfaceEngine
-
getPreferredWeighting
public float getPreferredWeighting()- Specified by:
getPreferredWeighting
in interfaceEngine
-
applyRankBias
public float applyRankBias(float _rank) - Specified by:
applyRankBias
in interfaceEngine
-
isMine
public boolean isMine() -
setMine
public void setMine(boolean mine) -
getUpdateURL
-
setUpdateURL
-
getUpdateCheckSecs
protected int getUpdateCheckSecs() -
setDefaultUpdateCheckSecs
protected void setDefaultUpdateCheckSecs(int secs) -
setLocalUpdateCheckSecs
protected void setLocalUpdateCheckSecs(int secs) -
getLastUpdateCheck
protected long getLastUpdateCheck() -
setLastUpdateCheck
protected void setLastUpdateCheck(long when) -
getAutoDownloadSupported
public int getAutoDownloadSupported()- Specified by:
getAutoDownloadSupported
in interfaceEngine
- Returns:
- one of AUTO_DL constants above
-
configDirty
protected void configDirty() -
addPotentialAssociation
- Specified by:
addPotentialAssociation
in interfaceEngine
-
getSubscription
- Specified by:
getSubscription
in interfaceEngine
-
exportToVuzeFile
- Specified by:
exportToVuzeFile
in interfaceEngine
- Throws:
IOException
-
exportToVuzeFile
- Specified by:
exportToVuzeFile
in interfaceEngine
- Throws:
IOException
-
exportToVuzeFile
- Throws:
IOException
-
getLocalKey
-
reset
public void reset()Description copied from interface:Engine
resets to initial state (e.g. if the engine has state pertaining to what has/hasn't been downloaded such as etags then this will be cleared) -
setLocalString
-
getLocalString
-
setLocalBoolean
-
getLocalBoolean
-
setLocalLong
-
getLocalLong
-
setUserData
-
getUserData
-
getDebugFile
-
debugStart
protected void debugStart() -
debugLog
-
log
-
log
-
getString
-
getString
-