jurt

16:38:22.565 INFO  jd.cli.Main - Decompiling jurt.jar
package com.sun.star.comp.bridgefactory;

import java.math.BigInteger;

final class BridgeFactory$UniqueToken
{
  private final String token;
  
  public BridgeFactory$UniqueToken()
  {
    synchronized (UniqueToken.class)
    {
      token = counter.toString();
      counter = counter.add(BigInteger.ONE);
    }
  }
  
  public String toString()
  {
    return token;
  }
  
  private static BigInteger counter = BigInteger.ZERO;
}

/* Location:
 * Qualified Name:     com.sun.star.comp.bridgefactory.BridgeFactory.UniqueToken
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.bridgefactory;

import com.sun.star.bridge.BridgeExistsException;
import com.sun.star.bridge.XBridge;
import com.sun.star.bridge.XBridgeFactory;
import com.sun.star.bridge.XInstanceProvider;
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.connection.XConnection;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.IBridge;
import com.sun.star.uno.RuntimeException;
import com.sun.star.uno.UnoRuntime;
import java.math.BigInteger;
import java.util.Vector;

public class BridgeFactory
  implements XBridgeFactory
{
  private static final boolean DEBUG = false;
  public static final String __serviceName = "com.sun.star.bridge.BridgeFactory";
  
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    XSingleServiceFactory localXSingleServiceFactory = null;
    if (paramString.equals(BridgeFactory.class.getName())) {
      localXSingleServiceFactory = FactoryHelper.getServiceFactory(BridgeFactory.class, paramXMultiServiceFactory, paramXRegistryKey);
    }
    return localXSingleServiceFactory;
  }
  
  public XBridge createBridge(String paramString1, String paramString2, XConnection paramXConnection, XInstanceProvider paramXInstanceProvider)
    throws BridgeExistsException, IllegalArgumentException, RuntimeException
  {
    int i = paramString1.length() != 0 ? 1 : 0;
    UniqueToken localUniqueToken = i != 0 ? paramString1 : new UniqueToken();
    Object localObject;
    if (i != 0)
    {
      localObject = UnoRuntime.getBridges();
      for (int j = 0; j < localObject.length; j++)
      {
        XBridge localXBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, localObject[j]);
        if ((localXBridge != null) && 
          (localXBridge.getName().equals(paramString1))) {
          throw new BridgeExistsException(paramString1 + " already exists");
        }
      }
    }
    try
    {
      IBridge localIBridge = UnoRuntime.getBridgeByName("java", localUniqueToken, "remote", localUniqueToken, new Object[] { paramString2, paramXConnection, i != 0 ? new Object[] { paramString2, paramXConnection, paramXInstanceProvider, paramString1 } : paramXInstanceProvider });
      
      localObject = (XBridge)UnoRuntime.queryInterface(XBridge.class, localIBridge);
    }
    catch (Exception localException)
    {
      throw new IllegalArgumentException(localException.getMessage());
    }
    return (XBridge)localObject;
  }
  
  public XBridge getBridge(String paramString)
    throws RuntimeException
  {
    XBridge localXBridge = null;
    
    IBridge[] arrayOfIBridge = UnoRuntime.getBridges();
    for (int i = 0; i < arrayOfIBridge.length; i++)
    {
      localXBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, arrayOfIBridge[i]);
      if (localXBridge != null)
      {
        if (localXBridge.getName().equals(paramString)) {
          break;
        }
        localXBridge = null;
      }
    }
    return localXBridge;
  }
  
  public synchronized XBridge[] getExistingBridges()
    throws RuntimeException
  {
    Vector localVector = new Vector();
    
    IBridge[] arrayOfIBridge = UnoRuntime.getBridges();
    for (int i = 0; i < arrayOfIBridge.length; i++)
    {
      XBridge localXBridge = (XBridge)UnoRuntime.queryInterface(XBridge.class, arrayOfIBridge[i]);
      if (localXBridge != null) {
        localVector.addElement(localXBridge);
      }
    }
    XBridge[] arrayOfXBridge = new XBridge[localVector.size()];
    for (int j = 0; j < localVector.size(); j++) {
      arrayOfXBridge[j] = ((XBridge)localVector.elementAt(j));
    }
    return arrayOfXBridge;
  }
  
  private static final class UniqueToken
  {
    private final String token;
    
    public UniqueToken()
    {
      synchronized (UniqueToken.class)
      {
        token = counter.toString();
        counter = counter.add(BigInteger.ONE);
      }
    }
    
    public String toString()
    {
      return token;
    }
    
    private static BigInteger counter = BigInteger.ZERO;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.comp.bridgefactory.BridgeFactory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.connections;

import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.connection.AlreadyAcceptingException;
import com.sun.star.connection.ConnectionSetupException;
import com.sun.star.connection.XAcceptor;
import com.sun.star.connection.XConnection;
import com.sun.star.lang.IllegalArgumentException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;

public final class Acceptor
  implements XAcceptor
{
  public static final String __serviceName = "com.sun.star.connection.Acceptor";
  private static final boolean DEBUG = false;
  private final XMultiServiceFactory serviceFactory;
  
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    return paramString.equals(Acceptor.class.getName()) ? FactoryHelper.getServiceFactory(Acceptor.class, "com.sun.star.connection.Acceptor", paramXMultiServiceFactory, paramXRegistryKey) : null;
  }
  
  public Acceptor(XMultiServiceFactory paramXMultiServiceFactory)
  {
    serviceFactory = paramXMultiServiceFactory;
  }
  
  public XConnection accept(String paramString)
    throws AlreadyAcceptingException, ConnectionSetupException, IllegalArgumentException
  {
    XAcceptor localXAcceptor;
    synchronized (this)
    {
      if (acceptor == null)
      {
        acceptor = ((XAcceptor)Implementation.getConnectionService(serviceFactory, paramString, XAcceptor.class, "Acceptor"));
        
        acceptingDescription = paramString;
      }
      else if (!paramString.equals(acceptingDescription))
      {
        throw new AlreadyAcceptingException(acceptingDescription + " vs. " + paramString);
      }
      localXAcceptor = acceptor;
    }
    return localXAcceptor.accept(paramString);
  }
  
  public void stopAccepting()
  {
    XAcceptor localXAcceptor;
    synchronized (this)
    {
      localXAcceptor = acceptor;
    }
    localXAcceptor.stopAccepting();
  }
  
  private XAcceptor acceptor = null;
  private String acceptingDescription;
}

/* Location:
 * Qualified Name:     com.sun.star.comp.connections.Acceptor
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.connections;

import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.connection.ConnectionSetupException;
import com.sun.star.connection.NoConnectException;
import com.sun.star.connection.XConnection;
import com.sun.star.connection.XConnector;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;

public class Connector
  implements XConnector
{
  public static final String __serviceName = "com.sun.star.connection.Connector";
  private static final boolean DEBUG = false;
  private final XMultiServiceFactory serviceFactory;
  
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    return paramString.equals(Connector.class.getName()) ? FactoryHelper.getServiceFactory(Connector.class, "com.sun.star.connection.Connector", paramXMultiServiceFactory, paramXRegistryKey) : null;
  }
  
  public Connector(XMultiServiceFactory paramXMultiServiceFactory)
  {
    serviceFactory = paramXMultiServiceFactory;
  }
  
  public synchronized XConnection connect(String paramString)
    throws NoConnectException, ConnectionSetupException
  {
    if (connected) {
      throw new ConnectionSetupException("already connected");
    }
    XConnection localXConnection = ((XConnector)Implementation.getConnectionService(serviceFactory, paramString, XConnector.class, "Connector")).connect(paramString);
    
    connected = true;
    return localXConnection;
  }
  
  private boolean connected = false;
}

/* Location:
 * Qualified Name:     com.sun.star.comp.connections.Connector
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.connections;

import com.sun.star.bridge.XInstanceProvider;
import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.container.NoSuchElementException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.Exception;
import com.sun.star.uno.RuntimeException;

public class ConstantInstanceProvider
  implements XInstanceProvider
{
  public static final boolean DEBUG = false;
  private static final String __serviceName = "com.sun.star.comp.connection.InstanceProvider";
  protected XMultiServiceFactory _serviceManager;
  protected String _serviceName;
  protected Object _instance;
  
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    XSingleServiceFactory localXSingleServiceFactory = null;
    if (paramString.equals(ConstantInstanceProvider.class.getName())) {
      localXSingleServiceFactory = FactoryHelper.getServiceFactory(ConstantInstanceProvider.class, "com.sun.star.comp.connection.InstanceProvider", paramXMultiServiceFactory, paramXRegistryKey);
    }
    return localXSingleServiceFactory;
  }
  
  public void setInstance(String paramString)
    throws Exception
  {
    _instance = _serviceManager.createInstance(paramString);
    _serviceName = paramString;
  }
  
  public ConstantInstanceProvider(XMultiServiceFactory paramXMultiServiceFactory)
  {
    _serviceManager = paramXMultiServiceFactory;
    
    _serviceName = "SERVICEMANAGER";
    _instance = paramXMultiServiceFactory;
  }
  
  public Object getInstance(String paramString)
    throws NoSuchElementException, RuntimeException
  {
    Object localObject = paramString.equals(_serviceName) ? _instance : null;
    
    return localObject;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.comp.connections.ConstantInstanceProvider
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.connections;

import com.sun.star.connection.ConnectionSetupException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.uno.Exception;
import com.sun.star.uno.UnoRuntime;

final class Implementation
{
  public static Object getConnectionService(XMultiServiceFactory paramXMultiServiceFactory, String paramString1, Class paramClass, String paramString2)
    throws ConnectionSetupException
  {
    int i = paramString1.indexOf(',');
    String str = (i < 0 ? paramString1 : paramString1.substring(0, i)).toLowerCase();
    
    Object localObject = null;
    try
    {
      localObject = UnoRuntime.queryInterface(paramClass, paramXMultiServiceFactory.createInstance("com.sun.star.connection." + str + paramString2));
    }
    catch (RuntimeException localRuntimeException)
    {
      throw localRuntimeException;
    }
    catch (Exception localException) {}
    if (localObject == null) {
      try
      {
        localObject = Class.forName("com.sun.star.lib.connections." + str + "." + str + paramString2).newInstance();
      }
      catch (ClassNotFoundException localClassNotFoundException) {}catch (IllegalAccessException localIllegalAccessException) {}catch (InstantiationException localInstantiationException) {}
    }
    if (localObject == null) {
      throw new ConnectionSetupException("no " + paramString2 + " for " + str);
    }
    return localObject;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.comp.connections.Implementation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.connections;

import com.sun.star.comp.loader.FactoryHelper;
import com.sun.star.connection.XConnection;
import com.sun.star.io.IOException;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.registry.XRegistryKey;

public class PipedConnection
  implements XConnection
{
  public static final boolean DEBUG = false;
  private static final String __serviceName = "com.sun.star.connection.PipedConnection";
  protected static final int __waitTime = 10000;
  
  public static XSingleServiceFactory __getServiceFactory(String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    XSingleServiceFactory localXSingleServiceFactory = null;
    if (paramString.equals(PipedConnection.class.getName())) {
      localXSingleServiceFactory = FactoryHelper.getServiceFactory(PipedConnection.class, "com.sun.star.connection.PipedConnection", paramXMultiServiceFactory, paramXRegistryKey);
    }
    return localXSingleServiceFactory;
  }
  
  protected byte[] _buffer = new byte['?'];
  protected int _in;
  protected int _out;
  protected boolean _closed;
  protected PipedConnection _otherSide;
  
  public PipedConnection(Object[] paramArrayOfObject)
    throws com.sun.star.uno.RuntimeException
  {
    _otherSide = (paramArrayOfObject.length == 1 ? (PipedConnection)paramArrayOfObject[0] : null);
    if (_otherSide != null)
    {
      if (_otherSide == this) {
        throw new RuntimeException("can not connect to myself");
      }
      _otherSide._otherSide = this;
    }
  }
  
  private synchronized void receive(byte[] paramArrayOfByte)
    throws IOException
  {
    int i = 0;
    while (i < paramArrayOfByte.length)
    {
      while ((_out == _in - 1) || ((_in == 0) && (_out == _buffer.length - 1))) {
        try
        {
          notify();
          
          wait(10000L);
        }
        catch (InterruptedException localInterruptedException)
        {
          throw new IOException(localInterruptedException.toString());
        }
      }
      if (_closed) {
        throw new IOException("connection has been closed");
      }
      int j;
      if (_out < _in)
      {
        j = Math.min(paramArrayOfByte.length - i, _in - _out - 1);
        
        System.arraycopy(paramArrayOfByte, i, _buffer, _out, j);
      }
      else
      {
        if (_in > 0) {
          j = Math.min(paramArrayOfByte.length - i, _buffer.length - _out);
        } else {
          j = Math.min(paramArrayOfByte.length - i, _buffer.length - _out - 1);
        }
        System.arraycopy(paramArrayOfByte, i, _buffer, _out, j);
      }
      i += j;
      _out += j;
      if (_out >= _buffer.length) {
        _out = 0;
      }
    }
  }
  
  public synchronized int read(byte[][] paramArrayOfByte, int paramInt)
    throws IOException, com.sun.star.uno.RuntimeException
  {
    paramArrayOfByte[0] = new byte[paramInt];
    while ((paramInt > 0) && ((_in != _out) || (!_closed)))
    {
      while ((_in == _out) && (!_closed)) {
        try
        {
          notify();
          
          wait(10000L);
        }
        catch (InterruptedException localInterruptedException)
        {
          throw new IOException(localInterruptedException.toString());
        }
      }
      int i;
      if (_in < _out)
      {
        i = Math.min(paramInt, _out - _in);
        
        System.arraycopy(_buffer, _in, paramArrayOfByte[0], paramArrayOfByte[0].length - paramInt, i);
        
        paramInt -= i;
        _in += i;
      }
      else if (_in > _out)
      {
        i = Math.min(paramInt, _buffer.length - _in);
        
        System.arraycopy(_buffer, _in, paramArrayOfByte[0], paramArrayOfByte[0].length - paramInt, i);
        
        paramInt -= i;
        _in += i;
        if (_in >= _buffer.length) {
          _in = 0;
        }
      }
    }
    if (paramInt > 0)
    {
      byte[] arrayOfByte = new byte[paramArrayOfByte[0].length - paramInt];
      System.arraycopy(paramArrayOfByte[0], 0, arrayOfByte, 0, arrayOfByte.length);
      
      paramArrayOfByte[0] = arrayOfByte;
    }
    return paramArrayOfByte[0].length;
  }
  
  public void write(byte[] paramArrayOfByte)
    throws IOException, com.sun.star.uno.RuntimeException
  {
    _otherSide.receive(paramArrayOfByte);
  }
  
  public void flush()
    throws IOException, com.sun.star.uno.RuntimeException
  {
    synchronized (_otherSide)
    {
      _otherSide.notify();
    }
  }
  
  public synchronized void close()
    throws IOException, com.sun.star.uno.RuntimeException
  {
    if (!_closed)
    {
      _closed = true;
      
      _otherSide.close();
      
      notify();
    }
  }
  
  public String getDescription()
    throws com.sun.star.uno.RuntimeException
  {
    return getClass().getName();
  }
}

/* Location:
 * Qualified Name:     com.sun.star.comp.connections.PipedConnection
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.loader;

import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.Exception;
import com.sun.star.uno.Type;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class FactoryHelper$Factory
  implements XSingleServiceFactory, XSingleComponentFactory, XServiceInfo, XTypeProvider
{
  protected static Class __objectArray;
  protected XMultiServiceFactory _xMultiServiceFactory;
  protected XRegistryKey _xRegistryKey;
  protected int _nCode;
  protected Constructor _constructor;
  protected String _implName;
  protected String _serviceName;
  
  static
  {
    try
    {
      __objectArray = Class.forName("[Ljava.lang.Object;");
    }
    catch (ClassNotFoundException localClassNotFoundException)
    {
      System.err.println(FactoryHelper.class.getName() + " exception occurred - " + localClassNotFoundException);
    }
  }
  
  protected static Object _mutex = new Object();
  private static byte[] _implementationId;
  
  protected FactoryHelper$Factory(Class paramClass, String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
  {
    _xMultiServiceFactory = paramXMultiServiceFactory;
    _xRegistryKey = paramXRegistryKey;
    _implName = paramClass.getName();
    _serviceName = paramString;
    
    Constructor[] arrayOfConstructor = paramClass.getConstructors();
    for (int i = 0; (i < arrayOfConstructor.length) && (_constructor == null); i++)
    {
      Class[] arrayOfClass = arrayOfConstructor[i].getParameterTypes();
      if ((arrayOfClass.length == 3) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(XRegistryKey.class)) && (arrayOfClass[2].equals(__objectArray)))
      {
        _nCode = 0;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(XRegistryKey.class)))
      {
        _nCode = 1;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(__objectArray)))
      {
        _nCode = 2;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(XComponentContext.class)))
      {
        _nCode = 3;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 3) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(XRegistryKey.class)) && (arrayOfClass[2].equals(__objectArray)))
      {
        _nCode = 4;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(XRegistryKey.class)))
      {
        _nCode = 5;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(__objectArray)))
      {
        _nCode = 6;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(XMultiServiceFactory.class)))
      {
        _nCode = 7;
        _constructor = arrayOfConstructor[i];
      }
      else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(__objectArray)))
      {
        _nCode = 8;
        _constructor = arrayOfConstructor[i];
      }
      else if (arrayOfClass.length == 0)
      {
        _nCode = 9;
        _constructor = arrayOfConstructor[i];
      }
    }
    if (_constructor == null) {
      throw new com.sun.star.uno.RuntimeException(getClass().getName() + " can not find a useable constructor");
    }
  }
  
  private final XMultiServiceFactory getSMgr(XComponentContext paramXComponentContext)
  {
    if (paramXComponentContext != null) {
      return (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, paramXComponentContext.getServiceManager());
    }
    return _xMultiServiceFactory;
  }
  
  public Object createInstanceWithContext(XComponentContext paramXComponentContext)
    throws Exception
  {
    Object[] arrayOfObject;
    switch (_nCode)
    {
    case 0: 
      arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey, new Object[0] };
      break;
    case 1: 
      arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey };
      break;
    case 2: 
      arrayOfObject = new Object[] { paramXComponentContext, new Object[0] };
      break;
    case 3: 
      arrayOfObject = new Object[] { paramXComponentContext };
      break;
    case 4: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey, new Object[0] };
      break;
    case 5: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey };
      break;
    case 6: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), new Object[0] };
      break;
    case 7: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext) };
      break;
    case 8: 
      arrayOfObject = new Object[] { new Object[0] };
      break;
    default: 
      arrayOfObject = new Object[0];
    }
    try
    {
      return _constructor.newInstance(arrayOfObject);
    }
    catch (InvocationTargetException localInvocationTargetException)
    {
      Throwable localThrowable = localInvocationTargetException.getTargetException();
      if ((localThrowable instanceof RuntimeException)) {
        throw ((RuntimeException)localThrowable);
      }
      if ((localThrowable instanceof Exception)) {
        throw ((Exception)localThrowable);
      }
      if ((localThrowable instanceof com.sun.star.uno.RuntimeException)) {
        throw ((com.sun.star.uno.RuntimeException)localThrowable);
      }
      throw new Exception(localThrowable.toString());
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      throw new Exception(localIllegalAccessException.toString());
    }
    catch (InstantiationException localInstantiationException)
    {
      throw new Exception(localInstantiationException.toString());
    }
  }
  
  public Object createInstanceWithArgumentsAndContext(Object[] paramArrayOfObject, XComponentContext paramXComponentContext)
    throws Exception
  {
    int i = 1;
    Object[] arrayOfObject;
    switch (_nCode)
    {
    case 0: 
      arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey, paramArrayOfObject };
      i = 0;
      break;
    case 1: 
      arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey };
      break;
    case 2: 
      arrayOfObject = new Object[] { paramXComponentContext, paramArrayOfObject };
      i = 0;
      break;
    case 3: 
      arrayOfObject = new Object[] { paramXComponentContext };
      break;
    case 4: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey, paramArrayOfObject };
      i = 0;
      break;
    case 5: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey };
      break;
    case 6: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext), paramArrayOfObject };
      i = 0;
      break;
    case 7: 
      arrayOfObject = new Object[] { getSMgr(paramXComponentContext) };
      break;
    case 8: 
      arrayOfObject = new Object[] { paramArrayOfObject };
      i = 0;
      break;
    default: 
      arrayOfObject = new Object[0];
    }
    try
    {
      Object localObject1 = _constructor.newInstance(arrayOfObject);
      if (i != 0)
      {
        localObject2 = (XInitialization)UnoRuntime.queryInterface(XInitialization.class, localObject1);
        if (localObject2 != null) {
          ((XInitialization)localObject2).initialize(paramArrayOfObject);
        }
      }
      return localObject1;
    }
    catch (InvocationTargetException localInvocationTargetException)
    {
      Object localObject2 = localInvocationTargetException.getTargetException();
      if ((localObject2 instanceof RuntimeException)) {
        throw ((RuntimeException)localObject2);
      }
      if ((localObject2 instanceof Exception)) {
        throw ((Exception)localObject2);
      }
      if ((localObject2 instanceof com.sun.star.uno.RuntimeException)) {
        throw ((com.sun.star.uno.RuntimeException)localObject2);
      }
      throw new Exception(((Throwable)localObject2).toString());
    }
    catch (IllegalAccessException localIllegalAccessException)
    {
      throw new Exception(localIllegalAccessException.toString());
    }
    catch (InstantiationException localInstantiationException)
    {
      throw new Exception(localInstantiationException.toString());
    }
  }
  
  public Object createInstance()
    throws Exception, com.sun.star.uno.RuntimeException
  {
    return createInstanceWithContext(null);
  }
  
  public Object createInstanceWithArguments(Object[] paramArrayOfObject)
    throws Exception, com.sun.star.uno.RuntimeException
  {
    return createInstanceWithArgumentsAndContext(paramArrayOfObject, null);
  }
  
  public String[] getSupportedServiceNames()
    throws com.sun.star.uno.RuntimeException
  {
    return new String[] { _serviceName };
  }
  
  public String getImplementationName()
    throws com.sun.star.uno.RuntimeException
  {
    return _implName;
  }
  
  public boolean supportsService(String paramString)
    throws com.sun.star.uno.RuntimeException
  {
    String[] arrayOfString = getSupportedServiceNames();
    
    boolean bool = false;
    for (int i = 0; (i < arrayOfString.length) && (!bool); i++) {
      bool = arrayOfString[i].equals(paramString);
    }
    return bool;
  }
  
  public byte[] getImplementationId()
  {
    synchronized (_mutex)
    {
      if (_implementationId == null)
      {
        int i = hashCode();
        String str = getClass().getName();
        byte[] arrayOfByte = str.getBytes();
        int j = arrayOfByte.length;
        
        _implementationId = new byte[4 + j];
        _implementationId[0] = ((byte)(i & 0xFF));
        _implementationId[1] = ((byte)(i >>> 8 & 0xFF));
        _implementationId[2] = ((byte)(i >>> 16 & 0xFF));
        _implementationId[3] = ((byte)(i >>> 24 & 0xFF));
        
        System.arraycopy(arrayOfByte, 0, _implementationId, 4, j);
      }
    }
    return _implementationId;
  }
  
  public Type[] getTypes()
  {
    Type[] arrayOfType = { new Type(XSingleServiceFactory.class), new Type(XSingleComponentFactory.class), new Type(XServiceInfo.class), new Type(XTypeProvider.class) };
    
    return arrayOfType;
  }
}

/* Location:
 * Qualified Name:     com.sun.star.comp.loader.FactoryHelper.Factory
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package com.sun.star.comp.loader;

import com.sun.star.lang.XInitialization;
import com.sun.star.lang.XMultiServiceFactory;
import com.sun.star.lang.XServiceInfo;
import com.sun.star.lang.XSingleComponentFactory;
import com.sun.star.lang.XSingleServiceFactory;
import com.sun.star.lang.XTypeProvider;
import com.sun.star.registry.InvalidRegistryException;
import com.sun.star.registry.XRegistryKey;
import com.sun.star.uno.Type;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
import java.io.PrintStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;

public class FactoryHelper
{
  private static final boolean DEBUG = false;
  
  protected static class Factory
    implements XSingleServiceFactory, XSingleComponentFactory, XServiceInfo, XTypeProvider
  {
    protected static Class __objectArray;
    protected XMultiServiceFactory _xMultiServiceFactory;
    protected XRegistryKey _xRegistryKey;
    protected int _nCode;
    protected Constructor _constructor;
    protected String _implName;
    protected String _serviceName;
    
    static
    {
      try
      {
        __objectArray = Class.forName("[Ljava.lang.Object;");
      }
      catch (ClassNotFoundException localClassNotFoundException)
      {
        System.err.println(FactoryHelper.class.getName() + " exception occurred - " + localClassNotFoundException);
      }
    }
    
    protected static Object _mutex = new Object();
    private static byte[] _implementationId;
    
    protected Factory(Class paramClass, String paramString, XMultiServiceFactory paramXMultiServiceFactory, XRegistryKey paramXRegistryKey)
    {
      _xMultiServiceFactory = paramXMultiServiceFactory;
      _xRegistryKey = paramXRegistryKey;
      _implName = paramClass.getName();
      _serviceName = paramString;
      
      Constructor[] arrayOfConstructor = paramClass.getConstructors();
      for (int i = 0; (i < arrayOfConstructor.length) && (_constructor == null); i++)
      {
        Class[] arrayOfClass = arrayOfConstructor[i].getParameterTypes();
        if ((arrayOfClass.length == 3) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(XRegistryKey.class)) && (arrayOfClass[2].equals(__objectArray)))
        {
          _nCode = 0;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(XRegistryKey.class)))
        {
          _nCode = 1;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XComponentContext.class)) && (arrayOfClass[1].equals(__objectArray)))
        {
          _nCode = 2;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(XComponentContext.class)))
        {
          _nCode = 3;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 3) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(XRegistryKey.class)) && (arrayOfClass[2].equals(__objectArray)))
        {
          _nCode = 4;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(XRegistryKey.class)))
        {
          _nCode = 5;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 2) && (arrayOfClass[0].equals(XMultiServiceFactory.class)) && (arrayOfClass[1].equals(__objectArray)))
        {
          _nCode = 6;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(XMultiServiceFactory.class)))
        {
          _nCode = 7;
          _constructor = arrayOfConstructor[i];
        }
        else if ((arrayOfClass.length == 1) && (arrayOfClass[0].equals(__objectArray)))
        {
          _nCode = 8;
          _constructor = arrayOfConstructor[i];
        }
        else if (arrayOfClass.length == 0)
        {
          _nCode = 9;
          _constructor = arrayOfConstructor[i];
        }
      }
      if (_constructor == null) {
        throw new com.sun.star.uno.RuntimeException(getClass().getName() + " can not find a useable constructor");
      }
    }
    
    private final XMultiServiceFactory getSMgr(XComponentContext paramXComponentContext)
    {
      if (paramXComponentContext != null) {
        return (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class, paramXComponentContext.getServiceManager());
      }
      return _xMultiServiceFactory;
    }
    
    public Object createInstanceWithContext(XComponentContext paramXComponentContext)
      throws com.sun.star.uno.Exception
    {
      Object[] arrayOfObject;
      switch (_nCode)
      {
      case 0: 
        arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey, new Object[0] };
        break;
      case 1: 
        arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey };
        break;
      case 2: 
        arrayOfObject = new Object[] { paramXComponentContext, new Object[0] };
        break;
      case 3: 
        arrayOfObject = new Object[] { paramXComponentContext };
        break;
      case 4: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey, new Object[0] };
        break;
      case 5: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey };
        break;
      case 6: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), new Object[0] };
        break;
      case 7: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext) };
        break;
      case 8: 
        arrayOfObject = new Object[] { new Object[0] };
        break;
      default: 
        arrayOfObject = new Object[0];
      }
      try
      {
        return _constructor.newInstance(arrayOfObject);
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        Throwable localThrowable = localInvocationTargetException.getTargetException();
        if ((localThrowable instanceof RuntimeException)) {
          throw ((RuntimeException)localThrowable);
        }
        if ((localThrowable instanceof com.sun.star.uno.Exception)) {
          throw ((com.sun.star.uno.Exception)localThrowable);
        }
        if ((localThrowable instanceof com.sun.star.uno.RuntimeException)) {
          throw ((com.sun.star.uno.RuntimeException)localThrowable);
        }
        throw new com.sun.star.uno.Exception(localThrowable.toString());
      }
      catch (IllegalAccessException localIllegalAccessException)
      {
        throw new com.sun.star.uno.Exception(localIllegalAccessException.toString());
      }
      catch (InstantiationException localInstantiationException)
      {
        throw new com.sun.star.uno.Exception(localInstantiationException.toString());
      }
    }
    
    public Object createInstanceWithArgumentsAndContext(Object[] paramArrayOfObject, XComponentContext paramXComponentContext)
      throws com.sun.star.uno.Exception
    {
      int i = 1;
      Object[] arrayOfObject;
      switch (_nCode)
      {
      case 0: 
        arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey, paramArrayOfObject };
        i = 0;
        break;
      case 1: 
        arrayOfObject = new Object[] { paramXComponentContext, _xRegistryKey };
        break;
      case 2: 
        arrayOfObject = new Object[] { paramXComponentContext, paramArrayOfObject };
        i = 0;
        break;
      case 3: 
        arrayOfObject = new Object[] { paramXComponentContext };
        break;
      case 4: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey, paramArrayOfObject };
        i = 0;
        break;
      case 5: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), _xRegistryKey };
        break;
      case 6: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext), paramArrayOfObject };
        i = 0;
        break;
      case 7: 
        arrayOfObject = new Object[] { getSMgr(paramXComponentContext) };
        break;
      case 8: 
        arrayOfObject = new Object[] { paramArrayOfObject };
        i = 0;
        break;
      default: 
        arrayOfObject = new Object[0];
      }
      try
      {
        Object localObject1 = _constructor.newInstance(arrayOfObject);
        if (i != 0)
        {
          localObject2 = (XInitialization)UnoRuntime.queryInterface(XInitialization.class, localObject1);
          if (localObject2 != null) {
            ((XInitialization)localObject2).initialize(paramArrayOfObject);
          }
        }
        return localObject1;
      }
      catch (InvocationTargetException localInvocationTargetException)
      {
        Object localObject2 = localInvocationTargetException.getTargetException();
        if ((localObject2 instanceof RuntimeException)) {
          throw ((RuntimeException)localObject2);
        }
        if ((localObject2 instanceof com.sun.star.uno.Exception)) {
          throw ((com.sun.star.uno.Exception)localObject2);
        }
        if ((localObject2 instanceof com.sun.star.uno.RuntimeException)) {
          throw ((com.sun.star.uno.RuntimeException)localObject2);
        }
        throw new com.sun.star.uno.Exception(((Throwable)localObject2).toString());
      }
      catch (IllegalAccessException localIllegalAccessException)
      {
        throw new com.sun.star.uno.Exception(localIllegalAccessException.toString());
      }
      catch (InstantiationException localInstantiationException)
      {
        throw new com.sun.star.uno.Exception(localInstantiationException.toString());
      }
    }
    
    public Object createInstance()
      throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException
    {
      return createInstanceWithContext(null);
    }
    
    public Object createInstanceWithArguments(Object[] paramArrayOfObject)
      throws com.sun.star.uno.Exception, com.sun.star.uno.RuntimeException
    {
      return createInstanceWithArgumentsAndContext(paramArrayOfObject, null);
    }
    
    public String[] getSupportedServiceNames()
      throws com.sun.star.uno.RuntimeException
    {
      return new String[] { _serviceName };
    }
    
    public String getImplementationName()
      throws com.sun.star.uno.RuntimeException
    {
      return _implName;
    }
    
    public boolean supportsService(String paramString)
      throws com.sun.star.uno.RuntimeException
    {
      String[] arrayOfString = getSupportedServiceNames();
      
      boolean bool = false;
      for (int i = 0; (i < arrayOfString.length) && (!bool); i++) {
        bool = arrayOfString[i].equals(paramString);
      }
      return bool;
    }
    
    public byte[] getImplementationId()
1 2 3 4 5 6 7

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