cajo-1.142

16:33:20.329 INFO  jd.cli.Main - Decompiling cajo-1.142.jar
package gnu.cajo;

class Cajo$1 {}

/* Location:
 * Qualified Name:     gnu.cajo.Cajo.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import gnu.cajo.invoke.Invoke;
import gnu.cajo.invoke.Remote;
import java.rmi.RemoteException;
import java.util.Vector;

public final class Cajo$Purger
  implements Invoke
{
  private static final long serialVersionUID = 1L;
  private final Object object;
  private transient Vector items;
  
  private Cajo$Purger(Object paramObject, Vector paramVector)
  {
    object = paramObject;
    items = paramVector;
  }
  
  public Object invoke(String paramString, Object paramObject)
    throws Exception
  {
    try
    {
      return Remote.invoke(object, paramString, paramObject);
    }
    catch (RemoteException localRemoteException)
    {
      if (items != null) {
        items.remove(object);
      }
      throw localRemoteException;
    }
  }
  
  Cajo$Purger(Object paramObject, Vector paramVector, Cajo.1 param1)
  {
    this(paramObject, paramVector);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.Cajo.Purger
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import gnu.cajo.invoke.RemoteInvoke;
import gnu.cajo.utils.Multicast;
import java.util.Vector;

public final class Cajo$Registrar
{
  private final Vector items;
  
  private Cajo$Registrar(Vector paramVector)
  {
    items = paramVector;
  }
  
  public Object multicast(Multicast paramMulticast)
    throws Exception
  {
    if (items.size() > 0) {
      item.invoke("register", items);
    }
    register((Vector)item.invoke("request", null));
    return null;
  }
  
  public void register(Vector paramVector)
  {
    if ((paramVector != null) && (paramVector.size() > 0)) {
      synchronized (items)
      {
        for (int i = 0; i < paramVector.size(); i++) {
          if (!items.contains(paramVector.elementAt(i))) {
            items.add(paramVector.elementAt(i));
          }
        }
      }
    }
  }
  
  public Vector request()
  {
    return items;
  }
  
  Cajo$Registrar(Vector paramVector, Cajo.1 param1)
  {
    this(paramVector);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.Cajo.Registrar
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import gnu.cajo.invoke.Invoke;
import gnu.cajo.invoke.Remote;
import java.lang.reflect.Method;

public final class Cajo$Searchable
  implements Invoke
{
  private static final long serialVersionUID = 1L;
  private final Object object;
  
  private Cajo$Searchable(Object paramObject)
  {
    object = paramObject;
  }
  
  public Object invoke(String paramString, Object paramObject)
    throws Exception
  {
    if (paramString == null)
    {
      Class[] arrayOfClass1 = (Class[])((Object[])(Object[])paramObject)[0];
      String[] arrayOfString1 = (String[])((Object[])(Object[])paramObject)[1];
      Class[][] arrayOfClass = (Class[][])((Object[])(Object[])paramObject)[2];
      Method[] arrayOfMethod = object.getClass().getMethods();
      String[] arrayOfString2 = new String[arrayOfMethod.length];
      Class[] arrayOfClass2 = new Class[arrayOfMethod.length];
      for (int i = 0; i < arrayOfMethod.length; i++)
      {
        arrayOfClass2[i] = arrayOfMethod[i].getReturnType();
        arrayOfString2[i] = arrayOfMethod[i].getName();
      }
      label275:
      for (i = 0; i < arrayOfString1.length; i++)
      {
        for (int j = 0; j < arrayOfString2.length; j++) {
          if ((arrayOfString2[j].equals(arrayOfString1[i])) && ((arrayOfClass1[i].equals(Void.TYPE)) || (Remote.autobox(arrayOfClass1[i]).isAssignableFrom(Remote.autobox(arrayOfClass2[j])))))
          {
            Class[] arrayOfClass3 = arrayOfMethod[j].getParameterTypes();
            if (arrayOfClass3.length != arrayOfClass[i].length) {
              break;
            }
            for (int k = 0; (k < arrayOfClass3.length) && (Remote.autobox(arrayOfClass3[k]).isAssignableFrom(arrayOfClass[i][k])); k++) {}
            break label275;
          }
        }
        return null;
      }
      return Boolean.TRUE;
    }
    return Remote.invoke(object, paramString, paramObject);
  }
  
  Cajo$Searchable(Object paramObject, Cajo.1 param1)
  {
    this(paramObject);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.Cajo.Searchable
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import gnu.cajo.invoke.Invoke;
import gnu.cajo.invoke.Remote;
import gnu.cajo.invoke.RemoteInvoke;
import gnu.cajo.utils.ItemServer;
import gnu.cajo.utils.Multicast;
import gnu.cajo.utils.extra.TransparentItemProxy;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.UnknownHostException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Vector;

public final class Cajo
  implements Grail
{
  private final Multicast multicast;
  private final Vector items = new Vector();
  private final Registrar registrar = new Registrar(items, null);
  
  protected void finalize()
    throws Throwable
  {
    Remote.shutdown();
    super.finalize();
  }
  
  public Cajo(int paramInt, String paramString1, String paramString2)
    throws UnknownHostException, IOException
  {
    Remote.config(paramString1, paramInt, paramString2, paramInt);
    multicast = new Multicast("224.0.23.162", paramInt);
    multicast.listen(registrar);
    multicast.announce(registrar, 255);
    ItemServer.bind(registrar, "registrar");
  }
  
  public void export(Object paramObject)
    throws IOException
  {
    items.add(new Remote(new Searchable(paramObject, null)));
    multicast.announce(registrar, 255);
  }
  
  public Object[] lookup(Class paramClass)
    throws Exception
  {
    if (!paramClass.isInterface()) {
      throw new IllegalArgumentException("class must be an interface");
    }
    Method[] arrayOfMethod = paramClass.getMethods();
    Class[] arrayOfClass = new Class[arrayOfMethod.length];
    String[] arrayOfString = new String[arrayOfMethod.length];
    Class[][] arrayOfClass1 = new Class[arrayOfMethod.length][];
    for (int i = 0; i < arrayOfMethod.length; i++)
    {
      arrayOfClass[i] = arrayOfMethod[i].getReturnType();
      arrayOfString[i] = arrayOfMethod[i].getName();
      arrayOfClass1[i] = arrayOfMethod[i].getParameterTypes();
    }
    Object[] arrayOfObject1 = { arrayOfClass, arrayOfString, arrayOfClass1 };
    ArrayList localArrayList = new ArrayList();
    Object[] arrayOfObject2 = items.toArray();
    for (int j = 0; j < arrayOfObject2.length; j++) {
      try
      {
        Object localObject = Remote.invoke(arrayOfObject2[j], null, arrayOfObject1);
        if (Boolean.TRUE.equals(localObject)) {
          localArrayList.add(arrayOfObject2[j]);
        }
      }
      catch (Exception localException)
      {
        items.removeElement(arrayOfObject2[j]);
      }
    }
    return localArrayList.toArray();
  }
  
  public Object proxy(Object paramObject, Class paramClass)
  {
    return TransparentItemProxy.getItem(new Purger(paramObject, items, null), new Class[] { paramClass });
  }
  
  public static Object proxy(Object paramObject)
  {
    HashSet localHashSet = new HashSet();
    for (Class localClass = paramObject.getClass(); localClass != null; localClass = localClass.getSuperclass()) {
      localHashSet.addAll(Arrays.asList(localClass.getInterfaces()));
    }
    return TransparentItemProxy.getItem(paramObject, (Class[])localHashSet.toArray(new Class[0]));
  }
  
  public void register(String paramString, int paramInt)
    throws Exception
  {
    Object localObject = Remote.getItem("//" + paramString + ':' + paramInt + "/registrar");
    if (items.size() > 0) {
      Remote.invoke(localObject, "register", items);
    }
    registrar.register((Vector)Remote.invoke(localObject, "request", null));
  }
  
  public static void main(String[] paramArrayOfString)
    throws Exception
  {
    InputStream localInputStream = Cajo.class.getResourceAsStream("/readme.txt");
    byte[] arrayOfByte = new byte[localInputStream.available()];
    localInputStream.read(arrayOfByte);
    localInputStream.close();
    System.out.println(new String(arrayOfByte));
  }
  
  public static final class Purger
    implements Invoke
  {
    private static final long serialVersionUID = 1L;
    private final Object object;
    private transient Vector items;
    
    private Purger(Object paramObject, Vector paramVector)
    {
      object = paramObject;
      items = paramVector;
    }
    
    public Object invoke(String paramString, Object paramObject)
      throws Exception
    {
      try
      {
        return Remote.invoke(object, paramString, paramObject);
      }
      catch (RemoteException localRemoteException)
      {
        if (items != null) {
          items.remove(object);
        }
        throw localRemoteException;
      }
    }
    
    Purger(Object paramObject, Vector paramVector, Cajo.1 param1)
    {
      this(paramObject, paramVector);
    }
  }
  
  public static final class Searchable
    implements Invoke
  {
    private static final long serialVersionUID = 1L;
    private final Object object;
    
    private Searchable(Object paramObject)
    {
      object = paramObject;
    }
    
    public Object invoke(String paramString, Object paramObject)
      throws Exception
    {
      if (paramString == null)
      {
        Class[] arrayOfClass1 = (Class[])((Object[])(Object[])paramObject)[0];
        String[] arrayOfString1 = (String[])((Object[])(Object[])paramObject)[1];
        Class[][] arrayOfClass = (Class[][])((Object[])(Object[])paramObject)[2];
        Method[] arrayOfMethod = object.getClass().getMethods();
        String[] arrayOfString2 = new String[arrayOfMethod.length];
        Class[] arrayOfClass2 = new Class[arrayOfMethod.length];
        for (int i = 0; i < arrayOfMethod.length; i++)
        {
          arrayOfClass2[i] = arrayOfMethod[i].getReturnType();
          arrayOfString2[i] = arrayOfMethod[i].getName();
        }
        label275:
        for (i = 0; i < arrayOfString1.length; i++)
        {
          for (int j = 0; j < arrayOfString2.length; j++) {
            if ((arrayOfString2[j].equals(arrayOfString1[i])) && ((arrayOfClass1[i].equals(Void.TYPE)) || (Remote.autobox(arrayOfClass1[i]).isAssignableFrom(Remote.autobox(arrayOfClass2[j])))))
            {
              Class[] arrayOfClass3 = arrayOfMethod[j].getParameterTypes();
              if (arrayOfClass3.length != arrayOfClass[i].length) {
                break;
              }
              for (int k = 0; (k < arrayOfClass3.length) && (Remote.autobox(arrayOfClass3[k]).isAssignableFrom(arrayOfClass[i][k])); k++) {}
              break label275;
            }
          }
          return null;
        }
        return Boolean.TRUE;
      }
      return Remote.invoke(object, paramString, paramObject);
    }
    
    Searchable(Object paramObject, Cajo.1 param1)
    {
      this(paramObject);
    }
  }
  
  public static final class Registrar
  {
    private final Vector items;
    
    private Registrar(Vector paramVector)
    {
      items = paramVector;
    }
    
    public Object multicast(Multicast paramMulticast)
      throws Exception
    {
      if (items.size() > 0) {
        item.invoke("register", items);
      }
      register((Vector)item.invoke("request", null));
      return null;
    }
    
    public void register(Vector paramVector)
    {
      if ((paramVector != null) && (paramVector.size() > 0)) {
        synchronized (items)
        {
          for (int i = 0; i < paramVector.size(); i++) {
            if (!items.contains(paramVector.elementAt(i))) {
              items.add(paramVector.elementAt(i));
            }
          }
        }
      }
    }
    
    public Vector request()
    {
      return items;
    }
    
    Registrar(Vector paramVector, Cajo.1 param1)
    {
      this(paramVector);
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.Cajo
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

public abstract interface Grail
{
  public abstract void export(Object paramObject)
    throws Exception;
  
  public abstract Object[] lookup(Class paramClass)
    throws Exception;
  
  public abstract Object proxy(Object paramObject, Class paramClass);
}

/* Location:
 * Qualified Name:     gnu.cajo.Grail
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import java.io.Serializable;

public abstract interface Service$Proxy
  extends Serializable
{
  public abstract void init(Object paramObject);
}

/* Location:
 * Qualified Name:     gnu.cajo.Service.Proxy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo;

import java.io.Serializable;

public abstract interface Service
{
  public abstract Object sendProxy(Proxy paramProxy)
    throws ClassNotFoundException;
  
  public abstract Proxy requestProxy()
    throws ClassNotFoundException;
  
  public abstract boolean isReal();
  
  public static abstract interface Proxy
    extends Serializable
  {
    public abstract void init(Object paramObject);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.Service
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.awt.Frame;
import java.awt.Graphics;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

final class Client$CFrame
  extends Frame
  implements WindowListener
{
  private static final long serialVersionUID = 1L;
  
  public Client$CFrame(String paramString)
  {
    super(paramString);
    addWindowListener(this);
  }
  
  public void update(Graphics paramGraphics)
  {
    paint(paramGraphics);
  }
  
  public void windowActivated(WindowEvent paramWindowEvent) {}
  
  public void windowDeactivated(WindowEvent paramWindowEvent) {}
  
  public void windowOpened(WindowEvent paramWindowEvent) {}
  
  public void windowIconified(WindowEvent paramWindowEvent) {}
  
  public void windowDeiconified(WindowEvent paramWindowEvent) {}
  
  public void windowClosing(WindowEvent paramWindowEvent)
  {
    dispose();
  }
  
  public void windowClosed(WindowEvent paramWindowEvent)
  {
    System.exit(0);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Client.CFrame
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.net.URL;
import java.rmi.MarshalledObject;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import javax.swing.JComponent;
import javax.swing.JFrame;

public final class Client
  extends Applet
{
  private static final long serialVersionUID = 1L;
  private static Object proxy;
  private Graphics gbuffer;
  private Image ibuffer;
  
  public String getAppletInfo()
  {
    return "cajo Proxy Applet, Copyright � 1999 by John Catherino";
  }
  
  public String[][] getParameterInfo()
  {
    return new String[][] { { "proxyName", "String", "Server's proxy's registry name" }, { "proxyPort", "Integer", "Server's proxy's port number" }, { "clientHost", "String", "Client's external host name" }, { "clientPort", "Integer", "Client's external port number" }, { "localPort", "Integer", "Client's internal port number" } };
  }
  
  public void init()
  {
    try
    {
      String str1 = getParameter("proxyName");
      String str2 = getParameter("proxyPort");
      String str3 = getParameter("clientHost");
      String str4 = getParameter("clientPort");
      String str5 = getParameter("localPort");
      int i = str2 != null ? Integer.parseInt(str2) : 1099;
      int j = str4 != null ? Integer.parseInt(str4) : 0;
      int k = str5 != null ? Integer.parseInt(str5) : 0;
      if (str1 == null) {
        str1 = "main";
      }
      Remote.config("0.0.0.0", k, str3, j);
      proxy = LocateRegistry.getRegistry(getCodeBase().getHost(), i);
      proxy = ((Registry)proxy).lookup(str1);
      proxy = Remote.invoke(proxy, "getProxy", null);
      if ((proxy instanceof MarshalledObject)) {
        proxy = ((MarshalledObject)proxy).get();
      }
      if (!(proxy instanceof RemoteInvoke)) {
        try
        {
          proxy = Remote.invoke(proxy, "init", new Remote(proxy));
        }
        catch (Exception localException2) {}
      }
      if ((proxy instanceof Component))
      {
        setLayout(new BorderLayout());
        add((Component)proxy);
        validate();
      }
    }
    catch (Exception localException1)
    {
      localException1.printStackTrace();
    }
  }
  
  public void start()
  {
    try
    {
      Remote.invoke(proxy, "start", null);
    }
    catch (Exception localException) {}
  }
  
  public void stop()
  {
    try
    {
      Remote.invoke(proxy, "stop", null);
    }
    catch (Exception localException) {}
  }
  
  public void destroy()
  {
    try
    {
      Remote.invoke(proxy, "destroy", null);
    }
    catch (Exception localException) {}
  }
  
  public void update(Graphics paramGraphics)
  {
    int i = getWidth();
    int j = getHeight();
    if ((ibuffer == null) || (ibuffer.getWidth(null) != i) || (ibuffer.getHeight(null) != j))
    {
      if (ibuffer != null) {
        ibuffer.flush();
      }
      ibuffer = createImage(i, j);
      if (gbuffer != null) {
        gbuffer.dispose();
      }
      gbuffer = ibuffer.getGraphics();
    }
    gbuffer.clearRect(0, 0, i, j);
    paint(gbuffer);
    paramGraphics.drawImage(ibuffer, 0, 0, null);
  }
  
  public static Frame frame(Component paramComponent, String paramString)
  {
    if ((paramComponent instanceof JComponent))
    {
      localObject = new JFrame(paramString);
      if ((paramComponent instanceof WindowListener)) {
        ((JFrame)localObject).addWindowListener((WindowListener)paramComponent);
      }
      ((JFrame)localObject).setDefaultCloseOperation(3);
      ((JFrame)localObject).getContentPane().add((JComponent)paramComponent);
      ((JFrame)localObject).pack();
      ((JFrame)localObject).setVisible(true);
      return (Frame)localObject;
    }
    Object localObject = new CFrame(paramString);
    if ((paramComponent instanceof WindowListener)) {
      ((Frame)localObject).addWindowListener((WindowListener)paramComponent);
    }
    ((Frame)localObject).add(paramComponent);
    ((Frame)localObject).pack();
    ((Frame)localObject).setVisible(true);
    return (Frame)localObject;
  }
  
  public static void main(String[] paramArrayOfString)
    throws Exception
  {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new NoSecurityManager());
    }
    if (paramArrayOfString.length > 0)
    {
      int i = paramArrayOfString.length > 1 ? Integer.parseInt(paramArrayOfString[1]) : 0;
      String str1 = paramArrayOfString.length > 2 ? paramArrayOfString[2] : null;
      int j = paramArrayOfString.length > 3 ? Integer.parseInt(paramArrayOfString[3]) : 0;
      String str2 = paramArrayOfString.length > 4 ? paramArrayOfString[4] : "0.0.0.0";
      Remote.config(str2, j, str1, i);
      proxy = Remote.getItem(paramArrayOfString[0]);
      proxy = Remote.invoke(proxy, "getProxy", null);
      if ((proxy instanceof MarshalledObject)) {
        proxy = ((MarshalledObject)proxy).get();
      }
      if (!(proxy instanceof RemoteInvoke)) {
        proxy = Remote.invoke(proxy, "init", new Remote(proxy));
      }
      if ((proxy instanceof Component))
      {
        String str3 = "cajo Proxy Viewer";
        try
        {
          str3 = System.getProperty("gnu.cajo.invoke.Client.title");
        }
        catch (Exception localException) {}
        proxy = frame((Component)proxy, str3 + " - " + paramArrayOfString[0]);
      }
    }
    else
    {
      new Loader();
    }
  }
  
  private static final class CFrame
    extends Frame
    implements WindowListener
  {
    private static final long serialVersionUID = 1L;
    
    public CFrame(String paramString)
    {
      super();
      addWindowListener(this);
    }
    
    public void update(Graphics paramGraphics)
    {
      paint(paramGraphics);
    }
    
    public void windowActivated(WindowEvent paramWindowEvent) {}
    
    public void windowDeactivated(WindowEvent paramWindowEvent) {}
    
    public void windowOpened(WindowEvent paramWindowEvent) {}
    
    public void windowIconified(WindowEvent paramWindowEvent) {}
    
    public void windowDeiconified(WindowEvent paramWindowEvent) {}
    
    public void windowClosing(WindowEvent paramWindowEvent)
    {
      dispose();
    }
    
    public void windowClosed(WindowEvent paramWindowEvent)
    {
      System.exit(0);
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Client
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.io.Serializable;

public abstract interface Invoke
  extends Serializable
{
  public abstract Object invoke(String paramString, Object paramObject)
    throws Exception;
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Invoke
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.awt.Component;
import java.awt.Container;

class JClient$1
  implements Runnable
{
  private final JClient this$0;
  
  JClient$1(JClient paramJClient)
  {
    this$0 = paramJClient;
  }
  
  public void run()
  {
    try
    {
      JClient.access$002(Remote.invoke(JClient.access$000(), "init", new Remote(JClient.access$000())));
      if ((JClient.access$000() instanceof Component))
      {
        this$0.getContentPane().add((Component)JClient.access$000());
        this$0.validate();
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.JClient.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.WindowListener;
import javax.swing.JFrame;

class JClient$2
  implements Runnable
{
  private final String[] val$args;
  
  JClient$2(String[] paramArrayOfString)
  {
    val$args = paramArrayOfString;
  }
  
  public void run()
  {
    try
    {
      JClient.access$002(Remote.invoke(JClient.access$000(), "init", new Remote(JClient.access$000())));
      if ((JClient.access$000() instanceof Component))
      {
        String str = "cajo Proxy Viewer";
        try
        {
          str = System.getProperty("gnu.cajo.invoke.JClient.title");
        }
        catch (Exception localException2) {}
        JFrame localJFrame = new JFrame(str + " - " + val$args[0]);
        if ((JClient.access$000() instanceof WindowListener)) {
          localJFrame.addWindowListener((WindowListener)JClient.access$000());
        }
        localJFrame.setDefaultCloseOperation(3);
        localJFrame.getContentPane().add((Component)JClient.access$000());
        localJFrame.pack();
        localJFrame.setVisible(true);
      }
    }
    catch (Exception localException1)
    {
      localException1.printStackTrace();
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.JClient.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.awt.Component;
import java.awt.Container;
import java.awt.event.WindowListener;
import java.io.PrintStream;
import java.net.URL;
import java.rmi.MarshalledObject;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
import javax.swing.JApplet;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;

public final class JClient
  extends JApplet
{
  private static final long serialVersionUID = 1L;
  private static Object proxy;
  
  public String getAppletInfo()
  {
    return "cajo Proxy JApplet, Copyright � 2006 John Catherino";
  }
  
  public String[][] getParameterInfo()
  {
    return new String[][] { { "proxyName", "String", "Server's proxy's registry name" }, { "proxyPort", "Integer", "Server's proxy's port number" }, { "clientHost", "String", "Client's external host name" }, { "clientPort", "Integer", "Client's external port number" }, { "localPort", "Integer", "Client's internal port number" } };
  }
  
  public void init()
  {
    try
    {
      String str1 = getParameter("proxyName");
      String str2 = getParameter("proxyPort");
      String str3 = getParameter("clientHost");
      String str4 = getParameter("clientPort");
      String str5 = getParameter("localPort");
      int i = str2 != null ? Integer.parseInt(str2) : 1099;
      int j = str4 != null ? Integer.parseInt(str4) : 0;
      int k = str5 != null ? Integer.parseInt(str5) : 0;
      if (str1 == null) {
        str1 = "main";
      }
      Remote.config("0.0.0.0", k, str3, j);
      proxy = LocateRegistry.getRegistry(getCodeBase().getHost(), i);
      proxy = ((Registry)proxy).lookup(str1);
      proxy = Remote.invoke(proxy, "getProxy", null);
      if ((proxy instanceof MarshalledObject)) {
        proxy = ((MarshalledObject)proxy).get();
      }
      if (!(proxy instanceof RemoteInvoke)) {
        SwingUtilities.invokeAndWait(new Runnable()
        {
          public void run()
          {
            try
            {
              JClient.access$002(Remote.invoke(JClient.proxy, "init", new Remote(JClient.proxy)));
              if ((JClient.proxy instanceof Component))
              {
                getContentPane().add((Component)JClient.proxy);
                validate();
              }
            }
            catch (Exception localException)
            {
              localException.printStackTrace();
            }
          }
        });
      }
    }
    catch (Exception localException)
    {
      localException.printStackTrace();
    }
  }
  
  public void start()
  {
    try
    {
      Remote.invoke(proxy, "start", null);
    }
    catch (Exception localException) {}
  }
  
  public void stop()
  {
    try
    {
      Remote.invoke(proxy, "stop", null);
    }
    catch (Exception localException) {}
  }
  
  public void destroy()
  {
    try
    {
      Remote.invoke(proxy, "destroy", null);
    }
    catch (Exception localException) {}
  }
  
  public static void main(String[] paramArrayOfString)
    throws Exception
  {
    if (System.getSecurityManager() == null) {
      System.setSecurityManager(new NoSecurityManager());
    }
    if (paramArrayOfString.length > 0)
    {
      int i = paramArrayOfString.length > 1 ? Integer.parseInt(paramArrayOfString[1]) : 0;
      String str1 = paramArrayOfString.length > 2 ? paramArrayOfString[2] : null;
      int j = paramArrayOfString.length > 3 ? Integer.parseInt(paramArrayOfString[3]) : 0;
      String str2 = paramArrayOfString.length > 4 ? paramArrayOfString[4] : "0.0.0.0";
      Remote.config(str2, j, str1, i);
      proxy = Remote.getItem(paramArrayOfString[0]);
      proxy = Remote.invoke(proxy, "getProxy", null);
      if ((proxy instanceof MarshalledObject)) {
        proxy = ((MarshalledObject)proxy).get();
      }
      if (!(proxy instanceof RemoteInvoke)) {
        SwingUtilities.invokeLater(new Runnable()
        {
          private final String[] val$args;
          
          public void run()
          {
            try
            {
              JClient.access$002(Remote.invoke(JClient.proxy, "init", new Remote(JClient.proxy)));
              if ((JClient.proxy instanceof Component))
              {
                String str = "cajo Proxy Viewer";
                try
                {
                  str = System.getProperty("gnu.cajo.invoke.JClient.title");
                }
                catch (Exception localException2) {}
                JFrame localJFrame = new JFrame(str + " - " + val$args[0]);
                if ((JClient.proxy instanceof WindowListener)) {
                  localJFrame.addWindowListener((WindowListener)JClient.proxy);
                }
                localJFrame.setDefaultCloseOperation(3);
                localJFrame.getContentPane().add((Component)JClient.proxy);
                localJFrame.pack();
                localJFrame.setVisible(true);
              }
            }
            catch (Exception localException1)
            {
              localException1.printStackTrace();
            }
          }
        });
      }
    }
    else
    {
      System.err.println("No source URL provided");
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.JClient
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.awt.Button;
import java.awt.Component;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Label;
import java.awt.TextField;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.rmi.MarshalledObject;
import java.util.LinkedList;
import javax.swing.JComponent;
import javax.swing.JFrame;

final class Loader
  extends Frame
  implements WindowListener, ActionListener
{
  private static final long serialVersionUID = 1L;
  private static final String TITLE = "cajo Proxy Viewer - ";
  private static Button load;
  private static TextField host;
  private static TextField port;
  private static TextField item;
  private static TextField status;
  private final LinkedList proxies = new LinkedList();
  private boolean main;
  private Graphics gbuffer;
  private Image ibuffer;
  
  private Loader(String paramString)
  {
    super(paramString);
  }
  
  Loader()
  {
    super("Load cajo proxy");
    addWindowListener(this);
    main = true;
    setLayout(null);
    setSize(250, 200);
    Label localLabel;
    add(localLabel = new Label("Host:"));
    localLabel.setBounds(20, 33, 35, 20);
    add(host = new TextField());
    host.setBounds(62, 33, 166, 20);
    add(localLabel = new Label("Port:"));
    localLabel.setBounds(20, 66, 35, 20);
    add(port = new TextField("1198"));
    port.setBounds(145, 66, 83, 20);
    add(localLabel = new Label("Item:"));
    localLabel.setBounds(20, 99, 35, 20);
    add(item = new TextField("main"));
    item.setBounds(62, 99, 166, 20);
    add(load = new Button("Load"));
    load.setBounds(83, 132, 83, 25);
    load.addActionListener(this);
    add(status = new TextField("ready to load proxy"));
    status.setBounds(1, 179, 248, 20);
    status.setEditable(false);
    status.setBackground(getBackground());
    setResizable(false);
    setVisible(true);
  }
  
  public void actionPerformed(ActionEvent paramActionEvent)
  {
    setCursor(Cursor.getPredefinedCursor(3));
    try
    {
      String str = "//" + host.getText().trim() + ':' + port.getText().trim() + '/' + item.getText().trim();
      status.setText("requesting proxy " + str);
      Object localObject1 = Remote.getItem(str);
      localObject1 = Remote.invoke(localObject1, "getProxy", null);
      if ((localObject1 instanceof MarshalledObject)) {
        localObject1 = ((MarshalledObject)localObject1).get();
      }
      if (!(localObject1 instanceof RemoteInvoke)) {
        localObject1 = Remote.invoke(localObject1, "init", new Remote(localObject1));
      }
      str = "cajo proxy - " + str;
      Object localObject2;
      if ((localObject1 instanceof JComponent))
      {
        localObject2 = new JFrame("cajo Proxy Viewer - " + str);
        if ((localObject1 instanceof WindowListener)) {
          ((JFrame)localObject2).addWindowListener((WindowListener)localObject1);
        }
        ((JFrame)localObject2).setDefaultCloseOperation(2);
        ((JFrame)localObject2).getContentPane().add((JComponent)localObject1);
        ((JFrame)localObject2).pack();
        ((JFrame)localObject2).setVisible(true);
      }
      else if ((localObject1 instanceof Component))
      {
        localObject2 = new Loader("cajo Proxy Viewer - " + str);
        ((Loader)localObject2).add((Component)localObject1);
        if ((localObject1 instanceof WindowListener)) {
          ((Loader)localObject2).addWindowListener((WindowListener)localObject1);
        }
        ((Loader)localObject2).addWindowListener((WindowListener)localObject2);
        ((Loader)localObject2).pack();
        ((Loader)localObject2).setVisible(true);
      }
      else
      {
        proxies.add(localObject1);
      }
      status.setText("proxy loaded");
    }
    catch (Exception localException)
    {
      status.setText(localException.toString());
      Toolkit.getDefaultToolkit().beep();
    }
    setCursor(Cursor.getPredefinedCursor(0));
  }
  
  public void update(Graphics paramGraphics)
  {
    int i = getWidth();
    int j = getHeight();
    if ((ibuffer == null) || (ibuffer.getWidth(null) != i) || (ibuffer.getHeight(null) != j))
    {
      if (ibuffer != null) {
        ibuffer.flush();
      }
      ibuffer = createImage(i, j);
      if (gbuffer != null) {
        gbuffer.dispose();
      }
      gbuffer = ibuffer.getGraphics();
    }
    gbuffer.clearRect(0, 0, i, j);
    paint(gbuffer);
    paramGraphics.drawImage(ibuffer, 0, 0, null);
  }
  
  public void windowOpened(WindowEvent paramWindowEvent) {}
  
  public void windowActivated(WindowEvent paramWindowEvent) {}
  
  public void windowIconified(WindowEvent paramWindowEvent) {}
  
  public void windowDeiconified(WindowEvent paramWindowEvent) {}
  
  public void windowDeactivated(WindowEvent paramWindowEvent) {}
  
  public void windowClosing(WindowEvent paramWindowEvent)
  {
    dispose();
  }
  
  public void windowClosed(WindowEvent paramWindowEvent)
  {
    if (main) {
      System.exit(0);
    }
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Loader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.security.Permission;

public final class NoSecurityManager
  extends SecurityManager
{
  public void checkPermission(Permission paramPermission) {}
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.NoSecurityManager
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

class Remote$1
  extends Thread
{
  public void run() {}
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Remote.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.net.Authenticator;
import java.net.PasswordAuthentication;

class Remote$2
  extends Authenticator
{
  private final String val$username;
  private final String val$password;
  
  Remote$2(String paramString1, String paramString2)
  {
    val$username = paramString1;
    val$password = paramString2;
  }
  
  protected PasswordAuthentication getPasswordAuthentication()
  {
    return new PasswordAuthentication(val$username, val$password.toCharArray());
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Remote.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.io.IOException;
import java.io.Serializable;
import java.net.Socket;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMISocketFactory;

final class Remote$RCSF
  implements RMIClientSocketFactory, Serializable
{
  private static final long serialVersionUID = 101058626L;
  private int port;
  private String host;
  
  private Remote$RCSF() {}
  
  private Remote$RCSF(String paramString, int paramInt)
  {
    host = paramString;
    port = paramInt;
  }
  
  public Socket createSocket(String paramString, int paramInt)
    throws IOException
  {
    Socket localSocket = RMISocketFactory.getDefaultSocketFactory().createSocket(host, port);
    return localSocket;
  }
  
  public boolean equals(Object paramObject)
  {
    return ((paramObject instanceof RCSF)) && (port == port);
  }
  
  public int hashCode()
  {
    return getClass().hashCode() ^ port;
  }
  
  Remote$RCSF(String paramString, int paramInt, Remote.1 param1)
  {
    this(paramString, paramInt);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Remote.RCSF
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMISocketFactory;

final class Remote$RSSF
  implements RMIServerSocketFactory
{
  private int port;
  private String host;
  private Remote.RCSF rcsf;
  
  private Remote$RSSF(String paramString, int paramInt)
  {
    host = paramString;
    port = paramInt;
  }
  
  public ServerSocket createServerSocket(int paramInt)
    throws IOException
  {
    ServerSocket localServerSocket = host == null ? RMISocketFactory.getDefaultSocketFactory().createServerSocket(port) : new ServerSocket(port, 50, InetAddress.getByName(host));
    if (host == null)
    {
      host = localServerSocket.getInetAddress().getHostAddress();
      System.setProperty("java.rmi.server.hostname", host);
    }
    if (port == 0) {
      port = localServerSocket.getLocalPort();
    }
    if (rcsf != null)
    {
      if (Remote.RCSF.access$000(rcsf) == null) {
        Remote.RCSF.access$002(rcsf, InetAddress.getLocalHost().getHostAddress());
      }
      if (Remote.RCSF.access$100(rcsf) == 0) {
        Remote.RCSF.access$102(rcsf, port);
      }
      Remote.access$202(host);
      Remote.access$302(port);
      Remote.access$402(Remote.RCSF.access$000(rcsf));
      Remote.access$502(Remote.RCSF.access$100(rcsf));
      rcsf = null;
    }
    return localServerSocket;
  }
  
  public boolean equals(Object paramObject)
  {
    return ((paramObject instanceof RSSF)) && (port == port);
  }
  
  public int hashCode()
  {
    return getClass().hashCode() ^ port;
  }
  
  Remote$RSSF(String paramString, int paramInt, Remote.1 param1)
  {
    this(paramString, paramInt);
  }
}

/* Location:
 * Qualified Name:     gnu.cajo.invoke.Remote.RSSF
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package gnu.cajo.invoke;

import gnu.cajo.utils.ItemServer;
import gnu.cajo.utils.extra.TransparentItemProxy;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.Authenticator;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.PasswordAuthentication;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.URL;
import java.net.UnknownHostException;
import java.rmi.MarshalledObject;
import java.rmi.Naming;
import java.rmi.NoSuchObjectException;
import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
import java.rmi.server.RMISocketFactory;
import java.rmi.server.RemoteServer;
import java.rmi.server.ServerNotActiveException;
import java.rmi.server.UnicastRemoteObject;
import java.rmi.server.Unreferenced;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;
import java.util.Vector;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

public final class Remote
  extends UnicastRemoteObject
  implements RemoteInvoke, Unreferenced
{
  private static String defaultServerHost;
  private static String defaultClientHost;
  private static int defau
1 2 3 4

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd