/** * Returns a queryable that can be used to obtain any artifact repositories that * are needed for the provisioning operation. * * @param monitor a progress monitor to be used when creating the queryable * @return a queryable that can be used to query available artifact repositories. * * @see #setArtifactRepositories(URI[]) */ public IQueryable<IArtifactRepository> getArtifactRepositories(IProgressMonitor monitor) { return new ArtifactRepositoryQueryable(getLoadedArtifactRepositories(monitor)); }
private boolean containsProfile(IProfileRegistry profileRegistry, String profileId) { if (profileId == null || profileRegistry == null) return false; return profileRegistry.containsProfile(profileId); }
protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) { return plan.getAdditions(); } }
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(); } }
private IProfile findMostRecentReset(IProfileRegistry registry, IProfile profile) { long ts = findMostRecentResetTimestamp(registry, profile); if (ts == -1) return null; return registry.getProfile(profile.getProfileId(), ts); }
protected Preferences getRepositoryPreferenceNode(IAgentLocation agentLocation, IProfile profile, URI location, int type) { String key = type == IRepository.TYPE_METADATA ? METADATA_REPOSITORY : ARTIFACT_REPOSITORY; String profileId = profile == null ? IProfileRegistry.SELF : profile.getProfileId(); return new ProfileScope(agentLocation, profileId).getNode(key + '/' + NODE_REPOSITORIES + '/' + getKey(location)); }
private IStatus setProperty(String key, String value, ProvisioningContext provisioningContext, IProgressMonitor monitor) { IEngine engine = (IEngine) agent.getService(IEngine.SERVICE_NAME); IProvisioningPlan plan = engine.createPlan(profile, provisioningContext); plan.setProfileProperty(key, value); IPhaseSet phaseSet = PhaseSetFactory.createPhaseSetIncluding(new String[] {PhaseSetFactory.PHASE_PROPERTY}); return engine.perform(plan, phaseSet, monitor); }
private String getActionGatheringIUId(IProfile profile) { return ID_IU_FOR_ACTIONS + '.' + profile.getProfileId(); }
@Override public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) { return profile.query(query, monitor); } }
protected String getProfileProperty(IProfile profile, IInstallableUnit iu, String propertyName) { if (profile == null || iu == null) return null; return profile.getInstallableUnitProperty(iu, propertyName); }
@Override public long getTimestamp() { return profile.getTimestamp(); }
@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; }
protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) { return plan.getRemovals(); } }
@Override public Map<String, String> getProperties() { return profile.getProperties(); }
public static String formatContext(ProvisioningContext context) { return context.toString(); }
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(); } }
protected Preferences getRepositoryPreferenceNode(IAgentLocation agentLocation, IProfile profile, URI location, int type) { String key = type == IRepository.TYPE_METADATA ? METADATA_REPOSITORY : ARTIFACT_REPOSITORY; String profileId = profile == null ? IProfileRegistry.SELF : profile.getProfileId(); return new ProfileScope(agentLocation, profileId).getNode(key + '/' + NODE_REPOSITORIES + '/' + getKey(location)); }
@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; }
/** * Returns a queryable that can be used to obtain any artifact repositories that * are needed for the provisioning operation. * * @param monitor a progress monitor to be used when creating the queryable * @return a queryable that can be used to query available artifact repositories. * * @see #setArtifactRepositories(URI[]) */ public IQueryable<IArtifactRepository> getArtifactRepositories(IProgressMonitor monitor) { return new ArtifactRepositoryQueryable(getLoadedArtifactRepositories(monitor)); }
private boolean containsProfile(IProfileRegistry profileRegistry, String profileId) { if (profileId == null || profileRegistry == null) return false; return profileRegistry.containsProfile(profileId); }