JSPservletPkg
Class whoisHandler

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--JSPservletPkg.whoisHandler

class whoisHandler
extends java.lang.Thread

Handles whois requests in a worker thread.

 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.
 

Version:
1, 0, 4
Author:
Alexis Grandemange

Inner Class Summary
(package private)  class whoisHandler.CodeRange
          Returned by whois.
 
Field Summary
private  int action
          Equals NOOP or WHOIS.
(package private)  java.lang.String address
          IP address in xxx.xxx.xxx.xxx format.
(package private)  whoisHandler.CodeRange codeRange
          Object returned by thread.
(package private)  boolean completed
          If true the thread has completed its task.
(package private)  JSPhandler handler
          Handle on JSPhandler set in constructor.
(package private)  boolean isStarted
          If true, the thread is ready.
private static int NOOP
          No operation - wait.
private static int WHOIS
          Check availability - use of subscrib and rc.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadQ, values
 
Constructor Summary
(package private) whoisHandler(JSPhandler jh)
          Starts the thread.
 
Method Summary
 void run()
          Main method of Thread.
private  whoisHandler.CodeRange threadWhois(java.lang.String address)
          Returns the country code and the alloted range of addresses for a address.
private  whoisHandler.CodeRange threadWhois2(java.lang.String authority, java.lang.String address)
          Returns the country code and the alloted range of addresses for a address.
(package private)  whoisHandler.CodeRange whois(java.lang.String address)
          Returns the country code and the alloted range of addresses for a address.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isStarted

boolean isStarted
If true, the thread is ready.

handler

JSPhandler handler
Handle on JSPhandler set in constructor.

address

java.lang.String address
IP address in xxx.xxx.xxx.xxx format. Set by whois and handled in thread.

codeRange

whoisHandler.CodeRange codeRange
Object returned by thread. If null whois request has failed.

completed

boolean completed
If true the thread has completed its task.

NOOP

private static final int NOOP
No operation - wait.

WHOIS

private static final int WHOIS
Check availability - use of subscrib and rc.

action

private int action
Equals NOOP or WHOIS.
Constructor Detail

whoisHandler

whoisHandler(JSPhandler jh)
Starts the thread.
Method Detail

whois

whoisHandler.CodeRange whois(java.lang.String address)
Returns the country code and the alloted range of addresses for a address. Submits to worker thread.
Parameters:
address - requestor address.

run

public void run()
Main method of Thread.
Overrides:
run in class java.lang.Thread

threadWhois

private whoisHandler.CodeRange threadWhois(java.lang.String address)
Returns the country code and the alloted range of addresses for a address. Validated with mapper.testArin.

Algorithm

  1. Returns PageBox based on cache
  2. Query whois.arinc.net
  3. If not managed by arinc, query ripe or apnic
  4. Parse the response to find the IP range
Parameters:
address - requestor address.

threadWhois2

private whoisHandler.CodeRange threadWhois2(java.lang.String authority,
                                            java.lang.String address)
Returns the country code and the alloted range of addresses for a address. RIPE/APNIC parsing.
Validated with mapper.testRipe.

Algorithm

  1. Query specified authority
  2. If not managed by arinc, query ripe or apnic
  3. Parse the response to find the IP range
Parameters:
authority - authority to query (RIPE/APNIC supported).
address - requestor address.