org.eclipse.jem.proxy_2.0.400.v201101101900

ate Bundle bundle;
  private Bundle ideBundle;
  
  public IDEProxyFactoryRegistry$IDESpecialClassLoader(URL[] urls, Bundle bundle)
  {
    super(urls, null);
    ideBundle = ProxyPlugin.getPlugin().getBundle();
    this.bundle = bundle;
  }
  
  public IDEProxyFactoryRegistry$IDESpecialClassLoader(URL[] urls)
  {
    this(urls, null);
  }
  
  protected Class findClass(String name)
    throws ClassNotFoundException
  {
    try
    {
      return ideBundle.loadClass(name);
    }
    catch (ClassNotFoundException localClassNotFoundException1)
    {
      if (bundle != null) {
        try
        {
          return bundle.loadClass(name);
        }
        catch (ClassNotFoundException localClassNotFoundException2) {}
      }
    }
    return super.findClass(name);
  }
  
  public URL findResource(String name)
  {
    URL r = ideBundle.getResource(name);
    if ((r == null) && (bundle != null)) {
      r = bundle.getResource(name);
    }
    return r != null ? r : super.findResource(name);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry.IDESpecialClassLoader
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jem.internal.proxy.common.IVMServer;
import org.eclipse.jem.internal.proxy.core.BaseProxyFactoryRegistry;
import org.eclipse.jem.internal.proxy.core.IBeanProxy;
import org.eclipse.jem.internal.proxy.core.ICallbackRegistry;
import org.eclipse.jem.internal.proxy.core.ProxyPlugin;
import org.osgi.framework.Bundle;

public class IDEProxyFactoryRegistry
  extends BaseProxyFactoryRegistry
  implements IVMServer
{
  public static final String IDE_REGISTRY_TYPE_ID = "org.eclipse.jem.IDE";
  protected String fName;
  protected ClassLoader fClassLoader;
  protected IDECallbackRegistry fCallbackRegistry;
  List shutdownRunnables;
  
  private static class IDESpecialClassLoader
    extends URLClassLoader
  {
    private Bundle bundle;
    private Bundle ideBundle;
    
    public IDESpecialClassLoader(URL[] urls, Bundle bundle)
    {
      super(null);
      ideBundle = ProxyPlugin.getPlugin().getBundle();
      this.bundle = bundle;
    }
    
    public IDESpecialClassLoader(URL[] urls)
    {
      this(urls, null);
    }
    
    protected Class findClass(String name)
      throws ClassNotFoundException
    {
      try
      {
        return ideBundle.loadClass(name);
      }
      catch (ClassNotFoundException localClassNotFoundException1)
      {
        if (bundle != null) {
          try
          {
            return bundle.loadClass(name);
          }
          catch (ClassNotFoundException localClassNotFoundException2) {}
        }
      }
      return super.findClass(name);
    }
    
    public URL findResource(String name)
    {
      URL r = ideBundle.getResource(name);
      if ((r == null) && (bundle != null)) {
        r = bundle.getResource(name);
      }
      return r != null ? r : super.findResource(name);
    }
  }
  
  public static ClassLoader createSpecialLoader(String pluginName, URL[] otherURLs)
  {
    Bundle bundle = pluginName != null ? Platform.getBundle(pluginName) : null;
    
    URL[] mustHaveUrls = ProxyPlugin.getPlugin().urlLocalizeAllFromBundleAndFragments(ProxyPlugin.getPlugin().getBundle(), "vm/remotevm.jar");
    
    URL[] urls = (URL[])null;
    if (otherURLs != null)
    {
      urls = new URL[otherURLs.length + mustHaveUrls.length];
      System.arraycopy(mustHaveUrls, 0, urls, 0, mustHaveUrls.length);
      System.arraycopy(otherURLs, 0, urls, mustHaveUrls.length, otherURLs.length);
    }
    else
    {
      urls = mustHaveUrls;
    }
    return bundle != null ? new IDESpecialClassLoader(urls, bundle) : new IDESpecialClassLoader(urls);
  }
  
  public IDEProxyFactoryRegistry(String aName, ClassLoader loader)
  {
    super("org.eclipse.jem.IDE");
    fName = aName;
    fClassLoader = loader;
  }
  
  ClassLoader getPluginClassLoader()
  {
    return fClassLoader;
  }
  
  protected void registryTerminated(boolean wait)
  {
    List runnables = null;
    synchronized (this)
    {
      runnables = shutdownRunnables;
      shutdownRunnables = null;
    }
    if (runnables != null) {
      for (Iterator itr = runnables.iterator(); itr.hasNext();) {
        try
        {
          ((Runnable)itr.next()).run();
        }
        catch (RuntimeException e)
        {
          e.printStackTrace();
        }
      }
    }
  }
  
  Class loadClass(String aClassName)
    throws ClassNotFoundException, ExceptionInInitializerError, LinkageError
  {
    return fClassLoader.loadClass(aClassName);
  }
  
  public ICallbackRegistry getCallbackRegistry()
  {
    if (fCallbackRegistry == null) {
      fCallbackRegistry = new IDECallbackRegistry(this);
    }
    return fCallbackRegistry;
  }
  
  IBeanProxy getBeanProxy(Class returnType, Object bean)
  {
    IDEStandardBeanTypeProxyFactory proxyFactory = (IDEStandardBeanTypeProxyFactory)getBeanTypeProxyFactory();
    if (!returnType.isPrimitive()) {
      return IDEStandardBeanProxyFactory.createBeanProxy(this, bean);
    }
    if (returnType == Integer.TYPE) {
      return intType.newBeanProxy(bean);
    }
    if (returnType == Boolean.TYPE) {
      return booleanType.newBeanProxy(bean);
    }
    if (returnType == Float.TYPE) {
      return floatType.newBeanProxy(bean);
    }
    if (returnType == Long.TYPE) {
      return longType.newBeanProxy(bean);
    }
    if (returnType == Short.TYPE) {
      return shortType.newBeanProxy(bean);
    }
    if (returnType == Double.TYPE) {
      return doubleType.newBeanProxy(bean);
    }
    if (returnType == Byte.TYPE) {
      return byteType.newBeanProxy(bean);
    }
    if (returnType == Character.TYPE) {
      return charType.newBeanProxy(bean);
    }
    throw new RuntimeException("Unknown primitive type " + returnType.getName());
  }
  
  public synchronized void addShutdownListener(Runnable runnable)
  {
    if (shutdownRunnables == null) {
      shutdownRunnables = new ArrayList();
    } else if (shutdownRunnables.contains(runnable)) {
      return;
    }
    shutdownRunnables.add(runnable);
  }
  
  public synchronized void removeShutdownListener(Runnable runnable)
  {
    if (shutdownRunnables != null) {
      shutdownRunnables.remove(runnable);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEProxyFactoryRegistry
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;
import org.eclipse.jem.internal.proxy.core.ProxyLaunchSupport.LaunchInfo;

class IDERegistration$1
  implements ISafeRunnable
{
  final IDERegistration this$0;
  private final IConfigurationContributor[] val$contribs;
  private final int val$ii;
  private final ProxyLaunchSupport.LaunchInfo val$launchInfo;
  
  IDERegistration$1(IDERegistration paramIDERegistration, IConfigurationContributor[] paramArrayOfIConfigurationContributor, int paramInt, ProxyLaunchSupport.LaunchInfo paramLaunchInfo)
  {
    this$0 = paramIDERegistration;val$contribs = paramArrayOfIConfigurationContributor;val$ii = paramInt;val$launchInfo = paramLaunchInfo;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$contribs[val$ii].initialize(val$launchInfo.getConfigInfo());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDERegistration.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;
import org.eclipse.jem.internal.proxy.remote.LocalFileConfigurationContributorController;

class IDERegistration$2
  implements ISafeRunnable
{
  final IDERegistration this$0;
  private final IConfigurationContributor[] val$contribs;
  private final int val$ii;
  private final LocalFileConfigurationContributorController val$controller;
  
  IDERegistration$2(IDERegistration paramIDERegistration, IConfigurationContributor[] paramArrayOfIConfigurationContributor, int paramInt, LocalFileConfigurationContributorController paramLocalFileConfigurationContributorController)
  {
    this$0 = paramIDERegistration;val$contribs = paramArrayOfIConfigurationContributor;val$ii = paramInt;val$controller = paramLocalFileConfigurationContributorController;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$contribs[val$ii].contributeClasspaths(val$controller);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDERegistration.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.jem.internal.proxy.core.BaseProxyFactoryRegistry;
import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;

class IDERegistration$3
  implements ISafeRunnable
{
  final IDERegistration this$0;
  private final IConfigurationContributor[] val$contribs;
  private final int val$ii;
  private final BaseProxyFactoryRegistry val$registry;
  
  IDERegistration$3(IDERegistration paramIDERegistration, IConfigurationContributor[] paramArrayOfIConfigurationContributor, int paramInt, BaseProxyFactoryRegistry paramBaseProxyFactoryRegistry)
  {
    this$0 = paramIDERegistration;val$contribs = paramArrayOfIConfigurationContributor;val$ii = paramInt;val$registry = paramBaseProxyFactoryRegistry;
  }
  
  public void handleException(Throwable exception) {}
  
  public void run()
    throws Exception
  {
    val$contribs[val$ii].contributeToRegistry(val$registry);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDERegistration.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import java.net.URL;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.ISafeRunnable;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jem.internal.proxy.core.BaseProxyFactoryRegistry;
import org.eclipse.jem.internal.proxy.core.IConfigurationContributor;
import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
import org.eclipse.jem.internal.proxy.core.ProxyLaunchSupport;
import org.eclipse.jem.internal.proxy.core.ProxyLaunchSupport.LaunchInfo;
import org.eclipse.jem.internal.proxy.ide.awt.IDERegisterAWT;
import org.eclipse.jem.internal.proxy.remote.LocalFileConfigurationContributorController;

public class IDERegistration
{
  private String pluginName;
  
  public static ProxyFactoryRegistry startAnImplementation(IConfigurationContributor[] contributors, boolean attachAWT, IProject project, String vmName, String pluginName, IProgressMonitor pm)
    throws CoreException
  {
    IDERegistration idereg = new IDERegistration(pluginName);
    return idereg.startImplementation(contributors, attachAWT, project, vmName, pm);
  }
  
  public IDERegistration() {}
  
  private IDERegistration(String pluginName)
  {
    this.pluginName = pluginName;
  }
  
  public ProxyFactoryRegistry startImplementation(IConfigurationContributor[] contributors, boolean attachAWT, IProject project, String vmName, IProgressMonitor pm)
    throws CoreException
  {
    URL[] classPaths = (URL[])null;
    IJavaProject javaProject = null;
    if (project != null)
    {
      javaProject = JavaCore.create(project);
      
      classPaths = ProxyLaunchSupport.convertStringPathsToURL(JavaRuntime.computeDefaultRuntimeClassPath(javaProject));
    }
    else
    {
      classPaths = new URL[0];
    }
    IJavaProject jp = javaProject;
    
    ProxyLaunchSupport.LaunchInfo launchInfo = new ProxyLaunchSupport.LaunchInfo();
    contributors = ProxyLaunchSupport.fillInLaunchInfo(contributors == null ? ProxyLaunchSupport.EMPTY_CONFIG_CONTRIBUTORS : contributors, launchInfo, jp != null ? jp.getElementName() : null);
    LocalFileConfigurationContributorController controller = new LocalFileConfigurationContributorController(classPaths, new URL[3][], launchInfo);
    IConfigurationContributor[] contribs = contributors;
    for (int i = 0; i < contributors.length; i++)
    {
      int ii = i;
      
      SafeRunner.run(new ISafeRunnable()
      {
        private final IConfigurationContributor[] val$contribs;
        private final int val$ii;
        private final ProxyLaunchSupport.LaunchInfo val$launchInfo;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$contribs[val$ii].initialize(val$launchInfo.getConfigInfo());
        }
      });
    }
    for (int i = 0; i < contributors.length; i++)
    {
      int ii = i;
      
      SafeRunner.run(new ISafeRunnable()
      {
        private final IConfigurationContributor[] val$contribs;
        private final int val$ii;
        private final LocalFileConfigurationContributorController val$controller;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$contribs[val$ii].contributeClasspaths(val$controller);
        }
      });
    }
    classPaths = controller.getFinalClasspath();
    
    BaseProxyFactoryRegistry registry = (BaseProxyFactoryRegistry)createIDEProxyFactoryRegistry(vmName, pluginName, classPaths);
    ProxyLaunchSupport.performExtensionRegistrations(registry, launchInfo);
    for (int i = 0; i < contribs.length; i++)
    {
      int ii = i;
      
      SafeRunner.run(new ISafeRunnable()
      {
        private final IConfigurationContributor[] val$contribs;
        private final int val$ii;
        private final BaseProxyFactoryRegistry val$registry;
        
        public void handleException(Throwable exception) {}
        
        public void run()
          throws Exception
        {
          val$contribs[val$ii].contributeToRegistry(val$registry);
        }
      });
    }
    return registry;
  }
  
  public static ProxyFactoryRegistry createIDEProxyFactoryRegistry(String aName, String aPluginName, URL[] otherURLs)
  {
    IDEProxyFactoryRegistry registry = 
      new IDEProxyFactoryRegistry(aName, IDEProxyFactoryRegistry.createSpecialLoader(aPluginName, otherURLs));
    initRegistry(registry);
    return registry;
  }
  
  public static ProxyFactoryRegistry createIDEProxyFactoryRegistry(String aName, ClassLoader loader)
  {
    IDEProxyFactoryRegistry registry = new IDEProxyFactoryRegistry(aName, loader);
    initRegistry(registry);
    return registry;
  }
  
  private static void initRegistry(IDEProxyFactoryRegistry registry)
  {
    new IDEStandardBeanTypeProxyFactory(registry);
    new IDEStandardBeanProxyFactory(registry);
    new IDEMethodProxyFactory(registry);
    
    IDERegisterAWT.registerAWT(registry);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDERegistration
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.jem.internal.proxy.core.INumberBeanProxy;

final class IDEShortClassBeanTypeProxy
  extends IDENumberBeanTypeProxy
{
  protected IDEShortClassBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass)
  {
    super(aRegistry, aClass, new Short((short)0));
  }
  
  INumberBeanProxy createShortBeanProxy(Short aShort)
  {
    return new IDENumberBeanProxy(fProxyFactoryRegistry, aShort, this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEShortClassBeanTypeProxy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.jem.internal.proxy.core.INumberBeanProxy;

final class IDEShortTypeBeanTypeProxy
  extends IDEPrimitiveBeanTypeProxy
{
  protected IDEShortTypeBeanTypeProxy(IDEProxyFactoryRegistry aRegistry, Class aClass)
  {
    super(aRegistry, aClass);
  }
  
  INumberBeanProxy createShortBeanProxy(short aShort)
  {
    return new IDENumberBeanProxy(fProxyFactoryRegistry, new Short(aShort), this);
  }
  
  int getPrimitiveType()
  {
    return 8;
  }
  
  protected IIDEBeanProxy newBeanProxy(Object anObject)
  {
    Number n = (anObject instanceof Character) ? new Short((short)((Character)anObject).charValue()) : (Number)anObject;
    return new IDENumberBeanProxy(fProxyFactoryRegistry, n, this);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEShortTypeBeanTypeProxy
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import org.eclipse.core.runtime.Status;
import org.eclipse.jem.internal.proxy.common.IVMServer;
import org.eclipse.jem.internal.proxy.core.IArrayBeanProxy;
import org.eclipse.jem.internal.proxy.core.IBeanProxy;
import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy;
import org.eclipse.jem.internal.proxy.core.IBooleanBeanProxy;
import org.eclipse.jem.internal.proxy.core.ICharacterBeanProxy;
import org.eclipse.jem.internal.proxy.core.IExpression;
import org.eclipse.jem.internal.proxy.core.IIntegerBeanProxy;
import org.eclipse.jem.internal.proxy.core.INumberBeanProxy;
import org.eclipse.jem.internal.proxy.core.IStandardBeanProxyFactory;
import org.eclipse.jem.internal.proxy.core.IStringBeanProxy;
import org.eclipse.jem.internal.proxy.core.ProxyFactoryRegistry;
import org.eclipse.jem.internal.proxy.core.ProxyPlugin;
import org.eclipse.jem.internal.proxy.core.ThrowableProxy;
import org.eclipse.jem.internal.proxy.initParser.InitializationStringParser;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.osgi.framework.Bundle;

public class IDEStandardBeanProxyFactory
  implements IStandardBeanProxyFactory
{
  protected IDEProxyFactoryRegistry fRegistry;
  protected IDEStandardBeanTypeProxyFactory fBeanTypeProxyFactory;
  private IBeanProxy ivmServerProxy;
  
  static IIDEBeanProxy createBeanProxy(ProxyFactoryRegistry aRegistry, Object anObject)
  {
    return ((IDEStandardBeanProxyFactory)aRegistry.getBeanProxyFactory()).createIDEBeanProxyWith(anObject);
  }
  
  IDEStandardBeanProxyFactory(IDEProxyFactoryRegistry aRegistry)
  {
    fRegistry = aRegistry;
    fRegistry.registerBeanProxyFactory(this);
    fBeanTypeProxyFactory = ((IDEStandardBeanTypeProxyFactory)aRegistry.getBeanTypeProxyFactory());
    ivmServerProxy = fRegistry.getBeanProxy(IVMServer.class, fRegistry);
  }
  
  public IStringBeanProxy createBeanProxyWith(String aString)
  {
    return fBeanTypeProxyFactory.stringClass.createStringBeanProxy(aString);
  }
  
  public INumberBeanProxy createBeanProxyWith(float aFloat)
  {
    return fBeanTypeProxyFactory.floatType.createFloatBeanProxy(aFloat);
  }
  
  public INumberBeanProxy createBeanProxyWith(short aShort)
  {
    return fBeanTypeProxyFactory.shortType.createShortBeanProxy(aShort);
  }
  
  public ICharacterBeanProxy createBeanProxyWith(char aChar)
  {
    return fBeanTypeProxyFactory.charType.createCharBeanProxy(aChar);
  }
  
  public ICharacterBeanProxy createBeanProxyWith(Character aCharacter)
  {
    return fBeanTypeProxyFactory.charClass.createCharacterBeanProxy(aCharacter);
  }
  
  public IIntegerBeanProxy createBeanProxyWith(int anInt)
  {
    return fBeanTypeProxyFactory.intType.createIntegerBeanProxy(anInt);
  }
  
  public IIntegerBeanProxy createBeanProxyWith(Integer anInteger)
  {
    return fBeanTypeProxyFactory.integerClass.createIntegerBeanProxy(anInteger);
  }
  
  public INumberBeanProxy createBeanProxyWith(long aLong)
  {
    return fBeanTypeProxyFactory.longType.createLongBeanProxy(aLong);
  }
  
  public INumberBeanProxy createBeanProxyWith(Number aNumber)
  {
    IDENumberBeanTypeProxy numberTypeProxy = (IDENumberBeanTypeProxy)fBeanTypeProxyFactory.getBeanTypeProxy(aNumber.getClass());
    return numberTypeProxy.createNumberBeanProxy(aNumber);
  }
  
  public IBooleanBeanProxy createBeanProxyWith(boolean aBoolean)
  {
    return fBeanTypeProxyFactory.booleanType.createBooleanBeanProxy(aBoolean);
  }
  
  public IBooleanBeanProxy createBeanProxyWith(Boolean aBoolean)
  {
    return fBeanTypeProxyFactory.booleanClass.createBooleanBeanProxy(aBoolean);
  }
  
  public INumberBeanProxy createBeanProxyWith(byte aByte)
  {
    return fBeanTypeProxyFactory.byteType.createByteBeanProxy(aByte);
  }
  
  public INumberBeanProxy createBeanProxyWith(double aDouble)
  {
    return fBeanTypeProxyFactory.doubleType.createDoubleBeanProxy(aDouble);
  }
  
  public IBeanProxy convertToPrimitiveBeanProxy(IBeanProxy nonPrimitiveProxy)
  {
    if (nonPrimitiveProxy == null) {
      return null;
    }
    if (!nonPrimitiveProxy.isValid()) {
      return nonPrimitiveProxy;
    }
    IDEBeanTypeProxy type = (IDEBeanTypeProxy)nonPrimitiveProxy.getTypeProxy();
    if (type.getClass() == Boolean.class) {
      return createBeanProxyWith(((IBooleanBeanProxy)nonPrimitiveProxy).booleanValue());
    }
    if (type.getClass() == Byte.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).byteValue());
    }
    if (type.getClass() == Character.class) {
      return createBeanProxyWith(((ICharacterBeanProxy)nonPrimitiveProxy).charValue());
    }
    if (type.getClass() == Double.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).doubleValue());
    }
    if (type.getClass() == Float.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).floatValue());
    }
    if (type.getClass() == Integer.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).intValue());
    }
    if (type.getClass() == Long.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).longValue());
    }
    if (type.getClass() == Short.class) {
      return createBeanProxyWith(((INumberBeanProxy)nonPrimitiveProxy).shortValue());
    }
    return nonPrimitiveProxy;
  }
  
  public IArrayBeanProxy createBeanProxyWith(IBeanTypeProxy type, int dimension)
    throws ThrowableProxy
  {
    return createBeanProxyWith(type, new int[] { dimension });
  }
  
  public IArrayBeanProxy createBeanProxyWith(IBeanTypeProxy type, int[] dimensions)
    throws ThrowableProxy
  {
    if (type.isArray()) {
      return ((IDEArrayBeanTypeProxy)type).createBeanProxyWith(dimensions);
    }
    IDEArrayBeanTypeProxy arrayType = 
      (IDEArrayBeanTypeProxy)fBeanTypeProxyFactory.getBeanTypeProxy(type.getTypeName(), dimensions.length);
    return arrayType.createBeanProxyWith(dimensions);
  }
  
  public void releaseProxy(IBeanProxy aProxy) {}
  
  public IIDEBeanProxy createIDEBeanProxyWith(Object anObject)
  {
    if (anObject == null) {
      return null;
    }
    return ((IDEBeanTypeProxy)fBeanTypeProxyFactory.getBeanTypeProxy(anObject.getClass())).newBeanProxy(anObject);
  }
  
  IBeanProxy createBeanProxy(IDEBeanTypeProxy aTypeProxy, String initializationString)
  {
    if (initializationString.equals("null")) {
      return null;
    }
    try
    {
      ClassLoader pluginClassLoader = fRegistry.getPluginClassLoader();
      Object newValue = InitializationStringParser.evaluate(initializationString, pluginClassLoader);
      return newValue != null ? aTypeProxy.newBeanProxy(newValue) : null;
    }
    catch (Exception exc)
    {
      ProxyPlugin.getPlugin().getLogger().log(
        new Status(2, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc));
    }
    return null;
  }
  
  IBeanProxy createBeanProxy(IDEBeanTypeProxy aTypeProxy)
  {
    Class beanType = fClass;
    try
    {
      return aTypeProxy.newBeanProxy(!aTypeProxy.isPrimitive() ? beanType.newInstance() : null);
    }
    catch (Exception exc)
    {
      ProxyPlugin.getPlugin().getLogger().log(
        new Status(2, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc));
    }
    return null;
  }
  
  public void terminateFactory(boolean wait) {}
  
  public IExpression createExpression()
  {
    return new IDEExpression(fRegistry);
  }
  
  public IBeanProxy createBeanProxyFrom(String initializationString)
    throws ThrowableProxy
  {
    if (initializationString.equals("null")) {
      return null;
    }
    try
    {
      ClassLoader pluginClassLoader = fRegistry.getPluginClassLoader();
      InitializationStringParser parser = InitializationStringParser.createParser(initializationString, pluginClassLoader);
      Object newValue = parser.evaluate();
      if (newValue != null) {
        return fRegistry.getBeanProxy(parser.getExpectedType(), newValue);
      }
      return null;
    }
    catch (Exception exc)
    {
      ProxyPlugin.getPlugin().getLogger().log(
        new Status(2, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", exc));
    }
    return null;
  }
  
  public IBeanProxy getIVMServerProxy()
  {
    return ivmServerProxy;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEStandardBeanProxyFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import java.util.Map;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyAdapter;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyEvent;
import org.eclipse.jem.internal.proxy.core.IProxyBeanType;

class IDEStandardBeanTypeProxyFactory$1
  extends ExpressionProxy.ProxyAdapter
{
  final IDEStandardBeanTypeProxyFactory this$0;
  private final String val$typeName;
  
  IDEStandardBeanTypeProxyFactory$1(IDEStandardBeanTypeProxyFactory paramIDEStandardBeanTypeProxyFactory, String paramString)
  {
    this$0 = paramIDEStandardBeanTypeProxyFactory;val$typeName = paramString;
  }
  
  public void proxyResolved(ExpressionProxy.ProxyEvent event)
  {
    String typeName = ((IProxyBeanType)event.getSource()).getTypeName();
    synchronized (this$0)
    {
      if (!this$0.beanProxies.containsKey(typeName)) {
        this$0.beanProxies.put(typeName, event.getProxy());
      }
    }
  }
  
  public void proxyNotResolved(ExpressionProxy.ProxyEvent event)
  {
    ((IDEExpression)((ExpressionProxy)event.getSource()).getExpression()).removeBeanType(val$typeName);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jem.internal.proxy.ide.IDEStandardBeanTypeProxyFactory.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jem.internal.proxy.ide;

import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.Status;
import org.eclipse.jem.internal.proxy.common.MapTypes;
import org.eclipse.jem.internal.proxy.core.Expression;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyAdapter;
import org.eclipse.jem.internal.proxy.core.ExpressionProxy.ProxyEvent;
import org.eclipse.jem.internal.proxy.core.IBeanTypeProxy;
import org.eclipse.jem.internal.proxy.core.IExpression;
import org.eclipse.jem.internal.proxy.core.IProxyBeanType;
import org.eclipse.jem.internal.proxy.core.IStandardBeanTypeProxyFactory;
import org.eclipse.jem.internal.proxy.core.ProxyPlugin;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.osgi.framework.Bundle;

public class IDEStandardBeanTypeProxyFactory
  implements IStandardBeanTypeProxyFactory
{
  protected final IDEProxyFactoryRegistry fFactoryRegistry;
  protected Map beanProxies;
  public static Map MAP_SHORTSIG_TO_TYPE = new HashMap(8);
  public static Map MAP_TYPENAME_TO_SHORTSIG = new HashMap(8);
  IDEBeanTypeProxy objectClass;
  IDEBooleanTypeBeanTypeProxy booleanType;
  IDEBooleanClassBeanTypeProxy booleanClass;
  IDEIntegerTypeBeanTypeProxy intType;
  IDEIntegerClassBeanTypeProxy integerClass;
  IDEFloatTypeBeanTypeProxy floatType;
  IDEFloatClassBeanTypeProxy floatClass;
  IDELongTypeBeanTypeProxy longType;
  IDELongClassBeanTypeProxy longClass;
  IDEShortTypeBeanTypeProxy shortType;
  IDEShortClassBeanTypeProxy shortClass;
  IDEByteTypeBeanTypeProxy byteType;
  IDEByteClassBeanTypeProxy byteClass;
  IDECharTypeBeanTypeProxy charType;
  IDECharacterClassBeanTypeProxy charClass;
  IDEDoubleTypeBeanTypeProxy doubleType;
  IDEDoubleClassBeanTypeProxy doubleClass;
  IDEStringBeanTypeProxy stringClass;
  IDEClassBeanTypeProxy classClass;
  IDEBeanTypeProxy voidType;
  
  static
  {
    MAP_SHORTSIG_TO_TYPE.put("B", Byte.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("C", Character.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("D", Double.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("F", Float.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("I", Integer.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("J", Long.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("S", Short.TYPE);
    MAP_SHORTSIG_TO_TYPE.put("Z", Boolean.TYPE);
    
    MAP_TYPENAME_TO_SHORTSIG.put("byte", "B");
    MAP_TYPENAME_TO_SHORTSIG.put("char", "C");
    MAP_TYPENAME_TO_SHORTSIG.put("double", "D");
    MAP_TYPENAME_TO_SHORTSIG.put("float", "F");
    MAP_TYPENAME_TO_SHORTSIG.put("int", "I");
    MAP_TYPENAME_TO_SHORTSIG.put("long", "J");
    MAP_TYPENAME_TO_SHORTSIG.put("short", "S");
    MAP_TYPENAME_TO_SHORTSIG.put("boolean", "Z");
  }
  
  public IDEStandardBeanTypeProxyFactory(IDEProxyFactoryRegistry aRegistry)
  {
    fFactoryRegistry = aRegistry;
    aRegistry.registerBeanTypeProxyFactory(this);
    
    objectClass = new IDEBeanTypeProxy(fFactoryRegistry, Object.class);
    booleanType = new IDEBooleanTypeBeanTypeProxy(fFactoryRegistry, Boolean.TYPE);
    booleanClass = new IDEBooleanClassBeanTypeProxy(fFactoryRegistry, Boolean.class);
    intType = new IDEIntegerTypeBeanTypeProxy(fFactoryRegistry, Integer.TYPE);
    integerClass = new IDEIntegerClassBeanTypeProxy(fFactoryRegistry, Integer.class);
    floatType = new IDEFloatTypeBeanTypeProxy(fFactoryRegistry, Float.TYPE);
    floatClass = new IDEFloatClassBeanTypeProxy(fFactoryRegistry, Float.class);
    longType = new IDELongTypeBeanTypeProxy(fFactoryRegistry, Long.TYPE);
    longClass = new IDELongClassBeanTypeProxy(fFactoryRegistry, Long.class);
    shortType = new IDEShortTypeBeanTypeProxy(fFactoryRegistry, Short.TYPE);
    shortClass = new IDEShortClassBeanTypeProxy(fFactoryRegistry, Short.class);
    byteType = new IDEByteTypeBeanTypeProxy(fFactoryRegistry, Byte.TYPE);
    byteClass = new IDEByteClassBeanTypeProxy(fFactoryRegistry, Byte.class);
    charType = new IDECharTypeBeanTypeProxy(fFactoryRegistry, Character.TYPE);
    charClass = new IDECharacterClassBeanTypeProxy(fFactoryRegistry, Character.class);
    doubleType = new IDEDoubleTypeBeanTypeProxy(fFactoryRegistry, Double.TYPE);
    doubleClass = new IDEDoubleClassBeanTypeProxy(fFactoryRegistry, Double.class);
    stringClass = new IDEStringBeanTypeProxy(fFactoryRegistry, String.class);
    classClass = new IDEClassBeanTypeProxy(fFactoryRegistry, Class.class);
    voidType = new IDEBeanTypeProxy(fFactoryRegistry, Void.TYPE);
    
    beanProxies = new HashMap(20);
    
    beanProxies.put(intType.getTypeName(), intType);
    beanProxies.put(booleanType.getTypeName(), booleanType);
    beanProxies.put(charType.getTypeName(), charType);
    beanProxies.put(byteType.getTypeName(), byteType);
    beanProxies.put(shortType.getTypeName(), shortType);
    beanProxies.put(longType.getTypeName(), longType);
    beanProxies.put(floatType.getTypeName(), floatType);
    beanProxies.put(doubleType.getTypeName(), doubleType);
    
    beanProxies.put(integerClass.getTypeName(), integerClass);
    beanProxies.put(booleanClass.getTypeName(), booleanClass);
    beanProxies.put(charClass.getTypeName(), charClass);
    beanProxies.put(byteClass.getTypeName(), byteClass);
    beanProxies.put(shortClass.getTypeName(), shortClass);
    beanProxies.put(longClass.getTypeName(), longClass);
    beanProxies.put(floatClass.getTypeName(), floatClass);
    beanProxies.put(doubleClass.getTypeName(), doubleClass);
    beanProxies.put(BigDecimal.class.getName(), new IDEBigDecimalBeanTypeProxy(fFactoryRegistry, BigDecimal.class));
    beanProxies.put(BigInteger.class.getName(), new IDEBigIntegerBeanTypeProxy(fFactoryRegistry, BigInteger.class));
    beanProxies.put(stringClass.getTypeName(), stringClass);
    
    beanProxies.put(classClass.getTypeName(), classClass);
    beanProxies.put(voidType.getTypeName(), voidType);
  }
  
  IBeanTypeProxy getBeanTypeProxy(Class anIDEClass)
  {
    return getBeanTypeProxy(anIDEClass.getName());
  }
  
  public synchronized IBeanTypeProxy getBeanTypeProxy(String typeName)
  {
    typeName = MapTypes.getJNIFormatName(typeName);
    
    IProxyBeanType beanTypeProxy = (IProxyBeanType)beanProxies.get(typeName);
    if ((beanTypeProxy != null) && (beanTypeProxy.isBeanProxy())) {
      return (IBeanTypeProxy)beanTypeProxy;
    }
    if (typeName.charAt(0) != '[')
    {
      int packageIndex = typeName.lastIndexOf('.');
      if (packageIndex != -1)
      {
        String packageName = typeName.substring(0, packageIndex);
        IDEExtensionBeanTypeProxyFactory packageFactory = (IDEExtensionBeanTypeProxyFactory)fFactoryRegistry
          .getBeanTypeProxyFactoryExtension(packageName);
        if (packageFactory != null)
        {
          beanTypeProxy = packageFactory.getExtensionBeanTypeProxy(typeName);
          if (beanTypeProxy != null)
          {
            registerBeanTypeProxy((IBeanTypeProxy)beanTypeProxy, false);
            return (IBeanTypeProxy)beanTypeProxy;
          }
        }
      }
      try
      {
        Class ideClass = fFactoryRegistry.loadClass(typeName);
        IDEBeanTypeProxy superTypeProxy = null;
        if (ideClass.getSuperclass() != null) {
          superTypeProxy = (IDEBeanTypeProxy)getBeanTypeProxy(ideClass.getSuperclass());
        }
        if (superTypeProxy != null) {
          beanTypeProxy = superTypeProxy.newBeanTypeForClass(ideClass);
        }
        if (beanTypeProxy == null) {
          beanTypeProxy = new IDEBeanTypeProxy(fFactoryRegistry, ideClass);
        }
      }
      catch (ClassNotFoundException e)
      {
        ProxyPlugin.getPlugin().getLogger().log(new Status(1, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e));
        String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage() });
        beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e);
      }
      catch (ExceptionInInitializerError e)
      {
        ProxyPlugin.getPlugin().getLogger().log(new Status(2, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e));
        String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage() });
        beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e.getCause());
      }
      catch (LinkageError e)
      {
        ProxyPlugin.getPlugin().getLogger().log(new Status(2, ProxyPlugin.getPlugin().getBundle().getSymbolicName(), 0, "", e));
        String msg = MessageFormat.format("{0}({1})", new Object[] { e.getClass(), e.getMessage() });
        beanTypeProxy = new IDEInitErrorBeanTypeProxy(fFactoryRegistry, typeName, msg, e);
      }
      beanProxies.put(typeName, beanTypeProxy);
      return (IBeanTypeProxy)beanTypeProxy;
    }
    int dims = typeName.lastIndexOf('[') + 1;
    Class finalComponentType = null;
    if (typeName.charAt(dims) == 'L')
    {
      IDEBeanTypeProxy finalType = (IDEBeanTypeProxy)getBeanTypeProxy(typeName.substring(dims + 1, typeName.length() - 1));
      if (finalType != null) {
        finalComponentType = fClass;
      }
    }
    else
    {
      finalComponentType = (Class)MAP_SHORTSIG_TO_TYPE.get(typeName.substring(dims, dims + 1));
    }
    if (finalComponentType != null)
    {
      Object dummyArray = Array.newInstance(finalComponentType, new int[dims]);
      beanTypeProxy = new IDEArrayBeanTypeProxy(fFactoryRegistry, typeName, dummyArray.getClass());
      beanProxies.put(typeName, beanTypeProxy);
    }
    return (IBeanTypeProxy)beanTypeProxy;
  }
  
  public synchronized IProxyBeanType getBeanTypeProxy(IExpression expression, String typeName)
  {
    typeName = MapTypes.getJNIFormatName(typeName);
    
    IProxyBeanType beanTypeProxy = (IProxyBeanType)beanProxies.get(typeName);
    if (beanTypeProxy != null) {
      return beanTypeProxy;
    }
    beanTypeProxy = ((IDEExpression)expression).getBeanType(typeName);
    if (beanTypeProxy != null) {
      return beanTypeProxy;
    }
    if (typeName.charAt(0) != '[')
    {
      int packageIndex = typeName.lastIndexOf('.');
      if (packageIndex != -1)
      {
        String packageName = typeName.substring(0, packageIndex);
        IDEExtensionBeanTypeProxyFactory packageFactory = (IDEExtensionBeanTypeProxyFactory)fFactoryRegistry
          .getBeanTypeProxyFactoryExtension(packageName);
        if (packageFactory != null)
        {
          beanTypeProxy = packageFactory.getExtensionBeanTypeProxy(typeName, expression);
          if (beanTypeProxy != null)
          {
            registerBeanTypeProxy(beanTypeProxy, false);
            return beanTypeProxy;
          }
        }
      }
    }
    beanTypeProxy = ((Expression)expression).createBeanTypeExpressionProxy(typeName);
    registerBeanTypeProxy(beanTypeProxy, false);
    return beanTypeProxy;
  }
  
  public IBeanTypeProxy getBeanTypeProxy(String componentClassName, int dimensions)
  {
    return getBeanTypeProxy(getArrayClassname(componentClassName, dimensions));
  }
  
  public IProxyBeanType getBeanTypeProxy(IExpression expression, String componentClassName, int dimensions)
  {
    return getBeanTypeProxy(expression, getArrayClassname(componentClassName, dimensions));
  }
  
  protected String getArrayClassname(String componentClassName, int dimensions)
  {
    String jniComponentTypeName = MapTypes.getJNIFormatName(componentClassName);
    String compType = jniComponentTypeName;
    if (jniComponentTypeName.charAt(0) != '[')
    {
      compType = (String)MAP_TYPENAME_TO_SHORTSIG.get(componentClassName);
      if (compType == null) {
        compType = "L" + jniComponentTypeName + ";";
      }
    }
    StringBuffer buffer = new StringBuffer(dimensions + compType.length());
    for (int i = 0; i < dimensions; i++) {
      buffer.append('[');
    }
    buffer.append(compType);
    return buffer.toString();
  }
  
  public void terminateFactory(boolean wait) {}
  
  public synchronized void registerBeanTypeProxy(IBeanTypeProxy aBeanTypeProxy, boolean permanent)
  {
    beanProxies.put(aBeanTypeProxy.getTypeName(), aBeanTypeProxy);
  }
  
  public void registerBeanTypeProxy(IProxyBeanType aProxyBeanType, boolean permanent)
  {
    if (aProxyBeanType.isBeanProxy())
    {
      registerBeanTypeProxy((IBeanTypeProxy)aProxyBeanType, permanent);
    }
    else
    {
      ExpressionProxy beanExpressionProxy = (ExpressionProxy)aProxyBeanType;
      String typeName = aProxyBeanType.getTypeName();
      ((IDEExpression)beanExpressionProxy.getExpression()).addBeanType(typeName, aProxyBeanType);
      beanExpressionProxy.addProxyListener(new ExpressionProxy.ProxyAdapter()
      {
        private final String val$typeName;
        
        public void proxyResolved(ExpressionProxy.ProxyEvent event)
        {
          String typeName = ((IProxyBeanType)event.getSource()).getTypeName();
          synchronized (IDEStandardBeanTypeProxyFactory.this)
          
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

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