📄 syspropserver.java
字号:
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
class SysPropImpl extends SysPropPOA {
private ORB orb;
public void setORB(ORB orb_val)
{
orb = orb_val;
}
public String getProperty(String key)
{
System.out.println("调用"+key);
String s;
s = System.getProperty(key);
if(s==null)
{
s="null";
}
System.out.println(key+"="+s);
return s;
}
}
public class SysPropServer
{
public static void main(String args[])
{
try
{
ORB orb = ORB.init(args, null);
POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
rootpoa.the_POAManager().activate();
SysPropImpl sysPropImpl = new SysPropImpl();
sysPropImpl.setORB(orb);
org.omg.CORBA.Object ref = rootpoa.servant_to_reference(sysPropImpl);
SysProp href = SysPropHelper.narrow(ref);
org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
String name = "SysProp";
NameComponent path[] = ncRef.to_name(name);
ncRef.rebind(path,href);
System.out.println("SysPropServer ready and waiting ...... ");
orb.run();
}
catch(Exception e)
{
System.out.println("Error: " + e);
e.printStackTrace(System.out);
}
System.out.println("GetItServer Exiting ...");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -