T
Tarun
Hi there,
I have a query regarding xml and java:
Please guide.
Scenario is like this:
I have a few configuration parameters in an xml file that I need to
read when I am starting my java application(RMI server application).
So, I read xml parameters using DOM APIs and I am creating a java
object per element.
that is, lets say I have an element called FTP in xml file with
attributes say ftp directory and time out interval.
<FTP>
ftpDir="\somepath"
timeout="30"
</FTP>
So, I read them and put them into an object of type FTPSetting.java
where I have these 2 attributes as instance variables and setter and
getter methods for them.
something like
############
private String ftpDir;
private int ftpTimeOut;
getFtpDir()
getTimeOut()
setFtpDir()
setTimeOut()
############
Is this approach fine?
Info: "The application is an RMI application."
2. Next, I have to have a utility to change these parameters at
runtime.
For that, I am creating a simple client class that looks up for the
sever class in RMI registry (a simple lookup call) and then depending
upon the parameter name and value provided to this class thru command
line, I call the modify function of server class that in turn calls the
setter function of the FTPSetting class for that particular attribute.
i.e.,
if "ftpDir" and "<some path>" are provided as command line arguments, I
call the modifyConfigParam(paramName, paramValue) function of server
class that in turn calls the setFtpDir() of FtpSettings.java.
Will this suffice to change the parameter value at runtime?
A quick response will be highly acknowledged.
I have a query regarding xml and java:
Please guide.
Scenario is like this:
I have a few configuration parameters in an xml file that I need to
read when I am starting my java application(RMI server application).
So, I read xml parameters using DOM APIs and I am creating a java
object per element.
that is, lets say I have an element called FTP in xml file with
attributes say ftp directory and time out interval.
<FTP>
ftpDir="\somepath"
timeout="30"
</FTP>
So, I read them and put them into an object of type FTPSetting.java
where I have these 2 attributes as instance variables and setter and
getter methods for them.
something like
############
private String ftpDir;
private int ftpTimeOut;
getFtpDir()
getTimeOut()
setFtpDir()
setTimeOut()
############
Is this approach fine?
Info: "The application is an RMI application."
2. Next, I have to have a utility to change these parameters at
runtime.
For that, I am creating a simple client class that looks up for the
sever class in RMI registry (a simple lookup call) and then depending
upon the parameter name and value provided to this class thru command
line, I call the modify function of server class that in turn calls the
setter function of the FTPSetting class for that particular attribute.
i.e.,
if "ftpDir" and "<some path>" are provided as command line arguments, I
call the modifyConfigParam(paramName, paramValue) function of server
class that in turn calls the setFtpDir() of FtpSettings.java.
Will this suffice to change the parameter value at runtime?
A quick response will be highly acknowledged.