org.eclipse.mylyn.discovery.core_3.7.1.v20120425-0100

tory);
    }
    return directory;
  }
  
  private class DirectoryContentHandler
    implements ContentHandler
  {
    Directory directory;
    
    private DirectoryContentHandler() {}
    
    public void characters(char[] ch, int start, int length)
      throws SAXException
    {}
    
    public void endDocument()
      throws SAXException
    {}
    
    public void endElement(String uri, String localName, String qName)
      throws SAXException
    {}
    
    public void endPrefixMapping(String prefix)
      throws SAXException
    {}
    
    public void ignorableWhitespace(char[] ch, int start, int length)
      throws SAXException
    {}
    
    public void processingInstruction(String target, String data)
      throws SAXException
    {}
    
    public void setDocumentLocator(Locator locator) {}
    
    public void skippedEntity(String name)
      throws SAXException
    {}
    
    public void startDocument()
      throws SAXException
    {}
    
    public void startElement(String uri, String localName, String qName, Attributes atts)
      throws SAXException
    {
      if ("directory".equals(localName))
      {
        if (directory != null) {
          unexpectedElement(localName);
        }
        directory = new Directory();
      }
      else if ((directory != null) && ("entry".equals(localName)))
      {
        String url = atts.getValue("", "url");
        if ((url != null) && (url.length() > 0))
        {
          try
          {
            URI entryUri = new URI(url);
            if ((baseUri != null) && (!entryUri.isAbsolute())) {
              url = baseUri.resolve(url).toString();
            }
          }
          catch (URISyntaxException localURISyntaxException) {}
          Directory.Entry entry = new Directory.Entry();
          entry.setLocation(url);
          entry.setPermitCategories(Boolean.parseBoolean(atts.getValue("permitCategories")));
          directory.getEntries().add(entry);
        }
      }
    }
    
    private void unexpectedElement(String localName)
      throws SAXException
    {
      throw new SAXException(NLS.bind(Messages.DirectoryParser_unexpected_element, localName));
    }
    
    public void startPrefixMapping(String prefix, String uri)
      throws SAXException
    {}
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.discovery.core.model.DirectoryParser
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.discovery.core.model;

import java.util.ArrayList;
import java.util.List;

public class ConnectorCategory
{
  protected String id;
  protected String name;
  protected String description;
  protected String relevance;
  protected Icon icon;
  protected Overview overview;
  protected List<Group> group = new ArrayList();
  
  public String getId()
  {
    return id;
  }
  
  public void setId(String id)
  {
    this.id = id;
  }
  
  public String getName()
  {
    return name;
  }
  
  public void setName(String name)
  {
    this.name = name;
  }
  
  public String getDescription()
  {
    return description;
  }
  
  public void setDescription(String description)
  {
    this.description = description;
  }
  
  public String getRelevance()
  {
    return relevance;
  }
  
  public void setRelevance(String relevance)
  {
    this.relevance = relevance;
  }
  
  public Icon getIcon()
  {
    return icon;
  }
  
  public void setIcon(Icon icon)
  {
    this.icon = icon;
  }
  
  public Overview getOverview()
  {
    return overview;
  }
  
  public void setOverview(Overview overview)
  {
    this.overview = overview;
  }
  
  public List<Group> getGroup()
  {
    return group;
  }
  
  public void setGroup(List<Group> group)
  {
    this.group = group;
  }
  
  public void validate()
    throws ValidationException
  {
    if ((id == null) || (id.length() == 0)) {
      throw new ValidationException(Messages.ConnectorCategory_must_specify_connectorCategory_id);
    }
    if ((name == null) || (name.length() == 0)) {
      throw new ValidationException(Messages.ConnectorCategory_must_specify_connectorCategory_name);
    }
    if ((description == null) || (description.length() == 0)) {
      throw new ValidationException("Must specify connectorCategory/@description");
    }
    if (icon != null) {
      icon.validate();
    }
    if (relevance != null) {
      try
      {
        int r = Integer.parseInt(relevance, 10);
        if ((r < 0) || (r > 100)) {
          throw new NumberFormatException();
        }
      }
      catch (NumberFormatException localNumberFormatException)
      {
        throw new ValidationException(Messages.ConnectorCategory_connectorCategory_relevance_invalid);
      }
    }
    if (overview != null) {
      overview.validate();
    }
    for (Group groupItem : group) {
      groupItem.validate();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.discovery.core.model.ConnectorCategory
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.discovery.core.model;

import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.UnknownHostException;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.internal.discovery.core.util.WebUtil;
import org.eclipse.mylyn.internal.discovery.core.util.WebUtil.TextContentProcessor;
import org.eclipse.osgi.util.NLS;

public class RemoteBundleDiscoveryStrategy
  extends BundleDiscoveryStrategy
{
  private String directoryUrl;
  private DiscoveryRegistryStrategy registryStrategy;
  private File temporaryStorage;
  private int maxDiscoveryJarDownloadAttempts = 1;
  /* Error */
  public void performDiscovery(IProgressMonitor monitor)
    throws org.eclipse.core.runtime.CoreException
  {
    // Byte code:
    //   0: aload_0
    //   1: getfield 363	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:connectors	Ljava/util/List;
    //   4: ifnull +17 -> 21
    //   7: aload_0
    //   8: getfield 362	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:categories	Ljava/util/List;
    //   11: ifnull +10 -> 21
    //   14: aload_0
    //   15: getfield 361	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:directoryUrl	Ljava/lang/String;
    //   18: ifnonnull +11 -> 29
    //   21: new 164	java/lang/IllegalStateException
    //   24: dup
    //   25: invokespecial 375	java/lang/IllegalStateException:<init>	()V
    //   28: athrow
    //   29: aload_0
    //   30: getfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   33: ifnull +11 -> 44
    //   36: new 164	java/lang/IllegalStateException
    //   39: dup
    //   40: invokespecial 375	java/lang/IllegalStateException:<init>	()V
    //   43: athrow
    //   44: aload_1
    //   45: getstatic 356	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_task_remote_discovery	Ljava/lang/String;
    //   48: ldc 2
    //   50: invokeinterface 430 3 0
    //   55: aload_0
    //   56: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   59: ifnull +21 -> 80
    //   62: aload_0
    //   63: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   66: invokevirtual 366	java/io/File:exists	()Z
    //   69: ifeq +11 -> 80
    //   72: aload_0
    //   73: aload_0
    //   74: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   77: invokespecial 402	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:delete	(Ljava/io/File;)V
    //   80: aload_0
    //   81: ldc 6
    //   83: invokevirtual 373	java/lang/Class:getSimpleName	()Ljava/lang/String;
    //   86: ldc 4
    //   88: invokestatic 371	java/io/File:createTempFile	(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;
    //   91: putfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   94: aload_0
    //   95: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   98: invokevirtual 365	java/io/File:delete	()Z
    //   101: pop
    //   102: aload_0
    //   103: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   106: invokevirtual 368	java/io/File:mkdirs	()Z
    //   109: ifne +11 -> 120
    //   112: new 161	java/io/IOException
    //   115: dup
    //   116: invokespecial 372	java/io/IOException:<init>	()V
    //   119: athrow
    //   120: new 160	java/io/File
    //   123: dup
    //   124: aload_0
    //   125: getfield 360	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:temporaryStorage	Ljava/io/File;
    //   128: ldc 3
    //   130: invokespecial 370	java/io/File:<init>	(Ljava/io/File;Ljava/lang/String;)V
    //   133: astore_2
    //   134: aload_2
    //   135: invokevirtual 368	java/io/File:mkdirs	()Z
    //   138: ifne +34 -> 172
    //   141: new 161	java/io/IOException
    //   144: dup
    //   145: invokespecial 372	java/io/IOException:<init>	()V
    //   148: athrow
    //   149: astore_3
    //   150: new 183	org/eclipse/core/runtime/CoreException
    //   153: dup
    //   154: new 189	org/eclipse/core/runtime/Status
    //   157: dup
    //   158: iconst_4
    //   159: ldc 5
    //   161: getstatic 355	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_io_failure_temp_storage	Ljava/lang/String;
    //   164: aload_3
    //   165: invokespecial 388	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   168: invokespecial 386	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   171: athrow
    //   172: aload_1
    //   173: invokeinterface 427 1 0
    //   178: ifeq +10 -> 188
    //   181: aload_1
    //   182: invokeinterface 426 1 0
    //   187: return
    //   188: iconst_1
    //   189: anewarray 193	org/eclipse/mylyn/internal/discovery/core/model/Directory
    //   192: astore 4
    //   194: new 168	java/net/URI
    //   197: dup
    //   198: aload_0
    //   199: getfield 361	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:directoryUrl	Ljava/lang/String;
    //   202: invokespecial 378	java/net/URI:<init>	(Ljava/lang/String;)V
    //   205: astore 5
    //   207: aload 5
    //   209: new 199	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$1
    //   212: dup
    //   213: aload_0
    //   214: aload 5
    //   216: aload 4
    //   218: invokespecial 406	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$1:<init>	(Lorg/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy;Ljava/net/URI;[Lorg/eclipse/mylyn/internal/discovery/core/model/Directory;)V
    //   221: new 190	org/eclipse/core/runtime/SubProgressMonitor
    //   224: dup
    //   225: aload_1
    //   226: sipush 10000
    //   229: invokespecial 389	org/eclipse/core/runtime/SubProgressMonitor:<init>	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   232: invokestatic 410	org/eclipse/mylyn/internal/discovery/core/util/WebUtil:readResource	(Ljava/net/URI;Lorg/eclipse/mylyn/internal/discovery/core/util/WebUtil$TextContentProcessor;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   235: aload 4
    //   237: iconst_0
    //   238: aaload
    //   239: astore_3
    //   240: aload_3
    //   241: ifnonnull +94 -> 335
    //   244: new 164	java/lang/IllegalStateException
    //   247: dup
    //   248: invokespecial 375	java/lang/IllegalStateException:<init>	()V
    //   251: athrow
    //   252: astore 4
    //   254: new 183	org/eclipse/core/runtime/CoreException
    //   257: dup
    //   258: new 189	org/eclipse/core/runtime/Status
    //   261: dup
    //   262: iconst_4
    //   263: ldc 5
    //   265: getstatic 358	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_unknown_host_discovery_directory	Ljava/lang/String;
    //   268: aload 4
    //   270: invokevirtual 379	java/net/UnknownHostException:getMessage	()Ljava/lang/String;
    //   273: invokestatic 411	org/eclipse/osgi/util/NLS:bind	(Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/String;
    //   276: aload 4
    //   278: invokespecial 388	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   281: invokespecial 386	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   284: athrow
    //   285: astore 4
    //   287: new 183	org/eclipse/core/runtime/CoreException
    //   290: dup
    //   291: new 189	org/eclipse/core/runtime/Status
    //   294: dup
    //   295: iconst_4
    //   296: ldc 5
    //   298: getstatic 354	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_io_failure_discovery_directory	Ljava/lang/String;
    //   301: aload 4
    //   303: invokespecial 388	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   306: invokespecial 386	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   309: athrow
    //   310: astore 4
    //   312: new 183	org/eclipse/core/runtime/CoreException
    //   315: dup
    //   316: new 189	org/eclipse/core/runtime/Status
    //   319: dup
    //   320: iconst_4
    //   321: ldc 5
    //   323: getstatic 354	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_io_failure_discovery_directory	Ljava/lang/String;
    //   326: aload 4
    //   328: invokespecial 388	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   331: invokespecial 386	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   334: athrow
    //   335: aload_1
    //   336: invokeinterface 427 1 0
    //   341: ifeq +10 -> 351
    //   344: aload_1
    //   345: invokeinterface 426 1 0
    //   350: return
    //   351: aload_3
    //   352: invokevirtual 393	org/eclipse/mylyn/internal/discovery/core/model/Directory:getEntries	()Ljava/util/List;
    //   355: invokeinterface 415 1 0
    //   360: ifeq +24 -> 384
    //   363: new 183	org/eclipse/core/runtime/CoreException
    //   366: dup
    //   367: new 189	org/eclipse/core/runtime/Status
    //   370: dup
    //   371: iconst_4
    //   372: ldc 5
    //   374: getstatic 353	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_empty_directory	Ljava/lang/String;
    //   377: invokespecial 387	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;)V
    //   380: invokespecial 386	org/eclipse/core/runtime/CoreException:<init>	(Lorg/eclipse/core/runtime/IStatus;)V
    //   383: athrow
    //   384: new 172	java/util/HashMap
    //   387: dup
    //   388: invokespecial 381	java/util/HashMap:<init>	()V
    //   391: astore 4
    //   393: aload_0
    //   394: aload_3
    //   395: invokevirtual 393	org/eclipse/mylyn/internal/discovery/core/model/Directory:getEntries	()Ljava/util/List;
    //   398: invokeinterface 414 1 0
    //   403: invokespecial 404	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:createExecutorService	(I)Ljava/util/concurrent/ExecutorService;
    //   406: astore 5
    //   408: new 171	java/util/ArrayList
    //   411: dup
    //   412: invokespecial 380	java/util/ArrayList:<init>	()V
    //   415: astore 6
    //   417: aload_3
    //   418: invokevirtual 393	org/eclipse/mylyn/internal/discovery/core/model/Directory:getEntries	()Ljava/util/List;
    //   421: invokeinterface 417 1 0
    //   426: astore 8
    //   428: goto +41 -> 469
    //   431: aload 8
    //   433: invokeinterface 413 1 0
    //   438: checkcast 194	org/eclipse/mylyn/internal/discovery/core/model/Directory$Entry
    //   441: astore 7
    //   443: aload 6
    //   445: aload 5
    //   447: new 200	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob
    //   450: dup
    //   451: aload_0
    //   452: aload 7
    //   454: aload_1
    //   455: invokespecial 409	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob:<init>	(Lorg/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy;Lorg/eclipse/mylyn/internal/discovery/core/model/Directory$Entry;Lorg/eclipse/core/runtime/IProgressMonitor;)V
    //   458: invokeinterface 420 2 0
    //   463: invokeinterface 416 2 0
    //   468: pop
    //   469: aload 8
    //   471: invokeinterface 412 1 0
    //   476: ifne -45 -> 431
    //   479: ldc 1
    //   481: aload_3
    //   482: invokevirtual 393	org/eclipse/mylyn/internal/discovery/core/model/Directory:getEntries	()Ljava/util/List;
    //   485: invokeinterface 414 1 0
    //   490: idiv
    //   491: istore 7
    //   493: aload 6
    //   495: invokeinterface 417 1 0
    //   500: astore 9
    //   502: goto +204 -> 706
    //   505: aload 9
    //   507: invokeinterface 413 1 0
    //   512: checkcast 179	java/util/concurrent/Future
    //   515: astore 8
    //   517: aload 8
    //   519: lconst_1
    //   520: getstatic 352	java/util/concurrent/TimeUnit:SECONDS	Ljava/util/concurrent/TimeUnit;
    //   523: invokeinterface 421 4 0
    //   528: checkcast 200	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob
    //   531: astore 10
    //   533: goto +28 -> 561
    //   536: pop
    //   537: aload_1
    //   538: invokeinterface 427 1 0
    //   543: ifeq -26 -> 517
    //   546: aload 5
    //   548: invokeinterface 419 1 0
    //   553: pop
    //   554: aload_1
    //   555: invokeinterface 426 1 0
    //   560: return
    //   561: aload 10
    //   563: invokestatic 407	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob:access$2	(Lorg/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob;)Ljava/io/File;
    //   566: ifnull +21 -> 587
    //   569: aload 4
    //   571: aload 10
    //   573: invokestatic 407	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob:access$2	(Lorg/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob;)Ljava/io/File;
    //   576: aload 10
    //   578: invokestatic 408	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob:access$3	(Lorg/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy$DownloadBundleJob;)Lorg/eclipse/mylyn/internal/discovery/core/model/Directory$Entry;
    //   581: invokeinterface 418 3 0
    //   586: pop
    //   587: aload_1
    //   588: iload 7
    //   590: invokeinterface 428 2 0
    //   595: goto +111 -> 706
    //   598: astore 10
    //   600: aload 10
    //   602: invokevirtual 382	java/util/concurrent/ExecutionException:getCause	()Ljava/lang/Throwable;
    //   605: astore 11
    //   607: aload 11
    //   609: instanceof 188
    //   612: ifeq +25 -> 637
    //   615: aload_1
    //   616: iconst_1
    //   617: invokeinterface 429 2 0
    //   622: aload 5
    //   624: invokeinterface 419 1 0
    //   629: pop
    //   630: aload_1
    //   631: invokeinterface 426 1 0
    //   636: return
    //   637: aload 11
    //   639: instanceof 183
    //   642: ifeq +16 -> 658
    //   645: aload 11
    //   647: checkcast 183	org/eclipse/core/runtime/CoreException
    //   650: invokevirtual 385	org/eclipse/core/runtime/CoreException:getStatus	()Lorg/eclipse/core/runtime/IStatus;
    //   653: astore 12
    //   655: goto +20 -> 675
    //   658: new 189	org/eclipse/core/runtime/Status
    //   661: dup
    //   662: iconst_4
    //   663: ldc 5
    //   665: getstatic 357	org/eclipse/mylyn/internal/discovery/core/model/Messages:RemoteBundleDiscoveryStrategy_unexpectedError	Ljava/lang/String;
    //   668: aload 11
    //   670: invokespecial 388	org/eclipse/core/runtime/Status:<init>	(ILjava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V
    //   673: astore 12
    //   675: aload 12
    //   677: invokestatic 390	org/eclipse/mylyn/commons/core/StatusHandler:log	(Lorg/eclipse/core/runtime/IStatus;)V
    //   680: goto +26 -> 706
    //   683: pop
    //   684: aload_1
    //   685: iconst_1
    //   686: invokeinterface 429 2 0
    //   691: aload 5
    //   693: invokeinterface 419 1 0
    //   698: pop
    //   699: aload_1
    //   700: invokeinterface 426 1 0
    //   705: return
    //   706: aload 9
    //   708: invokeinterface 412 1 0
    //   713: ifne -208 -> 505
    //   716: goto +16 -> 732
    //   719: astore 13
    //   721: aload 5
    //   723: invokeinterface 419 1 0
    //   728: pop
    //   729: aload 13
    //   731: athrow
    //   732: aload 5
    //   734: invokeinterface 419 1 0
    //   739: pop
    //   740: aload_0
    //   741: new 195	org/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy
    //   744: dup
    //   745: iconst_1
    //   746: anewarray 160	java/io/File
    //   749: dup
    //   750: iconst_0
    //   751: aload_2
    //   752: aastore
    //   753: iconst_1
    //   754: newarray <illegal type>
    //   756: aload_0
    //   757: invokespecial 397	org/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy:<init>	([Ljava/io/File;[ZLjava/lang/Object;)V
    //   760: putfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   763: aload_0
    //   764: getfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   767: aload 4
    //   769: invokevirtual 395	org/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy:setBundles	(Ljava/util/Map;)V
    //   772: new 182	org/eclipse/core/internal/registry/ExtensionRegistry
    //   775: dup
    //   776: aload_0
    //   777: getfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   780: aload_0
    //   781: aload_0
    //   782: invokespecial 384	org/eclipse/core/internal/registry/ExtensionRegistry:<init>	(Lorg/eclipse/core/runtime/spi/RegistryStrategy;Ljava/lang/Object;Ljava/lang/Object;)V
    //   785: astore 6
    //   787: aload 6
    //   789: ldc_w 159
    //   792: invokeinterface 425 2 0
    //   797: astore 7
    //   799: aload 7
    //   801: ifnull +51 -> 852
    //   804: aload 7
    //   806: invokeinterface 423 1 0
    //   811: astore 8
    //   813: aload 8
    //   815: arraylength
    //   816: ifle +36 -> 852
    //   819: aload_0
    //   820: new 190	org/eclipse/core/runtime/SubProgressMonitor
    //   823: dup
    //   824: aload_1
    //   825: sipush 30000
    //   828: invokespecial 389	org/eclipse/core/runtime/SubProgressMonitor:<init>	(Lorg/eclipse/core/runtime/IProgressMonitor;I)V
    //   831: aload 8
    //   833: invokevirtual 405	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:processExtensions	(Lorg/eclipse/core/runtime/IProgressMonitor;[Lorg/eclipse/core/runtime/IExtension;)V
    //   836: goto +16 -> 852
    //   839: astore 9
    //   841: aload 6
    //   843: aload_0
    //   844: invokeinterface 424 2 0
    //   849: aload 9
    //   851: athrow
    //   852: aload 6
    //   854: aload_0
    //   855: invokeinterface 424 2 0
    //   860: goto +13 -> 873
    //   863: astore 10
    //   865: aload_0
    //   866: aconst_null
    //   867: putfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   870: aload 10
    //   872: athrow
    //   873: aload_0
    //   874: aconst_null
    //   875: putfield 364	org/eclipse/mylyn/internal/discovery/core/model/RemoteBundleDiscoveryStrategy:registryStrategy	Lorg/eclipse/mylyn/internal/discovery/core/model/DiscoveryRegistryStrategy;
    //   878: goto +14 -> 892
    //   881: astore 14
    //   883: aload_1
    //   884: invokeinterface 426 1 0
    //   889: aload 14
    //   891: athrow
    //   892: aload_1
    //   893: invokeinterface 426 1 0
    //   898: return
    // Line number table:
    //   Java source line #69	-> byte code offset #0
    //   Java source line #70	-> byte code offset #21
    //   Java source line #72	-> byte code offset #29
    //   Java source line #73	-> byte code offset #36
    //   Java source line #78	-> byte code offset #44
    //   Java source line #82	-> byte code offset #55
    //   Java source line #83	-> byte code offset #72
    //   Java source line #85	-> byte code offset #80
    //   Java source line #86	-> byte code offset #94
    //   Java source line #87	-> byte code offset #102
    //   Java source line #88	-> byte code offset #112
    //   Java source line #90	-> byte code offset #120
    //   Java source line #91	-> byte code offset #134
    //   Java source line #92	-> byte code offset #141
    //   Java source line #94	-> byte code offset #149
    //   Java source line #95	-> byte code offset #150
    //   Java source line #96	-> byte code offset #161
    //   Java source line #95	-> byte code offset #168
    //   Java source line #98	-> byte code offset #172
    //   Java source line #208	-> byte code offset #181
    //   Java source line #99	-> byte code offset #187
    //   Java source line #105	-> byte code offset #188
    //   Java source line #106	-> byte code offset #194
    //   Java source line #107	-> byte code offset #207
    //   Java source line #113	-> byte code offset #221
    //   Java source line #107	-> byte code offset #232
    //   Java source line #114	-> byte code offset #235
    //   Java source line #115	-> byte code offset #240
    //   Java source line #116	-> byte code offset #244
    //   Java source line #118	-> byte code offset #252
    //   Java source line #119	-> byte code offset #254
    //   Java source line #120	-> byte code offset #265
    //   Java source line #119	-> byte code offset #273
    //   Java source line #120	-> byte code offset #276
    //   Java source line #119	-> byte code offset #281
    //   Java source line #121	-> byte code offset #285
    //   Java source line #122	-> byte code offset #287
    //   Java source line #123	-> byte code offset #298
    //   Java source line #122	-> byte code offset #306
    //   Java source line #124	-> byte code offset #310
    //   Java source line #125	-> byte code offset #312
    //   Java source line #126	-> byte code offset #323
    //   Java source line #125	-> byte code offset #331
    //   Java source line #128	-> byte code offset #335
    //   Java source line #208	-> byte code offset #344
    //   Java source line #129	-> byte code offset #350
    //   Java source line #131	-> byte code offset #351
    //   Java source line #132	-> byte code offset #363
    //   Java source line #133	-> byte code offset #374
    //   Java source line #132	-> byte code offset #380
    //   Java source line #136	-> byte code offset #384
    //   Java source line #138	-> byte code offset #393
    //   Java source line #140	-> byte code offset #408
    //   Java source line #142	-> byte code offset #417
    //   Java source line #143	-> byte code offset #443
    //   Java source line #142	-> byte code offset #469
    //   Java source line #145	-> byte code offset #479
    //   Java source line #147	-> byte code offset #493
    //   Java source line #152	-> byte code offset #517
    //   Java source line #153	-> byte code offset #533
    //   Java source line #154	-> byte code offset #536
    //   Java source line #155	-> byte code offset #537
    //   Java source line #185	-> byte code offset #546
    //   Java source line #208	-> byte code offset #554
    //   Java source line #156	-> byte code offset #560
    //   Java source line #160	-> byte code offset #561
    //   Java source line #161	-> byte code offset #569
    //   Java source line #163	-> byte code offset #587
    //   Java source line #164	-> byte code offset #598
    //   Java source line #165	-> byte code offset #600
    //   Java source line #166	-> byte code offset #607
    //   Java source line #167	-> byte code offset #615
    //   Java source line #185	-> byte code offset #622
    //   Java source line #208	-> byte code offset #630
    //   Java source line #168	-> byte code offset #636
    //   Java source line #171	-> byte code offset #637
    //   Java source line #172	-> byte code offset #645
    //   Java source line #174	-> byte code offset #658
    //   Java source line #175	-> byte code offset #665
    //   Java source line #174	-> byte code offset #670
    //   Java source line #178	-> byte code offset #675
    //   Java source line #179	-> byte code offset #683
    //   Java source line #180	-> byte code offset #684
    //   Java source line #185	-> byte code offset #691
    //   Java source line #208	-> byte code offset #699
    //   Java source line #181	-> byte code offset #705
    //   Java source line #147	-> byte code offset #706
    //   Java source line #184	-> byte code offset #719
    //   Java source line #185	-> byte code offset #721
    //   Java source line #186	-> byte code offset #729
    //   Java source line #185	-> byte code offset #732
    //   Java source line #189	-> byte code offset #740
    //   Java source line #190	-> byte code offset #753
    //   Java source line #189	-> byte code offset #760
    //   Java source line #191	-> byte code offset #763
    //   Java source line #192	-> byte code offset #772
    //   Java source line #194	-> byte code offset #787
    //   Java source line #195	-> byte code offset #799
    //   Java source line #196	-> byte code offset #804
    //   Java source line #197	-> byte code offset #813
    //   Java source line #198	-> byte code offset #819
    //   Java source line #201	-> byte code offset #839
    //   Java source line #202	-> byte code offset #841
    //   Java source line #203	-> byte code offset #849
    //   Java source line #202	-> byte code offset #852
    //   Java source line #204	-> byte code offset #863
    //   Java source line #205	-> byte code offset #865
    //   Java source line #206	-> byte code offset #870
    //   Java source line #205	-> byte code offset #873
    //   Java source line #207	-> byte code offset #881
    //   Java source line #208	-> byte code offset #883
    //   Java source line #209	-> byte code offset #889
    //   Java source line #208	-> byte code offset #892
    //   Java source line #210	-> byte code offset #898
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	899	0	this	RemoteBundleDiscoveryStrategy
    //   0	899	1	monitor	IProgressMonitor
    //   133	2	2	registryCacheFolder	File
    //   172	580	2	registryCacheFolder	File
    //   149	16	3	e	IOException
    //   239	2	3	directory	Directory
    //   335	147	3	directory	Directory
    //   192	44	4	temp	Directory[]
    //   252	25	4	e	UnknownHostException
    //   285	17	4	e	IOException
    //   310	17	4	e	URISyntaxException
    //   391	377	4	bundleFileToDirectoryEntry	java.util.Map<File, Directory.Entry>
    //   205	10	5	uri	URI
    //   406	327	5	executorService	ExecutorService
    //   415	79	6	futures	java.util.List<java.util.concurrent.Future<DownloadBundleJob>>
    //   785	68	6	extensionRegistry	org.eclipse.core.runtime.IExtensionRegistry
    //   441	12	7	entry	Directory.Entry
    //   491	98	7	futureSize	int
    //   797	8	7	extensionPoint	org.eclipse.core.runtime.IExtensionPoint
    //   426	44	8	localIterator1	java.util.Iterator
    //   515	3	8	job	Object
    //   811	21	8	extensions	org.eclipse.core.runtime.IExtension[]
    //   500	207	9	localIterator2	java.util.Iterator
    //   839	11	9	localObject1	Object
    //   531	3	10	bundleJob	DownloadBundleJob
    //   561	16	10	bundleJob	DownloadBundleJob
    //   598	273	10	e	java.util.concurrent.ExecutionException
    //   605	64	11	cause	Throwable
    //   653	3	12	status	org.eclipse.core.runtime.IStatus
    //   673	3	12	status	org.eclipse.core.runtime.IStatus
    //   719	11	13	localObject2	Object
    //   881	9	14	localObject3	Object
    //   536	1	32	localTimeoutException	java.util.concurrent.TimeoutException
    //   683	1	33	localInterruptedException	InterruptedException
    // Exception table:
    //   from	to	target	type
    //   55	149	149	java/io/IOException
    //   188	252	252	java/net/UnknownHostException
    //   188	252	285	java/io/IOException
    //   188	252	310	java/net/URISyntaxException
    //   517	533	536	java/util/concurrent/TimeoutException
    //   517	546	598	java/util/concurrent/ExecutionException
    //   561	595	598	java/util/concurrent/ExecutionException
    //   517	546	683	java/lang/InterruptedException
    //   561	595	683	java/lang/InterruptedException
    //   408	546	719	finally
    //   561	622	719	finally
    //   637	691	719	finally
    //   706	719	719	finally
    //   787	839	839	finally
    //   740	863	863	finally
    //   55	181	881	finally
    //   188	344	881	finally
    //   351	554	881	finally
    //   561	630	881	finally
    //   637	699	881	finally
    //   706	881	881	finally
  }
  
  private class DownloadBundleJob
    implements Callable<DownloadBundleJob>
  {
    private final IProgressMonitor monitor;
    private final Directory.Entry entry;
    private File file;
    
    public DownloadBundleJob(Directory.Entry entry, IProgressMonitor monitor)
    {
      this.entry = entry;
      this.monitor = monitor;
    }
    
    public DownloadBundleJob call()
    {
      String bundleUrl = entry.getLocation();
      for (int attemptCount = 0; attemptCount < maxDiscoveryJarDownloadAttempts; attemptCount++)
      {
        try
        {
          if ((!bundleUrl.startsWith("http://")) && (!bundleUrl.startsWith("https://")))
          {
            StatusHandler.log(new Status(2, "org.eclipse.mylyn.discovery.core", NLS.bind(
              Messages.RemoteBundleDiscoveryStrategy_unrecognized_discovery_url, bundleUrl)));
          }
          else
          {
            String lastPathElement = bundleUrl.lastIndexOf('/') == -1 ? 
              bundleUrl : 
              bundleUrl.substring(bundleUrl.lastIndexOf('/'));
            File target = File.createTempFile(
              lastPathElement.replaceAll("^[a-zA-Z0-9_.]", "_") + "_", ".jar", temporaryStorage);
            if (monitor.isCanceled()) {
              break;
            }
            try
            {
              WebUtil.download(new URI(bundleUrl), target, new NullProgressMonitor()
              {
                public boolean isCanceled()
                {
                  return (super.isCanceled()) || (monitor.isCanceled());
                }
              });
            }
            catch (URISyntaxException localURISyntaxException) {}
            file = target;
          }
        }
        catch (IOException e)
        {
          StatusHandler.log(new Status(4, "org.eclipse.mylyn.discovery.core", NLS.bind(
            Messages.RemoteBundleDiscoveryStrategy_cannot_download_bundle, bundleUrl, e.getMessage()), 
            e));
          if (!RemoteBundleDiscoveryStrategy.this.isUnknownHostException(e)) {
            continue;
          }
        }
        break;
      }
      return this;
    }
  }
  
  private ExecutorService createExecutorService(int size)
  {
    return Executors.newFixedThreadPool(Math.min(size, 4));
  }
  
  private boolean isUnknownHostException(Throwable t)
  {
    while (t != null)
    {
      if ((t instanceof UnknownHostException)) {
        return true;
      }
      Throwable t2 = t.getCause();
      if (t2 == t) {
        break;
      }
      t = t2;
    }
    return false;
  }
  
  private void delete(File file)
  {
    if (file.exists())
    {
      if (file.isDirectory())
      {
        File[] children = file.listFiles();
        if (children != null)
        {
          File[] arrayOfFile1;
          int j = (arrayOfFile1 = children).length;
          for (int i = 0; i < j; i++)
          {
            File child = arrayOfFile1[i];
            delete(child);
          }
        }
      }
      file.delete();
    }
  }
  
  public void dispose()
  {
    super.dispose();
    if (temporaryStorage != null) {
      delete(temporaryStorage);
    }
  }
  
  public String getDirectoryUrl()
  {
    return directoryUrl;
  }
  
  public void setDirectoryUrl(String directoryUrl)
  {
    this.directoryUrl = directoryUrl;
  }
  
  protected AbstractDiscoverySource computeDiscoverySource(IContributor contributor)
  {
    Directory.Entry directoryEntry = registryStrategy.getDirectoryEntry(contributor);
    Policy policy = new Policy(directoryEntry.isPermitCategories());
    JarDiscoverySource discoverySource = new JarDiscoverySource(contributor.getName(), 
      registryStrategy.getJarFile(contributor));
    discoverySource.setPolicy(policy);
    return discoverySource;
  }
  
  public int getMaxDiscoveryJarDownloadAttempts()
  {
    return maxDiscoveryJarDownloadAttempts;
  }
  
  public void setMaxDiscoveryJarDownloadAttempts(int maxDiscoveryJarDownloadAttempts)
  {
    if ((maxDiscoveryJarDownloadAttempts < 1) || (maxDiscoveryJarDownloadAttempts > 2)) {
      throw new IllegalArgumentException();
    }
    this.maxDiscoveryJarDownloadAttempts = maxDiscoveryJarDownloadAttempts;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.mylyn.internal.discovery.core.model.RemoteBundleDiscoveryStrategy
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.mylyn.internal.discovery.core.model;

import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Dictionary;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.mylyn.internal.discovery.core.util.WebUtil;
import org.osgi.framework.Bundle;

public class DiscoveryFeedbackJob
  extends Job
{
  private final List<ConnectorDescriptor> descriptors;
  
  private static String toUrl(Map<String, String> p)
    throws UnsupportedEncodingException
  {
    StringBuilder sb = new StringBuilder();
    for (Map.Entry<String, String> entry : p.entrySet()) {
      if (entry.getValue() != null)
      {
        if (sb.length() > 0) {
          sb.append("&");
        }
        sb.append((String)entry.getKey());
        sb.append("=");
        sb.append(URLEncoder.encode((String)e
1 2 3 4 5

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