org.eclipse.equinox.ds_1.4.1.v20120926-201320

16:43:50.748 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.ds_1.4.1.v20120926-201320.jar
package org.apache.felix.scr;

import java.util.Dictionary;
import org.osgi.framework.Bundle;
import org.osgi.service.component.ComponentInstance;

public abstract interface Component
{
  public static final int STATE_DISABLED = 1;
  public static final int STATE_ENABLING = 512;
  /**
   * @deprecated
   */
  public static final int STATE_ENABLED = 2;
  public static final int STATE_UNSATISFIED = 4;
  public static final int STATE_ACTIVATING = 8;
  public static final int STATE_ACTIVE = 16;
  public static final int STATE_REGISTERED = 32;
  public static final int STATE_FACTORY = 64;
  public static final int STATE_DEACTIVATING = 128;
  public static final int STATE_DISABLING = 1024;
  public static final int STATE_DISPOSING = 2048;
  /**
   * @deprecated
   */
  public static final int STATE_DESTROYED = 256;
  public static final int STATE_DISPOSED = 256;
  
  public abstract long getId();
  
  public abstract String getName();
  
  public abstract int getState();
  
  public abstract Bundle getBundle();
  
  public abstract String getFactory();
  
  public abstract boolean isServiceFactory();
  
  public abstract String getClassName();
  
  public abstract boolean isDefaultEnabled();
  
  public abstract boolean isImmediate();
  
  public abstract String[] getServices();
  
  public abstract Dictionary getProperties();
  
  public abstract Reference[] getReferences();
  
  public abstract ComponentInstance getComponentInstance();
  
  public abstract String getActivate();
  
  public abstract boolean isActivateDeclared();
  
  public abstract String getDeactivate();
  
  public abstract boolean isDeactivateDeclared();
  
  public abstract String getModified();
  
  public abstract String getConfigurationPolicy();
  
  public abstract void enable();
  
  public abstract void disable();
}

/* Location:
 * Qualified Name:     org.apache.felix.scr.Component
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.felix.scr;

import org.osgi.framework.ServiceReference;

public abstract interface Reference
{
  public abstract String getName();
  
  public abstract String getServiceName();
  
  public abstract ServiceReference[] getServiceReferences();
  
  public abstract boolean isSatisfied();
  
  public abstract boolean isOptional();
  
  public abstract boolean isMultiple();
  
  public abstract boolean isStatic();
  
  public abstract String getTarget();
  
  public abstract String getBindMethodName();
  
  public abstract String getUnbindMethodName();
  
  public abstract String getUpdatedMethodName();
}

/* Location:
 * Qualified Name:     org.apache.felix.scr.Reference
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.apache.felix.scr;

import org.osgi.framework.Bundle;

public abstract interface ScrService
{
  public abstract Component[] getComponents();
  
  public abstract Component getComponent(long paramLong);
  
  public abstract Component[] getComponents(String paramString);
  
  public abstract Component[] getComponents(Bundle paramBundle);
}

/* Location:
 * Qualified Name:     org.apache.felix.scr.ScrService
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

import java.io.IOException;
import java.io.PrintStream;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.felix.scr.ScrService;
import org.eclipse.equinox.internal.util.ref.Log;
import org.eclipse.osgi.framework.console.CommandProvider;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.framework.log.FrameworkLogEntry;
import org.eclipse.osgi.service.debug.DebugOptions;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
import org.osgi.framework.Filter;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceEvent;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.framework.SynchronousBundleListener;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationListener;
import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;

public class Activator
  implements BundleActivator, SynchronousBundleListener, ServiceListener
{
  public static BundleContext bc = null;
  public static ConfigurationAdmin configAdmin = null;
  public static boolean security = false;
  private ServiceRegistration configListenerReg;
  private SCRManager scrManager = null;
  public ScrServiceImpl scrService = null;
  private ServiceRegistration scrServiceReg;
  private ServiceRegistration scrCommandProviderReg;
  private static FrameworkLog fwLog;
  private boolean inited = false;
  public static Log log;
  public static boolean DEBUG;
  public static boolean PERF;
  public static boolean DBSTORE;
  public static boolean INSTANTIATE_ALL;
  public static boolean startup;
  static long[] time = null;
  
  public static void timeLog(String message)
  {
    time[1] = time[0];
    log.debug(message + String.valueOf((time[0] = System.currentTimeMillis()) - time[1]), null);
  }
  
  private void initSCR()
  {
    synchronized (this)
    {
      if (inited) {
        return;
      }
      inited = true;
    }
    boolean lazyIniting = false;
    if ((startup) && (time == null))
    {
      long tmp = System.currentTimeMillis();
      time = new long[] { tmp, 0, tmp };
      lazyIniting = true;
      if (startup) {
        timeLog("[BEGIN - lazy SCR init]");
      }
    }
    WorkThread.IDLE_TIMEOUT = getInteger("equinox.ds.idle_timeout", 1000);
    WorkThread.BLOCK_TIMEOUT = getInteger("equinox.ds.block_timeout", 30000);
    try
    {
      bc.addServiceListener(this, "(objectClass=" + ConfigurationAdmin.class.getName() + ')');
    }
    catch (InvalidSyntaxException localInvalidSyntaxException) {}
    ServiceReference caRef = bc.getServiceReference(ConfigurationAdmin.class.getName());
    if (caRef != null) {
      configAdmin = (ConfigurationAdmin)bc.getService(caRef);
    }
    if (startup) {
      timeLog("ConfigurationAdmin service getting took ");
    }
    scrManager = new SCRManager();
    if (startup) {
      timeLog("SCRManager instantiation took ");
    }
    configListenerReg = bc.registerService(ConfigurationListener.class.getName(), scrManager, null);
    if (startup) {
      timeLog("ConfigurationListener service registered for ");
    }
    bc.addServiceListener(scrManager);
    
    scrManager.startIt();
    if (startup) {
      timeLog("startIt() method took ");
    }
    installCommandProvider();
    if ((startup) && (lazyIniting))
    {
      log.debug("[END - lazy SCR init] Activator.initSCR() method executed for " + String.valueOf(time[0] - time[2]), null);
      time = null;
    }
  }
  
  public void start(BundleContext bundleContext)
    throws Exception
  {
    bc = bundleContext;
    startup = getBoolean("equinox.measurements.bundles", false);
    if (startup)
    {
      long tmp = System.currentTimeMillis();
      time = new long[] { tmp, 0, tmp };
    }
    log = new Log(bundleContext, false);
    ServiceTracker debugTracker = new ServiceTracker(bundleContext, DebugOptions.class.getName(), null);
    debugTracker.open();
    DebugOptions debugOptions = (DebugOptions)debugTracker.getService();
    DEBUG = (getBooleanDebugOption(debugOptions, "org.eclipse.equinox.ds/debug", false)) || (getBoolean("equinox.ds.debug", false));
    PERF = (getBooleanDebugOption(debugOptions, "org.eclipse.equinox.ds/performance", false)) || (getBoolean("equinox.ds.perf", false));
    INSTANTIATE_ALL = (getBooleanDebugOption(debugOptions, "org.eclipse.equinox.ds/instantiate_all", false)) || (getBoolean("equinox.ds.instantiate_all", false));
    
    DBSTORE = (getBooleanDebugOption(debugOptions, "org.eclipse.equinox.ds/cache_descriptions", true)) || (getBoolean("equinox.ds.dbstore", true));
    boolean print = (getBooleanDebugOption(debugOptions, "org.eclipse.equinox.ds/print_on_console", false)) || (getBoolean("equinox.ds.print", false));
    log.setDebug(DEBUG);
    log.setPrintOnConsole(print);
    
    debugTracker.close();
    ServiceReference fwRef = bc.getServiceReference(FrameworkLog.class.getName());
    if (fwRef != null) {
      fwLog = (FrameworkLog)bc.getService(fwRef);
    }
    if (startup) {
      timeLog("[BEGIN - start method] Creating Log instance and initializing log system took ");
    }
    security = Log.security();
    boolean hasHeaders = false;
    Bundle[] allBundles = bundleContext.getBundles();
    for (int i = 0; i < allBundles.length; i++)
    {
      Dictionary allHeaders = allBundles[i].getHeaders("");
      if (allHeaders.get("Service-Component") != null)
      {
        hasHeaders = true;
        break;
      }
    }
    if (hasHeaders) {
      initSCR();
    } else {
      bundleContext.addBundleListener(this);
    }
    ServiceReference envInfoRef = bc.getServiceReference(EnvironmentInfo.class.getName());
    EnvironmentInfo envInfo = null;
    if (envInfoRef != null) {
      envInfo = (EnvironmentInfo)bc.getService(envInfoRef);
    }
    if (envInfo != null)
    {
      envInfo.setProperty("equinox.use.ds", "true");
      bc.ungetService(envInfoRef);
    }
    else
    {
      System.setProperty("equinox.use.ds", "true");
    }
    scrService = new ScrServiceImpl();
    scrServiceReg = bc.registerService(ScrService.class.getName(), scrService, null);
    if (startup)
    {
      log.debug("[END - start method] Activator.start() method executed for " + String.valueOf(time[0] - time[2]), null);
      time = null;
    }
  }
  
  public void stop(BundleContext bundleContext)
    throws Exception
  {
    if (scrManager != null)
    {
      scrManager.stopIt();
      bundleContext.removeServiceListener(scrManager);
    }
    if (configListenerReg != null) {
      configListenerReg.unregister();
    }
    if (scrService != null)
    {
      scrService.dispose();
      scrServiceReg.unregister();
    }
    if (scrCommandProviderReg != null) {
      scrCommandProviderReg.unregister();
    }
    if (scrManager != null) {
      bundleContext.removeBundleListener(scrManager);
    } else {
      bundleContext.removeBundleListener(this);
    }
    ServiceReference envInfoRef = bc.getServiceReference(EnvironmentInfo.class.getName());
    EnvironmentInfo envInfo = null;
    if (envInfoRef != null) {
      envInfo = (EnvironmentInfo)bc.getService(envInfoRef);
    }
    if (envInfo != null)
    {
      envInfo.setProperty("equinox.use.ds", "false");
      bc.ungetService(envInfoRef);
    }
    else
    {
      System.setProperty("equinox.use.ds", "false");
    }
    log.close();
    log = null;
  }
  
  public static Filter createFilter(String filter)
    throws InvalidSyntaxException
  {
    return bc.createFilter(filter);
  }
  
  public void bundleChanged(BundleEvent event)
  {
    if ((event.getType() == 2) || (event.getType() == 512))
    {
      Dictionary allHeaders = event.getBundle().getHeaders("");
      if (allHeaders.get("Service-Component") != null)
      {
        bc.removeBundleListener(this);
        initSCR();
      }
    }
  }
  
  public static Configuration getConfiguration(String pid)
    throws IOException
  {
    if (configAdmin != null) {
      return configAdmin.getConfiguration(pid);
    }
    return null;
  }
  
  public static Configuration[] listConfigurations(String filter)
    throws IOException, InvalidSyntaxException
  {
    if (configAdmin != null) {
      return configAdmin.listConfigurations(filter);
    }
    return null;
  }
  
  public static boolean getBoolean(String property, boolean defaultValue)
  {
    String prop = bc != null ? bc.getProperty(property) : System.getProperty(property);
    if (prop != null) {
      return prop.equalsIgnoreCase("true");
    }
    return defaultValue;
  }
  
  public static boolean getBoolean(String property)
  {
    return getBoolean(property, false);
  }
  
  public static int getInteger(String property, int defaultValue)
  {
    String prop = bc != null ? bc.getProperty(property) : System.getProperty(property);
    if (prop != null) {
      try
      {
        return Integer.decode(prop).intValue();
      }
      catch (NumberFormatException localNumberFormatException) {}
    }
    return defaultValue;
  }
  
  public boolean getBooleanDebugOption(DebugOptions optionsService, String option, boolean defaultValue)
  {
    if (optionsService != null)
    {
      String value = optionsService.getOption(option);
      if (value != null) {
        return value.equalsIgnoreCase("true");
      }
    }
    return defaultValue;
  }
  
  private void installCommandProvider()
  {
    try
    {
      SCRCommandProvider scrCommandProvider = new SCRCommandProvider(scrManager);
      Hashtable reg_props = new Hashtable(1, 1.0F);
      reg_props.put("service.ranking", new Integer(Integer.MAX_VALUE));
      scrCommandProviderReg = bc.registerService(CommandProvider.class.getName(), scrCommandProvider, reg_props);
    }
    catch (NoClassDefFoundError e)
    {
      if (DEBUG) {
        log.debug("Cannot register SCR CommandProvider!", e);
      }
    }
  }
  
  public static void log(BundleContext bundleContext, int level, String message, Throwable t)
  {
    LogService logService = null;
    ServiceReference logRef = null;
    if (bundleContext != null) {
      try
      {
        logRef = bundleContext.getServiceReference(LogService.class.getName());
        if (logRef != null) {
          logService = (LogService)bundleContext.getService(logRef);
        }
      }
      catch (Exception e)
      {
        if (DEBUG) {
          log.debug("Cannot get LogService for bundle " + bundleContext.getBundle().getSymbolicName(), e);
        }
      }
    }
    if (logService != null)
    {
      logService.log(level, message, t);
      bundleContext.ungetService(logRef);
      if (log.getPrintOnConsole())
      {
        String prefix = "";
        switch (level)
        {
        case 1: 
          prefix = "ERROR ";
          break;
        case 2: 
          prefix = "WARNING ";
          break;
        case 3: 
          prefix = "INFO ";
        }
        dumpOnConsole(prefix, bundleContext, message, t, level == 1);
      }
    }
    else
    {
      logRef = bc.getServiceReference(LogService.class.getName());
      if (logRef == null) {
        if ((!log.getPrintOnConsole()) && (!logautoPrintOnConsole) && (fwLog == null)) {
          if (level == 1) {
            dumpOnConsole("ERROR ", bundleContext, message, t, true);
          }
        }
      }
      switch (level)
      {
      case 1: 
        log.error(message, t);
        break;
      case 2: 
        log.warning(message, t);
        break;
      case 3: 
        log.info(message);
        break;
      default: 
        log.debug(message, t);
      }
    }
    if (fwLog != null) {
      logToFWLog(bundleContext != null ? bundleContext.getBundle().getSymbolicName() : bc.getBundle().getSymbolicName(), level, message, t);
    }
  }
  
  private static void dumpOnConsole(String prefix, BundleContext bundleContext, String msg, Throwable t, boolean printInErr)
  {
    String message = prefix + bundleContext.getBundle().getBundleId() + " " + msg;
    if (printInErr) {
      System.err.println(message);
    } else {
      System.out.println(message);
    }
    if (t != null) {
      t.printStackTrace();
    }
  }
  
  private static void logToFWLog(String bsn, int level, String message, Throwable t)
  {
    int severity = 1;
    switch (level)
    {
    case 1: 
      severity = 4;
      break;
    case 2: 
      severity = 2;
      break;
    case 3: 
      severity = 1;
      break;
    case 4: 
      severity = 1;
    }
    fwLog.log(new FrameworkLogEntry(bsn, severity, 0, message, 0, t, null));
  }
  
  public void serviceChanged(ServiceEvent event)
  {
    switch (event.getType())
    {
    case 1: 
      Object caService = bc.getService(event.getServiceReference());
      configAdmin = (ConfigurationAdmin)caService;
      if (caService != null) {
        if (scrManager != null) {
          scrManager.configAdminRegistered((ConfigurationAdmin)caService, event.getServiceReference());
        }
      }
      break;
    case 4: 
      ServiceReference caRef = bc.getServiceReference(ConfigurationAdmin.class.getName());
      if (caRef != null) {
        configAdmin = (ConfigurationAdmin)bc.getService(caRef);
      } else {
        configAdmin = null;
      }
      break;
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.ds.Activator
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

import org.eclipse.equinox.internal.ds.model.ServiceComponentProp;

public class CircularityException
  extends Exception
{
  private static final long serialVersionUID = 1L;
  private ServiceComponentProp causingComponent;
  
  public CircularityException(ServiceComponentProp scp)
  {
    causingComponent = scp;
  }
  
  public ServiceComponentProp getCausingComponent()
  {
    return causingComponent;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.ds.CircularityException
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

import java.util.Vector;
import org.eclipse.equinox.internal.ds.model.DeclarationParser;
import org.osgi.framework.Bundle;

public abstract class ComponentStorage
{
  private final DeclarationParser parser = new DeclarationParser();
  
  public abstract Vector loadComponentDefinitions(Bundle paramBundle, String paramString);
  
  public abstract void deleteComponentDefinitions(long paramLong);
  
  public abstract void stop();
  
  /* Error */
  protected Vector parseXMLDeclaration(Bundle bundle, String dsHeader)
    throws java.lang.Exception
  {
    // Byte code:
    //   0: new 89	java/util/Vector
    //   3: dup
    //   4: invokespecial 178	java/util/Vector:<init>	()V
    //   7: astore_3
    //   8: aload_2
    //   9: ifnonnull +5 -> 14
    //   12: aload_3
    //   13: areturn
    //   14: ldc 3
    //   16: aload_2
    //   17: invokestatic 184	org/eclipse/osgi/util/ManifestElement:parseHeader	(Ljava/lang/String;Ljava/lang/String;)[Lorg/eclipse/osgi/util/ManifestElement;
    //   20: astore 4
    //   22: aload_0
    //   23: getfield 160	org/eclipse/equinox/internal/ds/ComponentStorage:parser	Lorg/eclipse/equinox/internal/ds/model/DeclarationParser;
    //   26: dup
    //   27: astore 5
    //   29: monitorenter
    //   30: iconst_0
    //   31: istore 6
    //   33: goto +384 -> 417
    //   36: aload 4
    //   38: iload 6
    //   40: aaload
    //   41: invokevirtual 183	org/eclipse/osgi/util/ManifestElement:getValueComponents	()[Ljava/lang/String;
    //   44: astore 7
    //   46: iconst_0
    //   47: istore 8
    //   49: goto +357 -> 406
    //   52: aload 7
    //   54: iload 8
    //   56: aaload
    //   57: astore 9
    //   59: aload 9
    //   61: bipush 47
    //   63: invokevirtual 170	java/lang/String:lastIndexOf	(I)I
    //   66: istore 10
    //   68: iload 10
    //   70: iconst_m1
    //   71: if_icmpeq +14 -> 85
    //   74: aload 9
    //   76: iconst_0
    //   77: iload 10
    //   79: invokevirtual 172	java/lang/String:substring	(II)Ljava/lang/String;
    //   82: goto +5 -> 87
    //   85: ldc 1
    //   87: astore 11
    //   89: aconst_null
    //   90: astore 12
    //   92: aload_1
    //   93: aload 11
    //   95: iload 10
    //   97: iconst_m1
    //   98: if_icmpeq +15 -> 113
    //   101: aload 9
    //   103: iload 10
    //   105: iconst_1
    //   106: iadd
    //   107: invokevirtual 171	java/lang/String:substring	(I)Ljava/lang/String;
    //   110: goto +5 -> 115
    //   113: aload 9
    //   115: iconst_0
    //   116: invokeinterface 191 4 0
    //   121: astore 13
    //   123: aload 13
    //   125: ifnull +13 -> 138
    //   128: aload 13
    //   130: invokeinterface 187 1 0
    //   135: ifne +258 -> 393
    //   138: aload_1
    //   139: invokeinterface 190 1 0
    //   144: iconst_1
    //   145: getstatic 162	org/eclipse/equinox/internal/ds/Messages:COMPONENT_XML_NOT_FOUND	Ljava/lang/String;
    //   148: aload_1
    //   149: invokeinterface 189 1 0
    //   154: aload 9
    //   156: invokestatic 186	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/String;
    //   159: aconst_null
    //   160: invokestatic 179	org/eclipse/equinox/internal/ds/Activator:log	(Lorg/osgi/framework/BundleContext;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   163: goto +240 -> 403
    //   166: aload 13
    //   168: invokeinterface 188 1 0
    //   173: checkcast 87	java/net/URL
    //   176: astore 14
    //   178: getstatic 158	org/eclipse/equinox/internal/ds/Activator:DEBUG	Z
    //   181: ifeq +30 -> 211
    //   184: getstatic 159	org/eclipse/equinox/internal/ds/Activator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   187: new 85	java/lang/StringBuffer
    //   190: dup
    //   191: ldc 2
    //   193: invokespecial 174	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   196: aload 14
    //   198: invokevirtual 169	java/lang/Object:toString	()Ljava/lang/String;
    //   201: invokevirtual 175	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   204: invokevirtual 173	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   207: aconst_null
    //   208: invokevirtual 182	org/eclipse/equinox/internal/util/ref/Log:debug	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   211: aload 14
    //   213: invokevirtual 176	java/net/URL:openStream	()Ljava/io/InputStream;
    //   216: astore 12
    //   218: aload 12
    //   220: ifnonnull +25 -> 245
    //   223: aload_1
    //   224: invokeinterface 190 1 0
    //   229: iconst_1
    //   230: getstatic 161	org/eclipse/equinox/internal/ds/Messages:CANT_OPEN_STREAM_TO_COMPONENT_XML	Ljava/lang/String;
    //   233: aload 14
    //   235: invokestatic 185	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   238: aconst_null
    //   239: invokestatic 179	org/eclipse/equinox/internal/ds/Activator:log	(Lorg/osgi/framework/BundleContext;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   242: goto +141 -> 383
    //   245: aload_3
    //   246: invokevirtual 177	java/util/Vector:size	()I
    //   249: istore 15
    //   251: aload_0
    //   252: getfield 160	org/eclipse/equinox/internal/ds/ComponentStorage:parser	Lorg/eclipse/equinox/internal/ds/model/DeclarationParser;
    //   255: aload 12
    //   257: aload_1
    //   258: aload_3
    //   259: aload 14
    //   261: invokevirtual 169	java/lang/Object:toString	()Ljava/lang/String;
    //   264: invokevirtual 181	org/eclipse/equinox/internal/ds/model/DeclarationParser:parse	(Ljava/io/InputStream;Lorg/osgi/framework/Bundle;Ljava/util/Vector;Ljava/lang/String;)V
    //   267: iload 15
    //   269: aload_3
    //   270: invokevirtual 177	java/util/Vector:size	()I
    //   273: if_icmpne +110 -> 383
    //   276: aload_1
    //   277: invokeinterface 190 1 0
    //   282: iconst_2
    //   283: getstatic 165	org/eclipse/equinox/internal/ds/Messages:NO_COMPONENTS_FOUND	Ljava/lang/String;
    //   286: aload 14
    //   288: invokestatic 185	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   291: aconst_null
    //   292: invokestatic 179	org/eclipse/equinox/internal/ds/Activator:log	(Lorg/osgi/framework/BundleContext;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   295: goto +88 -> 383
    //   298: astore 15
    //   300: aload_1
    //   301: invokeinterface 190 1 0
    //   306: iconst_1
    //   307: getstatic 163	org/eclipse/equinox/internal/ds/Messages:ERROR_OPENING_COMP_XML	Ljava/lang/String;
    //   310: aload 14
    //   312: invokestatic 185	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   315: aload 15
    //   317: invokestatic 179	org/eclipse/equinox/internal/ds/Activator:log	(Lorg/osgi/framework/BundleContext;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   320: aload 12
    //   322: ifnull +71 -> 393
    //   325: aload 12
    //   327: invokevirtual 167	java/io/InputStream:close	()V
    //   330: goto +63 -> 393
    //   333: astore 15
    //   335: aload_1
    //   336: invokeinterface 190 1 0
    //   341: iconst_1
    //   342: getstatic 164	org/eclipse/equinox/internal/ds/Messages:ILLEGAL_DEFINITION_FILE	Ljava/lang/String;
    //   345: aload 14
    //   347: invokestatic 185	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   350: aload 15
    //   352: invokestatic 179	org/eclipse/equinox/internal/ds/Activator:log	(Lorg/osgi/framework/BundleContext;ILjava/lang/String;Ljava/lang/Throwable;)V
    //   355: aload 12
    //   357: ifnull +36 -> 393
    //   360: aload 12
    //   362: invokevirtual 167	java/io/InputStream:close	()V
    //   365: goto +28 -> 393
    //   368: astore 16
    //   370: aload 12
    //   372: ifnull +8 -> 380
    //   375: aload 12
    //   377: invokevirtual 167	java/io/InputStream:close	()V
    //   380: aload 16
    //   382: athrow
    //   383: aload 12
    //   385: ifnull +8 -> 393
    //   388: aload 12
    //   390: invokevirtual 167	java/io/InputStream:close	()V
    //   393: aload 13
    //   395: invokeinterface 187 1 0
    //   400: ifne -234 -> 166
    //   403: iinc 8 1
    //   406: iload 8
    //   408: aload 7
    //   410: arraylength
    //   411: if_icmplt -359 -> 52
    //   414: iinc 6 1
    //   417: iload 6
    //   419: aload 4
    //   421: arraylength
    //   422: if_icmplt -386 -> 36
    //   425: aload_0
    //   426: getfield 160	org/eclipse/equinox/internal/ds/ComponentStorage:parser	Lorg/eclipse/equinox/internal/ds/model/DeclarationParser;
    //   429: getfield 166	org/eclipse/equinox/internal/ds/model/DeclarationParser:components	Ljava/util/Vector;
    //   432: astore_3
    //   433: aload_0
    //   434: getfield 160	org/eclipse/equinox/internal/ds/ComponentStorage:parser	Lorg/eclipse/equinox/internal/ds/model/DeclarationParser;
    //   437: aconst_null
    //   438: putfield 166	org/eclipse/equinox/internal/ds/model/DeclarationParser:components	Ljava/util/Vector;
    //   441: aload 5
    //   443: monitorexit
    //   444: goto +7 -> 451
    //   447: aload 5
    //   449: monitorexit
    //   450: athrow
    //   451: aload_3
    //   452: areturn
    // Line number table:
    //   Java source line #57	-> byte code offset #0
    //   Java source line #58	-> byte code offset #8
    //   Java source line #59	-> byte code offset #12
    //   Java source line #60	-> byte code offset #14
    //   Java source line #62	-> byte code offset #22
    //   Java source line #64	-> byte code offset #30
    //   Java source line #65	-> byte code offset #36
    //   Java source line #66	-> byte code offset #46
    //   Java source line #67	-> byte code offset #52
    //   Java source line #68	-> byte code offset #59
    //   Java source line #69	-> byte code offset #68
    //   Java source line #70	-> byte code offset #89
    //   Java source line #72	-> byte code offset #92
    //   Java source line #73	-> byte code offset #123
    //   Java source line #74	-> byte code offset #138
    //   Java source line #75	-> byte code offset #163
    //   Java source line #83	-> byte code offset #166
    //   Java source line #84	-> byte code offset #178
    //   Java source line #85	-> byte code offset #184
    //   Java source line #88	-> byte code offset #211
    //   Java source line #89	-> byte code offset #218
    //   Java source line #90	-> byte code offset #223
    //   Java source line #92	-> byte code offset #245
    //   Java source line #93	-> byte code offset #251
    //   Java source line #94	-> byte code offset #267
    //   Java source line #95	-> byte code offset #276
    //   Java source line #98	-> byte code offset #298
    //   Java source line #99	-> byte code offset #300
    //   Java source line #103	-> byte code offset #320
    //   Java source line #104	-> byte code offset #325
    //   Java source line #100	-> byte code offset #333
    //   Java source line #101	-> byte code offset #335
    //   Java source line #103	-> byte code offset #355
    //   Java source line #104	-> byte code offset #360
    //   Java source line #102	-> byte code offset #368
    //   Java source line #103	-> byte code offset #370
    //   Java source line #104	-> byte code offset #375
    //   Java source line #106	-> byte code offset #380
    //   Java source line #103	-> byte code offset #383
    //   Java source line #104	-> byte code offset #388
    //   Java source line #82	-> byte code offset #393
    //   Java source line #66	-> byte code offset #403
    //   Java source line #64	-> byte code offset #414
    //   Java source line #111	-> byte code offset #425
    //   Java source line #114	-> byte code offset #433
    //   Java source line #62	-> byte code offset #441
    //   Java source line #116	-> byte code offset #451
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	453	0	this	ComponentStorage
    //   0	453	1	bundle	Bundle
    //   0	453	2	dsHeader	String
    //   7	445	3	components	Vector
    //   20	400	4	elements	org.eclipse.osgi.util.ManifestElement[]
    //   27	421	5	Ljava/lang/Object;	Object
    //   31	387	6	i	int
    //   44	365	7	definitionFiles	String[]
    //   47	360	8	j	int
    //   57	98	9	definitionFile	String
    //   66	38	10	ind	int
    //   87	7	11	path	String
    //   90	299	12	is	java.io.InputStream
    //   121	273	13	urls	java.util.Enumeration
    //   176	170	14	url	java.net.URL
    //   249	19	15	compSize	int
    //   298	18	15	ie	java.io.IOException
    //   333	18	15	t	Throwable
    //   368	13	16	localObject1	Object
    // Exception table:
    //   from	to	target	type
    //   211	295	298	java/io/IOException
    //   211	295	333	java/lang/Throwable
    //   211	320	368	finally
    //   333	355	368	finally
    //   30	444	447	finally
    //   447	450	447	finally
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.ds.ComponentStorage
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

import org.eclipse.equinox.internal.ds.model.ServiceComponentProp;
import org.eclipse.equinox.internal.util.ref.Log;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentException;
import org.osgi.service.component.ComponentInstance;

final class FactoryReg
  implements ServiceFactory
{
  private final ServiceComponentProp component;
  
  FactoryReg(ServiceComponentProp component)
  {
    this.component = component;
  }
  
  public Object getService(Bundle bundle, ServiceRegistration registration)
  {
    try
    {
      if (Activator.DEBUG) {
        Activator.log.debug("FactoryReg.getService(): created new service for component " + component.name, null);
      }
      ComponentInstance ci = InstanceProcess.staticRef.buildComponent(bundle, component, null, false);
      if (ci != null) {
        return ci.getInstance();
      }
    }
    catch (Throwable t)
    {
      if (!(t instanceof ComponentException)) {
        Activator.log(component.bc, 1, NLS.bind(Messages.CANT_GET_SERVICE, component.name), t);
      } else {
        throw ((ComponentException)t);
      }
    }
    return null;
  }
  
  public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
  {
    if (Activator.DEBUG) {
      Activator.log.debug("FactoryReg.ungetService(): registration = " + registration.toString(), null);
    }
    component.disposeObj(service, 0);
  }
  
  public String toString()
  {
    return component.name + " FactoryRegistration";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.ds.FactoryReg
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

class InstanceProcess$Counter
{
  int count = 0;
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.ds.InstanceProcess.Counter
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.ds;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
import org.eclipse.equinox.internal.ds.impl.ComponentFactoryImpl;
import org.eclipse.equinox.internal.ds.impl.ComponentInstanceImpl;
import org.eclipse.equinox.internal.ds.model.ComponentReference;
import org.eclipse.equinox.internal.ds.model.ServiceComponent;
import org.eclipse.equinox.internal.ds.model.ServiceComponentProp;
import org.eclipse.equinox.internal.util.ref.Log;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.ComponentFactory;
import org.osgi.service.component.ComponentInstance;

public class InstanceProcess
{
  public static Resolver resolver;
  public static InstanceProcess staticRef;
  protected Hashtable factoryRegistrations;
  private Vector delayedBindList;
  static Hashtable buildingThreads = new Hashtable(7);
  static Hashtable stackCounts = new Hashtable(7);
  static int waitTime = Activator.getInteger("equinox.scr.waitTimeOnBlock", 10000);
  boolean busyBuilding = false;
  Thread workingThread;
  Object lock = new Object();
  int lockCounter = 0;
  
  InstanceProcess(Resolver resolver)
  {
    resolver = resolver;
    factoryRegistrations = new Hashtable(19);
    delayedBindList = new Vector(10);
    staticRef = this;
  }
  
  void dispose()
  {
    factoryRegistrations = null;
  }
  
  void getLock()
  {
    synchronized (lock)
    {
      Thread currentThread = Thread.currentThread();
      if (!busyBuilding)
      {
        busyBuilding = true;
        lockCounter += 1;
        workingThread = currentThread;
      }
      else if (workingThread == currentThread)
      {
        lockCounter += 1;
      }
      else if (workingThread != currentThread)
      {
        long start = System.currentTimeMillis();
        long timeToWait = waitTime;
        boolean lockSucceeded = false;
        do
        {
          try
          {
            lock.wait(timeToWait);
          }
          catch (InterruptedException localInterruptedException) {}
          if (!busyBuilding)
          {
            busyBuilding = true;
            lockCounter += 1;
            workingThread = currentThread;
            lockSucceeded = true;
            break;
          }
          timeToWait = waitTime + start - System.currentTimeMillis();
        } while (timeToWait > 0L);
        if (!lockSucceeded) {
          Activator.log(null, 2, NLS.bind(Messages.TIMEOUT_GETTING_LOCK, Integer.toString(waitTime)), new Exception("Debug stacktrace"));
        }
      }
    }
  }
  
  void freeLock()
  {
    synchronized (lock)
    {
      if (busyBuilding)
      {
        if (workingThread == Thread.currentThread()) {
          lockCounter -= 1;
        }
        if (lockCounter == 0)
        {
          busyBuilding = false;
          workingThread = null;
          lock.notify();
        }
      }
    }
  }
  
  /* Error */
  public void buildComponents(Vector list, boolean security)
  {
    // Byte code:
    //   0: aconst_null
    //   1: astore_3
    //   2: aconst_null
    //   3: astore 5
    //   5: aload_1
    //   6: ifnull +801 -> 807
    //   9: aload_0
    //   10: invokevirtual 645	org/eclipse/equinox/internal/ds/InstanceProcess:getLock	()V
    //   13: new 318	java/util/Vector
    //   16: dup
    //   17: invokespecial 630	java/util/Vector:<init>	()V
    //   20: astore 6
    //   22: iconst_0
    //   23: istore 7
    //   25: goto +39 -> 64
    //   28: aload_1
    //   29: iload 7
    //   31: invokevirtual 636	java/util/Vector:elementAt	(I)Ljava/lang/Object;
    //   34: checkcast 332	org/eclipse/equinox/internal/ds/model/ServiceComponentProp
    //   37: astore_3
    //   38: aload_3
    //   39: invokevirtual 662	org/eclipse/equinox/internal/ds/model/ServiceComponentProp:getState	()I
    //   42: iconst_4
    //   43: if_icmpeq +6 -> 49
    //   46: goto +15 -> 61
    //   49: aload_3
    //   50: bipush 8
    //   52: invokevirtual 668	org/eclipse/equinox/internal/ds/model/ServiceComponentProp:setState	(I)V
    //   55: aload 6
    //   57: aload_3
    //   58: invokevirtual 637	java/util/Vector:addElement	(Ljava/lang/Object;)V
    //   61: iinc 7 1
    //   64: iload 7
    //   66: aload_1
    //   67: invokevirtual 629	java/util/Vector:size	()I
    //   70: if_icmplt -42 -> 28
    //   73: aload_0
    //   74: invokevirtual 644	org/eclipse/equinox/internal/ds/InstanceProcess:freeLock	()V
    //   77: iconst_0
    //   78: istore 7
    //   80: goto +717 -> 797
    //   83: aload 6
    //   85: iload 7
    //   87: invokevirtual 636	java/util/Vector:elementAt	(I)Ljava/lang/Object;
    //   90: checkcast 332	org/eclipse/equinox/internal/ds/model/ServiceComponentProp
    //   93: astore_3
    //   94: aload_0
    //   95: invokevirtual 645	org/eclipse/equinox/internal/ds/InstanceProcess:getLock	()V
    //   98: aload_3
    //   99: invokevirtual 662	org/eclipse/equinox/internal/ds/model/ServiceComponentProp:getState	()I
    //   102: bipush 8
    //   104: if_icmpeq +10 -> 114
    //   107: aload_0
    //   108: invokevirtual 644	org/eclipse/equinox/internal/ds/InstanceProcess:freeLock	()V
    //   111: goto +683 -> 794
    //   114: lconst_0
    //   115: lstore 8
    //   117: iconst_1
    //   118: istore 10
    //   120: getstatic 554	org/eclipse/equinox/internal/ds/Activator:PERF	Z
    //   123: ifeq +30 -> 153
    //   126: invokestatic 619	java/lang/System:currentTimeMillis	()J
    //   129: lstore 8
    //   131: getstatic 555	org/eclipse/equinox/internal/ds/Activator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   134: new 311	java/lang/StringBuffer
    //   137: dup
    //   138: ldc 4
    //   140: invokespecial 616	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   143: aload_3
    //   144: invokevirtual 617	java/lang/StringBuffer:append	(Ljava/lang/Object;)Ljava/lang/StringBuffer;
    //   147: invokevirtual 615	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   150: invokevirtual 677	org/eclipse/equinox/internal/util/ref/Log:info	(Ljava/lang/String;)V
    //   153: aload_3
    //   154: getfield 600	org/eclipse/equinox/internal/ds/model/ServiceComponentProp:serviceComponent	Lorg/eclipse/equinox/internal/ds/model/ServiceComponent;
    //   157: astore 4
    //   159: aload 4
    //   161: getfield 592	org/eclipse/equinox/internal/ds/model/ServiceComponent:immediate	Z
    //   164: ifne +17 -> 181
    //   167: aload 4
    //   169: getfield 594	org/eclipse/equinox/internal/ds/model/ServiceComponent:factory	Ljava/lang/String;
    //   172: ifnonnull +130 -> 302
    //   175: getstatic 553	org/eclipse/equinox/internal/ds/Activator:INSTANTIATE_ALL	Z
    //   178: ifeq +124 -> 302
    //   181: getstatic 552	org/eclipse/equinox/internal/ds/Activator:DEBUG	Z
    //   184: ifeq +29 -> 213
    //   187: getstatic 555	org/eclipse/equinox/internal/ds/Activator:log	Lorg/eclipse/equinox/internal/util/ref/Log;
    //   190: new 311	java/lang/StringBuffer
    //   193: dup
    //   194: ldc 3
    //   196: invokespecial 616	java/la
1 2 3 4 5 6 7 8 9 10 11 12 13 14

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