Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / December 2005

Tip: Looking for answers? Try searching our database.

possible use for  a properties file?

Thread view: 
Brandon McCombs - 23 Dec 2005 02:30 GMT
I am developing an LDAP client that will allow a user to search and
browse a directory server.  I currently have the main window spawn a
settings dialog that stores user auth. credentials into a class I
created to hold that type of data.  I then am attempting to pass an
instance of that credential clas around to use in various places in the
code when I have to authenticate for a directory context connection.
That worked until I started having to pass it between classes and I
figured there had to be a better way.

I started wondering whether this would be a good time to start learning
how to use a props file.  I'm currently already using a file though to
store my user credentials and that data gets put into my credential
class instance so I'd end up with the same problem I think of having to
share data across classes instead of just methods.

Is the only way to share this data to pass my credentials class instance
into the constructor of any class that needs access to it or is there a
cleaner way of doing that like a props file?

thanks for any tips
castillo.bryan@gmail.com - 23 Dec 2005 16:20 GMT
I would suggest having some type of Manager/Application class that all
of your UI classes have a reference to.  You would have to pass it to
every constructor that needed information. Chances are some class will
need something else from the application besides credentials.  When
that happens, you can change your Manager class so that those items can
be retrieved from it.
Hiran Chaudhuri - 25 Dec 2005 11:25 GMT
>I would suggest having some type of Manager/Application class that all
> of your UI classes have a reference to.  You would have to pass it to
> every constructor that needed information.

Instead of passing around all these references to the Manager/Application it
is easier to have the Manager/Application class be static (with all fields
and methods) or create a singleton pattern.

Just my 0.02?...


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.