liqun chang

Ranch Hand
+ Follow
since Nov 20, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by liqun chang

Hi George and Andrew:

Thanks you very much for helping me.recently i see my certify database.and
see i pass the scjd.

Test: Sun Certified Developer for the Java 2 Platform (310-027)
Date Taken: 2004-08-10 09:46:14.700
Registration Number: kbdsyd511f
Site: cn8x
Grade: P
Score: 365
Comment: This report shows the total number of points awarded for each section. The maximum number of points is 400, to pass you need a score of 320. Section Summary: Section Max Actual Points Points General Con: 100 93 Documentation: 70 56 OOD: 30 28 GUI: 40 28 Locking: 80 80 Data Store: 40 40 Network Server: 40 40 Total: 400 365


If you need to resubmit your assignment, return to the test history screen, press the 'Assignments' button, and follow the instructions.

I will prepare for scea test and find my work.Hope you and your family gook
lucky.
15 years ago
Hi:Hanna and Javini thanks for helping me.

Whether you tell me.I have Client(has main method) and Server(has main method )applications.I must create a App that has main method.In this method
i can do so:if(...){Client.main();} and else{Server.main();}.Am i right?
Hi George and Andrew and other experts:


When you submit your assignment, each part (client and server) must be executable using a command of this exact form:

java -jar <path_and_filename> [<mode>]
Your programs must not require use of command line arguments other than the single mode flag, which must be supported. 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.
The mode flag must be either "server", indicating the server program must run, "alone", indicating standalone mode, or left out entirely, in which case the network client and gui must run.



My question is:In my design,i have two applications Client(contains main method) Server(contains main method).Wether i must package these two applications into one jar file(runme.jar)and how could i do?

If i package Client in a jar file,i can do it(in manifest i specify Main-Class) and run well, then i package Server in anoter jar file(in manifest i specify Main-Class) an run well.But how can i package two applications in
only one jar file?

please you help me?
[ June 06, 2004: Message edited by: liqun chang ]
Hi:Andrew

as you say:


I am not completely sure what you are suggesting with your factory methods. You may be safe, but I am not 100% sure about it.

If the remainder of your client code does not have networked code in it, and you do not require the network to be running to get to the server, you may be OK.



you do not answer me really.because you use two "may be".then i am more
wildered.

I design the Factory and its implementation class FactoryImpl either for network or for local.
When i start the server,the FactoryImpl is the remote object that registry to rmiregistry.i can return Services either for remote or for local.

When i do not start the server,FactoryImpl is the local object that can return local Services.

Whether you suggest me to create Factory only in client side that return either remote Services or local Services?
Hi:Nicholas thanks for your suggestion.but however i have question.

1.I will create JDialog that has button1(connect) button2(save),field1(host)
field2(port) for network client.

a. When i start the program,the JDialog load the suncertify.properties file to JDialog,if i click button1(connect) then
connect to default host and port(previous saved in suncertify.properties).


b. if i click the button2(save) then will save the configuration to suncertify.properties,when i restart the program use the previous configuration.

c. In the same time if i enter host in field1 and enter port in field2 then click the button1(connect),then i will connect to the new host and port.

Whether my mention is right? please you help me.

2. Or i create JDialog that has loadButton,saveButton,hostField,portField.
when start program it must be load the previous configuration through suncertify.properties file that saved int the disk.If i save the new configuration ,the program must be restarted for using the configuration.
Is this right?
[ May 20, 2004: Message edited by: liqun chang ]
Hi:George and Andrew and other experts.

the instruction say.


Your programs must not require use of command line arguments other than the single mode flag, which must be supported. 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.My question is the mean of the bold font.Whether its mean is All configuration must be done via a GUI,and All configuration must be persistent between runs of the program.

2.If yes.i will create FileInputStream and FileOutputStream and use System.getProperty("user.dir") and Property class.then load and store the
suncertify.properties file.Whether my method is right?

3.for "persistent" whether its meaning that it must not be changed between
runs of program?

4.From instruction of sun.I will create JDialog object to store and load
suncertify.properties file.but only after the finishing of store file and restart the program,the suncertify.properties can take effect.Is this right?
whether you have other method to do this?
Hi:Andrew let my try to answer your question above.
The equals() method is used to see whether value is equality.and the "=="is to see whether the reference point to same object.Am i right?

Andrew: the instruction say:


Non-Networked Mode
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.
The operating mode is selected using the single command line argument that is permitted. Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.



as my mention previous,my Factory interface implements Remote interface,
and my FactoryImpl class implements Factory and extends UnicastRemoteObject
so do i can reduce the remote object that registrys rmiregistry.

1.My question is whehter i can use the FactoryImpl(remote object)for creating local business object(ServicesImpl) and remote business object (RemoteServicesImpl)and return them to client?I don't know whether you understand what i say?
Because Factory implements Remote and its implementation class FactoryImpl
is remote object,so i am a little confusion whether it can used for local client?
Whether Factory and FactoryImpl is network server code?

please you help me.
[ May 19, 2004: Message edited by: liqun chang ]
Hi:Andrew and Javini.thanks for responding.
Andrew: according to your suggestion.I will do as below.

1.I will create Services interface(contains book and search)and throws IOException and RecordNotFoundException,its implementation class ServicesImpl has Data instance.These two classes(Services and ServicesImpl)
are used for alone client.

I will create RemoteServices interface implements Services and Remote,this is the good trick.RemoteServices has two methods in it(book and search).So do we can be simple,because the method that throws IOException can also thrwos RemoteExceptions.RemoteServices's implementation class is RemoteServicesImpl that do specified work.These two classes(RemoteServices and RemoteServicesImpl) are used for network client.

Because my design is:for network,each client has a remote object(RemoteServicesImpl instance) and each remote object has a Data instance.
so i require a Factory interface(has getConnection() that return RemoteServicesImpl object).the Factory interface implements Remote and
its implementation class is FactoryImpl.So do we have only one remote object
registry to rmiregistry.

2.From previous mention.I will create local(for client either alone client or network client) ServicesFactory and create method getServices(String location).but so do,it is a little not seem to the full factory pattern.




3.So my question is,whehter previous thinking is right? If have any questions please you tell me? thanks.
[ May 18, 2004: Message edited by: liqun chang ]
Hi:George and Andrew and other experts:

in other thread of this forum,Ken Krebs say:


Networking
========
Choosing RMI seemed to be a total no-brainer as it is so simple compared to using sockets. My entire networking code compiles to only 5,408 bytes of code. It consists of 2 classes, RemoteServices and RemoteServicesImpl. RemoteServices is an interface that extends Services and Remote. It has no body. This is possible because all the Services methods throw IOException and can therefore also throw a RemoteException. It's a nice trick that keeps things simple. RemoteServicesImpl extends UnicastRemoteObject and implements RemoteServices. It has 2 parts, the implementation of RemoteServices (i.e. the 2 Services methods) and static getServices methods that allow the clients to get a Services instance that is either an RMI server for the Network Server application functionality or its stub for the Network Client application functionality. The Services method implementations simply delegate all work to the ServicesImpl singleton. Since all of the locking occurs in a single method call in the Network Server's JVM, there is no need to worry about the RMI connection dieing in the middle of a locking operation


my question is:whether the interface can extends multiple interfaces.

for example:

public interface A
{
}

public interface B
{
}
public interface C extends A,B
{
}
Is this right?
Hi:George,Andrew and Philippe:
1.For network client:I create Factory and FactoryImpl to create remote objects.RemoteServices and its implementation class RemoteServicesImpl contains book and search method.The RemoteServicesImpl contains Data instance.FactoryImpl contains getConnection() to return the RemoteServicesImpl to network client.each network client contains a new RemoteServicesImpl instance,each RemoteServicesImpl contains a new Data instance.
2.For alone client:I create Services interface and its implementation class
ServicesImpl that contains book and search.The ServicesImpl contains Data instance.the alone client invokes directly the ServicesImpl's method.
3.I already create the class correctly and test work well.For testing,i create aloneClient and networkClient for local and remote test.They work correctly.
My question is:Whether i can create Clienta and Clientn class for accessing database?
Whether i must be create only one client for alone or network depending the
command line parameter ?if yes,how can i implements it?
thanks.
[ May 13, 2004: Message edited by: liqun chang ]
Hi:George and Andrew
I have finished my Data class and test it run better.
my question is :
I create DataSchema class and get the metadata of the database.and i put this in Data class.I also create ServicesImpl class for booking and searching.
whether i can create public method in Data class(public DataSchema getDataSchema())and used in ServicesImpl? also in Data class,whether i can create myself public method but the methods that sun provides?
please give me some suggestions.
Hi Vatili:my the RandomAccessFile is the static member for all Data instances. because i catch a cold,sorry for reply you now.
Hi Satish:thanks for your suggestion.because you said my update() is right.
So i change the WeakHashMap to HashMap,the result is ok.
But another question appears:How could i deal with the client crash?
Hi George,as you can see.

From this test,i finally get the result of owner field,but they are not
2000,but from 1800~1860,and the stack trace display the security exception
? why can result in this situation?