|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.lightdev.app.Application
com.lightdev.app.DefaultApplication
com.lightdev.app.ddnscl.DynDnsClient
An application to manually or automatically check the IP address of a machine and to update the obtained IP address at DynDns.org
| Nested Class Summary | |
class |
DynDnsClient.CheckTimerTask
a custom TimerTask that initiates an IP check in its run method |
class |
DynDnsClient.KillTimerTask
a custom TimerTask that terminates an automatically running IP check.
|
| Field Summary | |
static String |
ACTION_CHECK_IP
keyword of the action that initiates IP checks |
static String |
ACTION_TOGGLE_AUTO_MODE
keyword of the action that switches automatic IP checks and updates on or off |
static String |
ACTION_UPDATE_IP
keyword of the action that initiates IP updates |
static String |
APP_NAME
name of this application |
static String |
PREFS_DOMAIN
constant that denotes in the preferences the domain to update an IP address for |
static String |
PREFS_PASSWORD
constant that denotes in the preferences the password at DynDns.org |
static String |
PREFS_STORED_IP
constant that denotes in the preferences the IP address stored most recently |
static String |
PREFS_USER_NAME
constant that denotes in the preferences the user name at DnyDns.org |
| Fields inherited from class com.lightdev.app.DefaultApplication |
ACTION_ABOUT_APP, ACTION_EXIT_APP, ACTION_SHOW_HELP_CONTENTS |
| Fields inherited from class com.lightdev.app.Application |
APP_HELP_NAME, JAVA_HELP_EXT, logger, RB_KEY_ABOUT_APP_DIALOG_TITLE, RB_KEY_APP_MENUBAR, RB_KEY_LOG_APP_CAN_NOT_EXIT, RB_KEY_LOG_APP_STARTED, RB_KEY_LOG_APP_TERMINATED, RESOURCE_NOT_FOUND, URL_SEPARATOR |
| Constructor Summary | |
DynDnsClient(boolean withUI,
long duration)
constructor |
|
| Method Summary | |
void |
about()
show information about this application (overridden from class Application) |
void |
acquireIP()
get the IP address as determined by DynDns.org for this machine |
void |
initActions()
intialize the actions of this application |
void |
IPDetectionError(DynDnsIPChecker checker,
Exception e)
a DynDnsIPChecker thread calls this method when an error occured during thread execution |
void |
IPUpdateError(DynDnsIPUpdater updater,
Exception e)
a DynDnsIPUpdater thread calls this method when an error occured during thread execution |
static void |
main(String[] args)
application main method The application checks for exact two parameters in args. |
void |
receivedIP(DynDnsIPChecker checker)
a DynDnsIPChecker thread calls this method when it has received an IP address |
void |
receivedUpdateResponse(DynDnsIPUpdater updater)
a DynDnsIPUpdater thread calls this method when it has received an update response |
boolean |
runsInAutoMode()
determine if this application currently runs in auto mode, i.e. if it automatically checks and updates the IP address at DynDns.org |
void |
toggleAutoMode(boolean activate,
long idle,
long duration)
switch automatic IP checks and updates on or off when duration is set to a non-zero value, the automatic IP checks will terminate after the number of minutes given in duration. |
void |
updateIP()
store the current public IP address as acquired from DynDns.org as the IP address of the domain. |
| Methods inherited from class com.lightdev.app.DefaultApplication |
center, centerFrame, findMainFrame, initMainFrame |
| Methods inherited from class com.lightdev.app.Application |
canExit, exitApplication, getAppName, getBundle, getHelpBroker, getResMenu, log, logStackTrace, setLogging, setLogLevel |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String PREFS_STORED_IP
public static final String PREFS_DOMAIN
public static final String PREFS_USER_NAME
public static final String PREFS_PASSWORD
public static final String APP_NAME
public static final String ACTION_CHECK_IP
public static final String ACTION_UPDATE_IP
public static final String ACTION_TOGGLE_AUTO_MODE
| Constructor Detail |
public DynDnsClient(boolean withUI,
long duration)
withUI - boolean true, if a user interface is to be shown, false if notduration - long the number of minutes to run in background mode,
if withUI is false (0 = forever)| Method Detail |
public void acquireIP()
public void updateIP()
public boolean runsInAutoMode()
public void toggleAutoMode(boolean activate,
long idle,
long duration)
when duration is set to a non-zero value, the automatic IP checks will terminate after the number of minutes given in duration. When the application is started to run in the background, this will terminate the application along with the timer task after the given amount of minutes.
activate - boolean true if automatic IP checks and updates is to be switched on, false otherwiseidle - long the time to wait between two subsquent checks/updates
(unused, if 'activate' is false)duration - long length of the timer thread in minutespublic void about()
public static void main(String[] args)
The application checks for exact two parameters in args. When launched
without command line parameters, the application displays a user interface and runs
in interactive mode. The interactive mode allows to start and stop automatic IP
checks and updates manually.
When '-noui' is given as the first command line parameter, the application is launched as a task in the background without user interface. In this mode the application is started with automatic IP checks/updates switched on checking the IP address and updating as necessary every 10 minutes. The applicatin will run forever unless a numeric value is given as an optional second parameter which denotes the duration the application shall run in this mode in minutes.
Examples
1) java -jar DynDnsClient.jar
start the application in interacive mode with user interface
2) java -jar DynDnsClient.jar -noui
start the application in background mode without user interface
to run forever, checking/updating IPs every 10 minutes
3) java -jar DynDnsClient.jar -noui 60
start the application in background mode without user interface
to run for 60 minutes, checking/updating IPs every 10 minutes
args - String[] the arguments passed to the application upon startpublic void initActions()
public void receivedIP(DynDnsIPChecker checker)
receivedIP in interface DynDnsIPChecker.DynDnsIPCheckerListenerchecker - DynDnsIPChecker the thread that fired this event
public void IPDetectionError(DynDnsIPChecker checker,
Exception e)
IPDetectionError in interface DynDnsIPChecker.DynDnsIPCheckerListenerchecker - DynDnsIPChecker the thread that fired this evente - Exception the exception that occurredpublic void receivedUpdateResponse(DynDnsIPUpdater updater)
receivedUpdateResponse in interface DynDnsIPUpdater.DynDnsIPUpdaterListenerupdater - DynDnsIPUpdater the thread that fired this event
public void IPUpdateError(DynDnsIPUpdater updater,
Exception e)
IPUpdateError in interface DynDnsIPUpdater.DynDnsIPUpdaterListenerupdater - DynDnsIPUpdater the thread that fired this evente - Exception the exception that occurred
|
Copyright (c) 2004 Ulrich Hilger | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||