org.eclipse.equinox.p2.publisher_1.2.0.v20121002-080415

      licenses.add(license);
    }
    catch (URISyntaxException localURISyntaxException)
    {
      throw new IllegalStateException("bad license URI at token: " + current + ", " + currentValue());
    }
  }
  
  private void parseArtifacts(String prefix, List<IArtifactKey> artifacts)
  {
    while ((current != null) && (current.startsWith(prefix)))
    {
      int dotIndex = current.indexOf('.', prefix.length());
      if (dotIndex == -1) {
        throw new IllegalStateException("bad token: " + current + " = " + currentValue());
      }
      parseArtifact(current.substring(0, dotIndex + 1), artifacts);
    }
  }
  
  private void parseArtifact(String prefix, List<IArtifactKey> artifacts)
  {
    String artifactClassifier = null;
    String artifactId = null;
    org.eclipse.equinox.p2.metadata.Version artifactVersion = null;
    while ((current != null) && (current.startsWith(prefix)))
    {
      String token = current.substring(prefix.length());
      if (token.equals("classifier")) {
        artifactClassifier = currentValue();
      } else if (token.equals("id")) {
        artifactId = currentValue();
      } else if (token.equals("version")) {
        artifactVersion = org.eclipse.equinox.p2.metadata.Version.parseVersion(substituteVersionAndQualifier(currentValue()));
      }
      next();
    }
    IArtifactKey artifactKey = new ArtifactKey(artifactClassifier, artifactId, artifactVersion);
    artifacts.add(artifactKey);
  }
  
  private String substituteVersionAndQualifier(String version)
  {
    if (version.indexOf("$version$") != -1) {
      version = replace(version, "$version$", hostVersion.toString());
    }
    if (version.indexOf("$qualifier$") != -1) {
      try
      {
        String qualifier = PublisherHelper.toOSGiVersion(hostVersion).getQualifier();
        if (qualifier == null) {
          qualifier = "";
        }
        if (qualifier.length() == 0) {
          version = replace(version, ".$qualifier$", "");
        }
        version = replace(version, "$qualifier$", qualifier);
      }
      catch (UnsupportedOperationException localUnsupportedOperationException) {}
    }
    return version;
  }
  
  public static String replace(String source, String from, String to)
  {
    if (from.length() == 0) {
      return source;
    }
    StringBuffer buffer = new StringBuffer();
    int current = 0;
    int pos = 0;
    while (pos != -1)
    {
      pos = source.indexOf(from, current);
      if (pos == -1)
      {
        buffer.append(source.substring(current));
      }
      else
      {
        buffer.append(source.substring(current, pos));
        buffer.append(to);
        current = pos + from.length();
      }
    }
    return buffer.toString();
  }
  
  public Map<String, String> getProperties()
  {
    if (adviceProperties.isEmpty()) {
      return null;
    }
    return adviceProperties;
  }
  
  public IRequirement[] getRequiredCapabilities()
  {
    if (adviceRequires.isEmpty()) {
      return null;
    }
    return (IRequirement[])adviceRequires.toArray(new IRequirement[adviceRequires.size()]);
  }
  
  public IProvidedCapability[] getProvidedCapabilities()
  {
    if (adviceProvides.isEmpty()) {
      return null;
    }
    return (IProvidedCapability[])adviceProvides.toArray(new IProvidedCapability[adviceProvides.size()]);
  }
  
  public IUpdateDescriptor getUpdateDescriptor()
  {
    return adviceUpdateDescriptor;
  }
  
  public Map<String, ITouchpointInstruction> getTouchpointInstructions()
  {
    if (adviceInstructions.isEmpty()) {
      return null;
    }
    return adviceInstructions;
  }
  
  public MetadataFactory.InstallableUnitDescription[] getAdditionalInstallableUnitDescriptions()
  {
    if (adviceOtherIUs.isEmpty()) {
      return null;
    }
    return (MetadataFactory.InstallableUnitDescription[])adviceOtherIUs.toArray(new MetadataFactory.InstallableUnitDescription[adviceOtherIUs.size()]);
  }
  
  public IRequirement[] getMetaRequiredCapabilities()
  {
    if (adviceMetaRequires.isEmpty()) {
      return null;
    }
    return (IRequirement[])adviceMetaRequires.toArray(new IRequirement[adviceMetaRequires.size()]);
  }
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;

public abstract interface IPublisherAction
{
  public abstract IStatus perform(IPublisherInfo paramIPublisherInfo, IPublisherResult paramIPublisherResult, IProgressMonitor paramIProgressMonitor);
}

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

import org.eclipse.equinox.p2.metadata.Version;

public abstract interface IPublisherAdvice
{
  public abstract boolean isApplicable(String paramString1, boolean paramBoolean, String paramString2, Version paramVersion);
}

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

import java.util.Collection;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;

public abstract interface IPublisherInfo
{
  public static final int A_INDEX = 1;
  public static final int A_PUBLISH = 2;
  public static final int A_OVERWRITE = 4;
  public static final int A_NO_MD5 = 8;
  
  public abstract IArtifactRepository getArtifactRepository();
  
  public abstract IMetadataRepository getMetadataRepository();
  
  public abstract int getArtifactOptions();
  
  public abstract <T extends IPublisherAdvice> Collection<T> getAdvice(String paramString1, boolean paramBoolean, String paramString2, Version paramVersion, Class<T> paramClass);
  
  public abstract void addAdvice(IPublisherAdvice paramIPublisherAdvice);
  
  public abstract String[] getConfigurations();
  
  public abstract IArtifactRepository getContextArtifactRepository();
  
  public abstract IMetadataRepository getContextMetadataRepository();
}

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

import java.util.Collection;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.query.IQueryable;

public abstract interface IPublisherResult
  extends IQueryable<IInstallableUnit>
{
  public static final int MERGE_MATCHING = 0;
  public static final int MERGE_ALL_ROOT = 1;
  public static final int MERGE_ALL_NON_ROOT = 2;
  public static final String ROOT = "root";
  public static final String NON_ROOT = "non_root";
  
  public abstract void addIU(IInstallableUnit paramIInstallableUnit, String paramString);
  
  public abstract void addIUs(Collection<IInstallableUnit> paramCollection, String paramString);
  
  public abstract Collection<IInstallableUnit> getIUs(String paramString1, String paramString2);
  
  /**
   * @deprecated
   */
  public abstract IInstallableUnit getIU(String paramString1, String paramString2);
  
  public abstract IInstallableUnit getIU(String paramString1, Version paramVersion, String paramString2);
  
  public abstract void merge(IPublisherResult paramIPublisherResult, int paramInt);
}

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

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.p2.repository.IRunnableWithProgress;

class Publisher$ArtifactProcess
  implements IRunnableWithProgress
{
  private final IPublisherAction[] actions;
  private final IPublisherInfo info;
  private IStatus result = null;
  final Publisher this$0;
  
  public Publisher$ArtifactProcess(Publisher paramPublisher, IPublisherAction[] actions, IPublisherInfo info)
  {
    this.info = info;
    this.actions = actions;
  }
  
  public void run(IProgressMonitor monitor)
  {
    MultiStatus finalStatus = new MultiStatus("this", 0, "publishing result", null);
    for (int i = 0; i < actions.length; i++)
    {
      if (monitor.isCanceled())
      {
        result = Status.CANCEL_STATUS;
        return;
      }
      IStatus status = actions[i].perform(info, Publisher.access$0(this$0), monitor);
      finalStatus.merge(status);
      monitor.worked(1);
    }
    result = finalStatus;
  }
  
  public IStatus getStatus()
  {
    return result;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.Publisher.ArtifactProcess
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher;

import java.net.URI;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.ProvisionException;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.repository.IRunnableWithProgress;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;

public class Publisher
{
  public static final String PUBLISH_PACK_FILES_AS_SIBLINGS = "publishPackFilesAsSiblings";
  private static final long SERVICE_TIMEOUT = 5000L;
  private IPublisherInfo info;
  private IPublisherResult results;
  
  public static IMetadataRepository createMetadataRepository(IProvisioningAgent agent, URI location, String name, boolean append, boolean compress)
    throws ProvisionException
  {
    try
    {
      IMetadataRepository result = loadMetadataRepository(agent, location, true, true);
      if ((result != null) && (result.isModifiable()))
      {
        result.setProperty("p2.compressed", compress ? "true" : "false");
        if (!append) {
          result.removeAll();
        }
        return result;
      }
    }
    catch (ProvisionException localProvisionException)
    {
      IMetadataRepositoryManager manager = (IMetadataRepositoryManager)getService(agent, IMetadataRepositoryManager.SERVICE_NAME);
      String repositoryName = name == null ? location + " - metadata" : name;
      IMetadataRepository result = manager.createRepository(location, repositoryName, "org.eclipse.equinox.p2.metadata.repository.simpleRepository", null);
      if (result != null)
      {
        manager.removeRepository(result.getLocation());
        result.setProperty("p2.compressed", compress ? "true" : "false");
        return result;
      }
      String msg = org.eclipse.equinox.internal.p2.metadata.repository.Messages.repoMan_internalError;
      throw new ProvisionException(new Status(4, Activator.ID, 1, msg, null));
    }
  }
  
  public static IMetadataRepository loadMetadataRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager)
    throws ProvisionException
  {
    IMetadataRepositoryManager manager = (IMetadataRepositoryManager)getService(agent, IMetadataRepositoryManager.SERVICE_NAME);
    boolean existing = manager.contains(location);
    
    IMetadataRepository result = manager.loadRepository(location, modifiable ? 1 : 0, null);
    if ((!existing) && (removeFromManager)) {
      manager.removeRepository(location);
    }
    return result;
  }
  
  public static IArtifactRepository createArtifactRepository(IProvisioningAgent agent, URI location, String name, boolean compress, boolean reusePackedFiles)
    throws ProvisionException
  {
    try
    {
      IArtifactRepository result = loadArtifactRepository(agent, location, true, true);
      if ((result != null) && (result.isModifiable()))
      {
        result.setProperty("p2.compressed", compress ? "true" : "false");
        if (reusePackedFiles) {
          result.setProperty("publishPackFilesAsSiblings", "true");
        }
        return result;
      }
    }
    catch (ProvisionException localProvisionException)
    {
      IArtifactRepositoryManager manager = (IArtifactRepositoryManager)getService(agent, IArtifactRepositoryManager.SERVICE_NAME);
      String repositoryName = location + " - artifacts";
      IArtifactRepository result = manager.createRepository(location, repositoryName, "org.eclipse.equinox.p2.artifact.repository.simpleRepository", null);
      if (result != null)
      {
        manager.removeRepository(result.getLocation());
        if (reusePackedFiles) {
          result.setProperty("publishPackFilesAsSiblings", "true");
        }
        result.setProperty("p2.compressed", compress ? "true" : "false");
        return result;
      }
      String msg = org.eclipse.equinox.internal.p2.artifact.repository.Messages.repoMan_internalError;
      throw new ProvisionException(new Status(4, Activator.ID, 1, msg, null));
    }
  }
  
  public static IArtifactRepository loadArtifactRepository(IProvisioningAgent agent, URI location, boolean modifiable, boolean removeFromManager)
    throws ProvisionException
  {
    IArtifactRepositoryManager manager = (IArtifactRepositoryManager)getService(agent, IArtifactRepositoryManager.SERVICE_NAME);
    boolean existing = manager.contains(location);
    
    IArtifactRepository result = manager.loadRepository(location, modifiable ? 1 : 0, null);
    if ((!existing) && (removeFromManager)) {
      manager.removeRepository(location);
    }
    return result;
  }
  
  public Publisher(IPublisherInfo info)
  {
    this.info = info;
    results = new PublisherResult();
  }
  
  protected static <T> T getService(IProvisioningAgent agent, String serviceName)
  {
    T service = agent.getService(serviceName);
    if (service != null) {
      return service;
    }
    long start = System.currentTimeMillis();
    do
    {
      try
      {
        Thread.sleep(100L);
      }
      catch (InterruptedException localInterruptedException) {}
      service = agent.getService(serviceName);
      if (service != null) {
        return service;
      }
    } while (System.currentTimeMillis() - start < 5000L);
    throw new IllegalStateException("Unable to obtain required service: " + serviceName);
  }
  
  public Publisher(IPublisherInfo info, IPublisherResult results)
  {
    this.info = info;
    this.results = results;
  }
  
  class ArtifactProcess
    implements IRunnableWithProgress
  {
    private final IPublisherAction[] actions;
    private final IPublisherInfo info;
    private IStatus result = null;
    
    public ArtifactProcess(IPublisherAction[] actions, IPublisherInfo info)
    {
      this.info = info;
      this.actions = actions;
    }
    
    public void run(IProgressMonitor monitor)
    {
      MultiStatus finalStatus = new MultiStatus("this", 0, "publishing result", null);
      for (int i = 0; i < actions.length; i++)
      {
        if (monitor.isCanceled())
        {
          result = Status.CANCEL_STATUS;
          return;
        }
        IStatus status = actions[i].perform(info, results, monitor);
        finalStatus.merge(status);
        monitor.worked(1);
      }
      result = finalStatus;
    }
    
    public IStatus getStatus()
    {
      return result;
    }
  }
  
  public IStatus publish(IPublisherAction[] actions, IProgressMonitor monitor)
  {
    if (monitor == null) {
      monitor = new NullProgressMonitor();
    }
    SubMonitor sub = SubMonitor.convert(monitor, actions.length);
    if (Tracing.DEBUG_PUBLISHING) {
      Tracing.debug("Invoking publisher");
    }
    try
    {
      ArtifactProcess artifactProcess = new ArtifactProcess(actions, info);
      
      IStatus finalStatus = null;
      if (info.getArtifactRepository() != null)
      {
        finalStatus = info.getArtifactRepository().executeBatch(artifactProcess, sub);
        if (!finalStatus.matches(12)) {
          finalStatus = artifactProcess.getStatus();
        }
      }
      else
      {
        artifactProcess.run(sub);
        finalStatus = artifactProcess.getStatus();
      }
      if (Tracing.DEBUG_PUBLISHING) {
        Tracing.debug("Publishing complete. Result=" + finalStatus);
      }
      if ((finalStatus.isOK()) || (finalStatus.matches(3))) {
        savePublishedIUs();
      }
      IStatus localIStatus1;
      if (!finalStatus.isOK()) {
        return finalStatus;
      }
      return Status.OK_STATUS;
    }
    finally
    {
      sub.done();
    }
  }
  
  protected void savePublishedIUs()
  {
    IMetadataRepository metadataRepository = info.getMetadataRepository();
    if (metadataRepository != null)
    {
      Collection<IInstallableUnit> ius = results.getIUs(null, null);
      metadataRepository.addInstallableUnits(ius);
    }
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;

public class PublisherInfo
  implements IPublisherInfo
{
  private int artifactOptions = 0;
  private IMetadataRepository metadataRepository;
  private IArtifactRepository artifactRepository;
  private IMetadataRepository contextMetadataRepository;
  private IArtifactRepository contextArtifactRepository;
  private String[] configurations = new String[0];
  private List<IPublisherAdvice> adviceList = new ArrayList(11);
  
  public void addAdvice(IPublisherAdvice advice)
  {
    adviceList.add(advice);
  }
  
  public List<IPublisherAdvice> getAdvice()
  {
    return adviceList;
  }
  
  public <T extends IPublisherAdvice> Collection<T> getAdvice(String configSpec, boolean includeDefault, String id, Version version, Class<T> type)
  {
    ArrayList<T> result = new ArrayList();
    for (Iterator localIterator = adviceList.iterator(); localIterator.hasNext();)
    {
      IPublisherAdvice advice = (IPublisherAdvice)localIterator.next();
      if ((type.isInstance(advice)) && (advice.isApplicable(configSpec, includeDefault, id, version))) {
        result.add(advice);
      }
    }
    return result;
  }
  
  public IArtifactRepository getArtifactRepository()
  {
    return artifactRepository;
  }
  
  public IMetadataRepository getMetadataRepository()
  {
    return metadataRepository;
  }
  
  public IArtifactRepository getContextArtifactRepository()
  {
    return contextArtifactRepository;
  }
  
  public IMetadataRepository getContextMetadataRepository()
  {
    return contextMetadataRepository;
  }
  
  public int getArtifactOptions()
  {
    return artifactOptions;
  }
  
  public void setArtifactRepository(IArtifactRepository value)
  {
    artifactRepository = value;
  }
  
  public void setMetadataRepository(IMetadataRepository value)
  {
    metadataRepository = value;
  }
  
  public void setContextArtifactRepository(IArtifactRepository value)
  {
    contextArtifactRepository = value;
  }
  
  public void setContextMetadataRepository(IMetadataRepository value)
  {
    contextMetadataRepository = value;
  }
  
  public void setArtifactOptions(int value)
  {
    artifactOptions = value;
  }
  
  public String[] getConfigurations()
  {
    return configurations;
  }
  
  public void setConfigurations(String[] value)
  {
    configurations = value;
  }
  
  public String getSummary()
  {
    return ".";
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import org.eclipse.equinox.internal.p2.metadata.IUMap;
import org.eclipse.equinox.internal.p2.metadata.expression.CompoundIterator;
import org.eclipse.equinox.internal.p2.metadata.index.CompoundIndex;
import org.eclipse.equinox.internal.p2.metadata.index.IdIndex;
import org.eclipse.equinox.internal.p2.metadata.index.IndexProvider;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.index.IIndex;
import org.eclipse.equinox.p2.query.IQueryResult;

public class PublisherResult
  extends IndexProvider<IInstallableUnit>
  implements IPublisherResult
{
  final IUMap rootIUs = new IUMap();
  final IUMap nonRootIUs = new IUMap();
  private IIndex<IInstallableUnit> idIndex;
  
  public void addIU(IInstallableUnit iu, String type)
  {
    if (type == "root") {
      rootIUs.add(iu);
    }
    if (type == "non_root") {
      nonRootIUs.add(iu);
    }
  }
  
  public void addIUs(Collection<IInstallableUnit> ius, String type)
  {
    for (Iterator localIterator = ius.iterator(); localIterator.hasNext();)
    {
      IInstallableUnit iu = (IInstallableUnit)localIterator.next();
      addIU(iu, type);
    }
  }
  
  public IInstallableUnit getIU(String id, Version version, String type)
  {
    if ((type == null) || (type == "root"))
    {
      IInstallableUnit result = rootIUs.get(id, version);
      if (result != null) {
        return result;
      }
    }
    if ((type == null) || (type == "non_root"))
    {
      IInstallableUnit result = nonRootIUs.get(id, version);
      if (result != null) {
        return result;
      }
    }
    return null;
  }
  
  public IInstallableUnit getIU(String id, String type)
  {
    if ((type == null) || (type == "root"))
    {
      IQueryResult<IInstallableUnit> ius = rootIUs.get(id);
      if (!ius.isEmpty()) {
        return (IInstallableUnit)ius.iterator().next();
      }
    }
    if ((type == null) || (type == "non_root"))
    {
      IQueryResult<IInstallableUnit> ius = nonRootIUs.get(id);
      if (!ius.isEmpty()) {
        return (IInstallableUnit)ius.iterator().next();
      }
    }
    return null;
  }
  
  public Collection<IInstallableUnit> getIUs(String id, String type)
  {
    if (type == null)
    {
      ArrayList<IInstallableUnit> result = new ArrayList();
      result.addAll(rootIUs.get(id).toUnmodifiableSet());
      result.addAll(nonRootIUs.get(id).toUnmodifiableSet());
      return result;
    }
    if (type == "root") {
      return rootIUs.get(id).toUnmodifiableSet();
    }
    if (type == "non_root") {
      return nonRootIUs.get(id).toUnmodifiableSet();
    }
    return null;
  }
  
  public void merge(IPublisherResult result, int mode)
  {
    if (mode == 0)
    {
      addIUs(result.getIUs(null, "root"), "root");
      addIUs(result.getIUs(null, "non_root"), "non_root");
    }
    else if (mode == 1)
    {
      addIUs(result.getIUs(null, "root"), "root");
      addIUs(result.getIUs(null, "non_root"), "root");
    }
    else if (mode == 2)
    {
      addIUs(result.getIUs(null, "root"), "non_root");
      addIUs(result.getIUs(null, "non_root"), "non_root");
    }
  }
  
  public synchronized IIndex<IInstallableUnit> getIndex(String memberName)
  {
    if ("id".equals(memberName))
    {
      if (idIndex == null)
      {
        ArrayList<IIndex<IInstallableUnit>> indexes = new ArrayList();
        indexes.add(new IdIndex(nonRootIUs));
        indexes.add(new IdIndex(rootIUs));
        idIndex = new CompoundIndex(indexes);
      }
      return idIndex;
    }
    return null;
  }
  
  public Iterator<IInstallableUnit> everything()
  {
    ArrayList<Iterator<IInstallableUnit>> iterators = new ArrayList();
    iterators.add(nonRootIUs.iterator());
    iterators.add(rootIUs.iterator());
    return new CompoundIterator(iterators.iterator());
  }
  
  public Object getManagedProperty(Object client, String memberName, Object key)
  {
    return null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.PublisherResult
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IAdditionalInstallableUnitAdvice
  extends IPublisherAdvice
{
  public abstract MetadataFactory.InstallableUnitDescription[] getAdditionalInstallableUnitDescriptions(IInstallableUnit paramIInstallableUnit);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IAdditionalInstallableUnitAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface ICapabilityAdvice
  extends IPublisherAdvice
{
  public abstract IProvidedCapability[] getProvidedCapabilities(MetadataFactory.InstallableUnitDescription paramInstallableUnitDescription);
  
  public abstract IRequirement[] getRequiredCapabilities(MetadataFactory.InstallableUnitDescription paramInstallableUnitDescription);
  
  public abstract IRequirement[] getMetaRequiredCapabilities(MetadataFactory.InstallableUnitDescription paramInstallableUnitDescription);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.ICapabilityAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.internal.p2.core.helpers.FileUtils.IPathComputer;
import org.eclipse.equinox.internal.p2.publisher.FileSetDescriptor;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IFeatureRootAdvice
  extends IPublisherAdvice
{
  public abstract String[] getConfigurations();
  
  public abstract FileUtils.IPathComputer getRootFileComputer(String paramString);
  
  public abstract FileSetDescriptor getDescriptor(String paramString);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IFeatureRootAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IFilterAdvice
  extends IPublisherAdvice
{
  public abstract IMatchExpression<IInstallableUnit> getFilter(String paramString, Version paramVersion, boolean paramBoolean);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IFilterAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface ILicenseAdvice
  extends IPublisherAdvice
{
  public abstract String getLicenseURL();
  
  public abstract String getLicenseText();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.ILicenseAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import java.util.Map;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;

public abstract interface IPropertyAdvice
  extends IPublisherAdvice
{
  public abstract Map<String, String> getInstallableUnitProperties(MetadataFactory.InstallableUnitDescription paramInstallableUnitDescription);
  
  public abstract Map<String, String> getArtifactProperties(IInstallableUnit paramIInstallableUnit, IArtifactDescriptor paramIArtifactDescriptor);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import java.io.File;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IRootFilesAdvice
  extends IPublisherAdvice
{
  public abstract File getRoot();
  
  public abstract File[] getIncludedFiles();
  
  public abstract File[] getExcludedFiles();
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IRootFilesAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import java.util.Collection;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;
import org.eclipse.equinox.p2.publisher.IPublisherResult;

public abstract interface IRootIUAdvice
  extends IPublisherAdvice
{
  public abstract Collection<? extends Object> getChildren(IPublisherResult paramIPublisherResult);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IRootIUAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.ITouchpointData;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface ITouchpointAdvice
  extends IPublisherAdvice
{
  public abstract ITouchpointData getTouchpointData(ITouchpointData paramITouchpointData);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.ITouchpointAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IUpdateDescriptorAdvice
  extends IPublisherAdvice
{
  public abstract IUpdateDescriptor getUpdateDescriptor(MetadataFactory.InstallableUnitDescription paramInstallableUnitDescription);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IUpdateDescriptorAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.publisher.IPublisherAdvice;

public abstract interface IVersionAdvice
  extends IPublisherAdvice
{
  public static final String NS_BUNDLE = "bundle";
  public static final String NS_FEATURE = "feature";
  public static final String NS_ROOT = "root";
  
  public abstract Version getVersion(String paramString1, String paramString2);
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.IVersionAdvice
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

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

class JREAction$1
  implements FileFilter
{
  final JREAction this$0;
  
  JREAction$1(JREAction paramJREAction) {}
  
  public boolean accept(File pathname)
  {
    return pathname.getAbsolutePath().endsWith(".profile");
  }
}

/* Location:
 * Qualified Name:     org.eclipse.equinox.p2.publisher.actions.JREAction.1
 * Java Class Version: 1.4 (48.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.equinox.p2.publisher.actions;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
import org.eclipse.equinox.internal.p2.metadata.ArtifactKey;
import org.eclipse.equinox.internal.p2.publisher.Activator;
import org.eclipse.equinox.internal.p2.publisher.Messages;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
import org.eclipse.equinox.p2.metadata.IProvidedCapability;
import org.eclipse.equinox.p2.metadata.IRequirement;
import org.eclipse.equinox.p2.metadata.MetadataFactory;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitFragmentDescription;
import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.metadata.VersionRange;
import org.eclipse.equinox.p2.publisher.AbstractPublisherAction;
import org.eclipse.equinox.p2.publisher.IPublisherInfo;
import org.eclipse.equinox.p2.publisher.IPublisherResult;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
import org.eclipse.equinox.spi.p2.publisher.PublisherHelper;
import org.eclipse.osgi.util.ManifestElement;
import org.eclipse.osgi.util.NLS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;

public class JREAction
  extends AbstractPublisherAction
{
  private static final String DEFAULT_JRE_NAME = "a.jre";
  private static final Version DEFAULT_JRE_VERSION = Version.parseVersion("1.6");
  private static final String DEFAULT_PROFILE = "/profiles/JavaSE-1.6.profile";
  private static final String PROFILE_LOCATION = "jre.action.profile.location";
  private static final String PROFILE_NAME = "osgi.java.profile.name";
  private static final String PROFILE_TARGET_VERSION = "org.eclipse.jdt.core.compiler.codegen.targetPlatform";
  private static final String PROFILE_SYSTEM_PACKAGES = "org.osgi.framework.system.packages";
  private File jreLocation;
  private String environment;
  private Map<String, String> profileProperties;
  
  public JREAction(File location)
  {
    jreLocation = location;
  }
  
  public JREAction(String environment)
  {
    this.environment = environment;
  }
  
  public IStatus perform(IPublisherInfo publisherInfo, IPublisherResult results, IProgressMonitor monitor)
  {
    initialize(publisherInfo);
    IArtifactDescriptor artifact = createJREData(results);
    if (artifact != null) {
      publishArtifact(artifact, new File[] { jreLocation }, null, publisherInfo, createRootPrefixComputer(jreLocation));
    }
    return Status.OK_STATUS;
  }
  
  protected IArtifactDescriptor createJREData(IPublisherResult results)
  {
    MetadataFactory.InstallableUnitDescription iu = new MetadataFactory.InstallableUnitDescription();
    iu.setSingleton(false);
    iu.setId("a.jre");
    iu.setVersion(DEFAULT_JRE_VERSION);
    iu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    
    generateJREIUData(iu);
    
    MetadataFactory.InstallableUnitFragmentDescription cu = new MetadataFactory.InstallableUnitFragmentDescription();
    String configId = "config." + iu.getId();
    cu.setId(configId);
    cu.setVersion(iu.getVersion());
    VersionRange range = iu.getVersion() == Version.emptyVersion ? VersionRange.emptyRange : new VersionRange(iu.getVersion(), true, Version.MAX_VERSION, true);
    cu.setHost(new IRequirement[] { MetadataFactory.createRequirement("org.eclipse.equinox.p2.iu", iu.getId(), range, null, false, false) });
    cu.setProperty("org.eclipse.equinox.p2.type.fragment", Boolean.TRUE.toString());
    cu.setCapabilities(new IProvidedCapability[] { PublisherHelper.createSelfCapability(configId, iu.getVersion()) });
    cu.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    Map<String, String> touchpointData = new HashMap();
    if ((jreLocation == null) || (!jreLocation.isDirectory()))
    {
      touchpointData.put("install", "");
      cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
      results.addIU(MetadataFactory.createInstallableUnit(iu), "root");
      results.addIU(MetadataFactory.createInstallableUnit(cu), "root");
      return null;
    }
    IArtifactKey key = new ArtifactKey("binary", iu.getId(), iu.getVersion());
    iu.setArtifacts(new IArtifactKey[] { key });
    results.addIU(MetadataFactory.createInstallableUnit(iu), "root");
    
    String configurationData = "unzip(source:@artifact, target:${installFolder});";
    touchpointData.put("install", configurationData);
    String unConfigurationData = "cleanupzip(source:@artifact, target:${installFolder});";
    touchpointData.put("uninstall", unConfigurationData);
    cu.addTouchpointData(MetadataFactory.createTouchpointData(touchpointData));
    results.addIU(MetadataFactory.createInstallableUnit(cu), "root");
    
    return PublisherHelper.createArtifactDescriptor(info, key, jreLocation);
  }
  
  private IProvidedCapability[] generateJRECapability(String id, Version version)
  {
    if (profileProperties == null) {
      return new IProvidedCapability[0];
    }
    String packages = (String)profileProperties.get("org.osgi.framework.system.packages");
    if ((packages == null) || (packages.trim().length() == 0)) {
      return new IProvidedCapability[] { PublisherHelper.createSelfCapability(id, version) };
    }
    try
    {
      ManifestElement[] jrePackages = ManifestElement.parseHeader("org.osgi.framework.system.packages", packages);
      IProvidedCapability[] exportedPackageAsCapabilities = new IProvidedCapability[jrePackages.length + 1];
      exportedPackageAsCapabilities[0] = PublisherHelper.createSelfCapability(id, version);
      for (int i = 1; i <= jrePackages.length; i++)
      {
        String packageName = jrePackages[(i - 1)].getValue();
        Version packageVersion = Version.create(jrePackages[(i - 1)].getAttribute("version"));
        exportedPackageAsCapabilities[i] = MetadataFactory.createProvidedCapability("java.package", packageName, packageVersion);
      }
      return exportedPackageAsCapabilities;
    }
    catch (BundleException e)
    {
      e.printStackTrace();
    }
    return new IProvidedCapability[0];
  }
  
  private void generateJREIUData(MetadataFactory.InstallableUnitDescription iu)
  {
    if ((profileProperties == null) || (profileProperties.size() == 0)) {
      return;
    }
    String profileLocation = (String)profileProperties.get("jre.action.profile.location");
    
    String profileName = profileLocation != null ? new Path(profileLocation).lastSegment() : (String)profileProperties.get("osgi.java.profile.name");
    if (profileName.endsWith(".profile")) {
      profileName = profileName.substring(0, profileName.length() - 8);
    }
    Version version = null;
    int idx = profileName.indexOf('-');
    if (idx != -1)
    {
      try
      {
        version = Version.parseVersion(profileName.substring(idx + 1));
      }
      catch (IllegalArgumentException localIllegalArgumentException1) {}
      profileName = profileName.substring(0, idx);
    }
    if (version == null) {
      try
      {
        String targetVersion = (String)prof
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-2019. Infinite Loop Ltd