@Override ProvisioningContext getFirstPassProvisioningContext() { ProvisioningContext pc = new ProvisioningContext(session.getProvisioningAgent()); pc.setMetadataRepositories(new URI[0]); pc.setArtifactRepositories(new URI[0]); return pc; }
private ProvisioningContext createNoRepoContext(ProfileChangeRequest request) { ProvisioningContext noRepoContext = new ProvisioningContext(agent); noRepoContext.setMetadataRepositories(new URI[0]); noRepoContext.setArtifactRepositories(new URI[0]); noRepoContext.setProperty(INCLUDE_PROFILE_IUS, Boolean.FALSE.toString()); noRepoContext.setExtraInstallableUnits(new ArrayList<>(request.getProfile() .query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).toUnmodifiableSet())); return noRepoContext; }
private IProvisioningPlan resolve(IProfileChangeRequest temporaryRequest, IProgressMonitor monitor) { String explainPropertyBackup = null; try { temporaryRequest.setProfileProperty("_internal_user_defined_", "true"); //$NON-NLS-1$//$NON-NLS-2$ if (provisioningContext != null) { explainPropertyBackup = provisioningContext.getProperty(EXPLANATION_ENABLEMENT); provisioningContext.setProperty(EXPLANATION_ENABLEMENT, Boolean.FALSE.toString()); } return planner.getProvisioningPlan(temporaryRequest, provisioningContext, SubMonitor.convert(monitor)); } finally { if (provisioningContext != null) { if (explainPropertyBackup == null) provisioningContext.getProperties().remove(EXPLANATION_ENABLEMENT); else provisioningContext.setProperty(EXPLANATION_ENABLEMENT, explainPropertyBackup); } } }
public PlannerResolutionJob(String label, ProvisioningSession session, String profileId, ProfileChangeRequest request, ProvisioningContext context, IFailedStatusEvaluator evaluator, MultiStatus additionalStatus) { super(label, session); this.request = request; this.profileId = profileId; if (context == null) firstPass = new ProvisioningContext(session.getProvisioningAgent()); else firstPass = context; this.evaluator = evaluator; Assert.isNotNull(additionalStatus); this.additionalStatus = additionalStatus; }
public static IStatus validateProfile(IProfile profile) { IPlanner planner = (IPlanner) profile.getProvisioningAgent().getService(IPlanner.SERVICE_NAME); IProfileChangeRequest pcr = planner.createChangeRequest(profile); ProvisioningContext ctx = new ProvisioningContext(profile.getProvisioningAgent()); ctx.setMetadataRepositories(new URI[0]); return planner.getProvisioningPlan(pcr, ctx, null).getStatus(); } }
@Override public IProvisioningPlan getDiffPlan(IProfile currentProfile, IProfile targetProfile, IProgressMonitor monitor) { SubMonitor sub = SubMonitor.convert(monitor, ExpandWork); sub.setTaskName(Messages.Director_Task_Resolving_Dependencies); try { IProfileChangeRequest profileChangeRequest = FormerState.generateProfileDeltaChangeRequest(currentProfile, targetProfile); ProvisioningContext context = new ProvisioningContext(agent); if (context.getProperty(INCLUDE_PROFILE_IUS) == null) context.setProperty(INCLUDE_PROFILE_IUS, Boolean.FALSE.toString()); context.setExtraInstallableUnits(Arrays.asList( targetProfile.available(QueryUtil.createIUAnyQuery(), null).toArray(IInstallableUnit.class))); return getProvisioningPlan(profileChangeRequest, context, sub.newChild(ExpandWork / 2)); } finally { sub.done(); } }
agentRequest.add(metaRequirementIU); ProvisioningContext agentCtx = new ProvisioningContext(agent); agentCtx.setMetadataRepositories(new URI[0]); ArrayList<IInstallableUnit> extraIUs = new ArrayList<>(unattachedState); agentCtx.setExtraInstallableUnits(extraIUs); Object agentSolution = getSolutionFor(agentRequest, agentCtx, monitor.newChild(3)); if (agentSolution instanceof IProvisioningPlan
ProvisioningContext ctx = new ProvisioningContext( agent ); Collection<URI> repos = getRepositoryLocations(); if ( repos != null ) ctx.setArtifactRepositories( repos.toArray( new URI[repos.size()] ) );
context = new ProvisioningContext(agent); } else { for (IInstallableUnit iu : context.getExtraInstallableUnits()) { String key = iu.getId() + '_' + iu.getVersion().toString(); resultsMap.put(key, iu); IQueryable<IInstallableUnit> queryable = context.getMetadata(sub.newChild(500)); IQueryResult<IInstallableUnit> matches = queryable.query(QueryUtil.createIUQuery(null, VersionRange.emptyRange), sub.newChild(500));
public IStatus start(IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.download_artifact, 1000); try { if (requestsToProcess.isEmpty()) return Status.OK_STATUS; if (provContext == null) provContext = new ProvisioningContext(agent); IQueryable<IArtifactRepository> repoQueryable = provContext.getArtifactRepositories(subMonitor.newChild(250)); IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION); IArtifactRepository[] repositories = repoQueryable.query(all, subMonitor.newChild(250)).toArray(IArtifactRepository.class); if (repositories.length == 0) return new Status(IStatus.ERROR, EngineActivator.ID, Messages.download_no_repository, new Exception(Collect.NO_ARTIFACT_REPOSITORIES_AVAILABLE)); // Although we get a sorted list back from the ProvisioningContext above, it // gets unsorted when we convert the queryable into an array so we must re-sort it. // See https://bugs.eclipse.org/335153. Arrays.sort(repositories, LOCAL_FIRST_COMPARATOR); fetch(repositories, subMonitor.newChild(500)); return overallStatus(monitor); } finally { subMonitor.done(); } }
@Override ProvisioningContext getFirstPassProvisioningContext() { // Set it back to no referencing for first pass in case we reuse this context. context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, null); return context; }
private boolean shouldFollowArtifactReferences() { return Boolean.parseBoolean(getProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES)); }
public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("{artifactRepos=" + DebugHelper.formatArray(null != artifactRepositories ? Arrays.asList(artifactRepositories) : null, true, false)); //$NON-NLS-1$ buffer.append(", metadataRepos=" + DebugHelper.formatArray(null != metadataRepositories ? Arrays.asList(metadataRepositories) : null, true, false)); //$NON-NLS-1$ buffer.append(", properties=" + getProperties() + "}"); //$NON-NLS-1$ //$NON-NLS-2$ return buffer.toString(); } }
/** * Create an operation using the provided provisioning session. * Unless otherwise specified by the client, the operation is * performed on the currently running profile. * * @param session the provisioning session providing the services */ protected ProfileChangeOperation(ProvisioningSession session) { this.session = session; this.profileId = IProfileRegistry.SELF; this.context = new ProvisioningContext(session.getProvisioningAgent()); }
public static IStatus validateProfile(IProfile profile) { IPlanner planner = (IPlanner) profile.getProvisioningAgent().getService(IPlanner.SERVICE_NAME); IProfileChangeRequest pcr = planner.createChangeRequest(profile); ProvisioningContext ctx = new ProvisioningContext(profile.getProvisioningAgent()); ctx.setMetadataRepositories(new URI[0]); return planner.getProvisioningPlan(pcr, ctx, null).getStatus(); } }
@Override ProvisioningContext getFirstPassProvisioningContext() { // Set it back to no referencing for first pass in case we reuse this context. context.setProperty(ProvisioningContext.FOLLOW_REPOSITORY_REFERENCES, null); return context; }
private boolean shouldFollowArtifactReferences() { return Boolean.parseBoolean(getProperty(FOLLOW_ARTIFACT_REPOSITORY_REFERENCES)); }
@Override public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("{artifactRepos=" + DebugHelper.formatArray(null != artifactRepositories ? Arrays.asList(artifactRepositories) : null, true, false)); //$NON-NLS-1$ buffer.append(", metadataRepos=" + DebugHelper.formatArray(null != metadataRepositories ? Arrays.asList(metadataRepositories) : null, true, false)); //$NON-NLS-1$ buffer.append(", properties=" + getProperties() + "}"); //$NON-NLS-1$ //$NON-NLS-2$ return buffer.toString(); } }
@Override ProvisioningContext getFirstPassProvisioningContext() { ProvisioningContext pc = new ProvisioningContext(session.getProvisioningAgent()); pc.setMetadataRepositories(new URI[0]); pc.setArtifactRepositories(new URI[0]); return pc; }
public ProvisioningPlan(IStatus status, IProfile profile, Operand[] operands, ProvisioningContext context, IProvisioningPlan installerPlan) { Assert.isNotNull(profile); this.status = status; this.profile = profile; if (operands != null) this.operands.addAll(Arrays.asList(operands)); this.context = (context == null) ? new ProvisioningContext(profile.getProvisioningAgent()) : context; this.installerPlan = installerPlan; }