|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.xml.sax.helpers.DefaultHandler | +--ami.AMIrt
AMI Routing Table, stores information about all known peers
Field Summary | |
private AMIPublicKey |
apk
|
private static AMIrt |
art
Self instance used for signleton pattern |
private boolean |
bForget
Boolean used to say this peer musn't be taken into account when parsing |
private static Hashtable |
h
|
private int |
i
|
private Integer |
iDlc
|
private Integer |
iPf
|
private String |
sAl
|
private String |
sCm
|
private String[] |
sCurrent
|
private String |
sIp
|
Constructor Summary | |
private |
AMIrt()
The AMI routing table Singleton Entries in hashtable: pu 0: al 1: ip (ip:port:status) 2: pf 3: dlc 4: cm |
Method Summary | |
static void |
addPeer(AMIPublicKey apk,
String sAlias,
String sIP)
Idem with no comment |
static void |
addPeer(AMIPublicKey apk,
String sAlias,
String sIP,
String sComment)
add a peer in the rt. |
static AMIPublicKey |
addPeer(String sAlias,
String sIP)
Idem with no comment |
static AMIPublicKey |
addPeer(String sAlias,
String sIP,
String sComment)
Add a peer without public key ( usefull for eai for example ) |
(package private) static void |
alterPeer(AMIPublicKey apk,
String sIP)
Alter ip of a given pu after network validation |
(package private) static void |
alterPeer(Hashtable hModif)
Alters the rt entry given by pu and following instructions given in the hashtable: "pu" -> pu (mandatory) "al"-> "the alias" "cm" -> "the comment" |
(package private) static void |
commit()
Commit RT before quit |
(package private) static boolean |
contains(AMIPublicKey apk)
Used to know if a peer is in the RT |
(package private) static void |
decPerf(AMIPublicKey apk)
Decrease the performance of a peer |
void |
endElement(String sUri,
String sName,
String sQName)
Called when we reach the end of an element |
static String |
getAlias(AMIPublicKey apk)
Get alias associated with a pu returns null if the apk not in RT |
static Vector |
getAlIp(AMIPublicKey apk)
Advance search Return the set [alias,ip] for the given peer pu |
static String |
getComment(AMIPublicKey apk)
Get comment associated with pu returns null if the apk not in RT |
(package private) static int |
getConnectedPeerNumber()
Return number of pingable peers Can be usefull to know if we are isolated |
static Integer |
getDLC(AMIPublicKey apk)
retruns the date in seconds since 1970 od the last successful check returns null if the apk not in RT |
static String |
getFullIP(AMIPublicKey apk)
Return the ip:port for the given peer Format: ip:port ex: 10.0.0.31:1111 returns null if the apk not in RT |
static AMIrt |
getInstance()
Return an instance of the RT Implementation of the singleton pattern |
static String |
getIP(AMIPublicKey apk)
Return IP for the given peer Format: ip ex: 10.0.0.1 returns null if the apk not in RT |
static Enumeration |
getPeerEnumeration()
Returns the enumeration on peers public keys. |
static Integer |
getPerf(AMIPublicKey apk)
Get performance of peer associated with pu returns null if the apk not in RT |
static String |
getPort(AMIPublicKey apk)
Return the port for the given peer Format: ip ex: 1111 returns null if the apk not in RT |
(package private) static Vector |
getPuAl(String sIP)
Advance search Return the set [pu,al,pu,al,...] for the given peer ip ip is in format xxx:xxx |
(package private) static Vector |
getPuIp(String sAl)
Advance search Return the set [pu,ip,pu,ip,...] for the given peer alias |
(package private) static Enumeration |
getSortedPeerEnumeration()
Returns the enumeration on peers public keys sorted by performance. |
(package private) static void |
incPerf(AMIPublicKey apk)
Increase the performance by the standard value |
void |
parseFromFile(String sURL)
Get data from a file |
static void |
removePeer(AMIPublicKey apk)
Used to drop the entry identified by apk |
static void |
setAlias(AMIPublicKey apk,
String sValue)
Set the alias of a peer |
static void |
setComment(AMIPublicKey apk,
String sComment)
Set the comment of a peer |
static void |
setDLC(AMIPublicKey apk,
int iDate)
Set the DLC of a peer |
static void |
setIP(AMIPublicKey apk,
String sValue)
Set the ip of a peer |
static void |
setPerf(AMIPublicKey apk,
int iValue)
Set the performance of a peer |
void |
startDocument()
Called at parsing start |
void |
startElement(String sUri,
String sName,
String sQName,
org.xml.sax.Attributes attributes)
Called when we start an element |
void |
startPrefixMapping(String sPrefix,
String sUri)
Called to process namespaces |
Methods inherited from class org.xml.sax.helpers.DefaultHandler |
characters, endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
|
Field Detail |
private static Hashtable h
private AMIPublicKey apk
private String sAl
private String sIp
private Integer iPf
private Integer iDlc
private String sCm
private String[] sCurrent
private int i
private static AMIrt art
private boolean bForget
Constructor Detail |
private AMIrt() throws AMIException
Singleton
Entries in hashtable:
pu
0: al
1: ip (ip:port:status)
2: pf
3: dlc
4: cm
Method Detail |
public void parseFromFile(String sURL) throws AMIException
public static AMIrt getInstance() throws AMIException
Implementation of the singleton pattern
static boolean contains(AMIPublicKey apk)
static void commit() throws AMIException
public static String getAlias(AMIPublicKey apk)
apk
- public static String getIP(AMIPublicKey apk)
apkt
- public static String getPort(AMIPublicKey apk)
apkt
- public static String getFullIP(AMIPublicKey apk)
apkt
- public static Integer getPerf(AMIPublicKey apk)
apk
- public static Integer getDLC(AMIPublicKey apk)
apk
- public static String getComment(AMIPublicKey apk)
apk
- public static Vector getAlIp(AMIPublicKey apk)
static Vector getPuIp(String sAl)
static Vector getPuAl(String sIP)
public static void setAlias(AMIPublicKey apk, String sValue)
apk
- sValue
- public static void setIP(AMIPublicKey apk, String sValue)
apk
- sValue
- like IP:PORT (use setStatus() to set the status )static void incPerf(AMIPublicKey apk)
apk
- static void decPerf(AMIPublicKey apk)
apk
- public static void setPerf(AMIPublicKey apk, int iValue)
apk
- iValue
- public static void setDLC(AMIPublicKey apk, int iDate)
apk
- iValue
- public static void setComment(AMIPublicKey apk, String sComment)
apk
- sComment
- public static void removePeer(AMIPublicKey apk)
apk
- sComment
- public static Enumeration getPeerEnumeration()
apk
- sComment
- static Enumeration getSortedPeerEnumeration()
apk
- sComment
- public static void addPeer(AMIPublicKey apk, String sAlias, String sIP, String sComment) throws AMIException
The public key is get by amiping ( for network validation )
Caution: if the peer already exists, He will be overwritten.
sIP is under format : address:port
public static void addPeer(AMIPublicKey apk, String sAlias, String sIP) throws AMIException
public static AMIPublicKey addPeer(String sAlias, String sIP, String sComment) throws AMIException
public static AMIPublicKey addPeer(String sAlias, String sIP) throws AMIException
static void alterPeer(Hashtable hModif) throws AMIException
"pu" -> pu (mandatory)
"al"-> "the alias"
"cm" -> "the comment"
static void alterPeer(AMIPublicKey apk, String sIP) throws AMIException
AMIException
- if the peer is not alteredstatic int getConnectedPeerNumber()
public void startDocument()
startDocument
in class org.xml.sax.helpers.DefaultHandler
public void startElement(String sUri, String sName, String sQName, org.xml.sax.Attributes attributes) throws org.xml.sax.SAXException
startElement
in class org.xml.sax.helpers.DefaultHandler
public void endElement(String sUri, String sName, String sQName) throws org.xml.sax.SAXException
endElement
in class org.xml.sax.helpers.DefaultHandler
public void startPrefixMapping(String sPrefix, String sUri) throws org.xml.sax.SAXException
startPrefixMapping
in class org.xml.sax.helpers.DefaultHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |