📄 server.java
字号:
import org.omg.PortableServer.*;
import java.io.*;
public class Server{
public static void main(String[] args){
try{
//Initialize the ORB
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
//Create the servant
Data.FileServerImpl fileAccessImpl = new Data.FileServerImpl();
//Initialize the root POA
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootPOA.the_POAManager().activate();
//Generate object reference
org.omg.CORBA.Object obj = rootPOA.servant_to_reference(fileAccessImpl);
//Convert the object reference to a string and display it
//System.out.println(orb.object_to_string(obj));
FileWriter editor = new FileWriter("ior");
editor.write(orb.object_to_string(obj));
editor.close();
//Wait for incoming requests
orb.run();
} catch (Exception e) {e.printStackTrace();}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -