core

16:34:56.981 INFO  jd.cli.Main - Decompiling core.jar
package org.netbeans.core.startup;

import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import org.openide.modules.Dependency;

abstract class AutomaticDependencies$Dep
{
  public final String toString()
  {
    return manifestKey() + ": " + toManifestForm();
  }
  
  public abstract String toManifestForm();
  
  public abstract String manifestKey();
  
  public abstract int type();
  
  public final Dependency createDependency()
  {
    return (Dependency)Dependency.create(type(), toManifestForm()).iterator().next();
  }
  
  public abstract Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString);
  
  public abstract void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet);
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Dep
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

final class AutomaticDependencies$Exclusion
{
  public String codenamebase;
  public boolean prefix;
  
  public String toString()
  {
    return "Exclusion[" + codenamebase + ",prefix=" + prefix + "]";
  }
  
  public boolean matches(String paramString)
  {
    return (paramString.equals(codenamebase)) || ((prefix) && (paramString.startsWith(codenamebase + ".")));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Exclusion
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.List;
import org.openide.modules.SpecificationVersion;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

final class AutomaticDependencies$Handler
{
  private AutomaticDependencies.TransformationGroup currentGroup = null;
  private AutomaticDependencies.Transformation currentTransformation = null;
  private boolean inTrigger = false;
  
  AutomaticDependencies$Handler(AutomaticDependencies paramAutomaticDependencies) {}
  
  public void start_trigger(Attributes paramAttributes)
    throws SAXException
  {
    inTrigger = true;
    currentTransformation.triggerType = paramAttributes.getValue("type");
  }
  
  public void end_trigger()
    throws SAXException
  {
    inTrigger = false;
  }
  
  public void start_transformation(Attributes paramAttributes)
    throws SAXException
  {
    currentTransformation = new AutomaticDependencies.Transformation();
  }
  
  public void end_transformation()
    throws SAXException
  {
    currentGroup.transformations.add(currentTransformation);
    currentTransformation = null;
  }
  
  private void handleDep(AutomaticDependencies.Dep paramDep)
    throws SAXException
  {
    if (inTrigger) {
      currentTransformation.trigger = paramDep;
    } else {
      currentTransformation.results.add(paramDep);
    }
  }
  
  public void handle_module_dependency(Attributes paramAttributes)
    throws SAXException
  {
    AutomaticDependencies.ModuleDep localModuleDep = new AutomaticDependencies.ModuleDep();
    String str1 = paramAttributes.getValue("major");
    if (str1 != null) {
      major = Integer.parseInt(str1);
    }
    codenamebase = paramAttributes.getValue("codenamebase");
    String str2 = paramAttributes.getValue("spec");
    spec = (str2 == null ? null : new SpecificationVersion(str2));
    handleDep(localModuleDep);
  }
  
  public void handle_token_dependency(Attributes paramAttributes)
    throws SAXException
  {
    AutomaticDependencies.TokenDep localTokenDep = new AutomaticDependencies.TokenDep();
    name = paramAttributes.getValue("name");
    handleDep(localTokenDep);
  }
  
  public void handle_package_dependency(Attributes paramAttributes)
    throws SAXException
  {
    AutomaticDependencies.PackageDep localPackageDep = new AutomaticDependencies.PackageDep();
    name = paramAttributes.getValue("name");
    bname = AutomaticDependencies.access$000(name);
    if ((inTrigger) && 
      (!name.equals(bname))) {
      throw new SAXException("Cannot use test class in trigger");
    }
    String str = paramAttributes.getValue("spec");
    spec = (str == null ? null : new SpecificationVersion(str));
    handleDep(localPackageDep);
  }
  
  public void start_transformationgroup(Attributes paramAttributes)
    throws SAXException
  {
    currentGroup = new AutomaticDependencies.TransformationGroup();
  }
  
  public void end_transformationgroup()
    throws SAXException
  {
    AutomaticDependencies.access$100(this$0).add(currentGroup);
    currentGroup = null;
  }
  
  public void start_result(Attributes paramAttributes)
    throws SAXException
  {}
  
  public void end_result()
    throws SAXException
  {}
  
  public void handle_exclusion(Attributes paramAttributes)
    throws SAXException
  {
    AutomaticDependencies.Exclusion localExclusion = new AutomaticDependencies.Exclusion();
    codenamebase = paramAttributes.getValue("codenamebase");
    prefix = Boolean.valueOf(paramAttributes.getValue("prefix")).booleanValue();
    currentGroup.exclusions.add(localExclusion);
  }
  
  public void handle_description(String paramString, Attributes paramAttributes)
    throws SAXException
  {
    currentGroup.description = paramString;
  }
  
  public void start_transformations(Attributes paramAttributes)
    throws SAXException
  {
    if (!"1.0".equals(paramAttributes.getValue("version"))) {
      throw new SAXException("Unsupported DTD");
    }
  }
  
  public void end_transformations()
    throws SAXException
  {}
  
  public void start_results(Attributes paramAttributes)
    throws SAXException
  {}
  
  public void end_results()
    throws SAXException
  {}
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Handler
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.Map;
import java.util.Set;
import org.openide.modules.Dependency;
import org.openide.modules.SpecificationVersion;

final class AutomaticDependencies$ModuleDep
  extends AutomaticDependencies.Dep
{
  public String codenamebase;
  public int major = -1;
  public SpecificationVersion spec = null;
  
  public String toManifestForm()
  {
    return codenamebase + (major == -1 ? "" : new StringBuilder().append("/").append(major).toString()) + (spec == null ? "" : new StringBuilder().append(" > ").append(spec).toString());
  }
  
  public String manifestKey()
  {
    return "OpenIDE-Module-Module-Dependencies";
  }
  
  public int type()
  {
    return 1;
  }
  
  public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
  {
    Dependency localDependency = (Dependency)paramMap1.get(codenamebase);
    if (localDependency == null) {
      return null;
    }
    if (paramString.equals("cancel")) {
      return localDependency;
    }
    if (paramString.equals("older")) {
      return older(localDependency) ? localDependency : null;
    }
    throw new IllegalArgumentException(paramString);
  }
  
  private boolean older(Dependency paramDependency)
  {
    if (paramDependency.getType() != 1) {
      throw new IllegalArgumentException();
    }
    if (paramDependency.getComparison() == 2) {
      return false;
    }
    Integer localInteger = (Integer)org.netbeans.Util.parseCodeName(paramDependency.getName())[1];
    int i = localInteger == null ? -1 : localInteger.intValue();
    if (i < major) {
      return true;
    }
    if (i > major) {
      return false;
    }
    if (spec == null) {
      return false;
    }
    String str = paramDependency.getVersion();
    if (str == null) {
      return true;
    }
    assert (paramDependency.getComparison() == 1) : paramDependency.getComparison();
    return new SpecificationVersion(str).compareTo(spec) < 0;
  }
  
  public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
  {
    Dependency localDependency1 = (Dependency)paramMap1.get(codenamebase);
    if ((localDependency1 != null) && (older(localDependency1)))
    {
      paramSet.remove(localDependency1);
      Dependency localDependency2 = createDependency();
      assert (!localDependency2.equals(localDependency1)) : ("older() claimed to be true on itself for " + localDependency1);
      paramSet.add(localDependency2);
    }
    else if (localDependency1 == null)
    {
      paramSet.add(createDependency());
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.ModuleDep
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.Map;
import java.util.Set;
import org.openide.modules.Dependency;
import org.openide.modules.SpecificationVersion;

final class AutomaticDependencies$PackageDep
  extends AutomaticDependencies.Dep
{
  public String name;
  public String bname;
  public SpecificationVersion spec = null;
  
  public String toManifestForm()
  {
    return name + (spec == null ? "" : new StringBuilder().append(" > ").append(spec).toString());
  }
  
  public String manifestKey()
  {
    return "OpenIDE-Module-Package-Dependencies";
  }
  
  public int type()
  {
    return 2;
  }
  
  private boolean older(Dependency paramDependency)
  {
    if (paramDependency.getType() != 2) {
      throw new IllegalArgumentException();
    }
    if (paramDependency.getComparison() == 2) {
      return false;
    }
    if (spec == null) {
      return false;
    }
    String str = paramDependency.getVersion();
    if (str == null) {
      return true;
    }
    assert (paramDependency.getComparison() == 1) : paramDependency.getComparison();
    return new SpecificationVersion(str).compareTo(spec) < 0;
  }
  
  public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
  {
    Dependency localDependency = (Dependency)paramMap3.get(bname);
    if (localDependency == null) {
      return null;
    }
    if (paramString.equals("cancel")) {
      return localDependency;
    }
    if (paramString.equals("older"))
    {
      if (spec == null) {
        throw new IllegalStateException();
      }
      return older(localDependency) ? localDependency : null;
    }
    throw new IllegalStateException(paramString);
  }
  
  public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
  {
    Dependency localDependency = (Dependency)paramMap3.get(bname);
    if ((localDependency != null) && (older(localDependency)))
    {
      paramSet.remove(localDependency);
      paramSet.add(createDependency());
    }
    else if (localDependency == null)
    {
      paramSet.add(createDependency());
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.PackageDep
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.Stack;
import org.openide.xml.XMLUtil;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;

final class AutomaticDependencies$Parser
  implements ContentHandler, ErrorHandler, EntityResolver
{
  private StringBuffer buffer;
  private AutomaticDependencies.Handler handler;
  private Stack<Object[]> context;
  
  public AutomaticDependencies$Parser(AutomaticDependencies.Handler paramHandler)
  {
    handler = paramHandler;
    buffer = new StringBuffer(111);
    context = new Stack();
  }
  
  public final void setDocumentLocator(Locator paramLocator) {}
  
  public final void startDocument()
    throws SAXException
  {}
  
  public final void endDocument()
    throws SAXException
  {}
  
  public final void startElement(String paramString1, String paramString2, String paramString3, Attributes paramAttributes)
    throws SAXException
  {
    dispatch(true);
    context.push(new Object[] { paramString3, new AttributesImpl(paramAttributes) });
    if ("trigger-dependency".equals(paramString3)) {
      handler.start_trigger(paramAttributes);
    } else if ("transformation".equals(paramString3)) {
      handler.start_transformation(paramAttributes);
    } else if ("module-dependency".equals(paramString3)) {
      handler.handle_module_dependency(paramAttributes);
    } else if ("transformationgroup".equals(paramString3)) {
      handler.start_transformationgroup(paramAttributes);
    } else if ("result".equals(paramString3)) {
      handler.start_result(paramAttributes);
    } else if ("exclusion".equals(paramString3)) {
      handler.handle_exclusion(paramAttributes);
    } else if ("token-dependency".equals(paramString3)) {
      handler.handle_token_dependency(paramAttributes);
    } else if ("package-dependency".equals(paramString3)) {
      handler.handle_package_dependency(paramAttributes);
    } else if ("transformations".equals(paramString3)) {
      handler.start_transformations(paramAttributes);
    } else if ("implies".equals(paramString3)) {
      handler.start_results(paramAttributes);
    }
  }
  
  public final void endElement(String paramString1, String paramString2, String paramString3)
    throws SAXException
  {
    dispatch(false);
    context.pop();
    if ("trigger-dependency".equals(paramString3)) {
      handler.end_trigger();
    } else if ("transformation".equals(paramString3)) {
      handler.end_transformation();
    } else if ("transformationgroup".equals(paramString3)) {
      handler.end_transformationgroup();
    } else if ("result".equals(paramString3)) {
      handler.end_result();
    } else if ("transformations".equals(paramString3)) {
      handler.end_transformations();
    } else if ("implies".equals(paramString3)) {
      handler.end_results();
    }
  }
  
  public final void characters(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {
    buffer.append(paramArrayOfChar, paramInt1, paramInt2);
  }
  
  public final void ignorableWhitespace(char[] paramArrayOfChar, int paramInt1, int paramInt2)
    throws SAXException
  {}
  
  public final void processingInstruction(String paramString1, String paramString2)
    throws SAXException
  {}
  
  public final void startPrefixMapping(String paramString1, String paramString2)
    throws SAXException
  {}
  
  public final void endPrefixMapping(String paramString)
    throws SAXException
  {}
  
  public final void skippedEntity(String paramString)
    throws SAXException
  {}
  
  private void dispatch(boolean paramBoolean)
    throws SAXException
  {
    if ((paramBoolean) && (buffer.length() == 0)) {
      return;
    }
    Object[] arrayOfObject = (Object[])context.peek();
    String str = (String)arrayOfObject[0];
    Attributes localAttributes = (Attributes)arrayOfObject[1];
    if ("description".equals(str))
    {
      if (paramBoolean) {
        throw new IllegalStateException("Unexpected characters() event! (Missing DTD?)");
      }
      handler.handle_description(buffer.length() == 0 ? null : buffer.toString(), localAttributes);
    }
    buffer.delete(0, buffer.length());
  }
  
  public void parse(InputSource paramInputSource)
    throws SAXException, IOException
  {
    XMLReader localXMLReader = XMLUtil.createXMLReader(false, false);
    localXMLReader.setContentHandler(this);
    localXMLReader.setErrorHandler(this);
    localXMLReader.setEntityResolver(this);
    localXMLReader.parse(paramInputSource);
  }
  
  public void error(SAXParseException paramSAXParseException)
    throws SAXException
  {
    throw paramSAXParseException;
  }
  
  public void fatalError(SAXParseException paramSAXParseException)
    throws SAXException
  {
    throw paramSAXParseException;
  }
  
  public void warning(SAXParseException paramSAXParseException)
    throws SAXException
  {}
  
  public InputSource resolveEntity(String paramString1, String paramString2)
    throws SAXException, IOException
  {
    return new InputSource(new ByteArrayInputStream(new byte[0]));
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Parser
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.Set;
import org.openide.modules.Dependency;

public final class AutomaticDependencies$Report
{
  private final String cnb;
  private final Set<Dependency> added;
  private final Set<Dependency> removed;
  private final Set<String> messages;
  
  AutomaticDependencies$Report(String paramString, Set<Dependency> paramSet1, Set<Dependency> paramSet2, Set<String> paramSet)
  {
    cnb = paramString;
    added = paramSet1;
    removed = paramSet2;
    messages = paramSet;
  }
  
  public Set<Dependency> getAdded()
  {
    return added;
  }
  
  public Set<Dependency> getRemoved()
  {
    return removed;
  }
  
  public Set<String> getMessages()
  {
    return messages;
  }
  
  public boolean isModified()
  {
    return (!added.isEmpty()) || (!removed.isEmpty());
  }
  
  public String toString()
  {
    return "had to upgrade dependencies for module " + cnb + ": added = " + getAdded() + " removed = " + getRemoved() + "; details: " + getMessages();
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Report
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.Map;
import java.util.Set;
import org.openide.modules.Dependency;

final class AutomaticDependencies$TokenDep
  extends AutomaticDependencies.Dep
{
  public String name;
  
  public String toManifestForm()
  {
    return name;
  }
  
  public String manifestKey()
  {
    return "OpenIDE-Module-Requires";
  }
  
  public int type()
  {
    return 5;
  }
  
  public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
  {
    Dependency localDependency = (Dependency)paramMap2.get(name);
    if (localDependency == null) {
      return null;
    }
    if (paramString.equals("cancel")) {
      return localDependency;
    }
    throw new IllegalStateException(paramString);
  }
  
  public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
  {
    if (paramMap2.get(name) == null) {
      paramSet.add(createDependency());
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.TokenDep
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.openide.modules.Dependency;

final class AutomaticDependencies$Transformation
{
  public AutomaticDependencies.Dep trigger;
  public String triggerType;
  public final List<AutomaticDependencies.Dep> results = new ArrayList();
  
  public String toString()
  {
    return "Transformation[trigger=" + trigger + ",triggerType=" + triggerType + ",results=" + results + "]";
  }
  
  public void apply(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
  {
    Dependency localDependency = trigger.applies(paramMap1, paramMap2, paramMap3, paramSet, triggerType);
    if (localDependency != null)
    {
      if (triggerType.equals("cancel")) {
        paramSet.remove(localDependency);
      } else if (!triggerType.equals("older")) {
        throw new IllegalStateException(triggerType);
      }
      Iterator localIterator = results.iterator();
      while (localIterator.hasNext())
      {
        AutomaticDependencies.Dep localDep = (AutomaticDependencies.Dep)localIterator.next();
        localDep.update(paramMap1, paramMap2, paramMap3, paramSet);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.Transformation
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

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

final class AutomaticDependencies$TransformationGroup
{
  public String description;
  public final List<AutomaticDependencies.Exclusion> exclusions = new ArrayList();
  public final List<AutomaticDependencies.Transformation> transformations = new ArrayList();
  
  public String toString()
  {
    return "TransformationGroup[" + exclusions + "," + transformations + "]";
  }
  
  public boolean isExcluded(String paramString)
  {
    Iterator localIterator = exclusions.iterator();
    while (localIterator.hasNext()) {
      if (((AutomaticDependencies.Exclusion)localIterator.next()).matches(paramString)) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.netbeans.core.startup.AutomaticDependencies.TransformationGroup
 * Java Class Version: 6 (50.0)
 * JD-Core Version:    0.7.1
 */
package org.netbeans.core.startup;

import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.net.URL;
import java.util.ArrayList;
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.Set;
import java.util.Stack;
import java.util.TreeSet;
import org.openide.modules.Dependency;
import org.openide.modules.SpecificationVersion;
import org.openide.xml.XMLUtil;
import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler;
import org.xml.sax.EntityResolver;
import org.xml.sax.ErrorHandler;
import org.xml.sax.InputSource;
import org.xml.sax.Locator;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.AttributesImpl;

public final class AutomaticDependencies
{
  public static AutomaticDependencies empty()
  {
    return new AutomaticDependencies();
  }
  
  public static AutomaticDependencies parse(URL[] paramArrayOfURL)
    throws SAXException, IOException
  {
    AutomaticDependencies localAutomaticDependencies = new AutomaticDependencies(); AutomaticDependencies 
      tmp17_16 = localAutomaticDependencies;tmp17_16.getClass();Parser localParser = new Parser(new Handler(tmp17_16));
    for (URL localURL : paramArrayOfURL)
    {
      String str = localURL.toExternalForm();
      BufferedInputStream localBufferedInputStream = null;
      try
      {
        InputSource localInputSource = new InputSource(str);
        localBufferedInputStream = new BufferedInputStream(localURL.openStream());
        localInputSource.setByteStream(localBufferedInputStream);
        localParser.parse(localInputSource);
      }
      catch (SAXException localSAXException)
      {
        throw new SAXException("While parsing: " + str, localSAXException);
      }
      catch (IOException localIOException1)
      {
        IOException localIOException2 = new IOException("While parsing: " + str);
        localIOException2.initCause(localIOException1);
        throw localIOException2;
      }
      finally
      {
        if (localBufferedInputStream != null) {
          localBufferedInputStream.close();
        }
      }
    }
    return localAutomaticDependencies;
  }
  
  public static void main(String[] paramArrayOfString)
    throws Exception
  {
    URL[] arrayOfURL = new URL[paramArrayOfString.length];
    for (int i = 0; i < paramArrayOfString.length; i++) {
      arrayOfURL[i] = new URL(paramArrayOfString[i]);
    }
    parse(arrayOfURL);
    long l1 = System.currentTimeMillis();
    System.out.println(parse(arrayOfURL));
    long l2 = System.currentTimeMillis() - l1;
    System.out.println("Time taken: " + l2 + " msec");
  }
  
  public static final class Report
  {
    private final String cnb;
    private final Set<Dependency> added;
    private final Set<Dependency> removed;
    private final Set<String> messages;
    
    Report(String paramString, Set<Dependency> paramSet1, Set<Dependency> paramSet2, Set<String> paramSet)
    {
      cnb = paramString;
      added = paramSet1;
      removed = paramSet2;
      messages = paramSet;
    }
    
    public Set<Dependency> getAdded()
    {
      return added;
    }
    
    public Set<Dependency> getRemoved()
    {
      return removed;
    }
    
    public Set<String> getMessages()
    {
      return messages;
    }
    
    public boolean isModified()
    {
      return (!added.isEmpty()) || (!removed.isEmpty());
    }
    
    public String toString()
    {
      return "had to upgrade dependencies for module " + cnb + ": added = " + getAdded() + " removed = " + getRemoved() + "; details: " + getMessages();
    }
  }
  
  public Report refineDependenciesAndReport(String paramString, Set<Dependency> paramSet)
  {
    HashSet localHashSet = new HashSet(paramSet);
    
    HashMap localHashMap1 = new HashMap();
    HashMap localHashMap2 = new HashMap();
    HashMap localHashMap3 = new HashMap();
    for (Object localObject1 = paramSet.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (Dependency)((Iterator)localObject1).next();
      switch (((Dependency)localObject2).getType())
      {
      case 1: 
        localObject3 = (String)org.netbeans.Util.parseCodeName(localObject2.getName())[0];
        localHashMap1.put(localObject3, localObject2);
        break;
      case 2: 
        localObject4 = packageBaseName(((Dependency)localObject2).getName());
        localHashMap3.put(localObject4, localObject2);
        break;
      case 5: 
      case 6: 
      case 7: 
        localHashMap2.put(((Dependency)localObject2).getName(), localObject2);
        break;
      case 3: 
        break;
      case 4: 
      default: 
        throw new IllegalStateException(((Dependency)localObject2).toString());
      }
    }
    Object localObject3;
    Object localObject4;
    localObject1 = new TreeSet();
    for (Object localObject2 = groups.iterator(); ((Iterator)localObject2).hasNext();)
    {
      localObject3 = (TransformationGroup)((Iterator)localObject2).next();
      if (!((TransformationGroup)localObject3).isExcluded(paramString))
      {
        localObject4 = new HashSet(paramSet);
        for (Transformation localTransformation : transformations) {
          localTransformation.apply(localHashMap1, localHashMap2, localHashMap3, paramSet);
        }
        if (!localObject4.equals(paramSet)) {
          ((Set)localObject1).add(description);
        }
      }
    }
    if (!localHashSet.equals(paramSet))
    {
      assert (!((Set)localObject1).isEmpty());
      localObject2 = new HashSet(paramSet);
      ((Set)localObject2).removeAll(localHashSet);
      localHashSet.removeAll(paramSet);
      return new Report(paramString, (Set)localObject2, localHashSet, (Set)localObject1);
    }
    assert (((Set)localObject1).isEmpty());
    return new Report(paramString, Collections.emptySet(), Collections.emptySet(), Collections.emptySet());
  }
  
  public void refineDependencies(String paramString, Set<Dependency> paramSet)
  {
    refineDependenciesAndReport(paramString, paramSet);
  }
  
  public String refineDependenciesSimple(String paramString, Set<String> paramSet)
  {
    HashSet localHashSet = new HashSet();
    for (Object localObject1 = paramSet.iterator(); ((Iterator)localObject1).hasNext();)
    {
      localObject2 = (String)((Iterator)localObject1).next();
      localHashSet.addAll(Dependency.create(1, (String)localObject2));
    }
    Object localObject2;
    localObject1 = refineDependenciesAndReport(paramString, localHashSet);
    if (((Report)localObject1).isModified())
    {
      paramSet.clear();
      for (localObject2 = localHashSet.iterator(); ((Iterator)localObject2).hasNext();)
      {
        Dependency localDependency = (Dependency)((Iterator)localObject2).next();
        paramSet.add(localDependency.toString().replaceFirst("^module ", ""));
      }
      return ((Report)localObject1).toString();
    }
    return null;
  }
  
  private final List<TransformationGroup> groups = new ArrayList();
  
  public String toString()
  {
    return "AutomaticDependencies[" + groups + "]";
  }
  
  private static final class Exclusion
  {
    public String codenamebase;
    public boolean prefix;
    
    public String toString()
    {
      return "Exclusion[" + codenamebase + ",prefix=" + prefix + "]";
    }
    
    public boolean matches(String paramString)
    {
      return (paramString.equals(codenamebase)) || ((prefix) && (paramString.startsWith(codenamebase + ".")));
    }
  }
  
  private static final class TransformationGroup
  {
    public String description;
    public final List<AutomaticDependencies.Exclusion> exclusions = new ArrayList();
    public final List<AutomaticDependencies.Transformation> transformations = new ArrayList();
    
    public String toString()
    {
      return "TransformationGroup[" + exclusions + "," + transformations + "]";
    }
    
    public boolean isExcluded(String paramString)
    {
      Iterator localIterator = exclusions.iterator();
      while (localIterator.hasNext()) {
        if (((AutomaticDependencies.Exclusion)localIterator.next()).matches(paramString)) {
          return true;
        }
      }
      return false;
    }
  }
  
  private static final class Transformation
  {
    public AutomaticDependencies.Dep trigger;
    public String triggerType;
    public final List<AutomaticDependencies.Dep> results = new ArrayList();
    
    public String toString()
    {
      return "Transformation[trigger=" + trigger + ",triggerType=" + triggerType + ",results=" + results + "]";
    }
    
    public void apply(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
    {
      Dependency localDependency = trigger.applies(paramMap1, paramMap2, paramMap3, paramSet, triggerType);
      if (localDependency != null)
      {
        if (triggerType.equals("cancel")) {
          paramSet.remove(localDependency);
        } else if (!triggerType.equals("older")) {
          throw new IllegalStateException(triggerType);
        }
        Iterator localIterator = results.iterator();
        while (localIterator.hasNext())
        {
          AutomaticDependencies.Dep localDep = (AutomaticDependencies.Dep)localIterator.next();
          localDep.update(paramMap1, paramMap2, paramMap3, paramSet);
        }
      }
    }
  }
  
  private static abstract class Dep
  {
    public final String toString()
    {
      return manifestKey() + ": " + toManifestForm();
    }
    
    public abstract String toManifestForm();
    
    public abstract String manifestKey();
    
    public abstract int type();
    
    public final Dependency createDependency()
    {
      return (Dependency)Dependency.create(type(), toManifestForm()).iterator().next();
    }
    
    public abstract Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString);
    
    public abstract void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet);
  }
  
  private static final class ModuleDep
    extends AutomaticDependencies.Dep
  {
    public String codenamebase;
    public int major = -1;
    public SpecificationVersion spec = null;
    
    public String toManifestForm()
    {
      return codenamebase + (major == -1 ? "" : new StringBuilder().append("/").append(major).toString()) + (spec == null ? "" : new StringBuilder().append(" > ").append(spec).toString());
    }
    
    public String manifestKey()
    {
      return "OpenIDE-Module-Module-Dependencies";
    }
    
    public int type()
    {
      return 1;
    }
    
    public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
    {
      Dependency localDependency = (Dependency)paramMap1.get(codenamebase);
      if (localDependency == null) {
        return null;
      }
      if (paramString.equals("cancel")) {
        return localDependency;
      }
      if (paramString.equals("older")) {
        return older(localDependency) ? localDependency : null;
      }
      throw new IllegalArgumentException(paramString);
    }
    
    private boolean older(Dependency paramDependency)
    {
      if (paramDependency.getType() != 1) {
        throw new IllegalArgumentException();
      }
      if (paramDependency.getComparison() == 2) {
        return false;
      }
      Integer localInteger = (Integer)org.netbeans.Util.parseCodeName(paramDependency.getName())[1];
      int i = localInteger == null ? -1 : localInteger.intValue();
      if (i < major) {
        return true;
      }
      if (i > major) {
        return false;
      }
      if (spec == null) {
        return false;
      }
      String str = paramDependency.getVersion();
      if (str == null) {
        return true;
      }
      assert (paramDependency.getComparison() == 1) : paramDependency.getComparison();
      return new SpecificationVersion(str).compareTo(spec) < 0;
    }
    
    public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
    {
      Dependency localDependency1 = (Dependency)paramMap1.get(codenamebase);
      if ((localDependency1 != null) && (older(localDependency1)))
      {
        paramSet.remove(localDependency1);
        Dependency localDependency2 = createDependency();
        assert (!localDependency2.equals(localDependency1)) : ("older() claimed to be true on itself for " + localDependency1);
        paramSet.add(localDependency2);
      }
      else if (localDependency1 == null)
      {
        paramSet.add(createDependency());
      }
    }
  }
  
  private static String packageBaseName(String paramString)
  {
    int i = paramString.indexOf('[');
    if (i == -1) {
      return paramString;
    }
    if (i > 0) {
      return paramString.substring(0, i);
    }
    int j = paramString.lastIndexOf('.');
    return paramString.substring(1, j);
  }
  
  private static final class PackageDep
    extends AutomaticDependencies.Dep
  {
    public String name;
    public String bname;
    public SpecificationVersion spec = null;
    
    public String toManifestForm()
    {
      return name + (spec == null ? "" : new StringBuilder().append(" > ").append(spec).toString());
    }
    
    public String manifestKey()
    {
      return "OpenIDE-Module-Package-Dependencies";
    }
    
    public int type()
    {
      return 2;
    }
    
    private boolean older(Dependency paramDependency)
    {
      if (paramDependency.getType() != 2) {
        throw new IllegalArgumentException();
      }
      if (paramDependency.getComparison() == 2) {
        return false;
      }
      if (spec == null) {
        return false;
      }
      String str = paramDependency.getVersion();
      if (str == null) {
        return true;
      }
      assert (paramDependency.getComparison() == 1) : paramDependency.getComparison();
      return new SpecificationVersion(str).compareTo(spec) < 0;
    }
    
    public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
    {
      Dependency localDependency = (Dependency)paramMap3.get(bname);
      if (localDependency == null) {
        return null;
      }
      if (paramString.equals("cancel")) {
        return localDependency;
      }
      if (paramString.equals("older"))
      {
        if (spec == null) {
          throw new IllegalStateException();
        }
        return older(localDependency) ? localDependency : null;
      }
      throw new IllegalStateException(paramString);
    }
    
    public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
    {
      Dependency localDependency = (Dependency)paramMap3.get(bname);
      if ((localDependency != null) && (older(localDependency)))
      {
        paramSet.remove(localDependency);
        paramSet.add(createDependency());
      }
      else if (localDependency == null)
      {
        paramSet.add(createDependency());
      }
    }
  }
  
  private static final class TokenDep
    extends AutomaticDependencies.Dep
  {
    public String name;
    
    public String toManifestForm()
    {
      return name;
    }
    
    public String manifestKey()
    {
      return "OpenIDE-Module-Requires";
    }
    
    public int type()
    {
      return 5;
    }
    
    public Dependency applies(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet, String paramString)
    {
      Dependency localDependency = (Dependency)paramMap2.get(name);
      if (localDependency == null) {
        return null;
      }
      if (paramString.equals("cancel")) {
        return localDependency;
      }
      throw new IllegalStateException(paramString);
    }
    
    public void update(Map<String, Dependency> paramMap1, Map<String, Dependency> paramMap2, Map<String, Dependency> paramMap3, Set<Dependency> paramSet)
    {
      if (paramMap2.get(name) == null) {
        paramSet.add(createDependency());
      }
    }
  }
  
  private final class Handler
  {
    private AutomaticDependencies.TransformationGroup currentGroup = null;
    private AutomaticDependencies.Transformation currentTransformation = null;
    private boolean inTrigger = false;
    
    Handler() {}
    
    public void start_trigger(Attributes paramAttributes)
      throws SAXException
    {
      inTrigger = true;
      currentTransformation.triggerType = paramAttributes.getValue("type");
    }
    
    public void end_trigger()
      throws SAXException
    {
      inTrigger = false;
    }
    
    public void start_transformation(Attributes paramAttributes)
      throws SAXException
    {
      currentTransformation = new AutomaticDependencies.Transformation();
    }
    
    public void end_transformation()
      throws SAXException
    {
      currentGroup.transformations.add(currentTransformation);
      currentTransformation = null;
    }
    
    private void handleDep(AutomaticDependencies.Dep paramDep)
      throws SAXException
    {
      if (inTrigger) {
        currentTransformation.trigger = paramDep;
      } else {
        currentTransformation.results.add(paramDep);
      }
    }
    
    public void handle_module_dependency(Attributes paramAttributes)
      throws SAXException
    {
      AutomaticDependencies.ModuleDep localModuleDep = new AutomaticDependencies.ModuleDep();
      String str1 = paramAttributes.getValue("major");
      if (str1 != null) {
        major = Integer.parseInt(str1);
      }
      codenamebase = paramAttributes.getValue("codenamebase");
      String str2 = paramAttributes.getValue("spec");
      spec = (s
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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