com.aelitis.azureus.plugins.net.buddy
Class BuddyPluginBuddy

java.lang.Object
  extended by com.aelitis.azureus.plugins.net.buddy.BuddyPluginBuddy

public class BuddyPluginBuddy
extends java.lang.Object


Nested Class Summary
protected  class BuddyPluginBuddy.buddyConnection
           
protected  class BuddyPluginBuddy.buddyMessage
           
protected  class BuddyPluginBuddy.fragmentHandler
           
 
Constructor Summary
protected BuddyPluginBuddy(BuddyPlugin _plugin, long _created_time, int _subsystem, boolean _authorised, java.lang.String _pk, java.lang.String _nick_name, int _version, java.lang.String _rss_local_cats, java.lang.String _rss_remote_cats, int _last_status_seq, long _last_time_online, java.util.List<java.lang.Long> _recent_ygm)
           
 
Method Summary
protected  void addConnection(GenericMessageConnection _connection)
           
 void addLocalAuthorisedRSSTagOrCategory(java.lang.String category)
           
protected  boolean addressesEqual(java.net.InetAddress ip1, java.net.InetAddress ip2)
           
protected  boolean addYGMMarker(long marker)
           
protected  void buddyActive()
           
protected  void buddyConnectionEstablished(boolean outgoing)
           
protected  void buddyMessageFragmentReceived(int num_received, int total)
           
protected  void buddyMessageReceived(int size)
           
protected  void buddyMessageSent(int size, boolean record_active)
           
protected  boolean catsIdentical(java.util.Set<java.lang.String> c1, java.util.Set<java.lang.String> c2)
           
protected  java.lang.String catsToString(java.util.Set<java.lang.String> cats)
           
protected  void checkPersistentDispatch()
           
protected  void checkTimeouts()
           
 BuddyPlugin.cryptoResult decrypt(byte[] payload)
           
protected  void destroy()
           
 void disconnect()
           
protected  void dispatchMessage()
           
 BuddyPlugin.cryptoResult encrypt(byte[] payload)
           
 java.net.InetAddress getAdjustedIP()
           
 java.util.List<java.net.InetAddress> getAdjustedIPs()
           
 int getBytesInCount()
           
 int getBytesOutCount()
           
 java.lang.String getConnectionsString()
           
protected  long getCreatedTime()
           
 java.net.InetAddress getIP()
           
 long getLastMessagePending()
           
 java.lang.String getLastMessageReceived()
           
protected  long getLastStatusCheckTime()
           
protected  int getLastStatusSeq()
           
 long getLastTimeOnline()
           
 java.util.Set<java.lang.String> getLocalAuthorisedRSSTagsOrCategories()
           
 java.lang.String getLocalAuthorisedRSSTagsOrCategoriesAsString()
           
 java.lang.String getLocalReadTagsOrCategoriesAsString()
           
 BuddyPluginBuddyMessageHandler getMessageHandler()
           
 int getMessageInCount()
           
 java.lang.String getMessageInFragmentDetails()
           
 int getMessageOutCount()
           
 java.lang.String getName()
           
 java.lang.String getNickName()
           
 int getOnlineStatus()
           
protected  BuddyPlugin getPlugin()
           
 java.lang.String getPublicKey()
           
protected  byte[] getRawPublicKey()
           
 java.util.Set<java.lang.String> getRemoteAuthorisedRSSTagsOrCategories()
           
 java.lang.String getRemoteAuthorisedRSSTagsOrCategoriesAsString()
           
protected  java.lang.String getShortString()
           
 java.lang.String getString()
           
 java.net.URL getSubscriptionURL(java.lang.String cat)
           
 int getSubsystem()
           
 int getTCPPort()
           
 int getUDPPort()
           
 java.lang.Object getUserData(java.lang.Object key)
           
 int getVersion()
           
protected  java.util.List<java.lang.Long> getYGMMarkers()
           
protected  void incomingConnection(GenericMessageConnection _connection)
           
 boolean isAuthorised()
           
protected  boolean isClosing()
           
 boolean isConnected()
           
protected  boolean isIdle()
           
 boolean isLocalRSSTagOrCategoryAuthorised(java.lang.String category)
           
 boolean isOnline(boolean is_connected)
           
 boolean isRemoteRSSTagOrCategoryAuthorised(java.lang.String category)
           
 boolean isSubscribedToTagOrCategory(java.lang.String cat, java.lang.String creator_ref)
           
protected  void localRSSTagOrCategoryRead(java.lang.String str)
           
protected  void log(java.lang.String str)
           
protected  void log(java.lang.String str, java.lang.Throwable e)
           
protected  void logMessage(java.lang.String str)
           
protected  GenericMessageConnection outgoingConnection()
           
protected  void persistentDispatch()
           
protected  void persistentDispatchPending()
           
 void ping()
           
 java.util.Map readConfigFile(java.io.File name)
           
protected  void receivedCloseRequest(java.util.Map request)
           
 void remove()
           
protected  void removeConnection(BuddyPluginBuddy.buddyConnection bc)
           
 void removeLocalAuthorisedRSSTagOrCategory(java.lang.String category)
           
 java.util.List<BuddyPluginBuddyMessage> retrieveMessages(int type)
           
protected  void sendCloseRequest(boolean restarting)
           
protected  void sendKeepAlive()
           
 void sendMessage(int subsystem, java.util.Map content, int timeout_millis, BuddyPluginBuddyReplyListener listener)
           
protected  void sendMessageSupport(java.util.Map content, int subsystem, int timeout_millis, BuddyPluginBuddyReplyListener original_listener)
           
protected  void setAuthorised(boolean _a)
           
protected  void setCachedStatus(java.net.InetAddress _ip, int _tcp_port, int _udp_port)
           
protected  void setInitialStatus(long now, int num_buddies)
           
protected  void setLastMessageReceived(java.lang.String str)
           
 void setLocalAuthorisedRSSTagsOrCategories(java.util.Set<java.lang.String> new_cats)
           
 void setLocalAuthorisedRSSTagsOrCategories(java.lang.String new_cats)
           
 void setMessagePending()
           
protected  void setOnlineStatus(int s)
           
protected  void setRemoteAuthorisedRSSTagsOrCategories(java.util.Set<java.lang.String> new_cats)
           
protected  void setSubsystem(int _s)
           
 void setUserData(java.lang.Object key, java.lang.Object value)
           
protected  void setVersion(int v)
           
protected  boolean statusCheckActive()
           
protected  void statusCheckComplete(long _post_time, java.net.InetAddress _ip, int _tcp_port, int _udp_port, java.lang.String _nick_name, int _online_status, int _status_seq, int _version)
           
protected  void statusCheckFailed()
           
protected  boolean statusCheckStarts()
           
 BuddyPluginBuddyMessage storeMessage(int type, java.util.Map msg)
           
protected  java.util.Set<java.lang.String> stringToCats(java.lang.String str)
           
 void subscribeToCategory(java.lang.String cat)
           
 boolean verify(byte[] payload, byte[] signature)
           
 boolean writeConfigFile(java.io.File name, java.util.Map data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BuddyPluginBuddy

protected BuddyPluginBuddy(BuddyPlugin _plugin,
                           long _created_time,
                           int _subsystem,
                           boolean _authorised,
                           java.lang.String _pk,
                           java.lang.String _nick_name,
                           int _version,
                           java.lang.String _rss_local_cats,
                           java.lang.String _rss_remote_cats,
                           int _last_status_seq,
                           long _last_time_online,
                           java.util.List<java.lang.Long> _recent_ygm)
Method Detail

setInitialStatus

protected void setInitialStatus(long now,
                                int num_buddies)

getPlugin

protected BuddyPlugin getPlugin()

getMessageHandler

public BuddyPluginBuddyMessageHandler getMessageHandler()

persistentDispatchPending

protected void persistentDispatchPending()

checkPersistentDispatch

protected void checkPersistentDispatch()

persistentDispatch

protected void persistentDispatch()

readConfigFile

public java.util.Map readConfigFile(java.io.File name)

writeConfigFile

public boolean writeConfigFile(java.io.File name,
                               java.util.Map data)

getCreatedTime

protected long getCreatedTime()

getSubsystem

public int getSubsystem()

setSubsystem

protected void setSubsystem(int _s)

isAuthorised

public boolean isAuthorised()

setAuthorised

protected void setAuthorised(boolean _a)

getPublicKey

public java.lang.String getPublicKey()

getRawPublicKey

protected byte[] getRawPublicKey()

getShortString

protected java.lang.String getShortString()

getNickName

public java.lang.String getNickName()

getVersion

public int getVersion()

setVersion

protected void setVersion(int v)

getLocalAuthorisedRSSTagsOrCategoriesAsString

public java.lang.String getLocalAuthorisedRSSTagsOrCategoriesAsString()

getLocalAuthorisedRSSTagsOrCategories

public java.util.Set<java.lang.String> getLocalAuthorisedRSSTagsOrCategories()

addLocalAuthorisedRSSTagOrCategory

public void addLocalAuthorisedRSSTagOrCategory(java.lang.String category)

removeLocalAuthorisedRSSTagOrCategory

public void removeLocalAuthorisedRSSTagOrCategory(java.lang.String category)

setLocalAuthorisedRSSTagsOrCategories

public void setLocalAuthorisedRSSTagsOrCategories(java.lang.String new_cats)

setLocalAuthorisedRSSTagsOrCategories

public void setLocalAuthorisedRSSTagsOrCategories(java.util.Set<java.lang.String> new_cats)

getRemoteAuthorisedRSSTagsOrCategories

public java.util.Set<java.lang.String> getRemoteAuthorisedRSSTagsOrCategories()

getRemoteAuthorisedRSSTagsOrCategoriesAsString

public java.lang.String getRemoteAuthorisedRSSTagsOrCategoriesAsString()

setRemoteAuthorisedRSSTagsOrCategories

protected void setRemoteAuthorisedRSSTagsOrCategories(java.util.Set<java.lang.String> new_cats)

isLocalRSSTagOrCategoryAuthorised

public boolean isLocalRSSTagOrCategoryAuthorised(java.lang.String category)

isRemoteRSSTagOrCategoryAuthorised

public boolean isRemoteRSSTagOrCategoryAuthorised(java.lang.String category)

localRSSTagOrCategoryRead

protected void localRSSTagOrCategoryRead(java.lang.String str)

getLocalReadTagsOrCategoriesAsString

public java.lang.String getLocalReadTagsOrCategoriesAsString()

getSubscriptionURL

public java.net.URL getSubscriptionURL(java.lang.String cat)

subscribeToCategory

public void subscribeToCategory(java.lang.String cat)
                         throws BuddyPluginException
Throws:
BuddyPluginException

isSubscribedToTagOrCategory

public boolean isSubscribedToTagOrCategory(java.lang.String cat,
                                           java.lang.String creator_ref)

catsToString

protected java.lang.String catsToString(java.util.Set<java.lang.String> cats)

catsIdentical

protected boolean catsIdentical(java.util.Set<java.lang.String> c1,
                                java.util.Set<java.lang.String> c2)

stringToCats

protected java.util.Set<java.lang.String> stringToCats(java.lang.String str)

getOnlineStatus

public int getOnlineStatus()

setOnlineStatus

protected void setOnlineStatus(int s)

getName

public java.lang.String getName()

remove

public void remove()

getIP

public java.net.InetAddress getIP()

getAdjustedIP

public java.net.InetAddress getAdjustedIP()

getAdjustedIPs

public java.util.List<java.net.InetAddress> getAdjustedIPs()

getTCPPort

public int getTCPPort()

getUDPPort

public int getUDPPort()

isOnline

public boolean isOnline(boolean is_connected)

isIdle

protected boolean isIdle()

getLastTimeOnline

public long getLastTimeOnline()

encrypt

public BuddyPlugin.cryptoResult encrypt(byte[] payload)
                                 throws BuddyPluginException
Throws:
BuddyPluginException

decrypt

public BuddyPlugin.cryptoResult decrypt(byte[] payload)
                                 throws BuddyPluginException
Throws:
BuddyPluginException

verify

public boolean verify(byte[] payload,
                      byte[] signature)
               throws BuddyPluginException
Throws:
BuddyPluginException

storeMessage

public BuddyPluginBuddyMessage storeMessage(int type,
                                            java.util.Map msg)

retrieveMessages

public java.util.List<BuddyPluginBuddyMessage> retrieveMessages(int type)

setMessagePending

public void setMessagePending()
                       throws BuddyPluginException
Throws:
BuddyPluginException

getLastMessagePending

public long getLastMessagePending()

addYGMMarker

protected boolean addYGMMarker(long marker)

setLastMessageReceived

protected void setLastMessageReceived(java.lang.String str)

getLastMessageReceived

public java.lang.String getLastMessageReceived()

getYGMMarkers

protected java.util.List<java.lang.Long> getYGMMarkers()

getLastStatusSeq

protected int getLastStatusSeq()

buddyConnectionEstablished

protected void buddyConnectionEstablished(boolean outgoing)

buddyMessageSent

protected void buddyMessageSent(int size,
                                boolean record_active)

buddyMessageReceived

protected void buddyMessageReceived(int size)

buddyMessageFragmentReceived

protected void buddyMessageFragmentReceived(int num_received,
                                            int total)

getMessageInFragmentDetails

public java.lang.String getMessageInFragmentDetails()

getMessageInCount

public int getMessageInCount()

getMessageOutCount

public int getMessageOutCount()

getBytesInCount

public int getBytesInCount()

getBytesOutCount

public int getBytesOutCount()

isConnected

public boolean isConnected()

buddyActive

protected void buddyActive()

ping

public void ping()
          throws BuddyPluginException
Throws:
BuddyPluginException

sendCloseRequest

protected void sendCloseRequest(boolean restarting)

receivedCloseRequest

protected void receivedCloseRequest(java.util.Map request)

sendMessage

public void sendMessage(int subsystem,
                        java.util.Map content,
                        int timeout_millis,
                        BuddyPluginBuddyReplyListener listener)
                 throws BuddyPluginException
Throws:
BuddyPluginException

sendMessageSupport

protected void sendMessageSupport(java.util.Map content,
                                  int subsystem,
                                  int timeout_millis,
                                  BuddyPluginBuddyReplyListener original_listener)
                           throws BuddyPluginException
Throws:
BuddyPluginException

dispatchMessage

protected void dispatchMessage()

removeConnection

protected void removeConnection(BuddyPluginBuddy.buddyConnection bc)

getLastStatusCheckTime

protected long getLastStatusCheckTime()

statusCheckActive

protected boolean statusCheckActive()

statusCheckStarts

protected boolean statusCheckStarts()

statusCheckFailed

protected void statusCheckFailed()

setCachedStatus

protected void setCachedStatus(java.net.InetAddress _ip,
                               int _tcp_port,
                               int _udp_port)

statusCheckComplete

protected void statusCheckComplete(long _post_time,
                                   java.net.InetAddress _ip,
                                   int _tcp_port,
                                   int _udp_port,
                                   java.lang.String _nick_name,
                                   int _online_status,
                                   int _status_seq,
                                   int _version)

addressesEqual

protected boolean addressesEqual(java.net.InetAddress ip1,
                                 java.net.InetAddress ip2)

checkTimeouts

protected void checkTimeouts()

sendKeepAlive

protected void sendKeepAlive()

getConnectionsString

public java.lang.String getConnectionsString()

disconnect

public void disconnect()

isClosing

protected boolean isClosing()

destroy

protected void destroy()

logMessage

protected void logMessage(java.lang.String str)

outgoingConnection

protected GenericMessageConnection outgoingConnection()
                                               throws BuddyPluginException
Throws:
BuddyPluginException

incomingConnection

protected void incomingConnection(GenericMessageConnection _connection)
                           throws BuddyPluginException
Throws:
BuddyPluginException

addConnection

protected void addConnection(GenericMessageConnection _connection)
                      throws BuddyPluginException
Throws:
BuddyPluginException

setUserData

public void setUserData(java.lang.Object key,
                        java.lang.Object value)

getUserData

public java.lang.Object getUserData(java.lang.Object key)

log

protected void log(java.lang.String str)

log

protected void log(java.lang.String str,
                   java.lang.Throwable e)

getString

public java.lang.String getString()