com.aelitis.azureus.core.content
Class RelatedContentManager

java.lang.Object
  extended by com.aelitis.azureus.core.content.RelatedContentManager

public class RelatedContentManager
extends Object


Nested Class Summary
protected static class RelatedContentManager.ByteArrayHashMapEx<T>
           
protected static class RelatedContentManager.ContentCache
           
protected  class RelatedContentManager.DownloadInfo
           
protected  class RelatedContentManager.RCMSearchXFer
           
 
Field Summary
static long FILE_ASSOC_MIN_SIZE
           
protected static byte NET_I2P
           
protected static byte NET_NONE
           
protected static byte NET_PUBLIC
           
protected static byte NET_TOR
           
protected  Object rcm_lock
           
static int RCM_SEARCH_PROPERTY_CONTENT_NETWORK
           
static int RCM_SEARCH_PROPERTY_NETWORKS
           
static int RCM_SEARCH_PROPERTY_TAGS
           
static int RCM_SEARCH_PROPERTY_TRACKER_KEYS
           
static int RCM_SEARCH_PROPERTY_WEB_SEED_KEYS
           
protected static int TIMER_PERIOD
           
protected static Map<String,RelatedContentManager.DownloadInfo> transient_info_cache
           
 
Constructor Summary
protected RelatedContentManager()
           
 
Method Summary
protected  void addDownloads(Download[] downloads, boolean initialising)
           
 void addListener(RelatedContentManagerListener listener)
           
protected  void addPersistentlyDeleted(RelatedContent[] content)
           
protected  void analyseResponse(RelatedContentManager.DownloadInfo to_info, RelatedContentManagerListener listener)
           
protected  void contentChanged(boolean is_dirty)
           
protected  void contentChanged(RelatedContentManager.DownloadInfo info)
           
static String[] convertNetworks(byte net)
           
static byte convertNetworks(String[] networks)
           
protected  RelatedContentManager.DownloadInfo decodeInfo(Map map, byte[] from_hash, int level, boolean explicit, Set<String> unique_keys)
           
protected  String[] decodeTags(byte[] bytes)
           
protected  void decrementUnread()
           
 void delete(RelatedContent[] content)
           
protected  void delete(RelatedContent[] content, RelatedContentManager.ContentCache content_cache, boolean persistent)
           
 void deleteAll()
           
protected  byte[] domainsToArray(Set<String> domains, int max)
           
protected  byte[] encodeTags(String[] tags)
           
protected  void enforceMaxResults(boolean reset_explicit)
           
protected  void enforceMaxResults(RelatedContentManager.ContentCache content_cache, boolean reset_explicit)
           
protected  boolean enoughSpaceFor(RelatedContentManager.ContentCache content_cache, RelatedContentManager.DownloadInfo fi)
           
protected  Download getDownload(byte[] hash)
           
 int getMaxResults()
           
 int getMaxSearchLevel()
           
 int getNumUnread()
           
protected  byte[] getPermDelKey(RelatedContent info)
           
protected  PluginInterface getPluginInterface()
           
protected  String getPrivateInfoKey(RelatedContent info)
           
 RelatedContent[] getRelatedContent()
           
protected  List<RelatedContentManager.DownloadInfo> getRelatedContentAsList()
           
static RelatedContentManager getSingleton()
           
protected  List getURLList(TOTorrent torrent, String key)
           
protected  void incrementUnread()
           
 boolean isEnabled()
           
protected  boolean isPersistentlyDeleted(RelatedContent content)
           
protected  List<byte[]> loadPersistentlyDeleted()
           
protected  RelatedContentManager.ContentCache loadRelatedContent()
           
 void lookupAttributes(byte[] from_hash, RelatedAttributeLookupListener listener)
           
 void lookupAttributes(byte[] from_hash, String[] networks, RelatedAttributeLookupListener listener)
           
 void lookupContent(byte[] hash, RelatedContentLookupListener listener)
           
 void lookupContent(byte[] hash, String[] networks, RelatedContentLookupListener listener)
           
 void lookupContent(long file_size, RelatedContentLookupListener listener)
           
 void lookupContent(long file_size, String[] networks, RelatedContentLookupListener listener)
           
protected  void popuplateSecondaryLookups(RelatedContentManager.ContentCache content_cache)
           
static void preInitialise(AzureusCore _core)
           
 void releaseTemporarySpace()
           
 void removeListener(RelatedContentManagerListener listener)
           
 void reserveTemporarySpace()
           
 void reset()
           
protected  void reset(boolean reset_perm_dels)
           
protected  void resetPersistentlyDeleted()
           
protected  void saveRelatedContent(int tick_count)
           
 SearchInstance searchRCM(Map<String,Object> search_parameters, SearchObserver observer)
           
protected  void secondaryLookup()
           
 void setAllRead()
           
protected  void setConfigDirty()
           
 void setMaxResults(int _max)
           
 void setMaxSearchLevel(int _level)
           
protected  String truncateTag(String tag)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_ASSOC_MIN_SIZE

public static final long FILE_ASSOC_MIN_SIZE
See Also:
Constant Field Values

RCM_SEARCH_PROPERTY_CONTENT_NETWORK

public static final int RCM_SEARCH_PROPERTY_CONTENT_NETWORK
See Also:
Constant Field Values

RCM_SEARCH_PROPERTY_TRACKER_KEYS

public static final int RCM_SEARCH_PROPERTY_TRACKER_KEYS
See Also:
Constant Field Values

RCM_SEARCH_PROPERTY_WEB_SEED_KEYS

public static final int RCM_SEARCH_PROPERTY_WEB_SEED_KEYS
See Also:
Constant Field Values

RCM_SEARCH_PROPERTY_TAGS

public static final int RCM_SEARCH_PROPERTY_TAGS
See Also:
Constant Field Values

RCM_SEARCH_PROPERTY_NETWORKS

public static final int RCM_SEARCH_PROPERTY_NETWORKS
See Also:
Constant Field Values

TIMER_PERIOD

protected static final int TIMER_PERIOD
See Also:
Constant Field Values

NET_NONE

protected static final byte NET_NONE
See Also:
Constant Field Values

NET_PUBLIC

protected static final byte NET_PUBLIC
See Also:
Constant Field Values

NET_I2P

protected static final byte NET_I2P
See Also:
Constant Field Values

NET_TOR

protected static final byte NET_TOR
See Also:
Constant Field Values

rcm_lock

protected final Object rcm_lock

transient_info_cache

protected static Map<String,RelatedContentManager.DownloadInfo> transient_info_cache
Constructor Detail

RelatedContentManager

protected RelatedContentManager()
                         throws ContentException
Throws:
ContentException
Method Detail

preInitialise

public static void preInitialise(AzureusCore _core)

getSingleton

public static RelatedContentManager getSingleton()
                                          throws ContentException
Throws:
ContentException

getPluginInterface

protected PluginInterface getPluginInterface()

isEnabled

public boolean isEnabled()

getMaxSearchLevel

public int getMaxSearchLevel()

setMaxSearchLevel

public void setMaxSearchLevel(int _level)

getMaxResults

public int getMaxResults()

setMaxResults

public void setMaxResults(int _max)

addDownloads

protected void addDownloads(Download[] downloads,
                            boolean initialising)

decodeInfo

protected RelatedContentManager.DownloadInfo decodeInfo(Map map,
                                                        byte[] from_hash,
                                                        int level,
                                                        boolean explicit,
                                                        Set<String> unique_keys)

lookupAttributes

public void lookupAttributes(byte[] from_hash,
                             RelatedAttributeLookupListener listener)
                      throws ContentException
Throws:
ContentException

lookupAttributes

public void lookupAttributes(byte[] from_hash,
                             String[] networks,
                             RelatedAttributeLookupListener listener)
                      throws ContentException
Throws:
ContentException

lookupContent

public void lookupContent(byte[] hash,
                          RelatedContentLookupListener listener)
                   throws ContentException
Throws:
ContentException

lookupContent

public void lookupContent(byte[] hash,
                          String[] networks,
                          RelatedContentLookupListener listener)
                   throws ContentException
Throws:
ContentException

lookupContent

public void lookupContent(long file_size,
                          RelatedContentLookupListener listener)
                   throws ContentException
Throws:
ContentException

lookupContent

public void lookupContent(long file_size,
                          String[] networks,
                          RelatedContentLookupListener listener)
                   throws ContentException
Throws:
ContentException

popuplateSecondaryLookups

protected void popuplateSecondaryLookups(RelatedContentManager.ContentCache content_cache)

secondaryLookup

protected void secondaryLookup()

contentChanged

protected void contentChanged(RelatedContentManager.DownloadInfo info)

contentChanged

protected void contentChanged(boolean is_dirty)

delete

public void delete(RelatedContent[] content)

delete

protected void delete(RelatedContent[] content,
                      RelatedContentManager.ContentCache content_cache,
                      boolean persistent)

getPrivateInfoKey

protected String getPrivateInfoKey(RelatedContent info)

analyseResponse

protected void analyseResponse(RelatedContentManager.DownloadInfo to_info,
                               RelatedContentManagerListener listener)

enoughSpaceFor

protected boolean enoughSpaceFor(RelatedContentManager.ContentCache content_cache,
                                 RelatedContentManager.DownloadInfo fi)

getRelatedContent

public RelatedContent[] getRelatedContent()

getRelatedContentAsList

protected List<RelatedContentManager.DownloadInfo> getRelatedContentAsList()

reset

public void reset()

reset

protected void reset(boolean reset_perm_dels)

searchRCM

public SearchInstance searchRCM(Map<String,Object> search_parameters,
                                SearchObserver observer)
                         throws SearchException
Throws:
SearchException

setConfigDirty

protected void setConfigDirty()

loadRelatedContent

protected RelatedContentManager.ContentCache loadRelatedContent()

saveRelatedContent

protected void saveRelatedContent(int tick_count)

getNumUnread

public int getNumUnread()

setAllRead

public void setAllRead()

deleteAll

public void deleteAll()

incrementUnread

protected void incrementUnread()

decrementUnread

protected void decrementUnread()

getDownload

protected Download getDownload(byte[] hash)

domainsToArray

protected byte[] domainsToArray(Set<String> domains,
                                int max)

getURLList

protected List getURLList(TOTorrent torrent,
                          String key)

convertNetworks

public static String[] convertNetworks(byte net)

convertNetworks

public static byte convertNetworks(String[] networks)

encodeTags

protected byte[] encodeTags(String[] tags)

truncateTag

protected String truncateTag(String tag)

decodeTags

protected String[] decodeTags(byte[] bytes)

getPermDelKey

protected byte[] getPermDelKey(RelatedContent info)

loadPersistentlyDeleted

protected List<byte[]> loadPersistentlyDeleted()

addPersistentlyDeleted

protected void addPersistentlyDeleted(RelatedContent[] content)

isPersistentlyDeleted

protected boolean isPersistentlyDeleted(RelatedContent content)

resetPersistentlyDeleted

protected void resetPersistentlyDeleted()

reserveTemporarySpace

public void reserveTemporarySpace()

releaseTemporarySpace

public void releaseTemporarySpace()

enforceMaxResults

protected void enforceMaxResults(boolean reset_explicit)

enforceMaxResults

protected void enforceMaxResults(RelatedContentManager.ContentCache content_cache,
                                 boolean reset_explicit)

addListener

public void addListener(RelatedContentManagerListener listener)

removeListener

public void removeListener(RelatedContentManagerListener listener)