org.eclipse.equinox.p2.repository.tools_2.0.100.v20110815-1438

e:     org.eclipse.equinox.p2.internal.repository.tools.SlicingOptions
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import org.eclipse.equinox.p2.metadata.ICopyright;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class CopyrightAnalyzer
  extends IUAnalyzer
{
  public void analyzeIU(IInstallableUnit iu)
  {
    if (Boolean.valueOf(iu.getProperty("org.eclipse.equinox.p2.type.group")).booleanValue())
    {
      if ((iu.getCopyright() == null) || (iu.getCopyright().getBody().length() == 0))
      {
        error(iu, "[ERROR] " + iu.getId() + " has no copyright");
        return;
      }
      if ((iu.getCopyright() != null) && (iu.getCopyright().getBody().startsWith("%")))
      {
        String copyrightProperty = iu.getCopyright().getBody().substring(1);
        if (iu.getProperty("df_LT." + copyrightProperty) == null) {
          error(iu, "[ERROR] " + iu.getId() + " has no copyright");
        }
      }
    }
  }
  
  public void preAnalysis(IMetadataRepository repository) {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.CopyrightAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import java.util.Collection;
import java.util.Iterator;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.equinox.internal.p2.metadata.RequiredCapability;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class HostCheckAnalyzer
  extends IUAnalyzer
{
  private IMetadataRepository repository;
  
  public void analyzeIU(IInstallableUnit iu)
  {
    if ((iu instanceof IInstallableUnitFragment))
    {
      IInstallableUnitFragment fragment = (IInstallableUnitFragment)iu;
      Collection<IRequirement> hosts = fragment.getHost();
      for (Iterator localIterator = hosts.iterator(); localIterator.hasNext();)
      {
        IRequirement req = (IRequirement)localIterator.next();
        IMatchExpression<IInstallableUnit> hostMatch = req.getMatches();
        String namespace = RequiredCapability.extractNamespace(hostMatch);
        if ("osgi.bundle".equals(namespace))
        {
          String name = RequiredCapability.extractName(hostMatch);
          VersionRange range = RequiredCapability.extractRange(hostMatch);
          IQueryResult<IInstallableUnit> results = repository.query(QueryUtil.createIUQuery(name, range), new NullProgressMonitor());
          if (results.isEmpty())
          {
            error(iu, "IU Fragment: " + iu.getId() + " cannot find host" + name + " : " + range);
            return;
          }
        }
      }
    }
  }
  
  public void preAnalysis(IMetadataRepository repository)
  {
    this.repository = repository;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.HostCheckAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import java.io.PrintStream;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IIUAnalyzer;

public class IUCounting
  implements IIUAnalyzer
{
  int totalIUs = 0;
  int totalGroups = 0;
  int totalFragments = 0;
  int totalCategories = 0;
  
  private boolean hasProperty(IInstallableUnit iu, String property)
  {
    return Boolean.valueOf(iu.getProperty(property)).booleanValue();
  }
  
  public void analyzeIU(IInstallableUnit iu)
  {
    totalIUs += 1;
    if (hasProperty(iu, "org.eclipse.equinox.p2.type.fragment")) {
      totalFragments += 1;
    }
    if (hasProperty(iu, "org.eclipse.equinox.p2.type.group")) {
      totalGroups += 1;
    }
    if (hasProperty(iu, "org.eclipse.equinox.p2.type.category")) {
      totalCategories += 1;
    }
  }
  
  public IStatus postAnalysis()
  {
    System.out.println("Total IUs: " + totalIUs);
    System.out.println("  Total Groups: " + totalGroups);
    System.out.println("  Total Fragments: " + totalFragments);
    System.out.println("  Total Categories: " + totalCategories);
    return null;
  }
  
  public void preAnalysis(IMetadataRepository repo)
  {
    totalIUs = 0;
    totalGroups = 0;
    totalFragments = 0;
    totalCategories = 0;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.IUCounting
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import java.util.Collection;
import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.ILicense;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class LicenseAnalyzer
  extends IUAnalyzer
{
  public void analyzeIU(IInstallableUnit iu)
  {
    if (Boolean.valueOf(iu.getProperty("org.eclipse.equinox.p2.type.group")).booleanValue())
    {
      Collection<ILicense> licenses = iu.getLicenses();
      if ((iu.getLicenses() == null) || (licenses.size() == 0))
      {
        error(iu, "[ERROR] " + iu.getId() + " has no license");
        return;
      }
      if (((ILicense)licenses.iterator().next()).getBody().length() == 0)
      {
        error(iu, "[ERROR] " + iu.getId() + " has no license");
        return;
      }
      for (Iterator localIterator = licenses.iterator(); localIterator.hasNext();)
      {
        ILicense license = (ILicense)localIterator.next();
        if (license.getBody().startsWith("%"))
        {
          String licenseProperty = license.getBody().substring(1);
          if (iu.getProperty("df_LT." + licenseProperty) == null) {
            error(iu, "[ERROR] " + iu.getId() + " has no license");
          }
        }
      }
    }
  }
  
  public void preAnalysis(IMetadataRepository repository) {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.LicenseAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import java.util.HashSet;
import java.util.Set;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class UniqueIUAnalyzer
  extends IUAnalyzer
{
  Set<String> versionedNames = null;
  
  public void analyzeIU(IInstallableUnit iu)
  {
    String uniqueID = iu.getId() + ":" + iu.getVersion().toString();
    if (versionedNames.contains(uniqueID))
    {
      error(iu, "[ERROR]" + iu.getId() + " with version: " + iu.getVersion() + " already exists in the repository");
      return;
    }
    versionedNames.add(uniqueID);
  }
  
  public void preAnalysis(IMetadataRepository repo)
  {
    versionedNames = new HashSet();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.UniqueIUAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import java.util.Collection;
import java.util.Iterator;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.ITouchpointData;
import org.eclipse.equinox.p2.metadata.ITouchpointInstruction;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class UnzipFeatureJarAnalyzer
  extends IUAnalyzer
{
  public void analyzeIU(IInstallableUnit iu)
  {
    if (iu.getId().indexOf("feature.jar") > -1)
    {
      Collection<ITouchpointData> touchpointData = iu.getTouchpointData();
      if (touchpointData.size() == 0)
      {
        error(iu, "[ERROR] No unzip touchpoint for: " + iu.getId());
      }
      else
      {
        boolean found = false;
        for (Iterator localIterator = touchpointData.iterator(); localIterator.hasNext();)
        {
          ITouchpointData td = (ITouchpointData)localIterator.next();
          ITouchpointInstruction instruction = td.getInstruction("zipped");
          if (instruction.getBody().equals("true")) {
            found = true;
          }
        }
        if (!found) {
          error(iu, "[ERROR] No unzip touchpoint for: " + iu.getId());
        }
      }
    }
  }
  
  public void preAnalysis(IMetadataRepository repository) {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.UnzipFeatureJarAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.internal.repository.tools.analyzer;

import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer;

public class VersionAnalyzer
  extends IUAnalyzer
{
  public void analyzeIU(IInstallableUnit iu)
  {
    if (iu.getVersion().equals(org.eclipse.equinox.p2.metadata.Version.emptyVersion))
    {
      error(iu, "[ERROR] IU: " + iu.getId() + " has not replaced its qualifiier");
      return;
    }
    if (iu.getVersion().isOSGiCompatible())
    {
      String qualifier = toOSGiVersion(iu.getVersion()).getQualifier();
      if ((qualifier != null) && (qualifier.equals("qualifier")))
      {
        error(iu, "[ERROR] IU: " + iu.getId() + " has not replaced its qualifiier");
        return;
      }
    }
  }
  
  private static org.osgi.framework.Version toOSGiVersion(org.eclipse.equinox.p2.metadata.Version version)
  {
    if (version == null) {
      return null;
    }
    if (version == org.eclipse.equinox.p2.metadata.Version.emptyVersion) {
      return org.osgi.framework.Version.emptyVersion;
    }
    if (version == org.eclipse.equinox.p2.metadata.Version.MAX_VERSION) {
      return new org.osgi.framework.Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE);
    }
    return new org.osgi.framework.Version(version.toString());
  }
  
  public void preAnalysis(IMetadataRepository repo) {}
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.internal.repository.tools.analyzer.VersionAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.repository.tools.analyzer;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;

public abstract interface IIUAnalyzer
{
  public static final String ID = "org.eclipse.equinox.p2.repository.tools.verifier";
  
  public abstract void preAnalysis(IMetadataRepository paramIMetadataRepository);
  
  public abstract IStatus postAnalysis();
  
  public abstract void analyzeIU(IInstallableUnit paramIInstallableUnit);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.repository.tools.analyzer.IIUAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.repository.tools.analyzer;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;

public abstract class IUAnalyzer
  implements IIUAnalyzer
{
  private List<IStatus> errors = null;
  private String analyzerName;
  
  public void setName(String name)
  {
    analyzerName = name;
  }
  
  protected void error(IInstallableUnit iu, String error)
  {
    if (errors == null) {
      errors = new ArrayList();
    }
    errors.add(new Status(4, "org.eclipse.equinox.p2.transformer", error));
  }
  
  public IStatus postAnalysis()
  {
    if ((errors == null) || (errors.size() == 0)) {
      return Status.OK_STATUS;
    }
    return new MultiStatus("org.eclipse.equinox.p2.transformer", 4, (IStatus[])errors.toArray(new IStatus[errors.size()]), analyzerName, null);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.repository.tools.analyzer.IUAnalyzer
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.repository.tools.comparator;

import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.RegistryFactory;
import org.eclipse.equinox.internal.p2.artifact.repository.Messages;
import org.eclipse.osgi.util.NLS;

public class ArtifactComparatorFactory
{
  private static final String comparatorPoint = "org.eclipse.equinox.p2.artifact.repository.artifactComparators";
  private static final String ATTR_ID = "id";
  private static final String ATTR_CLASS = "class";
  
  public static IArtifactComparator getArtifactComparator(String comparatorID)
  {
    IConfigurationElement[] extensions = RegistryFactory.getRegistry().getConfigurationElementsFor("org.eclipse.equinox.p2.artifact.repository.artifactComparators");
    
    IConfigurationElement element = null;
    if ((comparatorID == null) && (extensions.length > 0)) {
      element = extensions[0];
    } else {
      for (int i = 0; i < extensions.length; i++) {
        if (extensions[i].getAttribute("id").equals(comparatorID))
        {
          element = extensions[i];
          break;
        }
      }
    }
    if (element != null) {
      try
      {
        Object execExt = element.createExecutableExtension("class");
        if ((execExt instanceof IArtifactComparator)) {
          return (IArtifactComparator)execExt;
        }
      }
      catch (Exception localException) {}
    }
    if (comparatorID != null) {
      throw new IllegalArgumentException(NLS.bind(Messages.exception_comparatorNotFound, comparatorID));
    }
    throw new IllegalArgumentException(Messages.exception_noComparators);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.repository.tools.comparator.ArtifactComparatorFactory
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.repository.tools.comparator;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;

public abstract interface IArtifactComparator
{
  public abstract IStatus compare(IArtifactRepository paramIArtifactRepository1, IArtifactDescriptor paramIArtifactDescriptor1, IArtifactRepository paramIArtifactRepository2, IArtifactDescriptor paramIArtifactDescriptor2);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.repository.tools.comparator.IArtifactComparator
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
1 2 3 4 5 6 7 8 9 10 11 12

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2019. Infinite Loop Ltd