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.
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.
Architecturally, this mode must use the database and GUI from the networked form, but must not use the network server code at all.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
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.
Originally posted by liqun chang:
1. I have two applications which is either Server or Client.For Server i will provide location of datafile and provide business method(book and search) and port. For Client,i will provide two selections(one is local mode or be called standalone mode,another is the network client).
2. When i running the application,either server mode or client(alone mode)use the same business methods,also the Sever and the Client that running in alone mode all use the same database system for access datafile.
3. When i use this command line:java -jar path_and_filename <server> then the Server running.When the Dialog of Server appear,i specify the location of datafile and prot.
When i use the command line :java -jar path_and_filename <alone> then the Client running.When the GUI of Client appear,i can specify either location of datafile or host and port of Sever.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
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.
The mode flag, if it is present, will be either "server" or "alone." If the mode flag is "server," it indicates that the application must run in server mode. If the mode flag is "alone," it indicates that the application must run in standalone mode. If the mode flag is not present, it indicates that the application must run in network client mode.
Originally posted by liqun chang:
1. Is the situation of"left out entirely" is the samething to"standalone mode",also java -jar filename <alone> is the samething to java -jar filename <empty> ,or any other means.
2. Whether The means of"in which case" represent in the case of standalone mode.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
public interface RemoteServices implements Services{}
public interface RemoteServices extends Remote
{
//no body because all of methods inherit Services interface
}
(because in ood i forget whether interface can implements interface.)
Regards, George
SCJP, SCJD, SCWCD, SCBCD
No, an interface cannot implement another interface. But that's not really what you're doing in the getServices method anyway. You're simply returning an object that implements the interface, which is OK.
Your server must be capable of handling multiple concurrent requests, and as part of this capability, must provide locking
functionality as specified in the interface provided above. You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server. Any attempt to lock a resource that is already locked should cause the current thread to give up the CPU,
consuming no CPU cycles until the desired resource becomes available.
public long lock(int recNo) throws RecordNotFoundException
{
//verify the recNo validity,if recNo isn't valid then throw RecordNotFoundException,
//if recNo is valid then go on.
isValidated(recNo);
//wrap recNo in Integer
//create a local variable cookie come from random creator
//wrap cookie in Long
synchronized(lockedMap)
{
while(lockMap.contain(lrecNo)
{
try
{
lockMap.wait();
}
catch(InterruptedExcption ie)
{
throw new DataAccessException("DataAccessException",ie);
}
}
lockMap.put(lrecNo,lockCookie);
lockMap.notifyAll();
}
return cookie;
}
public void unlock(int recNo, long cookie) throws RecordNotFoundException, SecurityException
{
//verify the recNo validity if not throw RecordNotFoundException
//if yes then go on
//wrap recNo in Integer
//wrap cookie in Long
//check if the cookie is same to lockMap.getValue()
//if not throw SecurityException;
//if yes then remove the lock and notify all waiting threads
}
public void isValidated(int recNo) throws RecordNotFoundException
{
//read head information of the database file.
//read all of the records to byte[].
//check whether recNo in the scope of the record numbers or is marked as valid
//if not throw RecordNotFoundException
//else do nothing
}
The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Originally posted by liqun chang:
1: From the bold fonts,i guess whether you suggest that simply returning an
ServicesImpl object that implements the Services interface ?
please you give me comment on this section.
Then i will change my idea a little more.
2: For business tier,i create Services interface that has three method(book,search and getServices()),i also create ServicesImpl class that implements Services interface.Both Services interface and ServicesImpl class is used for Server mode and alone mode.
3: For network,i create RemoteServices interface that has two method(book and search),i also create RemoteServicesImpl class that implements RemoteServices and extends UnicastRemoteObject.
4: In the RemoteServicesImpl,i will invoke ServicesImpl.getServices() static method and return a ServiceImpl object.When i invoke book method on
RemoteServices,i invoke really book method on ServicesImpl object.When i invoke search method on RemoteService,i invoke really search method on
ServicesImpl object.
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Originally posted by liqun chang:
Myself designpart 2)
Regards, George
SCJP, SCJD, SCWCD, SCBCD
Replace the word "snake" with "danger noodle" in all tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|