⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 server.java

📁 This an example showing how idl helping to build the abstract class for the java objects. As a resul
💻 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 + -