FileDocCategorySizeDatePackage
ActivateTest.javaAPI DocExample1878Wed Apr 05 11:25:42 BST 2000None

ActivateTest

public class ActivateTest extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

    String serverName = argv[0];
    String codebaseURL = argv[1];
    try {
      // Make group for activatable object
      ActivationGroupDesc gdesc = new ActivationGroupDesc(null, null);
      ActivationGroupID gid =
       ActivationGroup.getSystem().registerGroup(gdesc);
      ActivationGroup.createGroup(gid, gdesc, 0);

      MarshalledObject activationArg = new MarshalledObject(serverName);
      
      System.out.println("Making server...");
      ThisOrThatServer server;
      if (argv.length > 2 && argv[2].equals("pre")) {
	server =
	  new ActivatableThisOrThatServerImpl(serverName, codebaseURL, 0);
      }
      else {
	ActivationDesc desc =
	  new ActivationDesc(gid,
			     "ActivatableThisOrThatServerImpl",
			     codebaseURL, activationArg);
	System.out.println("Registering server with activation server...");
	server = (ThisOrThatServer)Activatable.register(desc);
      }
      System.out.println("Registering with naming server as " + serverName + "...");
      LocateRegistry.getRegistry().rebind(serverName, server);
      System.out.println("Server registered with naming and activation");
    }
    catch (Exception e) {
      e.printStackTrace();
      System.out.println("Failed to register server.");
    }
    return;