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

📄 server.java

📁 java的客户端程序
💻 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 + -