FileDocCategorySizeDatePackage
ServerObjectImpl.javaAPI DocExample3437Thu Mar 30 15:37:12 BST 2000tuning.distrib.rmi

ServerObjectImpl

public class ServerObjectImpl extends UnicastRemoteObject implements ServerObject

Fields Summary
static String[]
forQuery
boolean
bool
int
number
String
string
Constructors Summary
public ServerObjectImpl()

  
public ServerObjectImpl(boolean useCodec)

    super(0, new CodecClientSocketFactory(), new CodecServerSocketFactory());
  
Methods Summary
public booleangetBoolean()

    return bool;
  
public intgetNumber()

    return number;
  
public static java.lang.String[]getQuery(java.lang.String obj, java.lang.String[] array)

    Vector v = new Vector();
    for (int i = 0; i < array.length; i++)
      if (array[i].indexOf(obj) != -1)
        v.addElement(array[i]);
    String[] result = new String[v.size()];
    for (int i = 0; i < result.length; i++)
      result[i] = (String) v.elementAt(i);
    return result;
  
public java.lang.String[]getQueryArray()

    return forQuery;
  
public java.lang.String[]getRemoteQuery(java.lang.String obj)

    return getQuery(obj, forQuery);
  
public java.lang.StringgetString()

    return string;
  
public static voidinit()

    System.out.println("Starting class initialization");
    forQuery = new String[26*26*26*5];
//    forQuery = new String[26*26*26*26];
    int idx = 0;
    StringBuffer sb = new StringBuffer(4);
    for (int i = 'a"; i <= 'e"; i++)
      for (int j = 'a"; j <= 'z"; j++)
        for (int k = 'a"; k <= 'z"; k++)
          for (int l = 'a"; l <= 'z"; l++)
          {
            sb.setLength(0);
            sb.append((char) i).append((char) j).append((char) k).append((char) l);
//            sb.append((char) j).append((char) k).append((char) l);
            forQuery[idx++] = sb.toString();
          }
    System.out.println("Finished class initialization");
  
public static voidmain(java.lang.String[] args)

    if(System.getSecurityManager() == null)
      System.setSecurityManager(new RMISecurityManager());
    try
    {
      System.out.println("Creating ServerObj");
      ServerObjectImpl serverobjectimpl = 
        args.length > 0 ? new ServerObjectImpl(true) : new ServerObjectImpl();
      System.out.println("Binding ServerObj in registry");
      Naming.rebind("/ServerObj", serverobjectimpl);
      System.out.println("ServerObj bound in registry");
      return;
    }
    catch(Exception exception)
    {
      System.out.println("ServerObj err: " + exception.getMessage());
      exception.printStackTrace();
      return;
    }
  
public voidsetAll(boolean flag, int i, java.lang.String s)

    bool = flag;
    number = i;
    string = s;
  
public voidsetBoolean(boolean flag)

    bool = flag;
  
public voidsetNumber(int i)

    number = i;
  
public voidsetString(java.lang.String s)

    string = s;