Package org.eclipse.equinox.internal.provisional.p2.engine

Examples of org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext


    yourAppIU.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    Map<String, String> touchpointData = new HashMap<String, String>(7);
    touchpointData.put("collect", "collect();");
    touchpointData.put("install", installInstructions);
   
    ITouchpointData tpd = MetadataFactory.createTouchpointData(touchpointData);
    yourAppIU.addTouchpointData(tpd);
   
    //ArtifactKey jvm_rpm = new ArtifactKey(PublisherHelper.BINARY_ARTIFACT_CLASSIFIER, filename , Version.create("1.0.0"));
    //jvmIU.setArtifacts(new IArtifactKey[] {jvm_rpm});
   
View Full Code Here


    //Make Root IU
   
    String time = Long.toString(System.currentTimeMillis());

   
    InstallableUnitDescription vmIU = new InstallableUnitDescription();
    vmIU.setId("org.example.xenVM");
    vmIU.setVersion(Version.createOSGi(1, 0, 0, time));
    vmIU.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    IProvidedCapability createSelfCapability = PublisherHelper.createSelfCapability(vmIU.getId(), vmIU.getVersion());
    vmIU.setCapabilities(new IProvidedCapability[] {createSelfCapability});


    InstallableUnitDescription xenRootIU = new InstallableUnitDescription();
    xenRootIU.setId("org.example.xenRoot");
    xenRootIU.setVersion(Version.createOSGi(1, 0, 0, time));
 
    Map<String, String> touchpointData = new HashMap<String, String>(7);

   
    touchpointData.put("collect", "collect();");
    touchpointData.put("install",
        "mkdir(path:${installFolder}/image);" +
        "unzip(source:@artifact, target:${installFolder}/image, buildFile:${installFolder}/build.properties);" +
        "mkdir(path:${installFolder}/mountpoint);" +
        "mount(options:-o loop,targetDir:${installFolder}, mountpoint:mountpoint, targetFile:image/centos.5-3.x86.img,  buildFile:${installFolder}/build.properties);" +
        "mount(options:-t proc,targetDir:${installFolder}, mountpoint:mountpoint/proc, targetFile:proc,  buildFile:${installFolder}/build.properties);" +
        //"chrootExec(chroot:${installFolder}/mountpoint/, chrootExec:ls -l /);" +
        "");
       
   
   
   
    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);
 
   
    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);
    results.addIU(makeInstallYourApp(publisherInfo), IPublisherResult.NON_ROOT);
    results.addIU(MetadataFactory.createInstallableUnit(vmIU), IPublisherResult.NON_ROOT);
    results.addIU(MetadataFactory.createInstallableUnit(xenRootIU), IPublisherResult.ROOT);
View Full Code Here

   
    String installInstructions = "copy(source:@artifact, target:${installFolder}/mountpoint/tmp/"+filename+", overwrite:true);" +
      "rpm(package:jre-6u15-linux-i586, targetDir:${installFolder}/mountpoint/tmp, chroot:${installFolder}/mountpoint/);";// +
      //"umount(options:-l, targetDir:${installFolder}, mountpoint:mountpoint/proc);" +
      // "umount(options:-l, targetDir:${installFolder}, mountpoint:mountpoint);" ;
    InstallableUnitDescription jvmIU = new InstallableUnitDescription();
    jvmIU.setId("org.example.xenjvm");
    jvmIU.setVersion(Version.createOSGi(1, 0, 0, Long.toString(System.currentTimeMillis())));
    jvmIU.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
      Map<String, String> touchpointData = new HashMap<String, String>(7);
    touchpointData.put("collect", "collect();");
    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);
   
    publishArtifact(ad, f, publisherInfo);

    IProvidedCapability createSelfCapability = PublisherHelper.createSelfCapability(jvmIU.getId(),jvmIU.getVersion());
    jvmIU.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);
    //jvmIU.setRequiredCapabilities(new IRequiredCapability[] {vm});
 
    return MetadataFactory.createInstallableUnit(jvmIU);
View Full Code Here

    "chrootExec(chroot:${installFolder}/mountpoint/, chrootExec:chmod -R 777 /opt/app);" +
    "chrootExec(chroot:${installFolder}/mountpoint/, chrootExec:/opt/app/install-sh.sh);"
    ;
   
   
    InstallableUnitDescription yourAppIU = new InstallableUnitDescription();
    yourAppIU.setId("org.example.yourapp");
    yourAppIU.setVersion(Version.createOSGi(1, 0, 0, Long.toString(System.currentTimeMillis())));
    yourAppIU.setTouchpointType(PublisherHelper.TOUCHPOINT_NATIVE);
    Map<String, String> touchpointData = new HashMap<String, String>(7);
    touchpointData.put("collect", "collect();");
    touchpointData.put("install", installInstructions);
   
    ITouchpointData tpd = MetadataFactory.createTouchpointData(touchpointData);
    yourAppIU.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);
   
    //publishArtifact(ad, f, publisherInfo);
   
    IProvidedCapability createSelfCapability = PublisherHelper.createSelfCapability(yourAppIU.getId(),yourAppIU.getVersion());
    yourAppIU.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);
    //jvmIU.setRequiredCapabilities(new IRequiredCapability[] {vm});
   
    return MetadataFactory.createInstallableUnit(yourAppIU);
View Full Code Here

                }
                return (haveHost ? super.accept(object) : true);
            }
        };

        IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
        Collector collected = iuQuery.perform(localizationFragments.iterator(), hostLocalizationCollector);

        if (!collected.isEmpty()) {
            String translation = null;
            for (Iterator iter = collected.iterator(); iter.hasNext() && translation == null;) {
                IInstallableUnit localizationIU = (IInstallableUnit) iter.next();
View Full Code Here

        IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
        if (profile == null) {
            log.warn("Profile unavailable. Default language will be used.");
            return new Collector();
        }
        IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
        Collector collected = profile.query(iuQuery, localeFragmentCollector, null);
        LocaleCollectorCache.put(locale, new SoftReference(collected));
        return collected;
    }
View Full Code Here

        return licenseArrayList.toArray(new ILicense[licenseArrayList.size()]);
    }

    public static IInstallableUnit[] getAllInstalledIUs(QueryContext queryContext) {
        queryContext.setQueryable(getProfile());
        Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());
        queryContext.setQuery(query);
        InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
        IInstallableUnit[] groupPropertyTrueIUs = ProvisioningUtils.performIUQuery(installedIUQuery);

        query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.FALSE.toString());
        queryContext.setQuery(query);
        installedIUQuery = new InstalledIUQuery(queryContext);
        IInstallableUnit[] groupPropertyFalseIUs = ProvisioningUtils.performIUQuery(installedIUQuery);

        IInstallableUnit[] allInstalledIUs =
View Full Code Here

        IProfile profile = ProvisioningUtils.getProfile();
        if (queryable == null || profile == null) {
            return collector;
        }

        Query query = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_GROUP, Boolean.TRUE.toString());

        if (queryContext.isShowLatestVersionsOnly()) {
            query = new CompositeQuery(new Query[]{query, new LatestIUVersionQuery()});
        }
View Full Code Here

        for (IRequiredCapability requiredCapability : requiredCapabilities) {
            String namespace = requiredCapability.getNamespace();
            String name = requiredCapability.getName();
            if (IInstallableUnit.NAMESPACE_IU_ID.equals(namespace) && name.endsWith("feature.group") && !name.startsWith("org.eclipse.equinox")) {
                QueryContext queryContext = new QueryContext();
                queryContext.setQuery(new InstallableUnitQuery(name, requiredCapability.getRange()));
                queryContext.setQueryable(queryable);
                InstalledIUQuery installedIUQuery = new InstalledIUQuery(queryContext);
                IInstallableUnit requiredIU = ProvisioningUtils.performIUQuery(installedIUQuery)[0];
                if (requiredIU != null) {
                    requiredIUList.add(requiredIU);
View Full Code Here

        HashMap<String, IInstallableUnit> iuMap = new HashMap<String, IInstallableUnit>();

        for (FeatureInfo featureInfo : features) {
            Collector collector = new Collector();
            Query query = new InstallableUnitQuery(featureInfo.getFeatureID(),
                    new VersionRange(Version.create(featureInfo.getFeatureVersion()),
                            true, Version.create(featureInfo.getFeatureVersion()), true));
            collector = RepositoryUtils.getInstallableUnitsInRepositories(null, query, collector, null);
            IInstallableUnit[] units = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);
View Full Code Here

TOP

Related Classes of org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext

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.