📄 readme.txt
字号:
the Readme of exam3
1.Change to the directory that contains all the files .
2.Run the IDL-to-Java compiler, idlj, on the IDL file to create stubs and skeletons.
use command: idlj -fall MessageCenter.idl
then a package will produced. You will find there are 6 files.
(1)MessageCenterPOA.java
This abstract class is the stream-based server skeleton, providing basic CORBA functionality for the server. It extends org.omg.PortableServer.Serva nt , and implements the InvokeHandler interface and the MessageCenterOperations interface. The server class MessageCenterImpl extends MessageCenterPOA.
(2)_MessageCenterStub.java
This class is the client stub, providing CORBA functionality for the client. It extends org.CORBA.portable.ObjectImpl and implements the MessageCenter.java interface.
(3)MessageCenter.java
This interface contains the Java version of our IDL interface. The MessageCenter.java interface extends org.omg.CORBA.Object, providing standard CORBA object functionality. It also extends the MessageCenterOperations interface and org.omg.CORBA.portable.IDLEntity.
(4)MessageCenterHelper.java
This class provides auxiliary functionality, notably the narrow() method required to cast CORBA object references to their proper types.The Helper class is responsible for reading and writing the data type to CORBA streams, and inserting and extracting the data type from Anys. The Holder class delegates to the methods in the Helper class for reading and writing.
(5)MessageCenterHolder.java
This final class holds a public instance member of type MessageCenter. Whenever the IDL type is an out or an inout parameter, the Holder class is used. It provides operations for org.omg.CORBA.portable.OutputStream and org.omg.CORBA.portable.InputStream arguments, which CORBA allows, but which do not map easily to Java's semantics. The Holder class delegates to the methods in the Helper class for reading and writing. It implements org.omg.CORBA.portable.Streamable.
(6)MessageCenterOperations.java
This interface contains the methods register (String userName, String password), addItem (String uName, String uPsw, String sTime, String eTime, String uTask),queryItems (String uName, String uPsw, String sTime, String eTime),deleteItems (String userName, String userPSW, String num) and clearItems (String userName, String userPSW). The IDL-to-Java mapping puts all of the operations defined on the IDL interface into this file, which is shared by both the stubs and skeletons
3.Compile the .java files, including the stubs and skeletons (which are in the directory MessageCenterApp).
use command: javac *.java MessageCenterAPP/*.java
4.Start orbd.
use command: start orbd -ORBInitialPort portname
note:Note that portname is the port on which you want the name server to run.It should be bigger then 1024.
5.Start the server
use command: start java Server -ORBInitialPort portname -ORBInitialHost localhost
note : the portnumber is the same with the step4.
6.Run the client application
use command: java Client -ORBInitialPort portname -ORBInitialHost localhost
note : the portnumber is the same with the step4.
7.You can execute 4 methods:
(1) register:
You need to enter your name and password.
note:the name and password should be unique.
(2) showUsers:
This method can show all the users who haved registered.
(3) checkMessage:
You should enter your name and password to check all your messages .
(4)leaveMessage:
You can leave messages to anyone who have registered by entering your name ,the receiver's name and the message.
8.You can enter exit to exit the progrom.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -