org.eclipse.pde.api.tools_1.0.301.v20111129-2053

16:47:21.873 INFO  jd.cli.Main - Decompiling org.eclipse.pde.api.tools_1.0.301.v20111129-2053.jar
package org.eclipse.pde.api.tools.internal;

public class AnyValue
{
  public AnyValue(String arg) {}
  
  public boolean equals(Object obj)
  {
    return true;
  }
  
  public int hashCode()
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.AnyValue
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import org.eclipse.pde.api.tools.internal.provisional.IApiAccess;

class ApiAccess$NormalAccess
  implements IApiAccess
{
  public int getAccessLevel()
  {
    return 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.ApiAccess.NormalAccess
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import org.eclipse.pde.api.tools.internal.provisional.IApiAccess;

public class ApiAccess
  implements IApiAccess
{
  public static final IApiAccess NORMAL_ACCESS = new NormalAccess();
  
  static class NormalAccess
    implements IApiAccess
  {
    public int getAccessLevel()
    {
      return 0;
    }
  }
  
  private int access = 0;
  
  public ApiAccess(int access)
  {
    this.access = access;
  }
  
  public int getAccessLevel()
  {
    return access;
  }
  
  public int hashCode()
  {
    return access;
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof IApiAccess)) {
      return access == ((IApiAccess)obj).getAccessLevel();
    }
    return false;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("Access Level: ");
    buffer.append(getAccessText(getAccessLevel()));
    return buffer.toString();
  }
  
  public static String getAccessText(int access)
  {
    switch (access)
    {
    case 0: 
      return "NORMAL";
    case 1: 
      return "FRIEND";
    }
    return "<UNKNOWN ACCESS LEVEL>";
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.ApiAccess
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import org.eclipse.pde.api.tools.internal.provisional.IApiAnnotations;
import org.eclipse.pde.api.tools.internal.provisional.RestrictionModifiers;
import org.eclipse.pde.api.tools.internal.provisional.VisibilityModifiers;

public class ApiAnnotations
  implements IApiAnnotations
{
  public static final int VISIBILITY_MASK = 15;
  public static final int RESTRICTIONS_MASK = 496;
  public static final int OFFSET_VISIBILITY = 0;
  public static final int OFFSET_RESTRICTIONS = 4;
  private int bits;
  
  public ApiAnnotations(int visibility, int restrictions)
  {
    bits = 
      (visibility << 0 | restrictions << 4);
  }
  
  public int getRestrictions()
  {
    return (bits & 0x1F0) >> 4;
  }
  
  public int getVisibility()
  {
    return (bits & 0xF) >> 0;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append(VisibilityModifiers.getVisibilityName(getVisibility()));
    buffer.append(" / ");
    int restrictions = getRestrictions();
    buffer.append(RestrictionModifiers.getRestrictionText(restrictions));
    return buffer.toString();
  }
  
  public boolean equals(Object obj)
  {
    if ((obj instanceof ApiAnnotations))
    {
      ApiAnnotations desc = (ApiAnnotations)obj;
      
      return bits == bits;
    }
    return false;
  }
  
  public int hashCode()
  {
    return bits;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.ApiAnnotations
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import java.io.File;
import java.io.FileFilter;

class ApiBaselineManager$1
  implements FileFilter
{
  final ApiBaselineManager this$0;
  
  ApiBaselineManager$1(ApiBaselineManager paramApiBaselineManager)
  {
    this$0 = paramApiBaselineManager;
  }
  
  public boolean accept(File pathname)
  {
    return pathname.getName().endsWith(".profile");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.api.tools.internal.ApiBaselineManager.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.api.tools.internal;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import org.eclipse.core.resources.ISaveContext;
import org.eclipse.core.resources.ISaveParticipant;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.pde.api.tools.internal.model.ApiBaseline;
import org.eclipse.pde.api.tools.internal.model.ApiModelCache;
import org.eclipse.pde.api.tools.internal.model.StubApiComponent;
import org.eclipse.pde.api.tools.internal.provisional.ApiPlugin;
import org.eclipse.pde.api.tools.internal.provisional.IApiBaselineManager;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiBaseline;
import org.eclipse.pde.api.tools.internal.provisional.model.IApiComponent;
import org.eclipse.pde.api.tools.internal.util.Util;
import org.w3c.dom.Document;
import org.w3c.dom.Element;

public final class ApiBaselineManager
  implements IApiBaselineManager, ISaveParticipant
{
  private static boolean DEBUG = Util.DEBUG;
  private static final String DEFAULT_BASELINE = "default_api_profile";
  public static final String WORKSPACE_API_BASELINE_ID = "workspace";
  private static final String BASELINE_FILE_EXTENSION = ".profile";
  
  public static void setDebug(boolean debugValue)
  {
    DEBUG = (debugValue) || (Util.DEBUG);
  }
  
  private HashMap baselinecache = null;
  private HashMap handlecache = null;
  private HashSet hasinfos = null;
  private String defaultbaseline = null;
  private IApiBaseline workspacebaseline = null;
  private IPath savelocation = null;
  private boolean fNeedsSaving = false;
  private static ApiBaselineManager fInstance = null;
  
  private ApiBaselineManager(boolean framework)
  {
    if (framework)
    {
      ApiPlugin.getDefault().addSaveParticipant(this);
      savelocation = ApiPlugin.getDefault().getStateLocation().append(".api_profiles").addTrailingSeparator();
    }
  }
  
  public static synchronized ApiBaselineManager getManager()
  {
    if (fInstance == null) {
      fInstance = new ApiBaselineManager(ApiPlugin.isRunningInFramework());
    }
    return fInstance;
  }
  
  public synchronized IApiBaseline getApiBaseline(String name)
  {
    initializeStateCache();
    return (ApiBaseline)baselinecache.get(name);
  }
  
  public synchronized IApiBaseline[] getApiBaselines()
  {
    initializeStateCache();
    return (IApiBaseline[])baselinecache.values().toArray(new IApiBaseline[baselinecache.size()]);
  }
  
  public synchronized void addApiBaseline(IApiBaseline newbaseline)
  {
    if (newbaseline != null)
    {
      initializeStateCache();
      baselinecache.put(newbaseline.getName(), newbaseline);
      if (((ApiBaseline)newbaseline).peekInfos()) {
        hasinfos.add(newbaseline.getName());
      }
      fNeedsSaving = true;
    }
  }
  
  public synchronized boolean removeApiBaseline(String name)
  {
    if (name != null)
    {
      initializeStateCache();
      IApiBaseline baseline = (IApiBaseline)baselinecache.remove(name);
      if (baseline != null)
      {
        baseline.dispose();
        boolean success = true;
        if (savelocation == null) {
          return success;
        }
        File file = savelocation.append(name + ".profile").toFile();
        if (file.exists()) {
          success &= file.delete();
        }
        fNeedsSaving = true;
        
        ApiModelCache.getCache().removeElementInfo(baseline);
        return success;
      }
    }
    return false;
  }
  
  /* Error */
  public void loadBaselineInfos(IApiBaseline baseline)
    throws CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: invokespecial 613	org/eclipse/pde/api/tools/internal/ApiBaselineManager:initializeStateCache	()V
    //   4: aload_0
    //   5: getfield 553	org/eclipse/pde/api/tools/internal/ApiBaselineManager:hasinfos	Ljava/util/HashSet;
    //   8: aload_1
    //   9: invokeinterface 665 1 0
    //   14: invokevirtual 599	java/util/HashSet:contains	(Ljava/lang/Object;)Z
    //   17: ifeq +4 -> 21
    //   20: return
    //   21: aload_0
    //   22: getfield 552	org/eclipse/pde/api/tools/internal/ApiBaselineManager:handlecache	Ljava/util/HashMap;
    //   25: aload_1
    //   26: invokeinterface 665 1 0
    //   31: invokevirtual 593	java/util/HashMap:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   34: checkcast 291	java/lang/String
    //   37: astore_2
    //   38: aload_2
    //   39: ifnull +113 -> 152
    //   42: new 282	java/io/File
    //   45: dup
    //   46: aload_2
    //   47: invokespecial 564	java/io/File:<init>	(Ljava/lang/String;)V
    //   50: astore_3
    //   51: aload_3
    //   52: invokevirtual 560	java/io/File:exists	()Z
    //   55: ifeq +97 -> 152
    //   58: aconst_null
    //   59: astore 4
    //   61: new 283	java/io/FileInputStream
    //   64: dup
    //   65: aload_3
    //   66: invokespecial 567	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   69: astore 4
    //   71: aload_0
    //   72: aload_1
    //   73: aload 4
    //   75: invokespecial 619	org/eclipse/pde/api/tools/internal/ApiBaselineManager:restoreBaseline	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiBaseline;Ljava/io/InputStream;)V
    //   78: goto +46 -> 124
    //   81: astore 5
    //   83: aload 5
    //   85: invokestatic 633	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   88: aload 4
    //   90: ifnull +48 -> 138
    //   93: aload 4
    //   95: invokevirtual 566	java/io/FileInputStream:close	()V
    //   98: goto +40 -> 138
    //   101: pop
    //   102: goto +36 -> 138
    //   105: astore 6
    //   107: aload 4
    //   109: ifnull +12 -> 121
    //   112: aload 4
    //   114: invokevirtual 566	java/io/FileInputStream:close	()V
    //   117: goto +4 -> 121
    //   120: pop
    //   121: aload 6
    //   123: athrow
    //   124: aload 4
    //   126: ifnull +12 -> 138
    //   129: aload 4
    //   131: invokevirtual 566	java/io/FileInputStream:close	()V
    //   134: goto +4 -> 138
    //   137: pop
    //   138: aload_0
    //   139: getfield 553	org/eclipse/pde/api/tools/internal/ApiBaselineManager:hasinfos	Ljava/util/HashSet;
    //   142: aload_1
    //   143: invokeinterface 665 1 0
    //   148: invokevirtual 598	java/util/HashSet:add	(Ljava/lang/Object;)Z
    //   151: pop
    //   152: return
    // Line number table:
    //   Java source line #230	-> byte code offset #0
    //   Java source line #231	-> byte code offset #4
    //   Java source line #232	-> byte code offset #20
    //   Java source line #234	-> byte code offset #21
    //   Java source line #235	-> byte code offset #38
    //   Java source line #236	-> byte code offset #42
    //   Java source line #237	-> byte code offset #51
    //   Java source line #238	-> byte code offset #58
    //   Java source line #240	-> byte code offset #61
    //   Java source line #241	-> byte code offset #71
    //   Java source line #242	-> byte code offset #81
    //   Java source line #243	-> byte code offset #83
    //   Java source line #245	-> byte code offset #88
    //   Java source line #247	-> byte code offset #93
    //   Java source line #248	-> byte code offset #101
    //   Java source line #244	-> byte code offset #105
    //   Java source line #245	-> byte code offset #107
    //   Java source line #247	-> byte code offset #112
    //   Java source line #248	-> byte code offset #120
    //   Java source line #252	-> byte code offset #121
    //   Java source line #245	-> byte code offset #124
    //   Java source line #247	-> byte code offset #129
    //   Java source line #248	-> byte code offset #137
    //   Java source line #253	-> byte code offset #138
    //   Java source line #256	-> byte code offset #152
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	153	0	this	ApiBaselineManager
    //   0	153	1	baseline	IApiBaseline
    //   37	10	2	filename	String
    //   50	16	3	file	File
    //   59	71	4	inputStream	java.io.FileInputStream
    //   81	3	5	e	IOException
    //   105	17	6	localObject	Object
    //   101	1	7	localIOException1	IOException
    //   120	1	8	localIOException2	IOException
    //   137	1	9	localIOException3	IOException
    // Exception table:
    //   from	to	target	type
    //   61	78	81	java/io/IOException
    //   93	98	101	java/io/IOException
    //   61	88	105	finally
    //   112	117	120	java/io/IOException
    //   129	134	137	java/io/IOException
  }
  
  private synchronized void initializeStateCache()
  {
    long time = System.currentTimeMillis();
    if (baselinecache == null)
    {
      handlecache = new HashMap(8);
      hasinfos = new HashSet(8);
      baselinecache = new HashMap(8);
      if (!ApiPlugin.isRunningInFramework()) {
        return;
      }
      File[] baselines = savelocation.toFile().listFiles(new FileFilter()
      {
        public boolean accept(File pathname)
        {
          return pathname.getName().endsWith(".profile");
        }
      });
      if (baselines != null)
      {
        IApiBaseline newbaseline = null;
        for (int i = 0; i < baselines.length; i++)
        {
          File baseline = baselines[i];
          if (baseline.exists())
          {
            newbaseline = new ApiBaseline(new Path(baseline.getName()).removeFileExtension().toString());
            handlecache.put(newbaseline.getName(), baseline.getAbsolutePath());
            baselinecache.put(newbaseline.getName(), newbaseline);
          }
        }
      }
      String def = getDefaultProfilePref();
      IApiBaseline baseline = (IApiBaseline)baselinecache.get(def);
      defaultbaseline = (baseline != null ? def : null);
      if (DEBUG) {
        System.out.println("Time to initialize state cache: " + (System.currentTimeMillis() - time) + "ms");
      }
    }
  }
  
  private String getDefaultProfilePref()
  {
    IPreferencesService service = Platform.getPreferencesService();
    return service.getString("org.eclipse.pde.api.tools", "default_api_profile", null, new IScopeContext[] { InstanceScope.INSTANCE });
  }
  
  /* Error */
  private void persistStateCache()
    throws CoreException, IOException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 554	org/eclipse/pde/api/tools/internal/ApiBaselineManager:savelocation	Lorg/eclipse/core/runtime/IPath;
    //   4: ifnonnull +4 -> 8
    //   7: return
    //   8: getstatic 547	org/eclipse/core/runtime/preferences/InstanceScope:INSTANCE	Lorg/eclipse/core/runtime/preferences/IScopeContext;
    //   11: ldc_w 276
    //   14: invokeinterface 662 2 0
    //   19: astore_1
    //   20: aload_0
    //   21: getfield 550	org/eclipse/pde/api/tools/internal/ApiBaselineManager:defaultbaseline	Ljava/lang/String;
    //   24: ifnull +18 -> 42
    //   27: aload_1
    //   28: ldc 3
    //   30: aload_0
    //   31: getfield 550	org/eclipse/pde/api/tools/internal/ApiBaselineManager:defaultbaseline	Ljava/lang/String;
    //   34: invokeinterface 660 3 0
    //   39: goto +11 -> 50
    //   42: aload_1
    //   43: ldc 3
    //   45: invokeinterface 659 2 0
    //   50: aload_0
    //   51: getfield 551	org/eclipse/pde/api/tools/internal/ApiBaselineManager:baselinecache	Ljava/util/HashMap;
    //   54: ifnull +232 -> 286
    //   57: aload_0
    //   58: getfield 553	org/eclipse/pde/api/tools/internal/ApiBaselineManager:hasinfos	Ljava/util/HashSet;
    //   61: ifnull +225 -> 286
    //   64: new 282	java/io/File
    //   67: dup
    //   68: aload_0
    //   69: getfield 554	org/eclipse/pde/api/tools/internal/ApiBaselineManager:savelocation	Lorg/eclipse/core/runtime/IPath;
    //   72: invokeinterface 655 1 0
    //   77: invokespecial 564	java/io/File:<init>	(Ljava/lang/String;)V
    //   80: astore_2
    //   81: aload_2
    //   82: invokevirtual 560	java/io/File:exists	()Z
    //   85: ifne +8 -> 93
    //   88: aload_2
    //   89: invokevirtual 561	java/io/File:mkdirs	()Z
    //   92: pop
    //   93: aconst_null
    //   94: astore_3
    //   95: aconst_null
    //   96: astore 4
    //   98: aconst_null
    //   99: astore 5
    //   101: aconst_null
    //   102: astore 6
    //   104: aload_0
    //   105: getfield 551	org/eclipse/pde/api/tools/internal/ApiBaselineManager:baselinecache	Ljava/util/HashMap;
    //   108: invokevirtual 592	java/util/HashMap:keySet	()Ljava/util/Set;
    //   111: invokeinterface 653 1 0
    //   116: astore 7
    //   118: goto +158 -> 276
    //   121: aload 7
    //   123: invokeinterface 647 1 0
    //   128: checkcast 291	java/lang/String
    //   131: astore_3
    //   132: aload_0
    //   133: getfield 551	org/eclipse/pde/api/tools/internal/ApiBaselineManager:baselinecache	Ljava/util/HashMap;
    //   136: aload_3
    //   137: invokevirtual 593	java/util/HashMap:get	(Ljava/lang/Object;)Ljava/lang/Object;
    //   140: checkcast 324	org/eclipse/pde/api/tools/internal/provisional/model/IApiBaseline
    //   143: astore 6
    //   145: aload_0
    //   146: getfield 553	org/eclipse/pde/api/tools/internal/ApiBaselineManager:hasinfos	Ljava/util/HashSet;
    //   149: aload 6
    //   151: invokeinterface 665 1 0
    //   156: invokevirtual 599	java/util/HashSet:contains	(Ljava/lang/Object;)Z
    //   159: ifne +6 -> 165
    //   162: goto +114 -> 276
    //   165: aload_0
    //   166: getfield 554	org/eclipse/pde/api/tools/internal/ApiBaselineManager:savelocation	Lorg/eclipse/core/runtime/IPath;
    //   169: new 292	java/lang/StringBuffer
    //   172: dup
    //   173: aload_3
    //   174: invokestatic 578	java/lang/String:valueOf	(Ljava/lang/Object;)Ljava/lang/String;
    //   177: invokespecial 581	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   180: ldc 2
    //   182: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   185: invokevirtual 580	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   188: invokeinterface 658 2 0
    //   193: invokeinterface 654 1 0
    //   198: astore 4
    //   200: aload 4
    //   202: invokevirtual 560	java/io/File:exists	()Z
    //   205: ifne +9 -> 214
    //   208: aload 4
    //   210: invokevirtual 558	java/io/File:createNewFile	()Z
    //   213: pop
    //   214: new 284	java/io/FileOutputStream
    //   217: dup
    //   218: aload 4
    //   220: invokespecial 570	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   223: astore 5
    //   225: aload_0
    //   226: aload 6
    //   228: aload 5
    //   230: invokespecial 620	org/eclipse/pde/api/tools/internal/ApiBaselineManager:writeBaselineDescription	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiBaseline;Ljava/io/OutputStream;)V
    //   233: aload_0
    //   234: getfield 552	org/eclipse/pde/api/tools/internal/ApiBaselineManager:handlecache	Ljava/util/HashMap;
    //   237: aload 6
    //   239: invokeinterface 665 1 0
    //   244: aload 4
    //   246: invokevirtual 562	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   249: invokevirtual 595	java/util/HashMap:put	(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
    //   252: pop
    //   253: aload 5
    //   255: invokevirtual 569	java/io/FileOutputStream:flush	()V
    //   258: goto +13 -> 271
    //   261: astore 8
    //   263: aload 5
    //   265: invokevirtual 568	java/io/FileOutputStream:close	()V
    //   268: aload 8
    //   270: athrow
    //   271: aload 5
    //   273: invokevirtual 568	java/io/FileOutputStream:close	()V
    //   276: aload 7
    //   278: invokeinterface 646 1 0
    //   283: ifne -162 -> 121
    //   286: return
    // Line number table:
    //   Java source line #312	-> byte code offset #0
    //   Java source line #313	-> byte code offset #7
    //   Java source line #315	-> byte code offset #8
    //   Java source line #316	-> byte code offset #20
    //   Java source line #317	-> byte code offset #27
    //   Java source line #320	-> byte code offset #42
    //   Java source line #322	-> byte code offset #50
    //   Java source line #323	-> byte code offset #64
    //   Java source line #324	-> byte code offset #81
    //   Java source line #325	-> byte code offset #88
    //   Java source line #327	-> byte code offset #93
    //   Java source line #328	-> byte code offset #95
    //   Java source line #329	-> byte code offset #98
    //   Java source line #330	-> byte code offset #101
    //   Java source line #331	-> byte code offset #104
    //   Java source line #332	-> byte code offset #121
    //   Java source line #333	-> byte code offset #132
    //   Java source line #334	-> byte code offset #145
    //   Java source line #335	-> byte code offset #162
    //   Java source line #337	-> byte code offset #165
    //   Java source line #338	-> byte code offset #200
    //   Java source line #339	-> byte code offset #208
    //   Java source line #342	-> byte code offset #214
    //   Java source line #343	-> byte code offset #225
    //   Java source line #345	-> byte code offset #233
    //   Java source line #346	-> byte code offset #253
    //   Java source line #348	-> byte code offset #261
    //   Java source line #349	-> byte code offset #263
    //   Java source line #350	-> byte code offset #268
    //   Java source line #349	-> byte code offset #271
    //   Java source line #331	-> byte code offset #276
    //   Java source line #353	-> byte code offset #286
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	287	0	this	ApiBaselineManager
    //   19	24	1	node	org.eclipse.core.runtime.preferences.IEclipsePreferences
    //   80	9	2	dir	File
    //   94	80	3	id	String
    //   96	149	4	file	File
    //   99	173	5	fout	java.io.FileOutputStream
    //   102	136	6	baseline	IApiBaseline
    //   116	161	7	iter	Iterator
    //   261	8	8	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   214	261	261	finally
  }
  
  private void writeBaselineDescription(IApiBaseline baseline, OutputStream stream)
    throws CoreException
  {
    String xml = getProfileXML(baseline);
    try
    {
      stream.write(xml.getBytes("UTF-8"));
    }
    catch (UnsupportedEncodingException e)
    {
      abort("Error writing pofile descrition", e);
    }
    catch (IOException e)
    {
      abort("Error writing pofile descrition", e);
    }
  }
  
  private String getProfileXML(IApiBaseline baseline)
    throws CoreException
  {
    Document document = Util.newDocument();
    Element root = document.createElement("apiprofile");
    document.appendChild(root);
    root.setAttribute("name", baseline.getName());
    root.setAttribute("version", "2");
    String location = baseline.getLocation();
    if (location != null) {
      root.setAttribute("location", location);
    }
    Element celement = null;
    IApiComponent[] components = baseline.getApiComponents();
    int i = 0;
    for (int max = components.length; i < max; i++)
    {
      IApiComponent comp = components[i];
      if (!comp.isSystemComponent())
      {
        celement = document.createElement("apicomponent");
        celement.setAttribute("id", comp.getSymbolicName());
        celement.setAttribute("version", comp.getVersion());
        celement.setAttribute("location", new Path(comp.getLocation()).toPortableString());
        root.appendChild(celement);
      }
    }
    return Util.serializeDocument(document);
  }
  
  private static void abort(String message, Throwable e)
    throws CoreException
  {
    throw new CoreException(new Status(4, "org.eclipse.pde.api.tools", message, e));
  }
  
  /* Error */
  private void restoreBaseline(IApiBaseline baseline, java.io.InputStream stream)
    throws CoreException
  {
    // Byte code:
    //   0: invokestatic 585	java/lang/System:currentTimeMillis	()J
    //   3: lstore_3
    //   4: aconst_null
    //   5: astore 5
    //   7: invokestatic 604	javax/xml/parsers/DocumentBuilderFactory:newInstance	()Ljavax/xml/parsers/DocumentBuilderFactory;
    //   10: invokevirtual 603	javax/xml/parsers/DocumentBuilderFactory:newDocumentBuilder	()Ljavax/xml/parsers/DocumentBuilder;
    //   13: astore 5
    //   15: aload 5
    //   17: new 333	org/xml/sax/helpers/DefaultHandler
    //   20: dup
    //   21: invokespecial 643	org/xml/sax/helpers/DefaultHandler:<init>	()V
    //   24: invokevirtual 601	javax/xml/parsers/DocumentBuilder:setErrorHandler	(Lorg/xml/sax/ErrorHandler;)V
    //   27: goto +26 -> 53
    //   30: astore 6
    //   32: ldc_w 262
    //   35: aload 6
    //   37: invokestatic 622	org/eclipse/pde/api/tools/internal/ApiBaselineManager:abort	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   40: goto +13 -> 53
    //   43: astore 6
    //   45: ldc_w 262
    //   48: aload 6
    //   50: invokestatic 622	org/eclipse/pde/api/tools/internal/ApiBaselineManager:abort	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   53: aload 5
    //   55: aload_2
    //   56: invokevirtual 602	javax/xml/parsers/DocumentBuilder:parse	(Ljava/io/InputStream;)Lorg/w3c/dom/Document;
    //   59: astore 6
    //   61: aload 6
    //   63: invokeinterface 674 1 0
    //   68: astore 7
    //   70: aload 7
    //   72: invokeinterface 677 1 0
    //   77: ldc_w 270
    //   80: invokevirtual 576	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   83: ifeq +513 -> 596
    //   86: aload 7
    //   88: ldc_w 273
    //   91: invokeinterface 679 2 0
    //   96: astore 8
    //   98: aload 8
    //   100: ifnull +30 -> 130
    //   103: aload 8
    //   105: ldc_w 259
    //   108: invokevirtual 576	java/lang/String:equals	(Ljava/lang/Object;)Z
    //   111: ifne +19 -> 130
    //   114: aload_1
    //   115: aload 8
    //   117: invokestatic 609	org/eclipse/core/runtime/Path:fromPortableString	(Ljava/lang/String;)Lorg/eclipse/core/runtime/IPath;
    //   120: invokeinterface 655 1 0
    //   125: invokeinterface 666 2 0
    //   130: aload 7
    //   132: ldc_w 269
    //   135: invokeinterface 682 2 0
    //   140: astore 9
    //   142: new 294	java/util/ArrayList
    //   145: dup
    //   146: invokespecial 586	java/util/ArrayList:<init>	()V
    //   149: astore 10
    //   151: iconst_0
    //   152: istore 11
    //   154: goto +78 -> 232
    //   157: aload 9
    //   159: iload 11
    //   161: invokeinterface 684 2 0
    //   166: checkcast 330	org/w3c/dom/Element
    //   169: astore 12
    //   171: aload 12
    //   173: invokeinterface 678 1 0
    //   178: aload 7
    //   180: invokevirtual 575	java/lang/Object:equals	(Ljava/lang/Object;)Z
    //   183: ifeq +46 -> 229
    //   186: aload 12
    //   188: ldc_w 273
    //   191: invokeinterface 679 2 0
    //   196: astore 13
    //   198: aload_1
    //   199: aload 13
    //   201: invokestatic 609	org/eclipse/core/runtime/Path:fromPortableString	(Ljava/lang/String;)Lorg/eclipse/core/runtime/IPath;
    //   204: invokeinterface 655 1 0
    //   209: invokestatic 628	org/eclipse/pde/api/tools/internal/model/ApiModelFactory:newApiComponent	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiBaseline;Ljava/lang/String;)Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;
    //   212: astore 14
    //   214: aload 14
    //   216: ifnull +13 -> 229
    //   219: aload 10
    //   221: aload 14
    //   223: invokeinterface 649 2 0
    //   228: pop
    //   229: iinc 11 1
    //   232: iload 11
    //   234: aload 9
    //   236: invokeinterface 683 1 0
    //   241: if_icmplt -84 -> 157
    //   244: aload 7
    //   246: ldc_w 277
    //   249: invokeinterface 682 2 0
    //   254: astore 9
    //   256: aconst_null
    //   257: astore 11
    //   259: iconst_0
    //   260: istore 12
    //   262: goto +220 -> 482
    //   265: aload 9
    //   267: iload 12
    //   269: invokeinterface 684 2 0
    //   274: checkcast 330	org/w3c/dom/Element
    //   277: ldc_w 273
    //   280: invokeinterface 679 2 0
    //   285: astore 13
    //   287: aload 13
    //   289: invokestatic 609	org/eclipse/core/runtime/Path:fromPortableString	(Ljava/lang/String;)Lorg/eclipse/core/runtime/IPath;
    //   292: astore 14
    //   294: aload 7
    //   296: ldc_w 269
    //   299: invokeinterface 682 2 0
    //   304: astore 15
    //   306: iconst_0
    //   307: istore 16
    //   309: goto +158 -> 467
    //   312: aload 15
    //   314: iload 16
    //   316: invokeinterface 684 2 0
    //   321: checkcast 330	org/w3c/dom/Element
    //   324: astore 17
    //   326: aload 17
    //   328: ldc_w 272
    //   331: invokeinterface 679 2 0
    //   336: astore 18
    //   338: aload 17
    //   340: ldc_w 278
    //   343: invokeinterface 679 2 0
    //   348: astore 19
    //   350: new 292	java/lang/StringBuffer
    //   353: dup
    //   354: invokespecial 579	java/lang/StringBuffer:<init>	()V
    //   357: astore 20
    //   359: aload 20
    //   361: aload 18
    //   363: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   366: pop
    //   367: aload 20
    //   369: bipush 95
    //   371: invokevirtual 582	java/lang/StringBuffer:append	(C)Ljava/lang/StringBuffer;
    //   374: pop
    //   375: aload 20
    //   377: aload 19
    //   379: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   382: pop
    //   383: aload 14
    //   385: aload 20
    //   387: invokevirtual 580	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   390: invokeinterface 658 2 0
    //   395: invokeinterface 654 1 0
    //   400: astore 21
    //   402: aload 21
    //   404: invokevirtual 560	java/io/File:exists	()Z
    //   407: ifne +31 -> 438
    //   410: aload 20
    //   412: ldc_w 260
    //   415: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   418: pop
    //   419: aload 14
    //   421: aload 20
    //   423: invokevirtual 580	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   426: invokeinterface 658 2 0
    //   431: invokeinterface 654 1 0
    //   436: astore 21
    //   438: aload_1
    //   439: aload 21
    //   441: invokevirtual 562	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   444: invokestatic 628	org/eclipse/pde/api/tools/internal/model/ApiModelFactory:newApiComponent	(Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiBaseline;Ljava/lang/String;)Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;
    //   447: astore 11
    //   449: aload 11
    //   451: ifnull +13 -> 464
    //   454: aload 10
    //   456: aload 11
    //   458: invokeinterface 649 2 0
    //   463: pop
    //   464: iinc 16 1
    //   467: iload 16
    //   469: aload 15
    //   471: invokeinterface 683 1 0
    //   476: if_icmplt -164 -> 312
    //   479: iinc 12 1
    //   482: iload 12
    //   484: aload 9
    //   486: invokeinterface 683 1 0
    //   491: if_icmplt -226 -> 265
    //   494: aload_1
    //   495: aload 10
    //   497: aload 10
    //   499: invokeinterface 648 1 0
    //   504: anewarray 325	org/eclipse/pde/api/tools/internal/provisional/model/IApiComponent
    //   507: invokeinterface 650 2 0
    //   512: checkcast 281	[Lorg/eclipse/pde/api/tools/internal/provisional/model/IApiComponent;
    //   515: invokeinterface 668 2 0
    //   520: goto +76 -> 596
    //   523: astore 6
    //   525: ldc_w 262
    //   528: aload 6
    //   530: invokestatic 622	org/eclipse/pde/api/tools/internal/ApiBaselineManager:abort	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   533: aload_2
    //   534: invokevirtual 571	java/io/InputStream:close	()V
    //   537: goto +73 -> 610
    //   540: astore 23
    //   542: aload 23
    //   544: invokestatic 633	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   547: goto +63 -> 610
    //   550: astore 6
    //   552: ldc_w 262
    //   555: aload 6
    //   557: invokestatic 622	org/eclipse/pde/api/tools/internal/ApiBaselineManager:abort	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   560: aload_2
    //   561: invokevirtual 571	java/io/InputStream:close	()V
    //   564: goto +46 -> 610
    //   567: astore 23
    //   569: aload 23
    //   571: invokestatic 633	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   574: goto +36 -> 610
    //   577: astore 22
    //   579: aload_2
    //   580: invokevirtual 571	java/io/InputStream:close	()V
    //   583: goto +10 -> 593
    //   586: astore 23
    //   588: aload 23
    //   590: invokestatic 633	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   593: aload 22
    //   595: athrow
    //   596: aload_2
    //   597: invokevirtual 571	java/io/InputStream:close	()V
    //   600: goto +10 -> 610
    //   603: astore 23
    //   605: aload 23
    //   607: invokestatic 633	org/eclipse/pde/api/tools/internal/provisional/ApiPlugin:log	(Ljava/lang/Throwable;)V
    //   610: aload_1
    //   611: ifnonnull +10 -> 621
    //   614: ldc_w 264
    //   617: aconst_null
    //   618: invokestatic 622	org/eclipse/pde/api/tools/internal/ApiBaselineManager:abort	(Ljava/lang/String;Ljava/lang/Throwable;)V
    //   621: getstatic 548	org/eclipse/pde/api/tools/internal/ApiBaselineManager:DEBUG	Z
    //   624: ifeq +36 -> 660
    //   627: getstatic 546	java/lang/System:out	Ljava/io/PrintStream;
    //   630: new 292	java/lang/StringBuffer
    //   633: dup
    //   634: ldc_w 267
    //   637: invokespecial 581	java/lang/StringBuffer:<init>	(Ljava/lang/String;)V
    //   640: invokestatic 585	java/lang/System:currentTimeMillis	()J
    //   643: lload_3
    //   644: lsub
    //   645: invokevirtual 583	java/lang/StringBuffer:append	(J)Ljava/lang/StringBuffer;
    //   648: ldc_w 274
    //   651: invokevirtual 584	java/lang/StringBuffer:append	(Ljava/lang/String;)Ljava/lang/StringBuffer;
    //   654: invokevirtual 580	java/lang/StringBuffer:toString	()Ljava/lang/String;
    //   657: invokevirtual 573	java/io/PrintStream:println	(Ljava/lang/String;)V
    //   660: return
    // Line number table:
    //   Java source line #424	-> byte code offset #0
    //   Java source line #425	-> byte code offset #4
    //   Java source line #427	-> byte code offset #7
    //   Java source line #428	-> byte code offset #15
    //   Java source line #429	-> byte code offset #30
    //   Java source line #430	-> byte code offset #32
    //   Java source line #431	-> byte code offset #43
    //   Java source line #432	-> byte code offset #45
    //   Java source line #435	-> byte code offset #53
    //   Java source line #436	-> byte code offset #61
    //   Java source line #437	-> byte code offset #70
    //   Java source line #438	-> byte code offset #86
    //   Java source line #439	-> byte code offset #98
    //   Java source line #440	-> byte code offset #114
    //   Java source line #443	-> byte code offset #130
    //   Java source line #444	-> byte code offset #142
    //   Java source line #445	-> byte code offset #151
    //   Java source line #446	-> byte code offset #157
    //   Java source line #448	-> byte code offset #171
    //   Java source line #449	-> byte code offset #186
    //   Java source line #450	-> byte code offset #198
    //   Java source line #451	-> byte code offset #214
    //   Java source line #452	-> byte code offset #219
    //   Java source line #445	-> byte code offset #229
    //   Java source line #458	-> byte code offset #244
    //   Java source line #459	-> byte code offset #256
    //   Java source line #460	-> byte code offset #259
    //   Java source line #461	-> byte code offset #265
    //   Java source line #462	-> byte code offset #287
    //   Java source line #463	-> byte code offset #294
    //   Java source line #464	-> byte code offset #306
    //   Java source line #465	-> byte code offset #312
    //   Java source line #466	-> byte code offset #326
    //   Java source line #467	-> byte code offset #338
    //   Java source line #468	-> byte code offset #350
    //   Java source line #469	-> byte code offset #359
    //   Java source line #470	-> byte code offset #367
    //   Java source line #471	-> byte code offset #375
    //   Java source line #472	-> byte code offset #383
    //   Java source line #473	-> byte code offset #402
    //   Java source line #474	-> byte code offset #410
    //   Java source line #475	-> byte code offset #419
    //   Java source line #477	-> byte code offset #438
    //   Java source line #478	-> byte code offset #449
    //   Java source line #479	-> byte code offset #454
    //   Java source line #464	-> byte code offset #464
    //   Java source line #460	-> byte code offset #479
    //   Java source line #483	-> byte code offset #494
    //   Java source line #485	-> byte code offset #523
    //   Java source line #486	-> byte code offset #525
    //   Java source line #491	-> byte code offset #533
    //   Java source line #492	-> byte code offset #540
    //   Java source line #493	-> byte code offset #542
    //   Java source line #487	-> byte code offset #550
    //   Java source line #488	-> byte code offset #552
    //   Java source line #491	-> byte code offset #560
    //   Java source line #492	-> byte code offset #567
    //   Java source line #493	-> byte code offset #569
    //   Java source line #489	-> byte code offset #577
    //   Java source line #491	-> byte code offset #579
    //   Java source line #492	-> byte code offset #586
    //   Java source line #493	-> byte code offset #588
    //   Java source line #495	-> byte code offset #593
    //   Java source line #491	-> byte code offset #596
    //   Java source line #492	-> byte code offset #603
    //   Java source line #493	-> byte code offset #605
    //   Java source line #496	-> byte code offset #610
    //   Java source line #497	-> byte code offset #614
    //   Java source line #499	-> byte code offset #621
    //   Java source line #500	-> byte code offset #627
    //   Java source line #502	-> byte code offset #660
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	661	0	this	ApiBaselineManager
    //   0	661	1	baseline	IApiBaseline
    //   0	661	2	stream	java.io.InputStream
    //   3	641	3	start	long
    //   5	49	5	parser	javax.xml.parsers.DocumentBuilder
    //   30	6	6	e	javax.xml.parsers.ParserConfigurationException
    //   43	6	6	e	javax.xml.parsers.FactoryConfigurationError
    //   59	3	6	document	Document
    //   523	6	6	e	IOException
    //   550	6	6	e	org.xml.sax.SAXException
    //   68	227	7	root	Element
    //   96	20	8	baselineLocation	String
    //   140	345	9	children	org.w3c.dom.NodeList
    //   149	349	10	components	java.util.List
    //   152	81	11	j	int
    //   257	200	11	component	IApiComponent
    //   169	18	12	componentNode	Element
    //   260	223	12	j	int
    //   196	4	13	location	String
    //   285	3	13	location	String
    //   212	10	14	component	IApiComponent
    //   292	128	14	poolPath	IPath
    //   304	166	15	componentNodes	org.w3c.dom.NodeList
    //   307	161	16	i	int
    //   324	15	17	compElement	Element
    //   336	26	18	id	String
    //   348	30	19	ver	St
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

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