org.eclipse.osgi_3.8.2.v20130124-134944

i.framework.adaptor.BundleOperation;
import org.eclipse.osgi.framework.adaptor.EventPublisher;
import org.osgi.framework.BundleException;

public class BundleUpdate
  implements BundleOperation
{
  private BaseData data;
  private BaseData newData;
  private URLConnection source;
  private BaseStorage storage;
  
  public BundleUpdate(BaseData data, URLConnection source, BaseStorage storage)
  {
    this.data = data;
    this.source = source;
    this.storage = storage;
  }
  
  /* Error */
  public org.eclipse.osgi.framework.adaptor.BundleData begin()
    throws BundleException
  {
    // Byte code:
    //   0: aload_0
    //   1: aload_0
    //   2: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:storage	Lorg/eclipse/osgi/internal/baseadaptor/BaseStorage;
    //   5: aload_0
    //   6: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   9: invokevirtual 256	org/eclipse/osgi/baseadaptor/BaseData:getBundleID	()J
    //   12: aload_0
    //   13: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   16: invokevirtual 261	org/eclipse/osgi/baseadaptor/BaseData:getLocation	()Ljava/lang/String;
    //   19: invokevirtual 273	org/eclipse/osgi/internal/baseadaptor/BaseStorage:createBaseData	(JLjava/lang/String;)Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   22: putfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   25: aload_0
    //   26: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   29: invokestatic 247	java/lang/System:currentTimeMillis	()J
    //   32: invokevirtual 260	org/eclipse/osgi/baseadaptor/BaseData:setLastModified	(J)V
    //   35: aload_0
    //   36: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   39: aload_0
    //   40: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   43: invokevirtual 254	org/eclipse/osgi/baseadaptor/BaseData:getStartLevel	()I
    //   46: invokevirtual 258	org/eclipse/osgi/baseadaptor/BaseData:setStartLevel	(I)V
    //   49: aload_0
    //   50: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   53: aload_0
    //   54: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   57: invokevirtual 255	org/eclipse/osgi/baseadaptor/BaseData:getStatus	()I
    //   60: invokevirtual 259	org/eclipse/osgi/baseadaptor/BaseData:setStatus	(I)V
    //   63: aload_0
    //   64: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   67: invokevirtual 262	org/eclipse/osgi/baseadaptor/BaseData:getAdaptor	()Lorg/eclipse/osgi/baseadaptor/BaseAdaptor;
    //   70: invokevirtual 252	org/eclipse/osgi/baseadaptor/BaseAdaptor:getHookRegistry	()Lorg/eclipse/osgi/baseadaptor/HookRegistry;
    //   73: invokevirtual 266	org/eclipse/osgi/baseadaptor/HookRegistry:getStorageHooks	()[Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;
    //   76: astore_1
    //   77: aload_1
    //   78: arraylength
    //   79: anewarray 120	org/eclipse/osgi/baseadaptor/hooks/StorageHook
    //   82: astore_2
    //   83: iconst_0
    //   84: istore_3
    //   85: goto +47 -> 132
    //   88: aload_2
    //   89: iload_3
    //   90: aload_1
    //   91: iload_3
    //   92: aaload
    //   93: aload_0
    //   94: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   97: invokeinterface 286 2 0
    //   102: aastore
    //   103: aload_2
    //   104: iload_3
    //   105: aaload
    //   106: aload_0
    //   107: getfield 236	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:data	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   110: aload_2
    //   111: iload_3
    //   112: aaload
    //   113: invokeinterface 283 1 0
    //   118: checkcast 113	java/lang/String
    //   121: invokevirtual 265	org/eclipse/osgi/baseadaptor/BaseData:getStorageHook	(Ljava/lang/String;)Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;
    //   124: invokeinterface 285 2 0
    //   129: iinc 3 1
    //   132: iload_3
    //   133: aload_1
    //   134: arraylength
    //   135: if_icmplt -47 -> 88
    //   138: aload_0
    //   139: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   142: aload_2
    //   143: invokevirtual 263	org/eclipse/osgi/baseadaptor/BaseData:setStorageHooks	([Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;)V
    //   146: aload_0
    //   147: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   150: getstatic 234	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:KEY	Ljava/lang/String;
    //   153: invokevirtual 265	org/eclipse/osgi/baseadaptor/BaseData:getStorageHook	(Ljava/lang/String;)Lorg/eclipse/osgi/baseadaptor/hooks/StorageHook;
    //   156: checkcast 127	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook
    //   159: astore_3
    //   160: aload_0
    //   161: getfield 235	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:source	Ljava/net/URLConnection;
    //   164: invokevirtual 250	java/net/URLConnection:getInputStream	()Ljava/io/InputStream;
    //   167: astore 4
    //   169: aload_0
    //   170: getfield 235	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:source	Ljava/net/URLConnection;
    //   173: invokevirtual 251	java/net/URLConnection:getURL	()Ljava/net/URL;
    //   176: astore 5
    //   178: aload 5
    //   180: ifnonnull +7 -> 187
    //   183: aconst_null
    //   184: goto +8 -> 192
    //   187: aload 5
    //   189: invokevirtual 249	java/net/URL:getProtocol	()Ljava/lang/String;
    //   192: astore 6
    //   194: aload 4
    //   196: instanceof 123
    //   199: ifeq +63 -> 262
    //   202: aload 4
    //   204: checkcast 123	org/eclipse/osgi/framework/internal/core/ReferenceInputStream
    //   207: invokevirtual 267	org/eclipse/osgi/framework/internal/core/ReferenceInputStream:getReference	()Ljava/net/URL;
    //   210: astore 7
    //   212: ldc 2
    //   214: aload 7
    //   216: invokevirtual 249	java/net/URL:getProtocol	()Ljava/lang/String;
    //   219: invokevirtual 246	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   222: ifne +19 -> 241
    //   225: new 130	org/osgi/framework/BundleException
    //   228: dup
    //   229: getstatic 232	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:ADAPTOR_URL_CREATE_EXCEPTION	Ljava/lang/String;
    //   232: aload 7
    //   234: invokestatic 279	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   237: invokespecial 280	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;)V
    //   240: athrow
    //   241: aload 7
    //   243: invokevirtual 248	java/net/URL:getPath	()Ljava/lang/String;
    //   246: astore 8
    //   248: aload_3
    //   249: iconst_1
    //   250: invokevirtual 274	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setReference	(Z)V
    //   253: aload_3
    //   254: aload 8
    //   256: invokevirtual 278	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setFileName	(Ljava/lang/String;)V
    //   259: goto +126 -> 385
    //   262: aload_3
    //   263: invokevirtual 276	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:createGenerationDir	()Ljava/io/File;
    //   266: astore 7
    //   268: aload 7
    //   270: invokevirtual 239	java/io/File:exists	()Z
    //   273: ifne +22 -> 295
    //   276: new 130	org/osgi/framework/BundleException
    //   279: dup
    //   280: getstatic 230	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:ADAPTOR_DIRECTORY_CREATE_EXCEPTION	Ljava/lang/String;
    //   283: aload 7
    //   285: invokevirtual 241	java/io/File:getPath	()Ljava/lang/String;
    //   288: invokestatic 279	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   291: invokespecial 280	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;)V
    //   294: athrow
    //   295: aload_3
    //   296: iconst_0
    //   297: invokevirtual 274	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setReference	(Z)V
    //   300: aload_3
    //   301: ldc 1
    //   303: invokevirtual 278	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:setFileName	(Ljava/lang/String;)V
    //   306: new 109	java/io/File
    //   309: dup
    //   310: aload 7
    //   312: aload_3
    //   313: invokevirtual 277	org/eclipse/osgi/internal/baseadaptor/BaseStorageHook:getFileName	()Ljava/lang/String;
    //   316: invokespecial 243	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   319: astore 8
    //   321: ldc 2
    //   323: aload 6
    //   325: invokevirtual 246	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   328: ifeq +50 -> 378
    //   331: new 109	java/io/File
    //   334: dup
    //   335: aload_0
    //   336: getfield 235	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:source	Ljava/net/URLConnection;
    //   339: invokevirtual 251	java/net/URLConnection:getURL	()Ljava/net/URL;
    //   342: invokevirtual 248	java/net/URL:getPath	()Ljava/lang/String;
    //   345: invokespecial 242	java/io/File:<init>	(Ljava/lang/String;)V
    //   348: astore 9
    //   350: aload 9
    //   352: invokevirtual 240	java/io/File:isDirectory	()Z
    //   355: ifeq +13 -> 368
    //   358: aload 9
    //   360: aload 8
    //   362: invokestatic 268	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:copyDir	(Ljava/io/File;Ljava/io/File;)V
    //   365: goto +20 -> 385
    //   368: aload 4
    //   370: aload 8
    //   372: invokestatic 269	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:readFile	(Ljava/io/InputStream;Ljava/io/File;)V
    //   375: goto +10 -> 385
    //   378: aload 4
    //   380: aload 8
    //   382: invokestatic 269	org/eclipse/osgi/internal/baseadaptor/AdaptorUtil:readFile	(Ljava/io/InputStream;Ljava/io/File;)V
    //   385: aload_0
    //   386: getfield 238	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:storage	Lorg/eclipse/osgi/internal/baseadaptor/BaseStorage;
    //   389: aload_0
    //   390: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   393: iconst_1
    //   394: invokevirtual 272	org/eclipse/osgi/internal/baseadaptor/BaseStorage:loadManifest	(Lorg/eclipse/osgi/baseadaptor/BaseData;Z)Ljava/util/Dictionary;
    //   397: astore 7
    //   399: iconst_0
    //   400: istore 8
    //   402: goto +17 -> 419
    //   405: aload_2
    //   406: iload 8
    //   408: aaload
    //   409: aload 7
    //   411: invokeinterface 284 2 0
    //   416: iinc 8 1
    //   419: iload 8
    //   421: aload_2
    //   422: arraylength
    //   423: if_icmplt -18 -> 405
    //   426: goto +22 -> 448
    //   429: astore 10
    //   431: aload 4
    //   433: ifnull +12 -> 445
    //   436: aload 4
    //   438: invokevirtual 244	java/io/InputStream:close	()V
    //   441: goto +4 -> 445
    //   444: pop
    //   445: aload 10
    //   447: athrow
    //   448: aload 4
    //   450: ifnull +30 -> 480
    //   453: aload 4
    //   455: invokevirtual 244	java/io/InputStream:close	()V
    //   458: goto +22 -> 480
    //   461: pop
    //   462: goto +18 -> 480
    //   465: astore_1
    //   466: new 130	org/osgi/framework/BundleException
    //   469: dup
    //   470: getstatic 233	org/eclipse/osgi/internal/baseadaptor/AdaptorMsg:BUNDLE_READ_EXCEPTION	Ljava/lang/String;
    //   473: bipush 11
    //   475: aload_1
    //   476: invokespecial 281	org/osgi/framework/BundleException:<init>	(Ljava/lang/String;ILjava/lang/Throwable;)V
    //   479: athrow
    //   480: aload_0
    //   481: getfield 237	org/eclipse/osgi/internal/baseadaptor/BundleUpdate:newData	Lorg/eclipse/osgi/baseadaptor/BaseData;
    //   484: areturn
    // Line number table:
    //   Java source line #46	-> byte code offset #0
    //   Java source line #47	-> byte code offset #25
    //   Java source line #48	-> byte code offset #35
    //   Java source line #49	-> byte code offset #49
    //   Java source line #51	-> byte code offset #63
    //   Java source line #52	-> byte code offset #77
    //   Java source line #53	-> byte code offset #83
    //   Java source line #54	-> byte code offset #88
    //   Java source line #55	-> byte code offset #103
    //   Java source line #53	-> byte code offset #129
    //   Java source line #57	-> byte code offset #138
    //   Java source line #59	-> byte code offset #146
    //   Java source line #60	-> byte code offset #160
    //   Java source line #61	-> byte code offset #169
    //   Java source line #62	-> byte code offset #178
    //   Java source line #64	-> byte code offset #194
    //   Java source line #65	-> byte code offset #202
    //   Java source line #66	-> byte code offset #212
    //   Java source line #67	-> byte code offset #225
    //   Java source line #70	-> byte code offset #241
    //   Java source line #71	-> byte code offset #248
    //   Java source line #72	-> byte code offset #253
    //   Java source line #73	-> byte code offset #259
    //   Java source line #74	-> byte code offset #262
    //   Java source line #75	-> byte code offset #268
    //   Java source line #76	-> byte code offset #276
    //   Java source line #77	-> byte code offset #295
    //   Java source line #78	-> byte code offset #300
    //   Java source line #79	-> byte code offset #306
    //   Java source line #80	-> byte code offset #321
    //   Java source line #81	-> byte code offset #331
    //   Java source line #82	-> byte code offset #350
    //   Java source line #83	-> byte code offset #358
    //   Java source line #84	-> byte code offset #365
    //   Java source line #85	-> byte code offset #368
    //   Java source line #87	-> byte code offset #375
    //   Java source line #88	-> byte code offset #378
    //   Java source line #91	-> byte code offset #385
    //   Java source line #92	-> byte code offset #399
    //   Java source line #93	-> byte code offset #405
    //   Java source line #92	-> byte code offset #416
    //   Java source line #94	-> byte code offset #426
    //   Java source line #96	-> byte code offset #431
    //   Java source line #97	-> byte code offset #436
    //   Java source line #98	-> byte code offset #441
    //   Java source line #101	-> byte code offset #445
    //   Java source line #96	-> byte code offset #448
    //   Java source line #97	-> byte code offset #453
    //   Java source line #98	-> byte code offset #458
    //   Java source line #102	-> byte code offset #462
    //   Java source line #103	-> byte code offset #466
    //   Java source line #106	-> byte code offset #480
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	485	0	this	BundleUpdate
    //   76	58	1	storageHooks	org.eclipse.osgi.baseadaptor.hooks.StorageHook[]
    //   465	11	1	e	IOException
    //   82	340	2	instanceHooks	org.eclipse.osgi.baseadaptor.hooks.StorageHook[]
    //   84	49	3	i	int
    //   159	154	3	newStorageHook	BaseStorageHook
    //   167	287	4	in	java.io.InputStream
    //   176	12	5	sourceURL	java.net.URL
    //   192	132	6	protocol	String
    //   210	32	7	reference	java.net.URL
    //   266	45	7	genDir	java.io.File
    //   397	13	7	manifest	java.util.Dictionary<String, String>
    //   246	9	8	path	String
    //   319	62	8	outFile	java.io.File
    //   400	20	8	i	int
    //   348	11	9	inFile	java.io.File
    //   429	17	10	localObject	Object
    //   444	1	17	localIOException1	IOException
    //   461	1	18	localIOException2	IOException
    // Exception table:
    //   from	to	target	type
    //   194	429	429	finally
    //   431	441	444	java/io/IOException
    //   448	458	461	java/io/IOException
    //   0	462	465	java/io/IOException
  }
  
  public void commit(boolean postpone)
    throws BundleException
  {
    storage.processExtension(data, (byte)4);
    storage.processExtension(newData, (byte)8);
    newData.setLastModified(System.currentTimeMillis());
    storage.updateState(newData, 8);
    try
    {
      newData.save();
    }
    catch (IOException e)
    {
      throw new BundleException(AdaptorMsg.ADAPTOR_STORAGE_EXCEPTION, e);
    }
    BaseStorageHook oldStorageHook = (BaseStorageHook)data.getStorageHook(BaseStorageHook.KEY);
    try
    {
      oldStorageHook.delete(postpone, 2);
    }
    catch (IOException e)
    {
      data.getAdaptor().getEventPublisher().publishFrameworkEvent(2, data.getBundle(), e);
    }
  }
  
  public void undo()
    throws BundleException
  {
    if (newData != null)
    {
      BaseStorageHook newStorageHook = (BaseStorageHook)newData.getStorageHook(BaseStorageHook.KEY);
      try
      {
        if (newStorageHook != null) {
          newStorageHook.delete(false, 2);
        }
      }
      catch (IOException e)
      {
        data.getAdaptor().getEventPublisher().publishFrameworkEvent(2, data.getBundle(), e);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.BundleUpdate
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.security.AllPermission;
import java.security.CodeSource;
import java.security.PermissionCollection;
import java.security.ProtectionDomain;
import java.security.cert.Certificate;
import java.util.Collection;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFileWrapperChain;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.baseadaptor.loader.ParallelClassLoader;
import org.eclipse.osgi.framework.adaptor.BundleData;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.debug.Debug;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.signedcontent.SignedContent;
import org.eclipse.osgi.signedcontent.SignerInfo;
import org.osgi.framework.Bundle;

public class DefaultClassLoader
  extends ClassLoader
  implements ParallelClassLoader
{
  protected static final PermissionCollection ALLPERMISSIONS;
  private static final String CLASS_CERTIFICATE_SUPPORT = "osgi.support.class.certificate";
  private static final String CLASS_LOADER_TYPE = "osgi.classloader.type";
  private static final String CLASS_LOADER_TYPE_PARALLEL = "parallel";
  private static final boolean CLASS_CERTIFICATE;
  private static final boolean PARALLEL_CAPABLE;
  private static final Enumeration<URL> EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_LIST);
  protected ClassLoaderDelegate delegate;
  protected ProtectionDomain domain;
  protected ClasspathManager manager;
  
  static
  {
    CLASS_CERTIFICATE = Boolean.valueOf(FrameworkProperties.getProperty("osgi.support.class.certificate", "true")).booleanValue();
    AllPermission allPerm = new AllPermission();
    ALLPERMISSIONS = allPerm.newPermissionCollection();
    if (ALLPERMISSIONS != null) {
      ALLPERMISSIONS.add(allPerm);
    }
    boolean typeParallel = "parallel".equals(FrameworkProperties.getProperty("osgi.classloader.type", "parallel"));
    boolean parallelCapable = false;
    try
    {
      if (typeParallel)
      {
        Method parallelCapableMetod = ClassLoader.class.getDeclaredMethod("registerAsParallelCapable", null);
        parallelCapableMetod.setAccessible(true);
        parallelCapable = ((Boolean)parallelCapableMetod.invoke(null, null)).booleanValue();
      }
    }
    catch (Throwable localThrowable)
    {
      parallelCapable = false;
    }
    PARALLEL_CAPABLE = parallelCapable;
  }
  
  public DefaultClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, ProtectionDomain domain, BaseData bundledata, String[] classpath)
  {
    super(parent);
    this.delegate = delegate;
    this.domain = domain;
    manager = new ClasspathManager(bundledata, classpath, this);
  }
  
  protected Class<?> loadClass(String name, boolean resolve)
    throws ClassNotFoundException
  {
    if (Debug.DEBUG_LOADER) {
      Debug.println("BundleClassLoader[" + delegate + "].loadClass(" + name + ")");
    }
    try
    {
      Class<?> clazz = delegate.findClass(name);
      if (resolve) {
        resolveClass(clazz);
      }
      return clazz;
    }
    catch (Error e)
    {
      if (Debug.DEBUG_LOADER)
      {
        Debug.println("BundleClassLoader[" + delegate + "].loadClass(" + name + ") failed.");
        Debug.printStackTrace(e);
      }
      throw e;
    }
    catch (ClassNotFoundException e)
    {
      if (Debug.DEBUG_LOADER)
      {
        Debug.println("BundleClassLoader[" + delegate + "].loadClass(" + name + ") failed.");
        Debug.printStackTrace(e);
      }
      throw e;
    }
  }
  
  public URL getResource(String name)
  {
    if (Debug.DEBUG_LOADER) {
      Debug.println("BundleClassLoader[" + delegate + "].getResource(" + name + ")");
    }
    URL url = delegate.findResource(name);
    if (url != null) {
      return url;
    }
    if (Debug.DEBUG_LOADER) {
      Debug.println("BundleClassLoader[" + delegate + "].getResource(" + name + ") failed.");
    }
    return null;
  }
  
  protected Enumeration<URL> findResources(String name)
    throws IOException
  {
    Enumeration<URL> result = delegate.findResources(name);
    if (result == null) {
      return EMPTY_ENUMERATION;
    }
    return result;
  }
  
  protected String findLibrary(String libname)
  {
    return manager.findLibrary(libname);
  }
  
  public ProtectionDomain getDomain()
  {
    return domain;
  }
  
  public ClasspathEntry createClassPathEntry(BundleFile bundlefile, ProtectionDomain cpDomain)
  {
    return new ClasspathEntry(bundlefile, createProtectionDomain(bundlefile, cpDomain));
  }
  
  public Class<?> defineClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry)
  {
    return defineClass(name, classbytes, 0, classbytes.length, classpathEntry.getDomain());
  }
  
  public Class<?> publicFindLoaded(String classname)
  {
    return findLoadedClass(classname);
  }
  
  public Object publicGetPackage(String pkgname)
  {
    return getPackage(pkgname);
  }
  
  public Object publicDefinePackage(String name, String specTitle, String specVersion, String specVendor, String implTitle, String implVersion, String implVendor, URL sealBase)
  {
    return definePackage(name, specTitle, specVersion, specVendor, implTitle, implVersion, implVendor, sealBase);
  }
  
  public void initialize()
  {
    manager.initialize();
  }
  
  public URL findLocalResource(String resource)
  {
    return manager.findLocalResource(resource);
  }
  
  public Enumeration<URL> findLocalResources(String resource)
  {
    return manager.findLocalResources(resource);
  }
  
  public Class<?> findLocalClass(String classname)
    throws ClassNotFoundException
  {
    return manager.findLocalClass(classname);
  }
  
  public void close()
  {
    manager.close();
  }
  
  public void attachFragment(BundleData sourcedata, ProtectionDomain sourcedomain, String[] sourceclasspath)
  {
    manager.attachFragment(sourcedata, sourcedomain, sourceclasspath);
  }
  
  public ClassLoaderDelegate getDelegate()
  {
    return delegate;
  }
  
  public static ProtectionDomain createProtectionDomain(BundleFile bundlefile, ProtectionDomain baseDomain)
  {
    try
    {
      PermissionCollection permissions;
      PermissionCollection permissions;
      if (baseDomain != null) {
        permissions = baseDomain.getPermissions();
      } else {
        permissions = ALLPERMISSIONS;
      }
      Certificate[] certs = null;
      SignedContent signedContent = null;
      if ((bundlefile instanceof BundleFileWrapperChain))
      {
        BundleFileWrapperChain wrapper = (BundleFileWrapperChain)bundlefile;
        while ((wrapper != null) && (!(wrapper.getWrapped() instanceof SignedContent))) {
          wrapper = wrapper.getNext();
        }
        signedContent = wrapper == null ? null : (SignedContent)wrapper.getWrapped();
      }
      if ((CLASS_CERTIFICATE) && (signedContent != null) && (signedContent.isSigned()))
      {
        SignerInfo[] signers = signedContent.getSignerInfos();
        if (signers.length > 0) {
          certs = signers[0].getCertificateChain();
        }
      }
      return new BundleProtectionDomain(permissions, new CodeSource(bundlefile.getBaseFile().toURL(), certs), null);
    }
    catch (MalformedURLException localMalformedURLException) {}
    return baseDomain;
  }
  
  public ClasspathManager getClasspathManager()
  {
    return manager;
  }
  
  public Bundle getBundle()
  {
    return manager.getBaseData().getBundle();
  }
  
  public boolean isParallelCapable()
  {
    return PARALLEL_CAPABLE;
  }
  
  public List<URL> findEntries(String path, String filePattern, int options)
  {
    return manager.findEntries(path, filePattern, options);
  }
  
  public Collection<String> listResources(String path, String filePattern, int options)
  {
    return delegate.listResources(path, filePattern, options);
  }
  
  public Collection<String> listLocalResources(String path, String filePattern, int options)
  {
    return manager.listLocalResources(path, filePattern, options);
  }
  
  public String toString()
  {
    Bundle b = getBundle();
    StringBuffer result = new StringBuffer(super.toString());
    if (b == null) {
      return result.toString();
    }
    return '[' + b.getSymbolicName() + ':' + b.getVersion() + "(id=" + b.getBundleId() + ")]";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.File;
import java.security.ProtectionDomain;
import java.util.ArrayList;
import org.eclipse.osgi.baseadaptor.BaseData;
import org.eclipse.osgi.baseadaptor.HookConfigurator;
import org.eclipse.osgi.baseadaptor.HookRegistry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleEntry;
import org.eclipse.osgi.baseadaptor.bundlefile.BundleFile;
import org.eclipse.osgi.baseadaptor.hooks.ClassLoadingHook;
import org.eclipse.osgi.baseadaptor.loader.BaseClassLoader;
import org.eclipse.osgi.baseadaptor.loader.ClasspathEntry;
import org.eclipse.osgi.baseadaptor.loader.ClasspathManager;
import org.eclipse.osgi.baseadaptor.loader.FragmentClasspath;
import org.eclipse.osgi.framework.adaptor.BundleProtectionDomain;
import org.eclipse.osgi.framework.adaptor.ClassLoaderDelegate;
import org.eclipse.osgi.framework.util.KeyedElement;

public class DevClassLoadingHook
  implements ClassLoadingHook, HookConfigurator, KeyedElement
{
  public static final String KEY = DevClassLoadingHook.class.getName();
  public static final int HASHCODE = KEY.hashCode();
  private static final String FRAGMENT = "@fragment@";
  
  public byte[] processClass(String name, byte[] classbytes, ClasspathEntry classpathEntry, BundleEntry entry, ClasspathManager manager)
  {
    return null;
  }
  
  public boolean addClassPathEntry(ArrayList<ClasspathEntry> cpEntries, String cp, ClasspathManager hostmanager, BaseData sourcedata, ProtectionDomain sourcedomain)
  {
    String[] devClassPath = !DevClassPathHelper.inDevelopmentMode() ? null : DevClassPathHelper.getDevClassPath(sourcedata.getSymbolicName());
    if ((devClassPath == null) || (devClassPath.length == 0)) {
      return false;
    }
    if ((cpEntries.size() > 0) && (((ClasspathEntry)cpEntries.get(0)).getUserObject(KEY) != null)) {
      return false;
    }
    boolean result = false;
    for (int i = 0; i < devClassPath.length; i++) {
      if (ClasspathManager.addClassPathEntry(cpEntries, devClassPath[i], hostmanager, sourcedata, sourcedomain))
      {
        result = true;
      }
      else
      {
        String devCP = devClassPath[i];
        boolean fromFragment = devCP.endsWith("@fragment@");
        if ((!fromFragment) && (devCP.indexOf("..") >= 0))
        {
          File base = sourcedata.getBundleFile().getBaseFile();
          if (base.isDirectory())
          {
            ClasspathEntry entry = hostmanager.getExternalClassPath(new File(base, devCP).getAbsolutePath(), sourcedata, sourcedomain);
            if (entry != null)
            {
              cpEntries.add(entry);
              result = true;
            }
          }
        }
        else
        {
          if (fromFragment) {
            devCP = devCP.substring(0, devCP.length() - "@fragment@".length());
          }
          BaseData fragData = findFragmentSource(sourcedata, devCP, hostmanager, fromFragment);
          if (fragData != null)
          {
            ClasspathEntry entry = hostmanager.getExternalClassPath(devCP, fragData, sourcedomain);
            if (entry != null)
            {
              cpEntries.add(entry);
              result = true;
            }
          }
        }
      }
    }
    if ((result) && (cpEntries.size() > 0)) {
      ((ClasspathEntry)cpEntries.get(0)).addUserObject(this);
    }
    return result;
  }
  
  private BaseData findFragmentSource(BaseData hostData, String cp, ClasspathManager manager, boolean fromFragment)
  {
    if (hostData != manager.getBaseData()) {
      return hostData;
    }
    File file = new File(cp);
    if (!file.isAbsolute()) {
      return hostData;
    }
    FragmentClasspath[] fragCP = manager.getFragmentClasspaths();
    for (int i = 0; i < fragCP.length; i++)
    {
      BundleFile fragBase = fragCP[i].getBundleData().getBundleFile();
      File fragFile = fragBase.getBaseFile();
      if ((fragFile != null) && (file.getPath().startsWith(fragFile.getPath()))) {
        return fragCP[i].getBundleData();
      }
    }
    return fromFragment ? null : hostData;
  }
  
  public String findLibrary(BaseData data, String libName)
  {
    return null;
  }
  
  public ClassLoader getBundleClassLoaderParent()
  {
    return null;
  }
  
  public BaseClassLoader createClassLoader(ClassLoader parent, ClassLoaderDelegate delegate, BundleProtectionDomain domain, BaseData data, String[] bundleclasspath)
  {
    return null;
  }
  
  public void initializedClassLoader(BaseClassLoader baseClassLoader, BaseData data) {}
  
  public void addHooks(HookRegistry hookRegistry)
  {
    if (DevClassPathHelper.inDevelopmentMode()) {
      hookRegistry.addClassLoadingHook(new DevClassLoadingHook());
    }
  }
  
  public boolean compare(KeyedElement other)
  {
    return other.getKey() == KEY;
  }
  
  public Object getKey()
  {
    return KEY;
  }
  
  public int getKeyHashCode()
  {
    return HASHCODE;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.DevClassLoadingHook
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Dictionary;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.util.ManifestElement;

public final class DevClassPathHelper
{
  private static final String FILE_PROTOCOL = "file";
  private static final boolean inDevelopmentMode;
  private static final File devLocation;
  private static String[] devDefaultClasspath;
  private static Dictionary<String, String> devProperties = null;
  private static long lastModified = 0L;
  
  static
  {
    String osgiDev = FrameworkProperties.getProperty("osgi.dev");
    File f = null;
    boolean devMode = false;
    if (osgiDev != null) {
      try
      {
        devMode = true;
        URL location = new URL(osgiDev);
        if ("file".equals(location.getProtocol()))
        {
          f = new File(location.getFile());
          lastModified = f.lastModified();
        }
        try
        {
          load(location.openStream());
          devMode = true;
        }
        catch (IOException localIOException) {}
        inDevelopmentMode = devMode;
      }
      catch (MalformedURLException localMalformedURLException)
      {
        devDefaultClasspath = getArrayFromList(osgiDev);
      }
    }
    devLocation = f;
  }
  
  private static void updateDevProperties()
  {
    if (devLocation == null) {
      return;
    }
    if (devLocation.lastModified() == lastModified) {
      return;
    }
    try
    {
      load(new FileInputStream(devLocation));
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      return;
    }
    lastModified = devLocation.lastModified();
  }
  
  private static String[] getDevClassPath(String id, Dictionary<String, String> properties, String[] defaultClasspath)
  {
    String[] result = null;
    if ((id != null) && (properties != null))
    {
      String entry = (String)properties.get(id);
      if (entry != null) {
        result = getArrayFromList(entry);
      }
    }
    if (result == null) {
      result = defaultClasspath;
    }
    return result;
  }
  
  public static String[] getDevClassPath(String id, Dictionary<String, String> properties)
  {
    if (properties == null) {
      synchronized (DevClassPathHelper.class)
      {
        updateDevProperties();
        return getDevClassPath(id, devProperties, devDefaultClasspath);
      }
    }
    return getDevClassPath(id, properties, getArrayFromList((String)properties.get("*")));
  }
  
  public static String[] getDevClassPath(String id)
  {
    return getDevClassPath(id, null);
  }
  
  public static String[] getArrayFromList(String prop)
  {
    return ManifestElement.getArrayFromList(prop, ",");
  }
  
  public static boolean inDevelopmentMode()
  {
    return inDevelopmentMode;
  }
  
  /* Error */
  private static void load(java.io.InputStream input)
  {
    // Byte code:
    //   0: new 85	java/util/Properties
    //   3: dup
    //   4: invokespecial 158	java/util/Properties:<init>	()V
    //   7: astore_1
    //   8: aload_1
    //   9: aload_0
    //   10: invokevirtual 159	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   13: goto +34 -> 47
    //   16: pop
    //   17: aload_0
    //   18: ifnull +41 -> 59
    //   21: aload_0
    //   22: invokevirtual 147	java/io/InputStream:close	()V
    //   25: goto +34 -> 59
    //   28: pop
    //   29: goto +30 -> 59
    //   32: astore_2
    //   33: aload_0
    //   34: ifnull +11 -> 45
    //   37: aload_0
    //   38: invokevirtual 147	java/io/InputStream:close	()V
    //   41: goto +4 -> 45
    //   44: pop
    //   45: aload_2
    //   46: athrow
    //   47: aload_0
    //   48: ifnull +11 -> 59
    //   51: aload_0
    //   52: invokevirtual 147	java/io/InputStream:close	()V
    //   55: goto +4 -> 59
    //   58: pop
    //   59: aload_1
    //   60: astore_2
    //   61: aload_2
    //   62: putstatic 143	org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper:devProperties	Ljava/util/Dictionary;
    //   65: getstatic 143	org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper:devProperties	Ljava/util/Dictionary;
    //   68: ifnull +20 -> 88
    //   71: getstatic 143	org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper:devProperties	Ljava/util/Dictionary;
    //   74: ldc 1
    //   76: invokevirtual 157	java/util/Dictionary:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   79: checkcast 80	java/lang/String
    //   82: invokestatic 163	org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper:getArrayFromList	(Ljava/lang/String;)[Ljava/lang/String;
    //   85: putstatic 142	org/eclipse/osgi/internal/baseadaptor/DevClassPathHelper:devDefaultClasspath	[Ljava/lang/String;
    //   88: return
    // Line number table:
    //   Java source line #141	-> byte code offset #0
    //   Java source line #143	-> byte code offset #8
    //   Java source line #144	-> byte code offset #13
    //   Java source line #147	-> byte code offset #17
    //   Java source line #149	-> byte code offset #21
    //   Java source line #150	-> byte code offset #25
    //   Java source line #146	-> byte code offset #32
    //   Java source line #147	-> byte code offset #33
    //   Java source line #149	-> byte code offset #37
    //   Java source line #150	-> byte code offset #41
    //   Java source line #153	-> byte code offset #45
    //   Java source line #147	-> byte code offset #47
    //   Java source line #149	-> byte code offset #51
    //   Java source line #150	-> byte code offset #55
    //   Java source line #155	-> byte code offset #59
    //   Java source line #156	-> byte code offset #61
    //   Java source line #157	-> byte code offset #65
    //   Java source line #158	-> byte code offset #71
    //   Java source line #159	-> byte code offset #88
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	89	0	input	java.io.InputStream
    //   7	53	1	props	java.util.Properties
    //   32	14	2	localObject1	Object
    //   60	2	2	result	Object
    //   16	1	4	localIOException1	IOException
    //   28	1	5	localIOException2	IOException
    //   44	1	6	localIOException3	IOException
    //   58	1	7	localIOException4	IOException
    // Exception table:
    //   from	to	target	type
    //   8	13	16	java/io/IOException
    //   21	25	28	java/io/IOException
    //   8	17	32	finally
    //   37	41	44	java/io/IOException
    //   51	55	58	java/io/IOException
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.DevClassPathHelper
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import org.osgi.framework.Version;

public class InvalidVersion
  extends Version
{
  private String invalidVersion;
  
  public InvalidVersion(String badVersion)
  {
    super(0, 0, 0, null);
    invalidVersion = badVersion;
  }
  
  public String getInvalidVersion()
  {
    return invalidVersion;
  }
  
  public String toString()
  {
    return invalidVersion;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.osgi.internal.baseadaptor.InvalidVersion
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.osgi.internal.baseadaptor;

import java.io.File;
import java.io.IOException;
import org.eclipse.osgi.framework.internal.core.FrameworkProperties;
import org.eclipse.osgi.internal.module.ResolverImpl;
import org.eclipse.osgi.internal.resolver.ReadOnlyState;
import org.eclipse.osgi.internal.resolver.StateHelperImpl;
import org.eclipse.osgi.internal.resolver.StateImpl;
import org.eclipse.osgi.internal.resolver.StateObjectFactoryImpl;
import org.eclipse.osgi.service.resolver.DisabledInfo;
import org.eclipse.osgi.service.resolver.PlatformAdmin;
import org.eclipse.osgi.service.resolver.Resolver;
import org.eclipse.osgi.service.resolver.State;
import org.eclipse.osgi.service.resolver.StateHelper;
import org.eclipse.osgi.service.resolver.StateObjectFactory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;

public class StateManager
  implements PlatformAdmin, Runnable
{
  public static boolean DEBUG = false;
  public static boolean DEBUG_READER = false;
  public static boolean DEBUG_PLATFORM_ADMIN = false;
  pu
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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87

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-2019. Infinite Loop Ltd