FileDocCategorySizeDatePackage
ActivatableThisOrThatServerImpl.javaAPI DocExample2662Wed Apr 05 11:25:42 BST 2000None

ActivatableThisOrThatServerImpl

public class ActivatableThisOrThatServerImpl extends Activatable implements ThisOrThatServer
ActivatableThisOrThatServerImpl: A remote implementation of ThisOrThatServer which allows for automated (re)activation of the server object. Example 3-5, Java Enterprise in a Nutshell, 1st ed. Author: Jim Farley

Fields Summary
private String
myName
Constructors Summary
public ActivatableThisOrThatServerImpl(String name, String src, int port)


  // "Regular" constructor used to create a "pre-activated" server
        
          
    // Register and export object (on random open port)
    super(src, new MarshalledObject(name), false, port);
    // Save name
    myName = name;

    System.out.println("Initialization constructor called.");
  
protected ActivatableThisOrThatServerImpl(ActivationID id, MarshalledObject arg)

    // Export this object with the given activation id, on random port
    super(id, 0);
    System.out.println("Activating a server");
    // Check incoming data passed in with activation request
    try {
      Object oarg = arg.get();
      if (oarg instanceof String) {
        myName = (String)oarg;
      }
      else {
        System.out.println("Unknown argument received on activation: " + oarg);
      }
    }
    catch(Exception e) {
      System.out.println("Error retrieving argument to activation");
    }

    System.out.println("(Re)activation constructor called.");
  
Methods Summary
private java.lang.StringdoSomething(java.lang.String what, java.lang.String todo)

    String result = myName + ": " + what + " " + todo + " is done.";
    return result;
  
public java.lang.StringdoThat(java.lang.String todo)

    String result = doSomething("that", todo);
    return result;
  
public java.lang.StringdoThis(java.lang.String todo)

    String result = doSomething("this", todo);
    return result;