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

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

public class BuddyPluginBuddy
extends 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, String _pk, String _nick_name, int _version, String _rss_local_cats, String _rss_remote_cats, int _last_status_seq, long _last_time_online, List<Long> _recent_ygm)
           
 
Method Summary
protected  void addConnection(GenericMessageConnection _connection)
           
 void addLocalAuthorisedRSSTagOrCategory(String category)
           
protected  boolean addressesEqual(InetAddress ip1, 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(Set<String> c1, Set<String> c2)
           
protected  String catsToString(Set<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)
           
 InetAddress getAdjustedIP()
           
 List getAdjustedIPs()
           
 int getBytesInCount()
           
 int getBytesOutCount()
           
 String getConnectionsString()
           
protected  long getCreatedTime()
           
 InetAddress getIP()
           
 long getLastMessagePending()
           
 String getLastMessageReceived()
           
protected  long getLastStatusCheckTime()
           
protected  int getLastStatusSeq()
           
 long getLastTimeOnline()
           
 Set<String> getLocalAuthorisedRSSTagsOrCategories()
           
 String getLocalAuthorisedRSSTagsOrCategoriesAsString()
           
 String getLocalReadTagsOrCategoriesAsString()
           
 BuddyPluginBuddyMessageHandler getMessageHandler()
           
 int getMessageInCount()
           
 String getMessageInFragmentDetails()
           
 int getMessageOutCount()
           
 String getName()
           
 String getNickName()
           
 int getOnlineStatus()
           
protected  BuddyPlugin getPlugin()
           
 String getPublicKey()
           
protected  byte[] getRawPublicKey()
           
 Set<String> getRemoteAuthorisedRSSTagsOrCategories()
           
 String getRemoteAuthorisedRSSTagsOrCategoriesAsString()
           
protected  String getShortString()
           
 String getString()
           
 URL getSubscriptionURL(String cat)
           
 int getSubsystem()
           
 int getTCPPort()
           
 int getUDPPort()
           
 Object getUserData(Object key)
           
 int getVersion()
           
protected  List<Long> getYGMMarkers()
           
protected  void incomingConnection(GenericMessageConnection _connection)
           
 boolean isAuthorised()
           
protected  boolean isClosing()
           
 boolean isConnected()
           
protected  boolean isIdle()
           
 boolean isLocalRSSTagOrCategoryAuthorised(String category)
           
 boolean isOnline(boolean is_connected)
           
 boolean isRemoteRSSTagOrCategoryAuthorised(String category)
           
 boolean isSubscribedToTagOrCategory(String cat, String creator_ref)
           
protected  void localRSSTagOrCategoryRead(String str)
           
protected  void log(String str)
           
protected  void log(String str, Throwable e)
           
protected  void logMessage(String str)
           
protected  GenericMessageConnection outgoingConnection()
           
protected  void persistentDispatch()
           
protected  void persistentDispatchPending()
           
 void ping()
           
 Map readConfigFile(File name)
           
protected  void receivedCloseRequest(Map request)
           
 void remove()
           
protected  void removeConnection(BuddyPluginBuddy.buddyConnection bc)
           
 void removeLocalAuthorisedRSSTagOrCategory(String category)
           
 List<BuddyPluginBuddyMessage> retrieveMessages(int type)
           
protected  void sendCloseRequest(boolean restarting)
           
protected  void sendKeepAlive()
           
 void sendMessage(int subsystem, Map content, int timeout_millis, BuddyPluginBuddyReplyListener listener)
           
protected  void sendMessageSupport(Map content, int subsystem, int timeout_millis, BuddyPluginBuddyReplyListener original_listener)
           
protected  void setAuthorised(boolean _a)
           
protected  void setCachedStatus(InetAddress _ip, int _tcp_port, int _udp_port)
           
protected  void setInitialStatus(long now, int num_buddies)
           
protected  void setLastMessageReceived(String str)
           
 void setLocalAuthorisedRSSTagsOrCategories(Set<String> new_cats)
           
 void setLocalAuthorisedRSSTagsOrCategories(String new_cats)
           
 void setMessagePending()
           
protected  void setOnlineStatus(int s)
           
protected  void setRemoteAuthorisedRSSTagsOrCategories(Set<String> new_cats)
           
protected  void setSubsystem(int _s)
           
 void setUserData(Object key, Object value)
           
protected  void setVersion(int v)
           
protected  boolean statusCheckActive()
           
protected  void statusCheckComplete(long _post_time, InetAddress _ip, int _tcp_port, int _udp_port, String _nick_name, int _online_status, int _status_seq, int _version)
           
protected  void statusCheckFailed()
           
protected  boolean statusCheckStarts()
           
 BuddyPluginBuddyMessage storeMessage(int type, Map msg)
           
protected  Set<String> stringToCats(String str)
           
 void subscribeToCategory(String cat)
           
 boolean verify(byte[] payload, byte[] signature)
           
 boolean writeConfigFile(File name, 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,
                           String _pk,
                           String _nick_name,
                           int _version,
                           String _rss_local_cats,
                           String _rss_remote_cats,
                           int _last_status_seq,
                           long _last_time_online,
                           List<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 Map readConfigFile(File name)

writeConfigFile

public boolean writeConfigFile(File name,
                               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 String getPublicKey()

getRawPublicKey

protected byte[] getRawPublicKey()

getShortString

protected String getShortString()

getNickName

public String getNickName()

getVersion

public int getVersion()

setVersion

protected void setVersion(int v)

getLocalAuthorisedRSSTagsOrCategoriesAsString

public String getLocalAuthorisedRSSTagsOrCategoriesAsString()

getLocalAuthorisedRSSTagsOrCategories

public Set<String> getLocalAuthorisedRSSTagsOrCategories()

addLocalAuthorisedRSSTagOrCategory

public void addLocalAuthorisedRSSTagOrCategory(String category)

removeLocalAuthorisedRSSTagOrCategory

public void removeLocalAuthorisedRSSTagOrCategory(String category)

setLocalAuthorisedRSSTagsOrCategories

public void setLocalAuthorisedRSSTagsOrCategories(String new_cats)

setLocalAuthorisedRSSTagsOrCategories

public void setLocalAuthorisedRSSTagsOrCategories(Set<String> new_cats)

getRemoteAuthorisedRSSTagsOrCategories

public Set<String> getRemoteAuthorisedRSSTagsOrCategories()

getRemoteAuthorisedRSSTagsOrCategoriesAsString

public String getRemoteAuthorisedRSSTagsOrCategoriesAsString()

setRemoteAuthorisedRSSTagsOrCategories

protected void setRemoteAuthorisedRSSTagsOrCategories(Set<String> new_cats)

isLocalRSSTagOrCategoryAuthorised

public boolean isLocalRSSTagOrCategoryAuthorised(String category)

isRemoteRSSTagOrCategoryAuthorised

public boolean isRemoteRSSTagOrCategoryAuthorised(String category)

localRSSTagOrCategoryRead

protected void localRSSTagOrCategoryRead(String str)

getLocalReadTagsOrCategoriesAsString

public String getLocalReadTagsOrCategoriesAsString()

getSubscriptionURL

public URL getSubscriptionURL(String cat)

subscribeToCategory

public void subscribeToCategory(String cat)
                         throws BuddyPluginException
Throws:
BuddyPluginException

isSubscribedToTagOrCategory

public boolean isSubscribedToTagOrCategory(String cat,
                                           String creator_ref)

catsToString

protected String catsToString(Set<String> cats)

catsIdentical

protected boolean catsIdentical(Set<String> c1,
                                Set<String> c2)

stringToCats

protected Set<String> stringToCats(String str)

getOnlineStatus

public int getOnlineStatus()

setOnlineStatus

protected void setOnlineStatus(int s)

getName

public String getName()

remove

public void remove()

getIP

public InetAddress getIP()

getAdjustedIP

public InetAddress getAdjustedIP()

getAdjustedIPs

public List 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,
                                            Map msg)

retrieveMessages

public 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(String str)

getLastMessageReceived

public String getLastMessageReceived()

getYGMMarkers

protected List<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 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(Map request)

sendMessage

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

sendMessageSupport

protected void sendMessageSupport(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(InetAddress _ip,
                               int _tcp_port,
                               int _udp_port)

statusCheckComplete

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

addressesEqual

protected boolean addressesEqual(InetAddress ip1,
                                 InetAddress ip2)

checkTimeouts

protected void checkTimeouts()

sendKeepAlive

protected void sendKeepAlive()

getConnectionsString

public String getConnectionsString()

disconnect

public void disconnect()

isClosing

protected boolean isClosing()

destroy

protected void destroy()

logMessage

protected void logMessage(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(Object key,
                        Object value)

getUserData

public Object getUserData(Object key)

log

protected void log(String str)

log

protected void log(String str,
                   Throwable e)

getString

public String getString()