permaculture playing cards*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes SwingWorker & packaging 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 "SwingWorker & packaging" Watch "SwingWorker & packaging" New topic
Author

SwingWorker & packaging

Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
1).Should SwingWorker class be used.
Since it is not a part og swing. Is it ok if
I put it in the client folder and use it.
2). I am doing FBN and I have a FlightDAO which implements the remote
interface. I have a StandAloneDAO which extends FlightDAO.
I have done this to resuse code.
I have made this a part of the common/dao package.
But actually FlightDAO is required only on the server.Is it
okay to have it this way.
[ July 31, 2003: Message edited by: Akshay Sharma ]

Akshay Kumar Sharma<br />**********************<br />Good Better Best <br />Never Let it rest<br />For your good is better<br />and the better is the best
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Akshay
Should SwingWorker class be used.

I assume you talking about SwingWorker as in the SwingWorker example code used in the Swing tutorial.
You are not supposed to submit any code that is not your own work. Since you are supposed to subclass SwingWorker to do what you want anyway, I think you would be safer to just build your own class - it is not difficult for such an easy class.
StandAloneDAO which extends FlightDAO....

I think this means that even in local mode, your client will be calling the methods of the class that extends Remote (even though it is not using networking). Is this right?
Regards, Andrew


The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
Hi Andrew ,
I was talking abt this SwingWorker on;y.
Yaa even in Local mode internally StandAlone wil call methods of FlightDAO which extends Remore.
This is just for code reusability.I can ver well replicate the same code
in the StandAlone class.
******************
One more concern.
The assignment says that
"Writing Data Client
To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration. "
In the data class u have read / write etc etc why should these be implemented again. I am confused.
******************
Rgds
[ July 31, 2003: Message edited by: Akshay Sharma ]
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Akshay
Instructions: To connect with your server, you should create a client program. This implementation should include a class that implements the same public methods as the suncertify.db.Data class, although it will need different constructors to allow it to support the network configuration. "
Akshay: In the data class u have read / write etc etc why should these be implemented again. I am confused.

I think you are taking a bad interpretation of "implements".
What is needed to meet this requirement (in my opinion) is a class that has methods with the same name and equivalant functionality (via networking) as the public methods of Data class.
That is, inside my client application, I should be able to call a method named update() which has almost the same signature as the update method in Data class, that will perform the update by sending the update request through the network until it eventually reaches the Data class which will do the real update.
Does that make sense?
Regards, Andrew
Akshay Sharma
Ranch Hand

Joined: Mar 27, 2003
Posts: 42
Andrew just to reconfirm.
Currently I am having a FlightDAO which extends Remote
and a StandAlone DAO which extends FlightDAO.
Now if I modify StandAloneDAO not to extend FlightDAO and
also I put all methods in Data in StandAlone DAO then it should be fine
right.
I will move FlightDAO to server and StandAlone to client packages.
Curentl; they are in common/dao package
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11404
    
  81

Hi Akshay
Yes, this looks like a good plan.
Regards, Andrew
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SwingWorker & packaging
 
Similar Threads
Can I have two inner classes which extends SwingWorker class.
Problem with swing GUI due to lengthy code running in background.
Design for FBN.Pls review
Would you use SwingWorker in an applet? Problem with Java 1.5 browser plugin
transfer object