|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--JSPservletPkg.Mapper
Maps the user hostname. Version 1.0.4.
Copyright (c) 2000-2001
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
Cache,
whoisHandler| Inner Class Summary | |
(package private) class |
Mapper.Checker
Checker thread class. |
(package private) class |
Mapper.whoisFailedSubscriber
whois servers can be down... |
| Field Summary | |
(package private) static Region |
Asia
Asia region. |
(package private) static Region |
AsiaNames
Asia region. |
private static int |
CHECK
Check availability - use of subscrib and rc. |
(package private) static Mapper.Checker |
checker
Checker object created in constructor. |
(package private) static Region |
EMEA
Europa, Middle East and Africa region. |
(package private) static Region |
EMEAnames
Europa, Middle East and Africa region. |
private JSPhandler |
handler
Handle on JSPhandler. |
(package private) static Region |
LatinAmerica
Latin America region. |
(package private) static Region |
LatinAmericaNames
Latin America region. |
(package private) static Region |
Misc
We put there US, Canada and small isolated states. |
(package private) static Region |
MiscNames
We put there US, Canada and small isolated states. |
private java.lang.String |
msg
Error - diagnosis message. |
private static int |
NOOP
No operation - wait. |
(package private) int |
num
Number used for round-robbin load balancing. |
(package private) static Region |
Ocean
Pacific Ocean region. |
(package private) static Region |
OceanNames
Pacific ocean region. |
private java.lang.String |
publisher
Publisher URL. |
(package private) static Region[] |
regionNames
List of non-generic name regions. |
(package private) static Region[] |
regions
List of non-generic code regions. |
private java.util.Map |
subscribers
Key: domain. Value: String[]. |
private java.util.Map |
subscribersByCountry
Key: country. Value: String[]. |
private java.util.Map |
subscribersByRegion
Key: region. Value: String[]. |
(package private) static Region |
Test
For test purpose. |
(package private) static Region |
TestNames
For consistency... |
(package private) static Region |
Unknown
Generic name region. |
(package private) java.util.ArrayList |
whoisFailedSubscribers
Stores whoisFailedSubscriber elements. |
(package private) static whoisHandler |
whoisHdlr
whoisHandler object created in constructor. |
| Constructor Summary | |
(package private) |
Mapper(java.lang.String publisher,
JSPhandler handler)
Constructor. |
| Method Summary | |
boolean |
check(java.lang.String subscriber)
Checks the state of a subscribing PageBox and updates its state. |
void |
checkAll(int counterForPing)
Update global subscriber state. At each loop the scanner thread increments the invocation number. Allows to do 1/12 of the checks at a call. |
(package private) static java.lang.String |
formatAddress(long add)
Returns a readable IP address in usual xxx.xxx.xxx.xxx format. |
java.lang.String |
getDomain(java.lang.String host)
Service method. |
java.lang.String |
getInfo()
Returns info string. |
(package private) static long |
getLongAddress(java.lang.String address)
Converts the IP address in a number more suitable for comparison. Validated with mapper.testRipe. |
java.lang.String |
getMessage()
returns error - diagnosis message. |
java.lang.String |
getPageBox(java.lang.String domain,
java.lang.String address)
Returns the URL of the PageBox to use for a given URL. |
private boolean |
initialize()
Version 1.0.4. |
private java.lang.String |
loadBalance(java.lang.String[] PageBoxes)
Round-robbin load balancing returning a url. |
private void |
register(java.lang.String code,
java.lang.String subscriber)
Registers a PageBox in the proper country and region. |
(package private) void |
removeFromSubscribers(java.lang.String subscriber,
java.lang.String domain)
Cleanup subscribers for invalid subscribers. |
private java.lang.String[] |
scan(java.lang.String code)
Given a country code returns: PageBoxes in the same country. If not found, PageBoxes in the same region. |
private java.lang.String |
search(java.lang.String address)
Version 1.0.4. |
private static whoisHandler.CodeRange |
whois(java.lang.String address)
Version 1.0.4. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
static final Region EMEA
static final Region Asia
static final Region LatinAmerica
static final Region Ocean
static final Region Misc
static final Region EMEAnames
static final Region AsiaNames
static final Region LatinAmericaNames
static final Region OceanNames
static final Region MiscNames
static final Region Test
static final Region TestNames
static final Region Unknown
static Region[] regions
static Region[] regionNames
private java.util.Map subscribers
private java.util.Map subscribersByCountry
private java.util.Map subscribersByRegion
private java.lang.String publisher
private JSPhandler handler
static Mapper.Checker checker
static whoisHandler whoisHdlr
private static final int NOOP
private static final int CHECK
java.util.ArrayList whoisFailedSubscribers
private java.lang.String msg
int num
| Constructor Detail |
Mapper(java.lang.String publisher,
JSPhandler handler)
publisher - publisher url.handler - handle on JSPhandler.| Method Detail |
public java.lang.String getInfo()
static java.lang.String formatAddress(long add)
add - numeric value.public void checkAll(int counterForPing)
counterForPing - invocation number.public boolean check(java.lang.String subscriber)
subscriber - subscribing PageBox.private boolean initialize()
Initializes subscribers, subscribersByCountry, subscribersByRegion.
Validated with mapper.testInit.
private final void register(java.lang.String code,
java.lang.String subscriber)
code - country code.subscriber - subscribing PageBox.
void removeFromSubscribers(java.lang.String subscriber,
java.lang.String domain)
subscriber - invalid subscriber.domain - invalid subscriber domain.public java.lang.String getMessage()
public java.lang.String getPageBox(java.lang.String domain,
java.lang.String address)
Intented use: JSPservlet uses ServletRequest.getRemoteHost to get the name of the requestor and updates page HREF with the returned URL.
domain - requestor domain.address - requestor IP address.private java.lang.String[] scan(java.lang.String code)
code - country code.private final java.lang.String loadBalance(java.lang.String[] PageBoxes)
PageBoxes - candidate urls.static final long getLongAddress(java.lang.String address)
address - IP address.private static whoisHandler.CodeRange whois(java.lang.String address)
address - requestor address.private java.lang.String search(java.lang.String address)
address - requestor address.public java.lang.String getDomain(java.lang.String host)
host - host name.
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||