?? server.java
字號:
import org.omg.CORBA.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import java.io.*;
import ssd8exercise5creator.*;
import ssd8exercise5.*;
/**
* class <em>Server</em> represents the server for the SSD8
* Corba distributed to do list system. The server binds an to do list factory
* object using Corba naming. The to do list factory object is used to
* create new to do lists for each user that registers.
*
* @author iCarnegie, Inc (VP)
* @version 1.0
*/
public class Server {
public static void main( String [] args ) {
try {
/*
* Create and initialize the orb.
*/
ORB orb = ORB.init( args, null );
/*
* Create the TodolistCreator and register it
* with the orb.
*/
TodolistCreatorInterfaceImpl todolistCreator = new TodolistCreatorInterfaceImpl( args );
orb.connect( todolistCreator );
/*
* Get the root naming context.
*/
org.omg.CORBA.Object objRef = orb.resolve_initial_references( "NameService" );
NamingContext ncRef = NamingContextHelper.narrow( objRef );
/*
* Bind the object reference in naming.
*/
NameComponent nc = new NameComponent("TodolistCreator","");
System.out.println( "To Do List Creator is bound!" );
NameComponent path[] = { nc };
ncRef.rebind( path, todolistCreator );
/*
* Wait for client invocations.
*/
java.lang.Object sync = new java.lang.Object();
synchronized(sync) {
sync.wait();
}
} catch( Exception e ) {
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -