org.eclipse.equinox.p2.director.app_1.0.300.v20111126-0153

16:44:05.665 INFO  jd.cli.Main - Decompiling org.eclipse.equinox.p2.director.app_1.0.300.v20111126-0153.jar
package org.eclipse.equinox.internal.p2.director.app;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator
  implements BundleActivator
{
  public static final String ID = "org.eclipse.equinox.p2.director.app";
  private static BundleContext bundleContext;
  
  public static BundleContext getContext()
  {
    return bundleContext;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    bundleContext = context;
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    bundleContext = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.director.app.Activator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.director.app;

import java.security.cert.Certificate;
import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.core.UIServices.AuthenticationInfo;
import org.eclipse.equinox.p2.core.UIServices.TrustInfo;

class DirectorApplication$AvoidTrustPromptService
  extends UIServices
{
  final DirectorApplication this$0;
  
  DirectorApplication$AvoidTrustPromptService(DirectorApplication paramDirectorApplication) {}
  
  public UIServices.AuthenticationInfo getUsernamePassword(String location)
  {
    return null;
  }
  
  public UIServices.AuthenticationInfo getUsernamePassword(String location, UIServices.AuthenticationInfo previousInfo)
  {
    return null;
  }
  
  public UIServices.TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail)
  {
    return new UIServices.TrustInfo(null, false, true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.director.app.DirectorApplication.AvoidTrustPromptService
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.director.app;

import java.io.PrintStream;

class DirectorApplication$CommandLineOption
{
  private final String[] identifiers;
  private final String optionSyntaxString;
  private final String helpString;
  
  DirectorApplication$CommandLineOption(String[] identifiers, String optionSyntaxString, String helpString)
  {
    this.identifiers = identifiers;
    this.optionSyntaxString = optionSyntaxString;
    this.helpString = helpString;
  }
  
  boolean isOption(String opt)
  {
    int idx = identifiers.length;
    do
    {
      if (identifiers[idx].equalsIgnoreCase(opt)) {
        return true;
      }
      idx--;
    } while (idx >= 0);
    return false;
  }
  
  void appendHelp(PrintStream out)
  {
    out.print(identifiers[0]);
    for (int idx = 1; idx < identifiers.length; idx++)
    {
      out.print(" | ");
      out.print(identifiers[idx]);
    }
    if (optionSyntaxString != null)
    {
      out.print(' ');
      out.print(optionSyntaxString);
    }
    out.println();
    out.print("  ");
    out.println(helpString);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.director.app.DirectorApplication.CommandLineOption
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.director.app;

import java.net.URI;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;

class DirectorApplication$LocationQueryable
  implements IQueryable<IInstallableUnit>
{
  private URI location;
  final DirectorApplication this$0;
  
  public DirectorApplication$LocationQueryable(DirectorApplication paramDirectorApplication, URI location)
  {
    this.location = location;
    Assert.isNotNull(location);
  }
  
  public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor)
  {
    return this$0.getInstallableUnits(location, query, monitor);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.internal.p2.director.app.DirectorApplication.LocationQueryable
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.internal.p2.director.app;

import java.io.File;
import java.io.PrintStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Set;
import java.util.TreeSet;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.core.helpers.StringHelper;
import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest;
import org.eclipse.equinox.internal.provisional.p2.director.PlanExecutionHelper;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.core.UIServices.AuthenticationInfo;
import org.eclipse.equinox.p2.core.UIServices.TrustInfo;
import org.eclipse.equinox.p2.engine.IEngine;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.engine.IProfileRegistry;
import org.eclipse.equinox.p2.engine.IProvisioningPlan;
import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.ProvisioningContext;
import org.eclipse.equinox.p2.engine.query.UserVisibleRootQuery;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IVersionedId;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.metadata.VersionedId;
import org.eclipse.equinox.p2.planner.IPlanner;
import org.eclipse.equinox.p2.planner.IProfileChangeRequest;
import org.eclipse.equinox.p2.query.Collector;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
import org.eclipse.osgi.framework.log.FrameworkLog;
import org.eclipse.osgi.service.environment.EnvironmentInfo;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.packageadmin.PackageAdmin;

public class DirectorApplication
  implements IApplication
{
  class AvoidTrustPromptService
    extends UIServices
  {
    AvoidTrustPromptService() {}
    
    public UIServices.AuthenticationInfo getUsernamePassword(String location)
    {
      return null;
    }
    
    public UIServices.AuthenticationInfo getUsernamePassword(String location, UIServices.AuthenticationInfo previousInfo)
    {
      return null;
    }
    
    public UIServices.TrustInfo getTrustInfo(Certificate[][] untrustedChain, String[] unsignedDetail)
    {
      return new UIServices.TrustInfo(null, false, true);
    }
  }
  
  class LocationQueryable
    implements IQueryable<IInstallableUnit>
  {
    private URI location;
    
    public LocationQueryable(URI location)
    {
      this.location = location;
      Assert.isNotNull(location);
    }
    
    public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor)
    {
      return getInstallableUnits(location, query, monitor);
    }
  }
  
  private static class CommandLineOption
  {
    private final String[] identifiers;
    private final String optionSyntaxString;
    private final String helpString;
    
    CommandLineOption(String[] identifiers, String optionSyntaxString, String helpString)
    {
      this.identifiers = identifiers;
      this.optionSyntaxString = optionSyntaxString;
      this.helpString = helpString;
    }
    
    boolean isOption(String opt)
    {
      int idx = identifiers.length;
      do
      {
        if (identifiers[idx].equalsIgnoreCase(opt)) {
          return true;
        }
        idx--;
      } while (idx >= 0);
      return false;
    }
    
    void appendHelp(PrintStream out)
    {
      out.print(identifiers[0]);
      for (int idx = 1; idx < identifiers.length; idx++)
      {
        out.print(" | ");
        out.print(identifiers[idx]);
      }
      if (optionSyntaxString != null)
      {
        out.print(' ');
        out.print(optionSyntaxString);
      }
      out.println();
      out.print("  ");
      out.println(helpString);
    }
  }
  
  private static final CommandLineOption OPTION_HELP = new CommandLineOption(new String[] { "-help", "-h", "-?" }, null, Messages.Help_Prints_this_command_line_help);
  private static final CommandLineOption OPTION_LIST = new CommandLineOption(new String[] { "-list", "-l" }, Messages.Help_lb_lt_comma_separated_list_gt_rb, Messages.Help_List_all_IUs_found_in_repos);
  private static final CommandLineOption OPTION_LIST_INSTALLED = new CommandLineOption(new String[] { "-listInstalledRoots", "-lir" }, null, Messages.Help_List_installed_roots);
  private static final CommandLineOption OPTION_INSTALL_IU = new CommandLineOption(new String[] { "-installIU", "-installIUs", "-i" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Installs_the_listed_IUs);
  private static final CommandLineOption OPTION_UNINSTALL_IU = new CommandLineOption(new String[] { "-uninstallIU", "-uninstallIUs", "-u" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Uninstalls_the_listed_IUs);
  private static final CommandLineOption OPTION_REVERT = new CommandLineOption(new String[] { "-revert" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_Revert_to_previous_state);
  private static final CommandLineOption OPTION_DESTINATION = new CommandLineOption(new String[] { "-destination", "-d" }, Messages.Help_lt_path_gt, Messages.Help_The_folder_in_which_the_targetd_product_is_located);
  private static final CommandLineOption OPTION_METADATAREPOS = new CommandLineOption(new String[] { "-metadatarepository", "metadatarepositories", "-m" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_A_list_of_URLs_denoting_metadata_repositories);
  private static final CommandLineOption OPTION_ARTIFACTREPOS = new CommandLineOption(new String[] { "-artifactrepository", "artifactrepositories", "-a" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_A_list_of_URLs_denoting_artifact_repositories);
  private static final CommandLineOption OPTION_REPOSITORIES = new CommandLineOption(new String[] { "-repository", "repositories", "-r" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_A_list_of_URLs_denoting_colocated_repositories);
  private static final CommandLineOption OPTION_VERIFY_ONLY = new CommandLineOption(new String[] { "-verifyOnly" }, null, Messages.Help_Only_verify_dont_install);
  private static final CommandLineOption OPTION_PROFILE = new CommandLineOption(new String[] { "-profile", "-p" }, Messages.Help_lt_name_gt, Messages.Help_Defines_what_profile_to_use_for_the_actions);
  private static final CommandLineOption OPTION_FLAVOR = new CommandLineOption(new String[] { "-flavor", "-f" }, Messages.Help_lt_name_gt, Messages.Help_Defines_flavor_to_use_for_created_profile);
  private static final CommandLineOption OPTION_SHARED = new CommandLineOption(new String[] { "-shared", "-s" }, Messages.Help_lb_lt_path_gt_rb, Messages.Help_Use_a_shared_location_for_the_install);
  private static final CommandLineOption OPTION_BUNDLEPOOL = new CommandLineOption(new String[] { "-bundlepool", "-b" }, Messages.Help_lt_path_gt, Messages.Help_The_location_where_the_plugins_and_features_will_be_stored);
  private static final CommandLineOption OPTION_IU_PROFILE_PROPS = new CommandLineOption(new String[] { "-iuProfileproperties" }, Messages.Help_lt_path_gt, Messages.Help_path_to_IU_profile_properties_file);
  private static final CommandLineOption OPTION_PROFILE_PROPS = new CommandLineOption(new String[] { "-profileproperties" }, Messages.Help_lt_comma_separated_list_gt, Messages.Help_A_list_of_properties_in_the_form_key_value_pairs);
  private static final CommandLineOption OPTION_ROAMING = new CommandLineOption(new String[] { "-roaming" }, null, Messages.Help_Indicates_that_the_product_can_be_moved);
  private static final CommandLineOption OPTION_P2_OS = new CommandLineOption(new String[] { "-p2.os" }, null, Messages.Help_The_OS_when_profile_is_created);
  private static final CommandLineOption OPTION_P2_WS = new CommandLineOption(new String[] { "-p2.ws" }, null, Messages.Help_The_WS_when_profile_is_created);
  private static final CommandLineOption OPTION_P2_ARCH = new CommandLineOption(new String[] { "-p2.arch" }, null, Messages.Help_The_ARCH_when_profile_is_created);
  private static final CommandLineOption OPTION_P2_NL = new CommandLineOption(new String[] { "-p2.nl" }, null, Messages.Help_The_NL_when_profile_is_created);
  private static final CommandLineOption OPTION_PURGEHISTORY = new CommandLineOption(new String[] { "-purgeHistory" }, null, Messages.Help_Purge_the_install_registry);
  private static final CommandLineOption OPTION_FOLLOW_REFERENCES = new CommandLineOption(new String[] { "-followReferences" }, null, Messages.Help_Follow_references);
  private static final CommandLineOption OPTION_TAG = new CommandLineOption(new String[] { "-tag" }, Messages.Help_lt_name_gt, Messages.Help_Defines_a_tag_for_provisioning_session);
  private static final CommandLineOption OPTION_LIST_TAGS = new CommandLineOption(new String[] { "-listTags" }, null, Messages.Help_List_Tags);
  private static final CommandLineOption OPTION_DOWNLOAD_ONLY = new CommandLineOption(new String[] { "-downloadOnly" }, null, Messages.Help_Download_Only);
  private static final CommandLineOption OPTION_IGNORED = new CommandLineOption(new String[] { "-showLocation", "-eclipse.password", "-eclipse.keyring" }, null, "");
  private static final Integer EXIT_ERROR = new Integer(13);
  private static final String FLAVOR_DEFAULT = "tooling";
  private static final String PROP_P2_PROFILE = "eclipse.p2.profile";
  private static final String NO_ARTIFACT_REPOSITORIES_AVAILABLE = "noArtifactRepositoriesAvailable";
  private static final String FOLLOW_ARTIFACT_REPOSITORY_REFERENCES = "org.eclipse.equinox.p2.director.followArtifactRepositoryReferences";
  private static final String LIST_GROUPS_SHORTCUT = "Q:GROUP";
  private static final String QUERY_SEPARATOR = "Q:";
  private static final String QUERY_SEPARATOR_SMALL = "q:";
  public static final String LINE_SEPARATOR = System.getProperty("line.separator");
  private IArtifactRepositoryManager artifactManager;
  IMetadataRepositoryManager metadataManager;
  private URI[] artifactReposForRemoval;
  private URI[] metadataReposForRemoval;
  
  private static void getURIs(List<URI> uris, String spec)
    throws CoreException
  {
    if (spec == null) {
      return;
    }
    String[] urlSpecs = StringHelper.getArrayFromString(spec, ',');
    for (int i = 0; i < urlSpecs.length; i++) {
      try
      {
        uris.add(new URI(urlSpecs[i]));
      }
      catch (URISyntaxException localURISyntaxException1)
      {
        try
        {
          uris.add(URIUtil.fromString(urlSpecs[i]));
        }
        catch (URISyntaxException e)
        {
          throw new ProvisionException(NLS.bind(Messages.unable_to_parse_0_to_uri_1, urlSpecs[i], e.getMessage()));
        }
      }
    }
  }
  
  private static String getRequiredArgument(String[] args, int argIdx)
    throws CoreException
  {
    if (argIdx < args.length)
    {
      String arg = args[argIdx];
      if (!arg.startsWith("-")) {
        return arg;
      }
    }
    throw new ProvisionException(NLS.bind(Messages.option_0_requires_an_argument, args[(argIdx - 1)]));
  }
  
  private static String getOptionalArgument(String[] args, int argIdx)
  {
    
    if (argIdx < args.length)
    {
      String arg = args[argIdx];
      if (!arg.startsWith("-")) {
        return arg;
      }
    }
    return null;
  }
  
  private static void parseIUsArgument(List<IQuery<IInstallableUnit>> vnames, String arg)
  {
    String[] roots = StringHelper.getArrayFromString(arg, ',');
    for (int i = 0; i < roots.length; i++) {
      if (roots[i].equalsIgnoreCase("Q:GROUP"))
      {
        vnames.add(new PrettyQuery(QueryUtil.createIUGroupQuery(), "All groups"));
      }
      else if ((roots[i].startsWith("Q:")) || (roots[i].startsWith("q:")))
      {
        String queryString = roots[i].substring(2);
        vnames.add(new PrettyQuery(QueryUtil.createQuery(queryString, new Object[0]), queryString));
      }
      else
      {
        IVersionedId vId = VersionedId.parse(roots[i]);
        Version v = vId.getVersion();
        IQuery<IInstallableUnit> query = new PrettyQuery(QueryUtil.createIUQuery(vId.getId(), Version.emptyVersion.equals(v) ? VersionRange.emptyRange : new VersionRange(v, true, v, true)), roots[i]);
        vnames.add(query);
      }
    }
  }
  
  private static File processFileArgument(String arg)
  {
    if (arg.startsWith("file:")) {
      arg = arg.substring(5);
    }
    return Path.fromOSString(arg).toFile();
  }
  
  private final List<URI> artifactRepositoryLocations = new ArrayList();
  private final List<URI> metadataRepositoryLocations = new ArrayList();
  private final List<IQuery<IInstallableUnit>> rootsToInstall = new ArrayList();
  private final List<IQuery<IInstallableUnit>> rootsToUninstall = new ArrayList();
  private final List<IQuery<IInstallableUnit>> rootsToList = new ArrayList();
  private File bundlePool = null;
  private File destination;
  private File sharedLocation;
  private String flavor;
  private boolean printHelpInfo = false;
  private boolean printIUList = false;
  private boolean printRootIUList = false;
  private boolean printTags = false;
  private String revertToPreviousState = NOTHING_TO_REVERT_TO;
  private static String NOTHING_TO_REVERT_TO = "-1";
  private static String REVERT_TO_PREVIOUS = "0";
  private boolean verifyOnly = false;
  private boolean roamingProfile = false;
  private boolean purgeRegistry = false;
  private boolean stackTrace = false;
  private boolean followReferences = false;
  private boolean downloadOnly = false;
  private String profileId;
  private String profileProperties;
  private String iuProfileProperties;
  private String ws;
  private String os;
  private String arch;
  private String nl;
  private String tag;
  private IEngine engine;
  private boolean noProfileId = false;
  private PackageAdmin packageAdmin;
  private ServiceReference<PackageAdmin> packageAdminRef;
  private IPlanner planner;
  private ILog log = null;
  private IProvisioningAgent targetAgent;
  private boolean noArtifactRepositorySpecified = false;
  static Class class$0;
  static Class class$1;
  
  private ProfileChangeRequest buildProvisioningRequest(IProfile profile, Collection<IInstallableUnit> installs, Collection<IInstallableUnit> uninstalls)
  {
    ProfileChangeRequest request = new ProfileChangeRequest(profile);
    markRoots(request, installs);
    markRoots(request, uninstalls);
    request.addAll(installs);
    request.removeAll(uninstalls);
    buildIUProfileProperties(request);
    return request;
  }
  
  /* Error */
  private Properties loadProperties(File file)
  {
    // Byte code:
    //   0: aload_1
    //   1: invokevirtual 1499	java/io/File:exists	()Z
    //   4: ifne +30 -> 34
    //   7: aload_0
    //   8: new 754	org/eclipse/core/runtime/Status
    //   11: dup
    //   12: iconst_2
    //   13: ldc_w 692
    //   16: getstatic 1437	org/eclipse/equinox/internal/p2/director/app/Messages:File_does_not_exist	Ljava/lang/String;
    //   19: aload_1
    //   20: invokevirtual 1502	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   23: invokestatic 1666	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   26: invokespecial 1579	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;)V
    //   29: invokespecial 1610	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:logStatus	(Lorg/eclipse/core/runtime/IStatus;)V
    //   32: aconst_null
    //   33: areturn
    //   34: new 745	java/util/Properties
    //   37: dup
    //   38: invokespecial 1566	java/util/Properties:<init>	()V
    //   41: astore_2
    //   42: aconst_null
    //   43: astore_3
    //   44: new 714	java/io/BufferedInputStream
    //   47: dup
    //   48: new 716	java/io/FileInputStream
    //   51: dup
    //   52: aload_1
    //   53: invokespecial 1507	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   56: invokespecial 1498	java/io/BufferedInputStream:<init>	(Ljava/io/InputStream;)V
    //   59: astore_3
    //   60: aload_2
    //   61: aload_3
    //   62: invokevirtual 1567	java/util/Properties:load	(Ljava/io/InputStream;)V
    //   65: goto +63 -> 128
    //   68: astore 4
    //   70: aload_0
    //   71: new 754	org/eclipse/core/runtime/Status
    //   74: dup
    //   75: iconst_4
    //   76: ldc_w 692
    //   79: getstatic 1481	org/eclipse/equinox/internal/p2/director/app/Messages:Problem_loading_file	Ljava/lang/String;
    //   82: aload_1
    //   83: invokevirtual 1502	java/io/File:getAbsolutePath	()Ljava/lang/String;
    //   86: invokestatic 1666	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   89: aload 4
    //   91: invokespecial 1580	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   94: invokespecial 1609	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:logFailure	(Lorg/eclipse/core/runtime/IStatus;)V
    //   97: aload_3
    //   98: ifnull +11 -> 109
    //   101: aload_3
    //   102: invokevirtual 1508	java/io/InputStream:close	()V
    //   105: goto +4 -> 109
    //   108: pop
    //   109: aconst_null
    //   110: areturn
    //   111: astore 5
    //   113: aload_3
    //   114: ifnull +11 -> 125
    //   117: aload_3
    //   118: invokevirtual 1508	java/io/InputStream:close	()V
    //   121: goto +4 -> 125
    //   124: pop
    //   125: aload 5
    //   127: athrow
    //   128: aload_3
    //   129: ifnull +11 -> 140
    //   132: aload_3
    //   133: invokevirtual 1508	java/io/InputStream:close	()V
    //   136: goto +4 -> 140
    //   139: pop
    //   140: aload_2
    //   141: areturn
    // Line number table:
    //   Java source line #278	-> byte code offset #0
    //   Java source line #280	-> byte code offset #7
    //   Java source line #281	-> byte code offset #32
    //   Java source line #283	-> byte code offset #34
    //   Java source line #284	-> byte code offset #42
    //   Java source line #286	-> byte code offset #44
    //   Java source line #287	-> byte code offset #60
    //   Java source line #288	-> byte code offset #68
    //   Java source line #289	-> byte code offset #70
    //   Java source line #292	-> byte code offset #97
    //   Java source line #294	-> byte code offset #101
    //   Java source line #295	-> byte code offset #108
    //   Java source line #290	-> byte code offset #109
    //   Java source line #291	-> byte code offset #111
    //   Java source line #292	-> byte code offset #113
    //   Java source line #294	-> byte code offset #117
    //   Java source line #295	-> byte code offset #124
    //   Java source line #298	-> byte code offset #125
    //   Java source line #292	-> byte code offset #128
    //   Java source line #294	-> byte code offset #132
    //   Java source line #295	-> byte code offset #139
    //   Java source line #299	-> byte code offset #140
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	142	0	this	DirectorApplication
    //   0	142	1	file	File
    //   41	100	2	properties	Properties
    //   43	90	3	input	java.io.InputStream
    //   68	22	4	e	java.io.IOException
    //   111	15	5	localObject	Object
    //   108	1	6	localIOException1	java.io.IOException
    //   124	1	7	localIOException2	java.io.IOException
    //   139	1	8	localIOException3	java.io.IOException
    // Exception table:
    //   from	to	target	type
    //   44	65	68	java/io/IOException
    //   101	105	108	java/io/IOException
    //   44	97	111	finally
    //   117	121	124	java/io/IOException
    //   132	136	139	java/io/IOException
  }
  
  private void buildIUProfileProperties(IProfileChangeRequest request)
  {
    if (iuProfileProperties == null) {
      return;
    }
    Properties properties = loadProperties(new File(iuProfileProperties));
    if (properties == null) {
      return;
    }
    Set<String> alreadyProcessed = new HashSet();
    for (Iterator<Object> iter = properties.keySet().iterator(); iter.hasNext();)
    {
      String line = (String)iter.next();
      int index = line.lastIndexOf('.');
      if (index != -1)
      {
        int num = -1;
        String id = null;
        try
        {
          num = Integer.parseInt(line.substring(index + 1));
          line = line.substring(0, index);
          index = line.lastIndexOf('.');
          if (index == -1) {
            continue;
          }
          id = line.substring(0, index);
        }
        catch (NumberFormatException e)
        {
          logStatus(new Status(2, "org.eclipse.equinox.p2.director.app", NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
          continue;
        }
        catch (IndexOutOfBoundsException e)
        {
          logStatus(new Status(2, "org.eclipse.equinox.p2.director.app", NLS.bind(Messages.Bad_format, line, iuProfileProperties), e));
          continue;
        }
        String versionLine = id + '.' + "version" + '.' + num;
        String keyLine = id + '.' + "key" + '.' + num;
        String valueLine = id + '.' + "value" + '.' + num;
        if ((!alreadyProcessed.contains(versionLine)) && (!alreadyProcessed.contains(keyLine)) && (!alreadyProcessed.contains(valueLine)))
        {
          alreadyProcessed.add(versionLine);
          alreadyProcessed.add(keyLine);
          alreadyProcessed.add(valueLine);
          
          Version version = Version.create((String)properties.get(versionLine));
          String key = (String)properties.get(keyLine);
          String value = (String)properties.get(valueLine);
          if ((key == null) || (value == null))
          {
            String message = NLS.bind(Messages.Unmatched_iu_profile_property_key_value, key + '/' + value);
            logStatus(new Status(2, "org.eclipse.equinox.p2.director.app", message));
          }
          else
          {
            IQuery<IInstallableUnit> query = QueryUtil.createIUQuery(id, version);
            if (version == null) {
              query = QueryUtil.createLatestQuery(query);
            }
            IQueryResult<IInstallableUnit> qr = getInstallableUnits(null, query, null);
            if (qr.isEmpty())
            {
              String msg = NLS.bind(Messages.Cannot_set_iu_profile_property_iu_does_not_exist, id + '/' + version);
              logStatus(new Status(2, "org.eclipse.equinox.p2.director.app", msg));
            }
            else
            {
              IInstallableUnit iu = (IInstallableUnit)qr.iterator().next();
              request.setInstallableUnitProfileProperty(iu, key, value);
            }
          }
        }
      }
    }
  }
  
  private void cleanupRepositories()
  {
    if ((artifactReposForRemoval != null) && (artifactManager != null)) {
      for (int i = 0; (i < artifactReposForRemoval.length) && (artifactReposForRemoval[i] != null); i++) {
        artifactManager.removeRepository(artifactReposForRemoval[i]);
      }
    }
    if ((metadataReposForRemoval != null) && (metadataManager != null)) {
      for (int i = 0; (i < metadataReposForRemoval.length) && (metadataReposForRemoval[i] != null); i++) {
        metadataManager.removeRepository(metadataReposForRemoval[i]);
      }
    }
  }
  
  private IQueryResult<IInstallableUnit> collectRootIUs(IQuery<IInstallableUnit> query)
  {
    IProgressMonitor nullMonitor = new NullProgressMonitor();
    
    int top = metadataRepositoryLocations.size();
    if (top == 0) {
      return getInstallableUnits(null, query, nullMonitor);
    }
    List<IQueryable<IInstallableUnit>> locationQueryables = new ArrayList(top);
    for (int i = 0; i < top; i++) {
      locationQueryables.add(new LocationQueryable((URI)metadataRepositoryLocations.get(i)));
    }
    return QueryUtil.compoundQueryable(locationQueryables).query(query, nullMonitor);
  }
  
  private Collection<IInstallableUnit> collectRoots(IProfile profile, List<IQuery<IInstallableUnit>> rootNames, boolean forInstall)
    throws CoreException
  {
    ArrayList<IInstallableUnit> allRoots = new ArrayList();
    Iterator<IInstallableUnit> itor;
    for (Iterator localIterator = rootNames.iterator(); localIterator.hasNext(); 
        
          itor.hasNext())
    {
      IQuery<IInstallableUnit> rootQuery = (IQuery)localIterator.next();
      IQueryResult<IInstallableUnit> roots = null;
      if (forInstall) {
        roots = collectRootIUs(QueryUtil.createLatestQuery(rootQuery));
      }
      if ((roots == null) || (roots.isEmpty())) {
        roots = profile.query(rootQuery, new NullProgressMonitor());
      }
      itor = roots.iterator();
      if (!itor.hasNext()) {
        throw new CoreException(new Status(4, "org.eclipse.equinox.p2.director.app", NLS.bind(Messages.Missing_IU, rootQuery)));
      }
      allRoots.add((IInstallableUnit)itor.next());
    }
    return allRoots;
  }
  
  synchronized Bundle getBundle(String symbolicName)
  {
    if (packageAdmin == null) {
      return null;
    }
    Bundle[] bundles = packageAdmin.getBundles(symbolicName, null);
    if (bundles == null) {
      return null;
    }
    for (int i = 0; i < bundles.length; i++) {
      if ((bundles[i].getState() & 0x3) == 0) {
        return bundles[i];
      }
    }
    return null;
  }
  
  private String getEnvironmentProperty()
  {
    HashMap<String, String> values = new HashMap();
    if (os != null) {
      values.put("osgi.os", os);
    }
    if (nl != null) {
      values.put("osgi.nl", nl);
    }
    if (ws != null) {
      values.put("osgi.ws", ws);
    }
    if (arch != null) {
      values.put("osgi.arch", arch);
    }
    return values.isEmpty() ? null : toString(values);
  }
  
  private IProfile getProfile()
  {
    IProfileRegistry profileRegistry = (IProfileRegistry)targetAgent.getService(IProfileRegistry.SERVICE_NAME);
    if (profileId == null)
    {
      profileId = "_SELF_";
      noProfileId = true;
    }
    return profileRegistry.getProfile(profileId);
  }
  
  private IProfile initializeProfile()
    throws CoreException
  {
    IProfile profile = getProfile();
    if (profile == null)
    {
      if (destination == null) {
        missingArgument("destination");
      }
      if (flavor == null) {
        flavor = System.getProperty("eclipse.p2.configurationFlavor", "tooling");
      }
      Map<String, String> props = new HashMap();
      props.put("org.eclipse.equinox.p2.installFolder", destination.toString());
      if (bundlePool == null) {
        props.put("org.eclipse.equinox.p2.cache", sharedLocation == null ? destination.getAbsolutePath() : sharedLocation.getAbsolutePath());
      } else {
        props.put("org.eclipse.equinox.p2.cache", bundlePool.getAbsolutePath());
      }
      if (roamingProfile) {
        props.put("org.eclipse.equinox.p2.roaming", Boolean.TRUE.toString());
      }
      String env = getEnvironmentProperty();
      if (env != null) {
        props.put("org.eclipse.equinox.p2.environments", env);
      }
      if (profileProperties != null) {
        putProperties(profileProperties, props);
      }
      profile = ((IProfileRegistry)targetAgent.getService(IProfileRegistry.SERVICE_NAME)).addProfile(profileId, props);
    }
    return profile;
  }
  
  private void initializeRepositories()
    throws CoreException
  {
    if ((rootsToInstall.isEmpty()) && (revertToPreviousState == NOTHING_TO_REVERT_TO) && (!printIUList)) {
      return;
    }
    if (artifactRepositoryLocations == null) {
      missingArgument("-artifactRepository");
    }
    artifactManager = ((IArtifactRepositoryManager)targetAgent.getService(IArtifactRepositoryManager.SERVICE_NAME));
    if (artifactManager == null) {
      throw new ProvisionException(Messages.Application_NoManager);
    }
    int removalIdx = 0;
    boolean anyValid = false;
    artifactReposForRemoval = new URI[artifactRepositoryLocations.size()];
    for (int i = 0; i < artifactRepositoryLocations.size(); i++)
    {
      URI location = (URI)artifactRepositoryLocations.get(i);
      try
      {
        if (!artifactManager.contains(location))
        {
          artifactManager.loadRepository(location, null);
          artifactReposForRemoval[(removalIdx++)] = location;
        }
        anyValid = true;
      }
      catch (ProvisionException e)
      {
        logStatus(e.getStatus());
      }
    }
    if (!anyValid) {
      noArtifactRepositorySpecified = true;
    }
    if (metadataRepositoryLocations == null) {
      missingArgument("metadataRepository");
    }
    metadataManager = ((IMetadataRepositoryManager)targetAgent.getService(IMetadataRepositoryManager.SERVICE_NAME));
    if (metadataManager == null) {
      throw new ProvisionException(Messages.Application_NoManager);
    }
    removalIdx = 0;
    anyValid = false;
    int top = metadataRepositoryLocations.size();
    metadataReposForRemoval = new URI[top];
    for (int i = 0; i < top; i++)
    {
      URI location = (URI)metadataRepositoryLocations.get(i);
      try
      {
        if (!metadataManager.contains(location))
        {
          metadataManager.loadRepository(location, null);
          metadataReposForRemoval[(removalIdx++)] = location;
        }
        anyValid = true;
      }
      catch (ProvisionException e)
      {
        logStatus(e.getStatus());
      }
    }
    if (!anyValid) {
      throw new ProvisionException(Messages.Application_NoRepositories);
    }
  }
  
  /* Error */
  private void initializeServices()
    throws CoreException
  {
    // Byte code:
    //   0: invokestatic 1592	org/eclipse/equinox/internal/p2/director/app/Activator:getContext	()Lorg/osgi/framework/BundleContext;
    //   3: astore_1
    //   4: aload_0
    //   5: aload_1
    //   6: getstatic 1371	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:class$0	Ljava/lang/Class;
    //   9: dup
    //   10: ifnonnull +29 -> 39
    //   13: pop
    //   14: ldc_w 702
    //   17: invokestatic 1516	java/lang/Class:forName	(Ljava/lang/String;)Ljava/lang/Class;
    //   20: dup
    //   21: putstatic 1371	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:class$0	Ljava/lang/Class;
    //   24: goto +15 -> 39
    //   27: new 727	java/lang/NoClassDefFoundError
    //   30: dup_x1
    //   31: swap
    //   32: invokevirtual 1549	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   35: invokespecial 1522	java/lang/NoClassDefFoundError:<init>	(Ljava/lang/String;)V
    //   38: athrow
    //   39: invokeinterface 1742 2 0
    //   44: putfield 1430	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:packageAdminRef	Lorg/osgi/framework/ServiceReference;
    //   47: aload_0
    //   48: aload_1
    //   49: aload_0
    //   50: getfield 1430	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:packageAdminRef	Lorg/osgi/framework/ServiceReference;
    //   53: invokeinterface 1741 2 0
    //   58: checkcast 802	org/osgi/service/packageadmin/PackageAdmin
    //   61: putfield 1431	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:packageAdmin	Lorg/osgi/service/packageadmin/PackageAdmin;
    //   64: aload_1
    //   65: getstatic 1372	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:class$1	Ljava/lang/Class;
    //   68: dup
    //   69: ifnonnull +29 -> 98
    //   72: pop
    //   73: ldc_w 691
    //   76: invokestatic 1516	java/lang/Class:forName	(Ljava/lang/String;)Ljava/lang/Class;
    //   79: dup
    //   80: putstatic 1372	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:class$1	Ljava/lang/Class;
    //   83: goto +15 -> 98
    //   86: new 727	java/lang/NoClassDefFoundError
    //   89: dup_x1
    //   90: swap
    //   91: invokevirtual 1549	java/lang/Throwable:getMessage	()Ljava/lang/String;
    //   94: invokespecial 1522	java/lang/NoClassDefFoundError:<init>	(Ljava/lang/String;)V
    //   97: athrow
    //   98: invokeinterface 1742 2 0
    //   103: astore_2
    //   104: aload_1
    //   105: aload_2
    //   106: invokeinterface 1741 2 0
    //   111: checkcast 773	org/eclipse/equinox/p2/core/IProvisioningAgentProvider
    //   114: astore_3
    //   115: aload_0
    //   116: getfield 1369	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:destination	Ljava/io/File;
    //   119: ifnonnull +10 -> 129
    //   122: aload_0
    //   123: getfield 1370	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:sharedLocation	Ljava/io/File;
    //   126: ifnull +43 -> 169
    //   129: aload_0
    //   130: getfield 1370	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:sharedLocation	Ljava/io/File;
    //   133: ifnonnull +20 -> 153
    //   136: new 715	java/io/File
    //   139: dup
    //   140: aload_0
    //   141: getfield 1369	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:destination	Ljava/io/File;
    //   144: ldc_w 707
    //   147: invokespecial 1506	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   150: goto +7 -> 157
    //   153: aload_0
    //   154: getfield 1370	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:sharedLocation	Ljava/io/File;
    //   157: astore 5
    //   159: aload 5
    //   161: invokevirtual 1505	java/io/File:toURI	()Ljava/net/URI;
    //   164: astore 4
    //   166: goto +6 -> 172
    //   169: aconst_null
    //   170: astore 4
    //   172: aload_0
    //   173: aload_3
    //   174: aload 4
    //   176: invokeinterface 1702 2 0
    //   181: putfield 1425	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:targetAgent	Lorg/eclipse/equinox/p2/core/IProvisioningAgent;
    //   184: aload_0
    //   185: getfield 1425	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:targetAgent	Lorg/eclipse/equinox/p2/core/IProvisioningAgent;
    //   188: ldc_w 696
    //   191: aload_3
    //   192: aconst_null
    //   193: invokeinterface 1702 2 0
    //   198: invokeinterface 1700 3 0
    //   203: aload_1
    //   204: aload_2
    //   205: invokeinterface 1740 2 0
    //   210: pop
    //   211: aload_0
    //   212: getfield 1384	org/eclipse/equinox/internal/p2/director/app/DirectorApplication:profileId	Ljava/lang/String;
    //   215: ifnonnull +146 -> 361
    //   218: aload_0
    //   219: getfield 1369	org/eclipse/equinox/inter
1 2 3

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