Class EngineImpl

java.lang.Object
com.biglybt.core.metasearch.impl.EngineImpl
All Implemented Interfaces:
Engine
Direct Known Subclasses:
PluginEngine, WebEngine

public abstract class EngineImpl extends Object implements Engine
  • Field Details

    • DEFAULT_UPDATE_CHECK_SECS

      private static final int DEFAULT_UPDATE_CHECK_SECS
      See Also:
    • logging_enabled

      static boolean logging_enabled
    • LD_COOKIES

      protected static final String LD_COOKIES
      See Also:
    • LD_ETAG

      protected static final String LD_ETAG
      See Also:
    • LD_LAST_MODIFIED

      protected static final String LD_LAST_MODIFIED
      See Also:
    • LD_LAST_UPDATE_CHECK

      protected static final String LD_LAST_UPDATE_CHECK
      See Also:
    • LD_UPDATE_CHECK_SECS

      protected static final String LD_UPDATE_CHECK_SECS
      See Also:
    • LD_CREATED_BY_ME

      protected static final String LD_CREATED_BY_ME
      See Also:
    • LD_AUTO_DL_SUPPORTED

      protected static final String LD_AUTO_DL_SUPPORTED
      See Also:
    • type

      private int type
    • id

      private long id
    • last_updated

      private long last_updated
    • name

      private String 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

      private List first_level_mapping
    • second_level_mapping

      private List second_level_mapping
    • update_url

      private String update_url
    • update_check_default_secs

      private int update_check_default_secs
    • user_data

      private Map user_data
  • Constructor Details

  • 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

      protected void exportToBencodedMap(Map map, boolean generic) throws IOException
      Throws:
      IOException
    • exportToJSONObject

      protected void exportToJSONObject(JSONObject res) throws IOException
      Throws:
      IOException
    • importJSONMappings

      protected List importJSONMappings(JSONObject map, String str, boolean level_1) throws IOException
      Throws:
      IOException
    • exportJSONMappings

      protected void exportJSONMappings(JSONObject res, String str, List l, boolean level_1)
    • importBEncodedMappings

      protected List importBEncodedMappings(Map map, String name) throws IOException
      Throws:
      IOException
    • exportBEncodedMappings

      protected void exportBEncodedMappings(Map map, String name, List mappings) throws IOException
      Throws:
      IOException
    • exportToJSONString

      public String exportToJSONString() throws IOException
      Specified by:
      exportToJSONString in interface Engine
      Throws:
      IOException
    • getAZVersion

      public int getAZVersion()
      Specified by:
      getAZVersion in interface Engine
    • getVersion

      public int getVersion()
      Specified by:
      getVersion in interface Engine
    • setVersion

      protected void setVersion(int _v)
    • getUID

      public String getUID()
      Specified by:
      getUID in interface Engine
    • setUID

      protected void setUID(String str)
    • allocateUID

      protected void allocateUID(long id)
    • sameLogicAs

      public boolean sameLogicAs(Engine other)
      Description copied from interface: Engine
      Tests for sameness in terms of function (ignores id, selection state etc)
      Specified by:
      sameLogicAs in interface Engine
      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 interface Engine
      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

      protected Result[] mapResults(Result[] results)
    • 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()
      Specified by:
      delete in interface Engine
    • getMetaSearch

      protected MetaSearchImpl getMetaSearch()
    • vuzeFieldToID

      protected int vuzeFieldToID(String field)
    • vuzeIDToField

      protected String vuzeIDToField(int id)
    • getType

      public int getType()
      Specified by:
      getType in interface Engine
    • setId

      protected void setId(long _id)
    • getId

      public long getId()
      Specified by:
      getId in interface Engine
    • getLastUpdated

      public long getLastUpdated()
      Specified by:
      getLastUpdated in interface Engine
    • getName

      public String getName()
      Specified by:
      getName in interface Engine
    • setName

      protected void setName(String n)
    • isActive

      public boolean isActive()
      Specified by:
      isActive in interface Engine
    • isPublic

      public boolean isPublic()
      Specified by:
      isPublic in interface Engine
    • setPublic

      protected void setPublic(boolean p)
    • getSelectionState

      public int getSelectionState()
      Specified by:
      getSelectionState in interface Engine
    • setSelectionState

      public void setSelectionState(int state)
      Specified by:
      setSelectionState in interface Engine
    • isAuthenticated

      public boolean isAuthenticated()
      Specified by:
      isAuthenticated in interface Engine
    • recordSelectionState

      public void recordSelectionState()
      Specified by:
      recordSelectionState in interface Engine
    • checkSelectionStateRecorded

      public void checkSelectionStateRecorded()
      Specified by:
      checkSelectionStateRecorded in interface Engine
    • getSource

      public int getSource()
      Specified by:
      getSource in interface Engine
    • setSource

      public void setSource(int _source)
      Specified by:
      setSource in interface Engine
    • getRankBias

      public float getRankBias()
      Specified by:
      getRankBias in interface Engine
    • setRankBias

      public void setRankBias(float _rank_bias)
      Specified by:
      setRankBias in interface Engine
    • setPreferredDelta

      public void setPreferredDelta(float delta)
      Specified by:
      setPreferredDelta in interface Engine
    • getPreferredWeighting

      public float getPreferredWeighting()
      Specified by:
      getPreferredWeighting in interface Engine
    • applyRankBias

      public float applyRankBias(float _rank)
      Specified by:
      applyRankBias in interface Engine
    • isMine

      public boolean isMine()
      Specified by:
      isMine in interface Engine
    • setMine

      public void setMine(boolean mine)
      Specified by:
      setMine in interface Engine
    • getUpdateURL

      protected String getUpdateURL()
    • setUpdateURL

      protected void setUpdateURL(String url)
    • 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 interface Engine
      Returns:
      one of AUTO_DL constants above
    • configDirty

      protected void configDirty()
    • addPotentialAssociation

      public void addPotentialAssociation(String key)
      Specified by:
      addPotentialAssociation in interface Engine
    • getSubscription

      public Subscription getSubscription()
      Specified by:
      getSubscription in interface Engine
    • exportToVuzeFile

      public void exportToVuzeFile(File target) throws IOException
      Specified by:
      exportToVuzeFile in interface Engine
      Throws:
      IOException
    • exportToVuzeFile

      public VuzeFile exportToVuzeFile() throws IOException
      Specified by:
      exportToVuzeFile in interface Engine
      Throws:
      IOException
    • exportToVuzeFile

      public VuzeFile exportToVuzeFile(boolean generic) throws IOException
      Throws:
      IOException
    • getLocalKey

      private String 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)
      Specified by:
      reset in interface Engine
    • setLocalString

      protected void setLocalString(String key, String value)
    • getLocalString

      protected String getLocalString(String key)
    • setLocalBoolean

      protected void setLocalBoolean(String key, boolean value)
    • getLocalBoolean

      protected boolean getLocalBoolean(String key, boolean def)
    • setLocalLong

      protected void setLocalLong(String key, long value)
    • getLocalLong

      protected long getLocalLong(String key, long def)
    • setUserData

      protected void setUserData(Object key, Object value)
    • getUserData

      protected Object getUserData(Object key)
    • getDebugFile

      protected File getDebugFile()
    • debugStart

      protected void debugStart()
    • debugLog

      protected void debugLog(String str)
    • log

      protected void log(String str)
    • log

      protected void log(String str, Throwable e)
    • getString

      public String getString()
      Specified by:
      getString in interface Engine
    • getString

      public String getString(boolean full)