Package org.eclipse.equinox.internal.p2.director

Examples of org.eclipse.equinox.internal.p2.director.ProfileChangeRequest


    SubMonitor progress = SubMonitor.convert(monitor, (fileCnt > 0) ? fileCnt : 500);
    String archivePath = getArchivePath();
    BufferedInputStream bin = new BufferedInputStream(in);
    try {
      TarInputStream zin = new TarInputStream(bin);
      TarEntry entry = zin.getNextEntry();
      while (entry != null) {
        String name = entry.getName();
        progress.subTask(NLS.bind(Messages.InstallableRuntime2_TaskUncompressing, name));
        if (archivePath != null && name.startsWith(archivePath)) {
          name = name.substring(archivePath.length());
          if (name.length() > 1)
            name = name.substring(1);
        }
       
        if (name != null && name.length() > 0) {
          if (entry.getFileType() == TarEntry.DIRECTORY)
            path.append(name).toFile().mkdirs();
          else {
            File dir = path.append(name).removeLastSegments(1).toFile();
            if (!dir.exists())
              dir.mkdirs();
           
            FileOutputStream fout = new FileOutputStream(path.append(name).toFile());
            copyWithSize(zin, fout, progress.newChild(1), (int)entry.getSize());
            fout.close();
            if (fileCnt <= 0)
              progress.setWorkRemaining(500);
          }
        }
View Full Code Here


    int fileCnt = getFileCount();
    SubMonitor progress = SubMonitor.convert(monitor, (fileCnt > 0) ? fileCnt : 500);
    String archivePath = getArchivePath();
    BufferedInputStream bin = new BufferedInputStream(in);
    try {
      TarInputStream zin = new TarInputStream(bin);
      TarEntry entry = zin.getNextEntry();
      while (entry != null) {
        String name = entry.getName();
        progress.subTask(NLS.bind(Messages.InstallableRuntime2_TaskUncompressing, name));
        if (archivePath != null && name.startsWith(archivePath)) {
          name = name.substring(archivePath.length());
          if (name.length() > 1)
            name = name.substring(1);
        }
       
        if (name != null && name.length() > 0) {
          if (entry.getFileType() == TarEntry.DIRECTORY)
            path.append(name).toFile().mkdirs();
          else {
            File dir = path.append(name).removeLastSegments(1).toFile();
            if (!dir.exists())
              dir.mkdirs();
           
            FileOutputStream fout = new FileOutputStream(path.append(name).toFile());
            copyWithSize(zin, fout, progress.newChild(1), (int)entry.getSize());
            fout.close();
            if (fileCnt <= 0)
              progress.setWorkRemaining(500);
          }
        }
        entry = zin.getNextEntry();
      }
      zin.close();
    } catch (TarException ex) {
      throw new IOException(ex);
    }
  }
View Full Code Here

      context.setProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES, String.valueOf(followReferences));

      // EV: invoke private methods
      //ProfileChangeRequest request = buildProvisioningRequest(profile, installs, uninstalls);
      //printRequest(request);
      ProfileChangeRequest request = (ProfileChangeRequest)
        invokePrivate("buildProvisioningRequest",
            new Class[]{IProfile.class, Collection.class, Collection.class},
            new Object[]{profile, installs, uninstalls});
      invokePrivate(
          "printRequest",
View Full Code Here

   
   
    xenRootIU.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    ITouchpointData tpd = MetadataFactory.createTouchpointData(touchpointData);
    xenRootIU.addTouchpointData(tpd);
    ArtifactKey xen_image = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, filename, Version.create("1.0.0"));
    xenRootIU.setArtifacts(new IArtifactKey[] {xen_image});
   
    File f = new File(repofiles + filename);
    IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(xen_image, f);
 
View Full Code Here

    touchpointData.put("install", installInstructions);

    ITouchpointData tpd = MetadataFactory.createTouchpointData(touchpointData);
    jvmIU.addTouchpointData(tpd);

    ArtifactKey jvm_rpm = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, filename , Version.create("1.0.0"));
    jvmIU.setArtifacts(new IArtifactKey[] {jvm_rpm});
   
    File f = new File(repofiles + filename);
    IArtifactDescriptor ad = PublisherHelper.createArtifactDescriptor(jvm_rpm, f);
   
View Full Code Here

    publishArtifact(ad, f, publisherInfo);

    createSelfCapability = PublisherHelper.createSelfCapability(xenRootIU.getId(), xenRootIU.getVersion());
    xenRootIU.setCapabilities(new IProvidedCapability[] {createSelfCapability});

    RequiredCapability vm = new RequiredCapability(PublisherHelper.IU_NAMESPACE, "org.example.xenVM", new VersionRange(Version.create("0.0.0"), true, Version.create("9.9.9"), true), "", false, false);
    xenRootIU.setRequiredCapabilities(new IRequiredCapability[] {vm});
    ITouchpointData vm_touchpoint = MetadataFactory.createTouchpointData(Collections.EMPTY_MAP);
    xenRootIU.addTouchpointData(vm_touchpoint);
   
    results.addIU(makeJVM(publisherInfo), IPublisherResult.NON_ROOT);
View Full Code Here

 
  @Override
  protected StructuredViewer doCreateViewer(Composite container) {
   
    resources = new DiscoveryResources(getControl().getDisplay());
    StructuredViewer viewer = new ControlListViewer(container, SWT.BORDER) {
      @Override
      protected ControlListItem<?> doCreateItem(Composite parent, Object element) {
        return doCreateViewerItem(parent, element);
      }
    };
   
    viewer.setContentProvider(contentProvider = new PackagistContentProvider());
   
    searchResultCount = new Label(container, SWT.NONE);
    searchResultCount.setText("asdfasdf");
    GridDataFactory.fillDefaults().grab(true, false).span(3,1).align(SWT.BEGINNING, SWT.CENTER).hint(400, SWT.DEFAULT).applyTo(searchResultCount);
   
View Full Code Here

  }
 
  @Override
  protected StructuredViewer doCreateViewer(Composite container) {
   
    resources = new DiscoveryResources(getControl().getDisplay());
    StructuredViewer viewer = new ControlListViewer(container, SWT.BORDER) {
      @Override
      protected ControlListItem<?> doCreateItem(Composite parent, Object element) {
        return doCreateViewerItem(parent, element);
      }
View Full Code Here

        super(actionType);
    }

    public ProfileChangeRequest generateProfileChangeRequest(IProfile profile, MultiStatus status,
                                                             IProgressMonitor monitor) {
        ProfileChangeRequest request = new ProfileChangeRequest(profile);
        request.removeInstallableUnits(iusToUninstall);
        return request;
    }
View Full Code Here

        super(actionType);
    }

    public ProfileChangeRequest generateProfileChangeRequest(IProfile profile, MultiStatus status,
                                                             IProgressMonitor monitor) {
        ProfileChangeRequest request = new ProfileChangeRequest(profile);
        for (IInstallableUnit iu : iusToInstall) {
            // If the user is installing a patch, we mark it optional.  This allows
            // the patched IU to be updated later by removing the patch.
            if (Boolean.toString(true).equals(iu.getProperty(IInstallableUnit.PROP_TYPE_PATCH))) {
                request.setInstallableUnitInclusionRules(iu, PlannerHelper.createOptionalInclusionRule(iu));
            }

            // Check to see if it is already installed.  This may alter the request.
            Collector alreadyInstalled = profile.query(new InstallableUnitQuery(iu.getId()), new Collector(), null);

            if (alreadyInstalled.size() > 0) {
                IInstallableUnit installedIU = (IInstallableUnit) alreadyInstalled.iterator().next();
                int compareTo = iu.getVersion().compareTo(installedIU.getVersion());
                // If the iu is a newer version of something already installed, consider this an
                // update request
                if (compareTo > 0) {
                    boolean lockedForUpdate = false;
                    String value = profile.getInstallableUnitProperty(installedIU,
                            IInstallableUnit.PROP_PROFILE_LOCKED_IU);
                    if (value != null) {
                        lockedForUpdate = (Integer.parseInt(value) & IInstallableUnit.LOCK_UPDATE) ==
                                IInstallableUnit.LOCK_UPDATE;
                    }
                    if (lockedForUpdate) {
                        // Add a status telling the user that this implies an update, but the
                        // iu should not be updated
                        status.merge(new Status(IStatus.WARNING, "temp", 10013, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " will be ignored because it is already installed, " +
                                "and updates are not permitted.", null));
                    } else {
                        request.addInstallableUnits(new IInstallableUnit[]{iu});
                        request.removeInstallableUnits(new IInstallableUnit[]{installedIU});
                        // Add a status informing the user that the update has been inferred
                        status.merge(new Status(IStatus.WARNING, "temp", 10013, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " is already installed, so an update will be performed instead.", null));
                        // Mark it as a root if it hasn't been already
                        if (!Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU,
                                IInstallableUnit.PROP_PROFILE_ROOT_IU))) {
                            request.setInstallableUnitProfileProperty(iu, IInstallableUnit.PROP_PROFILE_ROOT_IU,
                                    Boolean.toString(true));
                        }
                    }
                } else if (compareTo < 0) {
                    // An implied downgrade.  We will not put this in the plan, add a status informing the user
                    status.merge(new Status(IStatus.WARNING, "temp", 10004, installedIU.getId() + "-" +
                            installedIU.getVersion() +
                            " will be ignored because a newer version is already installed.", null));
                } else {
                    if (Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU,
                            IInstallableUnit.PROP_PROFILE_ROOT_IU)))
                    // It is already a root, nothing to do. We tell the user it was already installed
                    {
                        status.merge(new Status(IStatus.WARNING, "temp", 10005, installedIU.getId() + "-" +
                                installedIU.getVersion() + " will be ignored because it is already installed.", null));
                    } else {
                        // It was already installed but not as a root.
                        // Tell the user that parts of it are already installed and mark it as a root.
                        status.merge(new Status(IStatus.WARNING, "temp", 10006, installedIU.getId() + "-" +
                                installedIU.getVersion() +
                                " is already present because other installed software requires it.  " +
                                "It will be added to the installed software list.", null));
                        request.setInstallableUnitProfileProperty(iu, "org.eclipse.equinox.p2.type.root",
                                Boolean.toString(true));
                    }
                }
            } else {
                // Install it and mark as a root
                request.addInstallableUnits(new IInstallableUnit[]{iu});
                request.setInstallableUnitProfileProperty(iu, "org.eclipse.equinox.p2.type.root",
                        Boolean.toString(true));
            }
        }
        return request;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.internal.p2.director.ProfileChangeRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.