private String getActionGatheringIUId(IProfile profile) { return ID_IU_FOR_ACTIONS + '.' + profile.getProfileId(); }
private long findMostRecentResetTimestamp(IProfileRegistry registry, IProfile profile) { long[] history = registry.listProfileTimestamps(profile.getProfileId()); int index = history.length - 1; boolean found = false; while (!(found = IProfile.STATE_SHARED_INSTALL_VALUE_BEFOREFLUSH.equals(registry.getProfileStateProperties(profile.getProfileId(), history[index]).get(IProfile.STATE_PROP_SHARED_INSTALL))) && index > 0) { index--; } if (!found) return -1; return history[index]; }
private void internalUnlockProfile(IProfile profile) { ProfileLock lock = profileLocks.get(profile.getProfileId()); lock.unlock(); }
public String getContextString(Phase phase, Operand operand, ProvisioningAction action) { if (action instanceof ParameterizedProvisioningAction) { ParameterizedProvisioningAction parameterizedAction = (ParameterizedProvisioningAction) action; action = parameterizedAction.getAction(); } String message = NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), phase.getClass().getName(), operand.toString(), getCurrentActionId()}); return message; }
public String getContextString(Phase phase, Operand operand, ProvisioningAction action) { if (action instanceof ParameterizedProvisioningAction) { ParameterizedProvisioningAction parameterizedAction = (ParameterizedProvisioningAction) action; action = parameterizedAction.getAction(); } String message = NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), phase.getClass().getName(), operand.toString(), getCurrentActionId()}); return message; }
public synchronized boolean isCurrent(IProfile profile) { Profile internalProfile = getProfileMap().get(profile.getProfileId()); if (internalProfile == null) throw new IllegalArgumentException(NLS.bind(Messages.profile_not_registered, profile.getProfileId())); if (!internalLockProfile(internalProfile)) throw new IllegalStateException(Messages.SimpleProfileRegistry_Profile_in_use); try { return (!((Profile) profile).isChanged() && checkTimestamps(profile, internalProfile)); } finally { internalUnlockProfile(internalProfile); } }
@Override public synchronized boolean isCurrent(IProfile profile) { Profile internalProfile = getProfileMap().get(profile.getProfileId()); if (internalProfile == null) throw new IllegalArgumentException(NLS.bind(Messages.profile_not_registered, profile.getProfileId())); if (!internalLockProfile(internalProfile)) throw new IllegalStateException(Messages.SimpleProfileRegistry_Profile_in_use); try { return (!((Profile) profile).isChanged() && checkTimestamps(profile, internalProfile)); } finally { internalUnlockProfile(internalProfile); } }
/** * Transforms the item to a UI element */ protected Object wrap(Object item) { return super.wrap(new ProfileElement(parent, ((IProfile) item).getProfileId())); }
public int getRestartPolicy() { //if we are installing into self we must always use the restart policy if (IProfileRegistry.SELF.equals(profileId)) return restartPolicy; //otherwise only apply restart policy if the profile being modified is the one that is currently running IProfile profile = getSession().getProfileRegistry().getProfile(IProfileRegistry.SELF); String id = profile == null ? null : profile.getProfileId(); if (id != null && profileId.equals(id)) { return restartPolicy; } return ProvisioningJob.RESTART_NONE; }
private IProfile findMostRecentReset(IProfileRegistry registry, IProfile profile) { long ts = findMostRecentResetTimestamp(registry, profile); if (ts == -1) return null; return registry.getProfile(profile.getProfileId(), ts); }
public File getProfileDataDirectory() { SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); return profileRegistry.getProfileDataDirectory(profile.getProfileId()); }
public MarkSet[] getMarkSets(IProvisioningAgent agent, IProfile inProfile) { artifactKeyList = new HashSet<IArtifactKey>(); IArtifactRepository repositoryToGC = Util.getBundlePoolRepository(agent, inProfile); if (repositoryToGC == null) return new MarkSet[0]; addArtifactKeys(inProfile); IProfile currentProfile = getCurrentProfile(agent); if (currentProfile != null && inProfile.getProfileId().equals(currentProfile.getProfileId())) { addRunningBundles(repositoryToGC); addRunningFeatures(inProfile, repositoryToGC); } return new MarkSet[] {new MarkSet(artifactKeyList.toArray(new IArtifactKey[artifactKeyList.size()]), repositoryToGC)}; }
public File getProfileDataDirectory() { SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); return profileRegistry.getProfileDataDirectory(profile.getProfileId()); }
private String getProfileId(Object obj) { if (obj instanceof ProfileElement) return ((ProfileElement) obj).getLabel(obj); IProfile profile = ProvUI.getAdapter(obj, IProfile.class); if (profile == null) return null; return profile.getProfileId(); }
public IStatus prepare(IProfile profile) { try { if (hasPreparedIUs(profile)) return validateProfile(profile); } catch (RuntimeException e) { return Util.createError(NLS.bind(Messages.error_validating_profile, profile.getProfileId()), e); } return Status.OK_STATUS; }
public String getContextString() { String message = NLS.bind(Messages.session_context, new Object[] {profile.getProfileId(), getCurrentPhaseId(), getCurrentOperandId(), getCurrentActionId()}); return message; }
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)); }
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)); }
/** * Transforms the item to a UI element */ protected Object wrap(Object item) { if (queryable instanceof IProfile) return super.wrap(new InstalledIUElement(parent, ((IProfile) queryable).getProfileId(), (IInstallableUnit) item)); // Shouldn't happen, the queryable should typically be a profile return super.wrap(item); }
@Override public IQueryResult<IInstallableUnit> queryProfile(IProfile profile, IQuery<IInstallableUnit> query, IProgressMonitor monitor) { IProfile sharedProfile = getSharedProfile(profile.getProfileId()); if (sharedProfile == null) return profile.query(query, monitor); // TODO: Should consider using a sequenced iterator here instead of collecting Collector<IInstallableUnit> result = new Collector<>(); result.addAll(sharedProfile.query(query, monitor)); result.addAll(profile.query(query, monitor)); return result; } }