Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java18
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java14
15 files changed, 90 insertions, 78 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
index 6fc28a2aa..cc923859b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java
@@ -32,7 +32,7 @@ public class DownloadManager {
/**
* This Comparator sorts the repositories such that local repositories are first.
- * TODO: This is copied from the ProvisioningContext class. Can we combine them?
+ * TODO: This is copied from the ProvisioningContext class. Can we combine them?
* See https://bugs.eclipse.org/335153.
*/
private static final Comparator<IArtifactRepository> LOCAL_FIRST_COMPARATOR = new Comparator<IArtifactRepository>() {
@@ -66,8 +66,8 @@ public class DownloadManager {
public void add(IArtifactRequest[] toAdd) {
Assert.isNotNull(toAdd);
- for (int i = 0; i < toAdd.length; i++) {
- add(toAdd[i]);
+ for (IArtifactRequest element : toAdd) {
+ add(element);
}
}
@@ -134,7 +134,7 @@ public class DownloadManager {
}
private void publishDownloadEvent(CollectEvent event) {
- IProvisioningEventBus bus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = agent.getService(IProvisioningEventBus.class);
if (bus != null)
bus.publishEvent(event);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java
index 49b781965..c752aa214 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java
@@ -58,8 +58,8 @@ public class Engine implements IEngine {
checkArguments(iprofile, phaseSet, operands);
if (operands.length == 0)
return Status.OK_STATUS;
- SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
- IProvisioningEventBus eventBus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ SimpleProfileRegistry profileRegistry = (SimpleProfileRegistry) agent.getService(IProfileRegistry.class);
+ IProvisioningEventBus eventBus = agent.getService(IProvisioningEventBus.class);
if (context == null)
context = new ProvisioningContext(agent);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
index 72ddb7524..b23db1e4a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -227,7 +227,7 @@ public class EngineSession {
MultiStatus result = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
SubMonitor sub = SubMonitor.convert(monitor, 10 + 10 + 10 * actionRecords.size());
try {
- phase.actionManager = (ActionManager) agent.getService(ActionManager.SERVICE_NAME);
+ phase.actionManager = agent.getService(ActionManager.class);
if (!currentPhaseActive)
phase.prePerform(result, this, sub.newChild(10));
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
index dac10e762..0071a1d62 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Landmark Graphics Corporation - bug 397183
@@ -76,7 +76,7 @@ public abstract class Phase {
}
private void broadcastPhaseEvent(EngineSession session, Operand[] operands, int type) {
- IProvisioningEventBus bus = (IProvisioningEventBus) session.getAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = session.getAgent().getService(IProvisioningEventBus.class);
if (bus != null) {
bus.publishEvent(getPhaseEvent(operands, type));
}
@@ -270,8 +270,7 @@ public abstract class Phase {
}
operandParameters = Collections.unmodifiableMap(operandParameters);
}
- for (int j = 0; j < actions.length; j++) {
- ProvisioningAction action = actions[j];
+ for (ProvisioningAction action : actions) {
Map<String, Object> parameters = operandParameters;
Touchpoint touchpoint = action.getTouchpoint();
if (touchpoint != null) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
index 970228fb4..88a289f7b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -45,7 +45,7 @@ public class PhaseSet implements IPhaseSet {
return status;
}
Phase phase = phases[i];
- phase.actionManager = (ActionManager) session.getAgent().getService(ActionManager.SERVICE_NAME);
+ phase.actionManager = session.getAgent().getService(ActionManager.class);
try {
phase.perform(status, session, operands, pm.newChild(weights[i]));
} catch (OperationCanceledException e) {
@@ -103,12 +103,11 @@ public class PhaseSet implements IPhaseSet {
public final IStatus validate(ActionManager actionManager, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) {
Set<MissingAction> missingActions = new HashSet<>();
- for (int i = 0; i < phases.length; i++) {
- Phase phase = phases[i];
+ for (Phase phase2 : phases) {
+ Phase phase = phase2;
phase.actionManager = actionManager;
try {
- for (int j = 0; j < operands.length; j++) {
- Operand operand = operands[j];
+ for (Operand operand : operands) {
try {
if (!phase.isApplicable(operand))
continue;
@@ -148,8 +147,8 @@ public class PhaseSet implements IPhaseSet {
private int getTotalWork(int[] weights) {
int sum = 0;
- for (int i = 0; i < weights.length; i++)
- sum += weights[i];
+ for (int weight : weights)
+ sum += weight;
return sum;
}
@@ -167,8 +166,8 @@ public class PhaseSet implements IPhaseSet {
private int countApplicable(Phase phase, Operand[] operands) {
int count = 0;
- for (int i = 0; i < operands.length; i++) {
- if (phase.isApplicable(operands[i]))
+ for (Operand operand : operands) {
+ if (phase.isApplicable(operand))
count++;
}
return count;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
index d84b6a4a6..65e8abf8a 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -58,7 +58,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
private void publishArtifactRepos() {
List<URI> artifactRepos = findArtifactRepos();
- IProvisioningEventBus bus = (IProvisioningEventBus) getProvisioningAgent().getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = getProvisioningAgent().getService(IProvisioningEventBus.class);
if (bus == null)
return;
for (URI repo : artifactRepos) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
index 70cc804d8..ecb329b01 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java
@@ -58,7 +58,7 @@ public class ProfilePreferences extends EclipsePreferences {
e.printStackTrace();
}
//ignore - this means the provisioning agent has already been stopped, and since
- //this job is joined during agent stop, it means this job has been scheduled after the
+ //this job is joined during agent stop, it means this job has been scheduled after the
//agent stopped and therefore can't have any interesting changes to save
} catch (BackingStoreException e) {
LogHelper.log(new Status(IStatus.WARNING, EngineActivator.ID, "Exception saving profile preferences", e)); //$NON-NLS-1$
@@ -122,7 +122,7 @@ public class ProfilePreferences extends EclipsePreferences {
protected void doSave(IProvisioningAgent agent) throws BackingStoreException {
synchronized (((ProfilePreferences) parent).profileLock) {
String profileId = getProfileIdSegment();
- IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry registry = agent.getService(IProfileRegistry.class);
//can't save anything without a profile registry
if (registry == null)
return;
@@ -176,8 +176,8 @@ public class ProfilePreferences extends EclipsePreferences {
private String encodeForFilter(String string) {
StringBuilder result = new StringBuilder(string.length());
char[] input = string.toCharArray();
- for (int i = 0; i < input.length; i++) {
- switch (input[i]) {
+ for (char element : input) {
+ switch (element) {
case '(' :
case ')' :
case '*' :
@@ -185,7 +185,7 @@ public class ProfilePreferences extends EclipsePreferences {
result.append('\\');
//fall through
default :
- result.append(input[i]);
+ result.append(element);
}
}
return result.toString();
@@ -196,7 +196,7 @@ public class ProfilePreferences extends EclipsePreferences {
*/
private IPath getDefaultLocation(IProvisioningAgent agent) {
//use engine agent location for preferences if there is no self profile
- IAgentLocation location = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation location = agent.getService(IAgentLocation.class);
if (location == null) {
LogHelper.log(new Status(IStatus.WARNING, EngineActivator.ID, "Agent location service not available", new RuntimeException())); //$NON-NLS-1$
return null;
@@ -257,7 +257,7 @@ public class ProfilePreferences extends EclipsePreferences {
IProvisioningAgent agent = getAgent(getAgentLocationSegment());
if (agent == null)
return;
- IProfileRegistry registry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME);
+ IProfileRegistry registry = agent.getService(IProfileRegistry.class);
String profileId = getProfileIdSegment();
if (!containsProfile(registry, profileId)) {
//use the default location for the self profile, otherwise just do nothing and return
@@ -288,7 +288,7 @@ public class ProfilePreferences extends EclipsePreferences {
}
/**
- * Schedules the save job. This method is synchronized to protect lazily initialization
+ * Schedules the save job. This method is synchronized to protect lazily initialization
* of the save job instance.
*/
@Override
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java
index c9445b4f1..d27ae5b8f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -26,9 +26,9 @@ public class ProfileRegistryComponent implements IAgentServiceFactory {
@Override
public Object createService(IProvisioningAgent agent) {
- IAgentLocation location = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME);
+ IAgentLocation location = agent.getService(IAgentLocation.class);
SimpleProfileRegistry registry = new SimpleProfileRegistry(agent, SimpleProfileRegistry.getDefaultRegistryDirectory(location));
- registry.setEventBus((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME));
+ registry.setEventBus(agent.getService(IProvisioningEventBus.class));
return registry;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
index 9f910cddf..0ff870c37 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Ericsson AB - Bug 400011 - [shared] Cleanup the SurrogateProfileHandler code
@@ -60,8 +60,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
"profileProperties[$0] == 'true' || (touchpointType != null && touchpointType.id == $1)", //$NON-NLS-1$
IProfile.PROP_PROFILE_ROOT_IU, NATIVE_TOUCHPOINT_TYPE);
IQueryResult<IInstallableUnit> rootIUs = sharedProfile.query(rootIUQuery, null);
- for (Iterator<IInstallableUnit> iterator = rootIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : rootIUs) {
userProfile.addInstallableUnit(iu);
userProfile.addInstallableUnitProperties(iu, sharedProfile.getInstallableUnitProperties(iu));
userProfile.setInstallableUnitProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU, IU_LOCKED);
@@ -86,8 +85,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
ArrayList<IRequirement> iuRequirements = new ArrayList<>();
IQueryResult<IInstallableUnit> allIUs = sharedProfile.query(QueryUtil.createIUAnyQuery(), null);
- for (Iterator<IInstallableUnit> iterator = allIUs.iterator(); iterator.hasNext();) {
- IInstallableUnit iu = iterator.next();
+ for (IInstallableUnit iu : allIUs) {
IMatchExpression<IInstallableUnit> iuMatcher = ExpressionUtil.getFactory().matchExpression(ExpressionUtil.parse("id == $0 && version == $1"), iu.getId(), iu.getVersion()); //$NON-NLS-1$
iuRequirements.add(MetadataFactory.createRequirement(iuMatcher, null, 0, 1, true));
}
@@ -116,7 +114,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
File configurationFolder = new File(configurationLocation.getURL().getPath());
userProfile.setProperty(IProfile.PROP_CONFIGURATION_FOLDER, configurationFolder.getAbsolutePath());
- // We need to check that the configuration folder is not a file system root.
+ // We need to check that the configuration folder is not a file system root.
// some of the profiles resources are stored as siblings to the configuration folder.
// also see bug 230384
if (configurationFolder.getParentFile() == null)
@@ -181,7 +179,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
*/
private void setUpRepos() {
//clean old junk
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class);
URI[] knownRepositories = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL);
for (URI uri : knownRepositories) {
if ("true".equals(metaManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$
@@ -189,7 +187,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
}
}
- IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent.getService(IArtifactRepositoryManager.SERVICE_NAME);
+ IArtifactRepositoryManager artifactManager = agent.getService(IArtifactRepositoryManager.class);
knownRepositories = artifactManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_LOCAL);
for (URI uri : knownRepositories) {
if ("true".equals(artifactManager.getRepositoryProperty(uri, EngineActivator.P2_FRAGMENT_PROPERTY))) { //$NON-NLS-1$
@@ -226,7 +224,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
Set<IInstallableUnit> added = new HashSet<>();
for (File extension : extensionLocations) {
try {
- IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
+ IMetadataRepositoryManager metaManager = agent.getService(IMetadataRepositoryManager.class);
IMetadataRepository repo = metaManager.loadRepository(extension.toURI(), new NullProgressMonitor());
Set<IInstallableUnit> installableUnits = repo.query(QueryUtil.createIUAnyQuery(), new NullProgressMonitor()).toUnmodifiableSet();
for (IInstallableUnit unit : installableUnits) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
index 61231725f..61d962663 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java
@@ -62,7 +62,7 @@ public class CertificateChecker {
}
private IStatus checkCertificates(SignedContentFactory verifierFactory) {
- UIServices serviceUI = (UIServices) agent.getService(UIServices.SERVICE_NAME);
+ UIServices serviceUI = agent.getService(UIServices.class);
SignedContent content = null;
SignerInfo[] signerInfo = null;
ArrayList<Certificate> untrusted = new ArrayList<>();
@@ -85,9 +85,9 @@ public class CertificateChecker {
} catch (IOException e) {
return new Status(IStatus.ERROR, EngineActivator.ID, Messages.CertificateChecker_SignedContentIOError, e);
}
- for (int i = 0; i < signerInfo.length; i++) {
- if (!signerInfo[i].isTrusted()) {
- Certificate[] certificateChain = signerInfo[i].getCertificateChain();
+ for (SignerInfo element : signerInfo) {
+ if (!element.isTrusted()) {
+ Certificate[] certificateChain = element.getCertificateChain();
if (!untrusted.contains(certificateChain[0])) {
untrusted.add(certificateChain[0]);
untrustedChain.add(certificateChain);
@@ -166,8 +166,8 @@ public class CertificateChecker {
}
// Anything that was trusted should be removed from the untrusted list
if (trustedCertificates != null) {
- for (int i = 0; i < trustedCertificates.length; i++) {
- untrusted.remove(trustedCertificates[i]);
+ for (Certificate trustedCertificate : trustedCertificates) {
+ untrusted.remove(trustedCertificate);
}
}
@@ -230,9 +230,9 @@ public class CertificateChecker {
}
public void add(Object[] toAdd) {
- for (int i = 0; i < toAdd.length; i++) {
- if (toAdd[i] instanceof File)
- add((File) toAdd[i]);
+ for (Object element : toAdd) {
+ if (element instanceof File)
+ add((File) element);
}
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
index 3ca7c1203..da5779783 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* WindRiver - https://bugs.eclipse.org/bugs/show_bug.cgi?id=227372
@@ -100,12 +100,12 @@ public class Collect extends InstallableUnitPhase {
List<IArtifactRequest> totalArtifactRequests = new ArrayList<>(artifactRequests.size());
DownloadManager dm = new DownloadManager(context, agent);
for (IArtifactRequest[] requests : artifactRequests) {
- for (int i = 0; i < requests.length; i++) {
- dm.add(requests[i]);
- totalArtifactRequests.add(requests[i]);
+ for (IArtifactRequest request : requests) {
+ dm.add(request);
+ totalArtifactRequests.add(request);
}
}
- IProvisioningEventBus bus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = agent.getService(IProvisioningEventBus.class);
if (bus != null)
bus.publishEvent(new CollectEvent(CollectEvent.TYPE_OVERALL_START, null, context, totalArtifactRequests.toArray(new IArtifactRequest[totalArtifactRequests.size()])));
IStatus downloadStatus = dm.start(monitor);
@@ -135,7 +135,7 @@ public class Collect extends InstallableUnitPhase {
private void firePauseEventToDownloadJobs() {
synchronized (this) {
if (agent != null) {
- IProvisioningEventBus bus = (IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME);
+ IProvisioningEventBus bus = agent.getService(IProvisioningEventBus.class);
if (bus != null)
bus.publishEvent(new DownloadPauseResumeEvent(isPaused ? DownloadPauseResumeEvent.TYPE_PAUSE : DownloadPauseResumeEvent.TYPE_RESUME));
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
index 83e630c00..7f85a12e5 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Configure.java
@@ -38,7 +38,8 @@ public class Configure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
return null;
}
@@ -48,7 +49,8 @@ public class Configure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
return null;
}
}
@@ -61,7 +63,8 @@ public class Configure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
return null;
}
@@ -71,7 +74,8 @@ public class Configure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
index 9cf05fa5e..2ebdfa912 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Install.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -37,7 +37,8 @@ public class Install extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
return null;
}
@@ -48,7 +49,8 @@ public class Install extends InstallableUnitPhase {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
profile.removeInstallableUnit(iu);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
return null;
}
}
@@ -62,7 +64,8 @@ public class Install extends InstallableUnitPhase {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
profile.addInstallableUnit(iu);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
return null;
}
@@ -72,7 +75,8 @@ public class Install extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
index 7f0a31b6e..991526612 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
* Wind River - ongoing development
@@ -37,7 +37,8 @@ public class Unconfigure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
return null;
}
@@ -47,7 +48,8 @@ public class Unconfigure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
return null;
}
}
@@ -60,7 +62,8 @@ public class Unconfigure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.UNCONFIGURE, getTouchpoint()));
return null;
}
@@ -70,7 +73,8 @@ public class Unconfigure extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.CONFIGURE, getTouchpoint()));
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
index 36c1859b9..0b8bfab0b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java
@@ -7,7 +7,7 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
- *
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -35,7 +35,8 @@ public class Uninstall extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
return null;
}
@@ -46,7 +47,8 @@ public class Uninstall extends InstallableUnitPhase {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
profile.addInstallableUnit(iu);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
return null;
}
}
@@ -59,7 +61,8 @@ public class Uninstall extends InstallableUnitPhase {
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
profile.removeInstallableUnit(iu);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, false, profile, iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, false, profile,
+ iu, InstallableUnitEvent.UNINSTALL, getTouchpoint()));
return null;
}
@@ -69,7 +72,8 @@ public class Uninstall extends InstallableUnitPhase {
String phaseId = (String) parameters.get(PARM_PHASE_ID);
IInstallableUnit iu = (IInstallableUnit) parameters.get(PARM_IU);
IProvisioningAgent agent = (IProvisioningAgent) parameters.get(PARM_AGENT);
- ((IProvisioningEventBus) agent.getService(IProvisioningEventBus.SERVICE_NAME)).publishEvent(new InstallableUnitEvent(phaseId, true, profile, iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
+ agent.getService(IProvisioningEventBus.class).publishEvent(new InstallableUnitEvent(phaseId, true, profile,
+ iu, InstallableUnitEvent.INSTALL, getTouchpoint()));
return null;
}
}

Back to the top