Configuration
dyndns-updater is configured by one xml-file. The file is read by the
Spring Framework. The
configuration file must be named configuration.xml
and must lie in
the current directory.
The content of the configuration file
It starts with a standard header:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans>
The next bean element sets up the ip getter (the service which determines the IP address):
<bean id="ipGetter" class="de.sw4j.dyndnsupdater.impl.EmptyIPGetter"> <property name="userPassword"> <value>password</value> </property> <property name="userName"> <value>user</value> </property> <property name="routerName"> <value>127.0.0.1</value> </property> </bean>
This section contains the class name of the IP getter (the value of the
attribute class
).
The properties are used to set up the IP getter. The following properties are supported at the moment:
- A user name:
userName
- A user password:
userPassword
- A router name (or IP address):
routerName
The first two properties should be self-explanatory. The third property is the name or the IP address of a service which resolves the IP address.
All three properties are depending on the class of the IP getter.
The next bean element sets up the DNS updater (the service which updates the DNS service):
<bean id="dnsUpdater" class="de.sw4j.dyndnsupdater.impl.EmptyDNSUpdater"> <property name="userPassword"> <value>password</value> </property> <property name="userName"> <value>user</value> </property> <property name="updateHostName"> <value>127.0.0.1</value> </property> <property name="dynHostName"> <value>localhost</value> </property> </bean>
This section contains the class name of the DNS updater (the value of the
attribute class
).
The properties are used to set up the DNS updater. The following properties are supported at the moment:
- A user name:
userName
- A user password:
userPassword
- An update host name (or IP address):
updateHostName
- A dynamic host name (or IP address):
dynHostName
The first two properties should be self-explanatory. The third property is the name or the IP address of a service which updates the dynamic IP address (e.g. members.dyndns.org). The last property is your own host name for which you will update the IP address.
All four properties are depending on the class of the DNS updater.
The next bean element sets up the runner:
<bean id="runner" class="de.sw4j.dyndnsupdater.Runner"> <property name="getter"> <ref bean="ipGetter"/> </property> <property name="updater"> <ref bean="dnsUpdater"/> </property> <property name="timeout"> <value>1</value> </property> <property name="updateFileName"> <value>/tmp/lastUpdate.xml</value> </property> </bean>
In this bean only the last two properties may be changed. The first two
(getter
and setter
) are used to reference the two
beans configured before.
The third property (timeout
) is used to configure the timeout of
the updater service. After timeout
days the IP address will be send
again to the DNS updater service, no matter is it changed or not. For dyndns.org
this value should be set to 28 so the host name will not be released.
The fourth property is to set up the file name which saves the last IP address and the last transmission date. This is needed because you may not actualize the IP address to often in some DNS services (e.g. dyndns.org).
The next bean element sets up the timer. Here nothing can be changed by the user. Both properties are used internal only.
<bean id="updateTask" class="org.springframework.scheduling.timer.MethodInvokingTimerTaskFactoryBean"> <property name="targetObject"> <ref bean="runner"/> </property> <property name="targetMethod"> <value>updateDNS</value> </property> </bean>
The first property is a reference to the bean defined before and the second is the method which is called in the class.
The next bean element sets up the scheduler:
<bean id="runnerSchedule" class="org.springframework.scheduling.timer.ScheduledTimerTask"> <property name="period"> <value>60000</value> </property> <property name="timerTask"> <ref local="updateTask"/> </property> </bean>
The first property (period
) determines the period between two
calls to the previous defined method. The period is defined in milliseconds.
This means in the example the method updateDNS
is called every
minute. Perhaps you must adjust this time according to the term of use of the
service used (some web pages only allow a query all 5 minutes).
The second property is again a reference to a bean defined previous.
The next bean element sets up the timer factory itself. Both properties should not be changed.
<bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean"> <property name="scheduledTimerTasks"> <list> <ref local="runnerSchedule"/> </list> </property> <property name="daemon"> <value>false</value> </property> </bean> </beans>
The first property is a reference to a bean defined previous. The second property is needed, because else the timer will run in daemon mode which means that the program will end immediatly after starting.
Post to project admin