com.aelitis.azureus.core.content
Class RelatedContentManager

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

public class RelatedContentManager
extends java.lang.Object


Nested Class Summary
protected static class RelatedContentManager.ByteArrayHashMapEx<T>
           
protected static class RelatedContentManager.ContentCache
           
protected  class RelatedContentManager.DownloadInfo
           
protected static 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  java.lang.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 java.util.Map<java.lang.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 java.lang.String[] convertNetworks(byte net)
           
static byte convertNetworks(java.lang.String[] networks)
           
protected  RelatedContentManager.DownloadInfo decodeInfo(java.util.Map map, byte[] from_hash, int level, boolean explicit, java.util.Set<java.lang.String> unique_keys)
           
protected  java.lang.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(java.util.Set<java.lang.String> domains, int max)
           
protected  byte[] encodeTags(java.lang.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  java.lang.String getPrivateInfoKey(RelatedContent info)
           
 RelatedContent[] getRelatedContent()
           
protected  java.util.List<RelatedContentManager.DownloadInfo> getRelatedContentAsList()
           
static RelatedContentManager getSingleton()
           
protected  java.util.List getURLList(TOTorrent torrent, java.lang.String key)
           
protected  void incrementUnread()
           
 boolean isEnabled()
           
protected  boolean isPersistentlyDeleted(RelatedContent content)
           
protected  java.util.List<byte[]> loadPersistentlyDeleted()
           
protected  RelatedContentManager.ContentCache loadRelatedContent()
           
 void lookupAttributes(byte[] from_hash, RelatedAttributeLookupListener listener)
           
 void lookupAttributes(byte[] from_hash, java.lang.String[] networks, RelatedAttributeLookupListener listener)
           
 void lookupContent(byte[] hash, RelatedContentLookupListener listener)
           
 void lookupContent(byte[] hash, java.lang.String[] networks, RelatedContentLookupListener listener)
           
 void lookupContent(long file_size, RelatedContentLookupListener listener)
           
 void lookupContent(long file_size, java.lang.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(java.util.Map<java.lang.String,java.lang.Object> search_parameters, SearchObserver observer)
           
protected  void secondaryLookup()
           
 void setAllRead()
           
protected  void setConfigDirty()
           
 void setMaxResults(int _max)
           
 void setMaxSearchLevel(int _level)
           
protected  java.lang.String truncateTag(java.lang.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 java.lang.Object rcm_lock

transient_info_cache

protected static java.util.Map<java.lang.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(java.util.Map map,
                                                        byte[] from_hash,
                                                        int level,
                                                        boolean explicit,
                                                        java.util.Set<java.lang.String> unique_keys)

lookupAttributes

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

lookupAttributes

public void lookupAttributes(byte[] from_hash,
                             java.lang.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,
                          java.lang.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,
                          java.lang.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 java.lang.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 java.util.List<RelatedContentManager.DownloadInfo> getRelatedContentAsList()

reset

public void reset()

reset

protected void reset(boolean reset_perm_dels)

searchRCM

public SearchInstance searchRCM(java.util.Map<java.lang.String,java.lang.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(java.util.Set<java.lang.String> domains,
                                int max)

getURLList

protected java.util.List getURLList(TOTorrent torrent,
                                    java.lang.String key)

convertNetworks

public static java.lang.String[] convertNetworks(byte net)

convertNetworks

public static byte convertNetworks(java.lang.String[] networks)

encodeTags

protected byte[] encodeTags(java.lang.String[] tags)

truncateTag

protected java.lang.String truncateTag(java.lang.String tag)

decodeTags

protected java.lang.String[] decodeTags(byte[] bytes)

getPermDelKey

protected byte[] getPermDelKey(RelatedContent info)

loadPersistentlyDeleted

protected java.util.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)