Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes NX: Questions about properties and security manager. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "NX: Questions about properties and security manager." Watch "NX: Questions about properties and security manager." New topic
Author

NX: Questions about properties and security manager.

Larry Li
Greenhorn

Joined: Nov 25, 2002
Posts: 27

You must not require the installation of a security manager.


Your programs must not require use of command line property specifications. All configuration must be done via a GUI, and must be persistent between runs of the program. Such configuration information must be stored in a file called suncertify.properties which must be located in the current working directory.

1. No security manager can be installed but how could we get read and write permissions? I only know write a property file and install it by runtime parameter, any other solutions?
2. It says "all configuration information must be done via a GUI", and "must be stored in a file ",I confused about the two,which ones should done via a GUI and which ones stored in a property file?


The hill is not a hill.
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
1. No security manager can be installed but how could we get read and write permissions? I only know write a property file and install it by runtime parameter, any other solutions?
2. It says "all configuration information must be done via a GUI", and "must be stored in a file ",I confused about the two,which ones should done via a GUI and which ones stored in a property file?

1) My app works without permissions, although it is on my network so I'll still do some investigations and testing on different environments. I dont create an instance of RMI security manager nor do I use a policy file, I'm sure I'll have problems later but so far none yet.
I sure hope others will offer some input here.
2) Both, it must be stored in a file and this file will be edited via your GUI
Larry Li
Greenhorn

Joined: Nov 25, 2002
Posts: 27
TQ,thx your reply.
1. without security manager we couldn't get read and write permission from remote client,so I think we still need it.
2. Do you mean we should also have a server GUI for configuration of urn, port, and db file place?
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by Larry Lee:
TQ,thx your reply.
1. without security manager we couldn't get read and write permission from remote client,so I think we still need it.
2. Do you mean we should also have a server GUI for configuration of urn, port, and db file place?

1) I read and write via remote client, you mean to the database or the config file ?
because the config file will be on the client puter as well, because the client also needs it to know which host to connect to, and we're only allowed one config file, so you cant have one for client and one for server, even though when using network the server needs it for DB location and as said the client for host address.
Anyway my server updates the database on remote clients request, and client updates its own config file.
2) No server GUI, it was not asked for, and neither does it need it, it only needs to know which DB to use and thats in the same config file the client GUI configures
Larry Li
Greenhorn

Joined: Nov 25, 2002
Posts: 27
Thx.
To the second question, we have a config file both in client and server, and do we need to have a GUI to modify it?
If yes, it's works of the server but not the client, if no ,what does "all configuration must be done via a GUI" mean?
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Hi guys, - the client GUI will also run locally (that is, on the server) so you can still modify the server's parameter settings and store them (on the server).
[ April 27, 2003: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Larry Li
Greenhorn

Joined: Nov 25, 2002
Posts: 27
Thx,Gaunt.
I get it, I will do it at client in local mode but not server mode. For I don't think a remote client should have any rights to modify the server configuration.
Larry.
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Hi, Could someone tell a little bit about the
property file format? Is a txt file enough like
port = 1099
DBFile = /db.db
or in XML format?
or uses java.util.Properties?
thx.
shan
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by shan chen:
Hi, Could someone tell a little bit about the
property file format? Is a txt file enough like
port = 1099
DBFile = /db.db
or in XML format?
or uses java.util.Properties?
thx.
shan


I will be using java.util.Properties together with the store() and load() methods. It does every thing you need. Just use the required file name when you create the streams.
-Barry
Ta Ri Ki Sun
Ranch Hand

Joined: Mar 26, 2002
Posts: 442
Originally posted by shan chen:
Hi, Could someone tell a little bit about the
property file format? Is a txt file enough like
port = 1099
DBFile = /db.db
or in XML format?
or uses java.util.Properties?
thx.
shan

I've done what Barry mentioned he plans to do, also found there are limitations on what you can and cant do, based on the file name and location, ie "suncertify.properties, location = user.dir", that rules out possibly the best and simplest way to handle configuration, java.util.Preferences.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Originally posted by Ta Ri Ki Sun:

I've done what Barry mentioned he plans to do, also found there are limitations on what you can and cant do, based on the file name and location, ie "suncertify.properties, location = user.dir", that rules out possibly the best and simplest way to handle configuration, java.util.Preferences.

Looks like a pleasure I have yet to experience.
-Barry
shan chen
Ranch Hand

Joined: Apr 09, 2003
Posts: 70
Thanks, guys.
frank sun
Ranch Hand

Joined: Apr 11, 2003
Posts: 102
Originally posted by Larry Lee:
TQ,thx your reply.
1. without security manager we couldn't get read and write permission from remote client,so I think we still need it.
2. Do you mean we should also have a server GUI for configuration of urn, port, and db file place?

If we provide a file java.policy, and grant all the permissions in there. Whenever the server changes to another machine or its port, the java.policy allows all the clients to connect to the server.
I wonder does it against the assignment spec?
Frank!
mannuel Taiwo
Greenhorn

Joined: May 08, 2003
Posts: 1
Thanks Guys, u are really putting me through a lot of things thumbs up.Keep it up. dolittle_d1@yahoo.com


D1
Bartolo Almeda
Greenhorn

Joined: Apr 17, 2003
Posts: 24
It's just one file suncertify.properties but inside that file you can store all the information you want like having two different sections one for the client and one for the server.
##Client section
client.lastURL=....
client.lastPort=...
##Server setion
server.lastFile=...
server.lastPort=...
something like that and each take cares of their own configuration properties.
Richard Sabey
Greenhorn

Joined: May 08, 2003
Posts: 3
Originally posted by Barry Gaunt:
Hi guys, - the client GUI will also run locally (that is, on the server) so you can still modify the server's parameter settings and store them (on the server).
[ April 27, 2003: Message edited by: Barry Gaunt ]

If I understand you correctly, I may start a client, then use the client's GUI to specify the server host's domain name and the port number (!), two bits of info which will be saved in suncertify.properties. Then I start the server. Then the client can proceed in the usual way. This seems backwards to me. I'd have thought it more sensible for the server to have the means to store its own domain name and port number in suncertify.properties, and for a client to read suncertify.properties. But, if all modification to suncertify.properties must be done using a GUI, and the server must not have a GUI, ...?


--<br />Richard Sabey, studying for SCJD
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Hi Richard,
the server must be able to start in a non-networked mode which has a non-networked client GUI.
That GUI can be used to set various server parameters and save them.
One of those parameters can be the port that the server will listen on for incoming connections if it is started in networking mode, another can be the location of the database file, if you want.
The server can be then shutdown from local mode and then restarted in networking mode, reading the new port and new location of its database from the configuration properties.
The remote networked client can be started up with a dialog "use default or set new server location" allowing the user to choose and save the server location and port. After that dialog finishes the GUI connects to the networked server. It doesn't have to be a dialog, but the client has to allow the user to change the server location before he connects to the server.
Disclaimer: This is my current thinking for my own project, I am not suggesting or recommending that you do the same.
[ May 16, 2003: Message edited by: Barry Gaunt ]
S. Ganapathy
Ranch Hand

Joined: Mar 26, 2003
Posts: 194
Hi all,

All configuration must be done via a GUI, and must be persistent betweenruns of the program. Such configuration must be stored in a file called suncertify.properties which must be located in the current working directory. You must not require manual editing of any files by the examiners.
Program must allow the user to specify the location of the database, and it must accept an indication that a local database is to be used, in which case, the networking must be bypassed entirely.

My question is what configuration details do you choose to persist in the suncertify.properties file.
By default, the GUI must display the local database option (current directory in the file chooser), if the user selects a different database location, then it will choose network server. default is local database, and will turn to standalone mode.
This question of showing database location arise only when the network client and GUI started. If the user runs in the server mode, server will run, and if the user runs in the 'alone' mode, standalone mode will run, and left as default, then all these options of choosing dalabase location will come into picture.
So in the server, I planned to do like this:
InetAddress ia = InetAddress.getLocalHost();
RemoteDBClient client = (RemoteDBClient) Naming.lookup("rmi://"
+ ia.getHostAddress() + "/Broker");
and in the client side, what ever the location the user chooses, it will be loaded with that ip address. This looks more dynamic both at the client and server. What do you say. Please look at my post host computers in LAN and try to provide your views for that. That means dynamically display available network computers in a list box, where client choose the database location of the rmi server. In worst case use File Chooser to select the location of the database. But here we should read only network computer name after "//" and before "/". But document your design decision.
Please provide your comments.
Thanks
Ganapathy
 
Don't get me started about those stupid light bulbs.
 
subject: NX: Questions about properties and security manager.
 
Similar Threads
NX: Configuring port number
NX: Question about suncertify.properties
suncertify.properties
Read file from Jar - Exception
NX:Some Questions(URLyBird1.3.2)