Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-01-10 03:40:50 -0500
committerAlexander Kurtakov2017-01-10 03:40:50 -0500
commit2a32a28ce58410413c26caeddbb741cdc7a5db41 (patch)
tree1fb56efb04e5387c11da969a7c4e0e64d03c730e /bundles/org.eclipse.equinox.p2.engine/src
parente0011efa5e7fea83479434ecd39831627afe2ac7 (diff)
downloadrt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.tar.gz
rt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.tar.xz
rt.equinox.p2-2a32a28ce58410413c26caeddbb741cdc7a5db41.zip
Bug 509473: Bump p2.engine and equinox.simpleconfigurator to JavaSE-1.7.
Enable some java 1.7 and older code style warnings and fix them: * Add missing @Override. * Remove redundant type declarations. * Remove useless non-javadoc comments. Change-Id: If80ea62f65204cad77275e07fee096a276d35c5c Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.engine/src')
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/DownloadManager.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Engine.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineSession.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPropertyOperand.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Phase.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PhaseSet.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepository.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfilePreferences.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileRegistryComponent.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PropertyOperand.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SharedProfilePreferences.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SizingPhaseSet.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SurrogateProfileHandler.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CertificateChecker.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Collect.java10
-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/Property.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Unconfigure.java12
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Uninstall.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/PhaseSetFactory.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileScope.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Value.java4
43 files changed, 310 insertions, 216 deletions
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
index 5a9652ea6..9077b039c 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ActionManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -90,7 +90,7 @@ public class ActionManager implements IRegistryChangeListener {
return actionMap;
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_ACTIONS);
IExtension[] extensions = point.getExtensions();
- actionMap = new HashMap<String, IConfigurationElement>(extensions.length);
+ actionMap = new HashMap<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
try {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
@@ -115,6 +115,7 @@ public class ActionManager implements IRegistryChangeListener {
return actionMap;
}
+ @Override
public synchronized void registryChanged(IRegistryChangeEvent event) {
actionMap = null;
}
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 d1df5cf0c..7c5872eb0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,7 +24,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRequest;
public class DownloadManager {
private ProvisioningContext provContext = null;
- ArrayList<IArtifactRequest> requestsToProcess = new ArrayList<IArtifactRequest>();
+ ArrayList<IArtifactRequest> requestsToProcess = new ArrayList<>();
private IProvisioningAgent agent = null;
/**
@@ -35,6 +35,7 @@ public class DownloadManager {
private static final Comparator<IArtifactRepository> LOCAL_FIRST_COMPARATOR = new Comparator<IArtifactRepository>() {
private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$
+ @Override
public int compare(IArtifactRepository arg0, IArtifactRepository arg1) {
String protocol0 = arg0.getLocation().getScheme();
String protocol1 = arg1.getLocation().getScheme();
@@ -89,7 +90,7 @@ public class DownloadManager {
provContext = new ProvisioningContext(agent);
IQueryable<IArtifactRepository> repoQueryable = provContext.getArtifactRepositories(subMonitor.newChild(250));
- IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
+ IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(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));
@@ -125,7 +126,7 @@ public class DownloadManager {
}
private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository) {
- ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>();
+ ArrayList<IArtifactRequest> applicable = new ArrayList<>();
for (IArtifactRequest request : requestsToProcess) {
if (repository.contains(request.getArtifactKey()))
applicable.add(request);
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 0b28237de..373ce7d4c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,10 +40,12 @@ public class Engine implements IEngine {
throw new IllegalArgumentException(Messages.null_operands);
}
+ @Override
public IStatus perform(IProvisioningPlan plan, IPhaseSet phaseSet, IProgressMonitor monitor) {
return perform(plan.getProfile(), phaseSet, ((ProvisioningPlan) plan).getOperands(), plan.getContext(), monitor);
}
+ @Override
public IStatus perform(IProvisioningPlan plan, IProgressMonitor monitor) {
return perform(plan, PhaseSetFactory.createDefaultPhaseSet(), monitor);
}
@@ -117,6 +119,7 @@ public class Engine implements IEngine {
return phaseSet.validate(actionManager, iprofile, operands, context, monitor);
}
+ @Override
public IProvisioningPlan createPlan(IProfile profile, ProvisioningContext context) {
return new ProvisioningPlan(profile, null, context);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java
index 8106718c8..0a2c775c8 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineActivator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2013 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -81,16 +81,18 @@ public class EngineActivator implements BundleActivator {
*/
public static final String P2_FRAGMENT_PROPERTY = "p2.fragment"; //$NON-NLS-1$
+ @Override
public void start(BundleContext aContext) throws Exception {
EngineActivator.context = aContext;
}
+ @Override
public void stop(BundleContext aContext) throws Exception {
EngineActivator.context = null;
}
public static File[] getExtensionsDirectories() {
- List<File> files = new ArrayList<File>(0);
+ List<File> files = new ArrayList<>(0);
if (EXTENSIONS != null) {
String[] locationToCheck = EXTENSIONS.split(","); //$NON-NLS-1$
for (String location : locationToCheck) {
@@ -111,7 +113,7 @@ public class EngineActivator implements BundleActivator {
// This method must match the implementation in the SimpleConfiguratorUtils with the only difference that
// parent folder of the metadata is returned.
private static ArrayList<File> getInfoFilesFromLocation(String locationToCheck) throws IOException, FileNotFoundException, URISyntaxException {
- ArrayList<File> result = new ArrayList<File>(1);
+ ArrayList<File> result = new ArrayList<>(1);
File extensionsLocation = new File(locationToCheck);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java
index e303c4eb5..a292dee72 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/EngineComponent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,9 +20,7 @@ import org.eclipse.equinox.p2.engine.IEngine;
*/
public class EngineComponent implements IAgentServiceFactory {
- /*(non-Javadoc)
- * @see org.eclipse.equinox.p2.core.spi.IAgentServiceFactory#createService(org.eclipse.equinox.p2.core.IProvisioningAgent)
- */
+ @Override
public Object createService(IProvisioningAgent agent) {
//ensure there is a garbage collector created for this agent if available
agent.getService("org.eclipse.equinox.internal.p2.garbagecollector.GarbageCollector"); //$NON-NLS-1$
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 cdf1e618a..3c4d6712d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,14 +29,14 @@ public class EngineSession {
private static class ActionsRecord {
Operand operand;
- List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ List<ProvisioningAction> actions = new ArrayList<>();
ActionsRecord(Operand operand) {
this.operand = operand;
}
}
- private List<Object[]> phaseActionRecordsPairs = new ArrayList<Object[]>();
+ private List<Object[]> phaseActionRecordsPairs = new ArrayList<>();
private Phase currentPhase;
boolean currentPhaseActive;
@@ -48,9 +48,9 @@ public class EngineSession {
private ProvisioningContext context;
- private final HashMap<String, Object> sessionServices = new HashMap<String, Object>();
+ private final HashMap<String, Object> sessionServices = new HashMap<>();
- private Set<Touchpoint> touchpoints = new HashSet<Touchpoint>();
+ private Set<Touchpoint> touchpoints = new HashSet<>();
private final IProvisioningAgent agent;
@@ -231,7 +231,7 @@ public class EngineSession {
for (ListIterator<ActionsRecord> it = actionRecords.listIterator(actionRecords.size()); it.hasPrevious();) {
ActionsRecord record = it.previous();
- List<ProvisioningAction> reversedActions = new ArrayList<ProvisioningAction>(record.actions);
+ List<ProvisioningAction> reversedActions = new ArrayList<>(record.actions);
Collections.reverse(reversedActions);
ProvisioningAction[] actions = reversedActions.toArray(new ProvisioningAction[record.actions.size()]);
try {
@@ -275,7 +275,7 @@ public class EngineSession {
throw new IllegalArgumentException(Messages.not_current_phase);
currentPhaseActive = true;
- currentActionRecords = new ArrayList<ActionsRecord>();
+ currentActionRecords = new ArrayList<>();
}
void recordPhaseEnd(Phase phase) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java
index 94f6135e2..4ccc64996 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitOperand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,6 +43,7 @@ public class InstallableUnitOperand extends Operand {
return second;
}
+ @Override
public String toString() {
return first + " --> " + second; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
index 0045d8c79..da6846d26 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPhase.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -31,11 +31,13 @@ public abstract class InstallableUnitPhase extends Phase {
this(phaseId, weight, false);
}
+ @Override
protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(PARM_INSTALL_FOLDER, profile.getProperty(IProfile.PROP_INSTALL_FOLDER));
return super.initializePhase(monitor, profile, parameters);
}
+ @Override
protected IStatus initializeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand;
MultiStatus status = new MultiStatus(EngineActivator.ID, IStatus.OK, null, null);
@@ -55,6 +57,7 @@ public abstract class InstallableUnitPhase extends Phase {
return Status.OK_STATUS;
}
+ @Override
protected IStatus completeOperand(IProfile profile, Operand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
InstallableUnitOperand iuOperand = (InstallableUnitOperand) operand;
@@ -68,6 +71,7 @@ public abstract class InstallableUnitPhase extends Phase {
return Status.OK_STATUS;
}
+ @Override
final protected List<ProvisioningAction> getActions(Operand operand) {
if (!(operand instanceof InstallableUnitOperand))
return null;
@@ -78,6 +82,7 @@ public abstract class InstallableUnitPhase extends Phase {
protected abstract List<ProvisioningAction> getActions(InstallableUnitOperand operand);
+ @Override
final public boolean isApplicable(Operand operand) {
if (!(operand instanceof InstallableUnitOperand))
return false;
@@ -96,7 +101,7 @@ public abstract class InstallableUnitPhase extends Phase {
if (instrSize == 0)
return null;
- List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ List<ProvisioningAction> actions = new ArrayList<>();
InstructionParser instructionParser = new InstructionParser(getActionManager());
for (int i = 0; i < instrSize; i++) {
actions.addAll(instructionParser.parseActions(instructions.get(i), unit.getTouchpointType()));
@@ -110,7 +115,7 @@ public abstract class InstallableUnitPhase extends Phase {
if (dataSize == 0)
return Collections.<ITouchpointInstruction> emptyList();
- ArrayList<ITouchpointInstruction> matches = new ArrayList<ITouchpointInstruction>(dataSize);
+ ArrayList<ITouchpointInstruction> matches = new ArrayList<>(dataSize);
for (ITouchpointData td : data) {
ITouchpointInstruction instructions = td.getInstruction(key);
if (instructions != null)
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPropertyOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPropertyOperand.java
index 44ab76c63..69066de98 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPropertyOperand.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstallableUnitPropertyOperand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,6 +40,7 @@ public class InstallableUnitPropertyOperand extends PropertyOperand {
return iu;
}
+ @Override
public String toString() {
return "[IInstallableUnit property for " + iu.toString() + "] " + super.toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
index 31a77f98a..2b9709d20 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/InstructionParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2010 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,7 +38,7 @@ public class InstructionParser {
}
public List<ProvisioningAction> parseActions(ITouchpointInstruction instruction, ITouchpointType touchpointType) {
- List<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ List<ProvisioningAction> actions = new ArrayList<>();
Map<String, ActionEntry> importMap = parseImportAttribute(instruction.getImportAttribute());
StringTokenizer tokenizer = new StringTokenizer(instruction.getBody(), ";"); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
@@ -51,7 +51,7 @@ public class InstructionParser {
if (importAttribute == null)
return Collections.<String, ActionEntry> emptyMap();
- Map<String, ActionEntry> result = new HashMap<String, ActionEntry>();
+ Map<String, ActionEntry> result = new HashMap<>();
StringTokenizer tokenizer = new StringTokenizer(importAttribute, ","); //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
StringTokenizer actionTokenizer = new StringTokenizer(tokenizer.nextToken(), ";"); //$NON-NLS-1$
@@ -85,7 +85,7 @@ public class InstructionParser {
return new ParameterizedProvisioningAction(action, Collections.<String, String> emptyMap(), statement);
StringTokenizer tokenizer = new StringTokenizer(nameValuePairs, ","); //$NON-NLS-1$
- Map<String, String> parameters = new HashMap<String, String>();
+ Map<String, String> parameters = new HashMap<>();
while (tokenizer.hasMoreTokens()) {
String nameValuePair = tokenizer.nextToken();
int colonIndex = nameValuePair.indexOf(":"); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java
index 2df1952f6..bb4e6eb70 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/MissingAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,10 +38,12 @@ public class MissingAction extends ProvisioningAction {
return versionRange;
}
+ @Override
public IStatus execute(Map<String, Object> parameters) {
throw new IllegalArgumentException(NLS.bind(Messages.action_not_found, actionId + (versionRange == null ? "" : "/" + versionRange.toString()))); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
// do nothing as we want this action to undo successfully
return Status.OK_STATUS;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
index 2ab439531..b614356ed 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ParameterizedProvisioningAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2012 IBM Corporation and others.
+ * Copyright (c) 2005, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,22 +29,24 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
throw new IllegalArgumentException(Messages.ParameterizedProvisioningAction_action_or_parameters_null);
this.action = action;
this.actionParameters = actionParameters;
- this.actualParameters = new HashMap<String, Object>(actionParameters.size());
+ this.actualParameters = new HashMap<>(actionParameters.size());
this.actionText = actionText;
}
+ @Override
public IStatus execute(Map<String, Object> parameters) {
parameters = processActionParameters(parameters);
return action.execute(parameters);
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
parameters = processActionParameters(parameters);
return action.undo(parameters);
}
private Map<String, Object> processActionParameters(Map<String, Object> parameters) {
- Map<String, Object> result = new HashMap<String, Object>(parameters);
+ Map<String, Object> result = new HashMap<>(parameters);
for (Entry<String, String> entry : actionParameters.entrySet()) {
String name = entry.getKey();
Object value = processVariables(entry.getValue(), parameters, false);
@@ -114,10 +116,12 @@ public class ParameterizedProvisioningAction extends ProvisioningAction {
return actionText;
}
+ @Override
public Touchpoint getTouchpoint() {
return action.getTouchpoint();
}
+ @Override
public void setTouchpoint(Touchpoint touchpoint) {
throw new UnsupportedOperationException();
}
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 a981318e9..2d9c711d8 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -43,9 +43,9 @@ public abstract class Phase {
protected int mainPerformWork = 10000;
protected int postPerformWork = 1000;
private Map<String, Object> operandParameters = null;
- private Map<String, Object> phaseParameters = new HashMap<String, Object>();
- private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointPhaseParameters = new HashMap<Touchpoint, Map<String, Object>>();
- private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointOperandParameters = new HashMap<Touchpoint, Map<String, Object>>();
+ private Map<String, Object> phaseParameters = new HashMap<>();
+ private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointPhaseParameters = new HashMap<>();
+ private Map<Touchpoint, Map<String, Object>> touchpointToTouchpointOperandParameters = new HashMap<>();
ActionManager actionManager; // injected from phaseset
protected boolean isPaused = false;
@@ -67,6 +67,7 @@ public abstract class Phase {
return actionManager;
}
+ @Override
public String toString() {
return getClass().getName() + " - " + this.weight; //$NON-NLS-1$
}
@@ -141,7 +142,7 @@ public abstract class Phase {
session.recordOperandStart(operand);
List<ProvisioningAction> actions = getActions(operand);
- operandParameters = new HashMap<String, Object>(phaseParameters);
+ operandParameters = new HashMap<>(phaseParameters);
operandParameters.put(PARM_OPERAND, operand);
mergeStatus(status, initializeOperand(profile, operand, operandParameters, subMonitor));
if (status.matches(IStatus.ERROR | IStatus.CANCEL)) {
@@ -172,7 +173,7 @@ public abstract class Phase {
parameters = touchpointToTouchpointOperandParameters.get(touchpoint);
}
if (lastResult != null) {
- parameters = new HashMap<String, Object>(parameters);
+ parameters = new HashMap<>(parameters);
parameters.put(LAST_RESULT_INTERNAL_NAME, lastResult);
}
parameters = Collections.unmodifiableMap(parameters);
@@ -221,14 +222,14 @@ public abstract class Phase {
Map<String, Object> touchpointPhaseParameters = touchpointToTouchpointPhaseParameters.get(touchpoint);
if (touchpointPhaseParameters == null) {
- touchpointPhaseParameters = new HashMap<String, Object>(phaseParameters);
+ touchpointPhaseParameters = new HashMap<>(phaseParameters);
IStatus status = touchpoint.initializePhase(monitor, profile, phaseId, touchpointPhaseParameters);
if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL))
return status;
touchpointToTouchpointPhaseParameters.put(touchpoint, touchpointPhaseParameters);
}
- Map<String, Object> touchpointOperandParameters = new HashMap<String, Object>(touchpointPhaseParameters);
+ Map<String, Object> touchpointOperandParameters = new HashMap<>(touchpointPhaseParameters);
touchpointOperandParameters.putAll(operandParameters);
IStatus status = touchpoint.initializeOperand(profile, touchpointOperandParameters);
if (status != null && status.matches(IStatus.ERROR | IStatus.CANCEL))
@@ -253,7 +254,7 @@ public abstract class Phase {
void undo(MultiStatus status, EngineSession session, IProfile profile, Operand operand, ProvisioningAction[] actions, ProvisioningContext context) {
if (operandParameters == null) {
- operandParameters = new HashMap<String, Object>(phaseParameters);
+ operandParameters = new HashMap<>(phaseParameters);
operandParameters.put(PARM_OPERAND, operand);
mergeStatus(status, initializeOperand(profile, operand, operandParameters, new NullProgressMonitor()));
Touchpoint operandTouchpoint = (Touchpoint) operandParameters.get(PARM_TOUCHPOINT);
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 6e03edabf..b9120e549 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -99,7 +99,7 @@ public class PhaseSet implements IPhaseSet {
}
public final IStatus validate(ActionManager actionManager, IProfile profile, Operand[] operands, ProvisioningContext context, IProgressMonitor monitor) {
- Set<MissingAction> missingActions = new HashSet<MissingAction>();
+ Set<MissingAction> missingActions = new HashSet<>();
for (int i = 0; i < phases.length; i++) {
Phase phase = phases[i];
phase.actionManager = actionManager;
@@ -171,6 +171,7 @@ public class PhaseSet implements IPhaseSet {
return count;
}
+ @Override
public String[] getPhaseIds() {
String[] ids = new String[phases.length];
for (int i = 0; i < ids.length; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
index 1572bf9ee..c477a8493 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/Profile.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -35,6 +35,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
* An index that limits the candidates to those units that has profile properties
*/
class ProfilePropertyIndex implements IIndex<IInstallableUnit> {
+ @Override
public Iterator<IInstallableUnit> getCandidates(IEvaluationContext ctx, IExpression variable, IExpression booleanExpr) {
return iuProperties.keySet().iterator();
}
@@ -65,7 +66,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
private OrderedProperties storage = new OrderedProperties();
private IUMap ius = new IUMap();
- final Map<IInstallableUnit, OrderedProperties> iuProperties = new HashMap<IInstallableUnit, OrderedProperties>();
+ final Map<IInstallableUnit, OrderedProperties> iuProperties = new HashMap<>();
private boolean changed = false;
private long timestamp;
@@ -83,16 +84,11 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getProfileId()
- */
+ @Override
public String getProfileId() {
return profileId;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getParentProfile()
- */
public IProfile getParentProfile() {
return parentProfile;
}
@@ -113,16 +109,13 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
* A profile is a root profile if it is not a sub-profile
* of another profile.
*/
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#isRootProfile()
- */
public boolean isRootProfile() {
return parentProfile == null;
}
public void addSubProfile(String subProfileId) throws IllegalArgumentException {
if (subProfileIds == null)
- subProfileIds = new ArrayList<String>();
+ subProfileIds = new ArrayList<>();
if (!subProfileIds.contains(subProfileId))
subProfileIds.add(subProfileId);
@@ -136,25 +129,17 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
subProfileIds.remove(subProfileId);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#hasSubProfiles()
- */
public boolean hasSubProfiles() {
return subProfileIds != null && !subProfileIds.isEmpty();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getSubProfileIds()
- */
public List<String> getSubProfileIds() {
if (subProfileIds == null)
return Collections.<String> emptyList();
return Collections.unmodifiableList(subProfileIds);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getProperty(java.lang.String)
- */
+ @Override
public String getProperty(String key) {
String value = getLocalProperty(key);
if (value == null && parentProfile != null) {
@@ -163,9 +148,6 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
return value;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getLocalProperty(java.lang.String)
- */
public String getLocalProperty(String key) {
return storage.getProperty(key);
}
@@ -184,6 +166,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
changed = true;
}
+ @Override
public synchronized IIndex<IInstallableUnit> getIndex(String memberName) {
if (InstallableUnit.MEMBER_ID.equals(memberName)) {
if (idIndex == null)
@@ -205,10 +188,12 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
return null;
}
+ @Override
public Iterator<IInstallableUnit> everything() {
return ius.iterator();
}
+ @Override
public Object getManagedProperty(Object client, String memberName, Object key) {
if (!(client instanceof IInstallableUnit))
return null;
@@ -225,15 +210,14 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
return null;
}
+ @Override
public IQueryResult<IInstallableUnit> available(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (surrogateProfileHandler != null)
return surrogateProfileHandler.queryProfile(this, query, monitor);
return query(query, new NullProgressMonitor());
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getInstallableUnitProperty(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit, java.lang.String)
- */
+ @Override
public String getInstallableUnitProperty(IInstallableUnit iu, String key) {
OrderedProperties properties = iuProperties.get(iu);
if (properties == null)
@@ -272,25 +256,21 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
// return iu.getId() + "_" + iu.getVersion().toString(); //$NON-NLS-1$
// }
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getLocalProperties()
- */
public Map<String, String> getLocalProperties() {
return OrderedProperties.unmodifiableProperties(storage);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getProperties()
- */
+ @Override
public Map<String, String> getProperties() {
if (parentProfile == null)
return getLocalProperties();
- Map<String, String> properties = new HashMap<String, String>(parentProfile.getProperties());
+ Map<String, String> properties = new HashMap<>(parentProfile.getProperties());
properties.putAll(storage);
return OrderedProperties.unmodifiableProperties(properties);
}
+ @Override
public IProvisioningAgent getProvisioningAgent() {
return agent;
}
@@ -319,9 +299,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
changed = true;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.engine.IProfile#getInstallableUnitProperties(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit)
- */
+ @Override
public Map<String, String> getInstallableUnitProperties(IInstallableUnit iu) {
OrderedProperties properties = iuProperties.get(iu);
if (properties == null)
@@ -390,7 +368,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
public void clearOrphanedInstallableUnitProperties() {
Set<IInstallableUnit> keys = iuProperties.keySet();
// Set orphans = new HashSet();
- Collection<IInstallableUnit> toRemove = new ArrayList<IInstallableUnit>();
+ Collection<IInstallableUnit> toRemove = new ArrayList<>();
for (IInstallableUnit iu : keys) {
if (!ius.contains(iu))
toRemove.add(iu);
@@ -406,6 +384,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
// iuProperties.keySet().retainAll(iuKeys);
}
+ @Override
public long getTimestamp() {
return timestamp;
}
@@ -421,6 +400,7 @@ public class Profile extends IndexProvider<IInstallableUnit> implements IProfile
/**
* Prints a string representation for debugging purposes only.
*/
+ @Override
public String toString() {
return "Profile(" + getProfileId() + ')'; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
index c81fd933f..057eb5b71 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,24 +27,17 @@ public class ProfileEvent extends EventObject implements IProfileEvent {
this.reason = reason;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProfileEvent#getReason()
- */
+ @Override
public int getReason() {
return reason;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProfileEvent#getProfileId()
- */
+ @Override
public String getProfileId() {
return (String) getSource();
}
- /*
- * (non-Javadoc)
- * @see java.util.EventObject#toString()
- */
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("ProfileEvent["); //$NON-NLS-1$
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 4051a1ade..af0453700 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2016 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -39,7 +39,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
public static final String TYPE = "org.eclipse.equinox.p2.engine.repo.metadataRepository"; //$NON-NLS-1$
public static final Integer VERSION = 1;
private IProfile profile;
- private HashSet<IRepositoryReference> repositories = new HashSet<IRepositoryReference>();
+ private HashSet<IRepositoryReference> repositories = new HashSet<>();
public ProfileMetadataRepository(IProvisioningAgent agent, URI location, IProgressMonitor monitor) throws ProvisionException {
super(agent, location.toString(), TYPE, VERSION.toString(), location, null, null, null);
@@ -65,7 +65,7 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
}
private List<URI> findArtifactRepos() {
- List<URI> artifactRepos = new ArrayList<URI>();
+ List<URI> artifactRepos = new ArrayList<>();
File p2Directory = findP2Directory();
// Add the profile registry's default agent artifact repository.
@@ -154,14 +154,17 @@ public class ProfileMetadataRepository extends AbstractMetadataRepository {
return p2EngineDirectory.getParentFile();
}
+ @Override
public Collection<IRepositoryReference> getReferences() {
return Collections.unmodifiableCollection(repositories);
}
+ @Override
public void initialize(RepositoryState state) {
// nothing to do
}
+ @Override
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
return profile.query(query, monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
index 54825d876..ce3cf8947 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileMetadataRepositoryFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,10 +24,12 @@ public class ProfileMetadataRepositoryFactory extends MetadataRepositoryFactory
* @throws ProvisionException
* documenting to avoid warning
*/
+ @Override
public IMetadataRepository create(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
return null;
}
+ @Override
public IMetadataRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
//return null if the caller wanted a modifiable repo
if ((flags & IRepositoryManager.REPOSITORY_HINT_MODIFIABLE) > 0) {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
index eb55ae93d..665e88c43 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileParser.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,6 +46,7 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
this.profileId = profileId;
}
+ @Override
protected void handleRootAttributes(Attributes attributes) {
profileId = parseRequiredAttributes(attributes, required)[0];
parentId = parseOptionalAttribute(attributes, PARENT_ID_ATTRIBUTE);
@@ -53,6 +54,7 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (PROPERTIES_ELEMENT.equals(name)) {
if (propertiesHandler == null) {
@@ -139,12 +141,14 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
iuIdentity = id + "_" + version.toString(); //$NON-NLS-1$
}
+ @Override
protected void finished() {
if (isValidXML() && iuIdentity != null && propertiesHandler != null) {
iusPropertiesMap.put(iuIdentity, propertiesHandler.getProperties());
}
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (name.equals(PROPERTIES_ELEMENT)) {
propertiesHandler = new PropertiesHandler(this, attributes);
@@ -162,13 +166,14 @@ public abstract class ProfileParser extends MetadataParser implements ProfileXML
super(parentHandler, IUS_PROPERTIES_ELEMENT);
String sizeStr = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
int size = (sizeStr != null ? Integer.parseInt(sizeStr) : 4);
- iusPropertiesMap = new LinkedHashMap<String, Map<String, String>>(size);
+ iusPropertiesMap = new LinkedHashMap<>(size);
}
public Map<String, Map<String, String>> getIUsPropertiesMap() {
return iusPropertiesMap;
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (name.equals(IU_PROPERTIES_ELEMENT)) {
new IUPropertiesHandler(this, attributes, iusPropertiesMap);
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 d62eb97e5..91a6c0952 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,10 +40,12 @@ public class ProfilePreferences extends EclipsePreferences {
this.agent = agent;
}
+ @Override
public boolean belongsTo(Object family) {
return family == PROFILE_SAVE_JOB_FAMILY;
}
+ @Override
protected IStatus run(IProgressMonitor monitor) {
try {
doSave(agent);
@@ -200,6 +202,7 @@ public class ProfilePreferences extends EclipsePreferences {
return computeLocation(dataArea, qualifier);
}
+ @Override
protected IEclipsePreferences getLoadLevel() {
if (loadLevel == null) {
if (qualifier == null)
@@ -224,6 +227,7 @@ public class ProfilePreferences extends EclipsePreferences {
return computeLocation(new Path(profileDataDirectory.getAbsolutePath()), qualifier);
}
+ @Override
protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
if (nodeName.equals("shared") && segmentCount == 1) { //$NON-NLS-1$
return new SharedProfilePreferences(nodeParent, nodeName);
@@ -231,6 +235,7 @@ public class ProfilePreferences extends EclipsePreferences {
return new ProfilePreferences(nodeParent, nodeName);
}
+ @Override
protected boolean isAlreadyLoaded(IEclipsePreferences node) {
return loadedNodes.contains(node.absolutePath());
}
@@ -243,6 +248,7 @@ public class ProfilePreferences extends EclipsePreferences {
* (non-Javadoc)
* Create an Engine phase to load profile preferences
*/
+ @Override
protected void load() throws BackingStoreException {
synchronized (((ProfilePreferences) parent).profileLock) {
IProvisioningAgent agent = getAgent(getAgentLocationSegment());
@@ -267,10 +273,12 @@ public class ProfilePreferences extends EclipsePreferences {
}
}
+ @Override
protected void loaded() {
loadedNodes.add(name());
}
+ @Override
public void removeNode() throws BackingStoreException {
super.removeNode();
loadedNodes.remove(this.absolutePath());
@@ -280,6 +288,7 @@ public class ProfilePreferences extends EclipsePreferences {
* Schedules the save job. This method is synchronized to protect lazily initialization
* of the save job instance.
*/
+ @Override
protected synchronized void save() throws BackingStoreException {
try {
IProvisioningAgent agent = getAgent(getAgentLocationSegment());
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 ee2f5dc78..f087ef823 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@ import org.eclipse.equinox.p2.engine.IProfileRegistry;
*/
public class ProfileRegistryComponent implements IAgentServiceFactory {
+ @Override
public Object createService(IProvisioningAgent agent) {
IAgentLocation location = (IAgentLocation) agent.getService(IAgentLocation.SERVICE_NAME);
SimpleProfileRegistry registry = new SimpleProfileRegistry(agent, SimpleProfileRegistry.getDefaultRegistryDirectory(location));
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
index 9832bc5d4..7f9e93085 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProfileWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,14 +10,13 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.engine;
-import org.eclipse.equinox.p2.query.QueryUtil;
-
import java.io.IOException;
import java.io.OutputStream;
import java.util.*;
import org.eclipse.equinox.internal.p2.metadata.repository.io.MetadataWriter;
import org.eclipse.equinox.p2.engine.IProfile;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.QueryUtil;
public class ProfileWriter extends MetadataWriter implements ProfileXMLConstants {
@@ -30,8 +29,9 @@ public class ProfileWriter extends MetadataWriter implements ProfileXMLConstants
attribute(ID_ATTRIBUTE, profile.getProfileId());
attribute(TIMESTAMP_ATTRIBUTE, Long.toString(profile.getTimestamp()));
writeProperties(profile.getProperties());
- ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(profile.query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet());
+ ArrayList<IInstallableUnit> ius = new ArrayList<>(profile.query(QueryUtil.createIUAnyQuery(), null).toUnmodifiableSet());
Collections.sort(ius, new Comparator<IInstallableUnit>() {
+ @Override
public int compare(IInstallableUnit iu1, IInstallableUnit iu2) {
int IdCompare = iu1.getId().compareTo(iu2.getId());
if (IdCompare != 0)
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PropertyOperand.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PropertyOperand.java
index 55593dceb..5e122012b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PropertyOperand.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/PropertyOperand.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,6 +49,7 @@ public class PropertyOperand extends Operand {
return key;
}
+ @Override
public String toString() {
return key + " = " + first + " --> " + second; //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
index 7703e3a67..b2725fe51 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/ProvisioningPlan.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,7 +22,7 @@ import org.eclipse.equinox.p2.query.*;
public class ProvisioningPlan implements IProvisioningPlan {
final IProfile profile;
- final List<Operand> operands = new ArrayList<Operand>();
+ final List<Operand> operands = new ArrayList<>();
final ProvisioningContext context;
IQueryable<IInstallableUnit> futureState;
IStatus status;
@@ -46,20 +46,17 @@ public class ProvisioningPlan implements IProvisioningPlan {
this.installerPlan = installerPlan;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getStatus()
- */
+ @Override
public IStatus getStatus() {
return status;
}
+ @Override
public void setStatus(IStatus status) {
this.status = status;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getProfile()
- */
+ @Override
public IProfile getProfile() {
return profile;
}
@@ -68,20 +65,17 @@ public class ProvisioningPlan implements IProvisioningPlan {
return operands.toArray(new Operand[operands.size()]);
}
+ @Override
public boolean isEmpty() {
return operands.isEmpty();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getRemovals()
- */
+ @Override
public IQueryable<IInstallableUnit> getRemovals() {
return new QueryablePlan(false);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getAdditions()
- */
+ @Override
public IQueryable<IInstallableUnit> getAdditions() {
return new QueryablePlan(true);
}
@@ -93,10 +87,11 @@ public class ProvisioningPlan implements IProvisioningPlan {
this.addition = add;
}
+ @Override
public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (operands == null || status.getSeverity() == IStatus.ERROR)
return Collector.emptyCollector();
- Collection<IInstallableUnit> list = new ArrayList<IInstallableUnit>();
+ Collection<IInstallableUnit> list = new ArrayList<>();
for (Operand operand : operands) {
if (!(operand instanceof InstallableUnitOperand))
continue;
@@ -109,33 +104,37 @@ public class ProvisioningPlan implements IProvisioningPlan {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.IProvisioningPlan#getInstallerPlan()
- */
+ @Override
public IProvisioningPlan getInstallerPlan() {
return installerPlan;
}
+ @Override
public ProvisioningContext getContext() {
return context;
}
+ @Override
public void setInstallerPlan(IProvisioningPlan p) {
installerPlan = p;
}
+ @Override
public void addInstallableUnit(IInstallableUnit iu) {
operands.add(new InstallableUnitOperand(null, iu));
}
+ @Override
public void removeInstallableUnit(IInstallableUnit iu) {
operands.add(new InstallableUnitOperand(iu, null));
}
+ @Override
public void updateInstallableUnit(IInstallableUnit iu1, IInstallableUnit iu2) {
operands.add(new InstallableUnitOperand(iu1, iu2));
}
+ @Override
public void setProfileProperty(String name, String value) {
String currentValue = profile.getProperty(name);
if (value == null && currentValue == null)
@@ -143,6 +142,7 @@ public class ProvisioningPlan implements IProvisioningPlan {
operands.add(new PropertyOperand(name, currentValue, value));
}
+ @Override
public void setInstallableUnitProfileProperty(IInstallableUnit iu, String name, String value) {
String currentValue = profile.getInstallableUnitProperty(iu, name);
if (value == null && currentValue == null)
@@ -150,10 +150,12 @@ public class ProvisioningPlan implements IProvisioningPlan {
operands.add(new InstallableUnitPropertyOperand(iu, name, currentValue, value));
}
+ @Override
public IQueryable<IInstallableUnit> getFutureState() {
return futureState;
}
+ @Override
public void setFuturePlan(IQueryable<IInstallableUnit> futureState) {
this.futureState = futureState;
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SharedProfilePreferences.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SharedProfilePreferences.java
index e249bfce5..0cd9e10dd 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SharedProfilePreferences.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SharedProfilePreferences.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 Ericsson AB and others.
+ * Copyright (c) 2012, 2017 Ericsson AB and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,19 +46,23 @@ public class SharedProfilePreferences extends ProfilePreferences {
qualifier = getQualifierSegment();
}
+ @Override
protected IProvisioningAgent getAgent(String segment) throws BackingStoreException {
IProvisioningAgent agent = super.getAgent(segment);
return (IProvisioningAgent) agent.getService(IProvisioningAgent.SHARED_BASE_AGENT);
}
+ @Override
protected void doSave(IProvisioningAgent agent) throws BackingStoreException {
throw new BackingStoreException("Can't store in shared install"); //$NON-NLS-1$
}
+ @Override
protected EclipsePreferences internalCreate(EclipsePreferences nodeParent, String nodeName, Object context) {
return new SharedProfilePreferences(nodeParent, nodeName);
}
+ @Override
protected IEclipsePreferences getLoadLevel() {
if (loadLevel == null) {
if (qualifier == null)
@@ -74,18 +78,22 @@ public class SharedProfilePreferences extends ProfilePreferences {
return loadLevel;
}
+ @Override
protected synchronized void save() throws BackingStoreException {
throw new BackingStoreException("Can't store in shared install");
}
+ @Override
protected String getQualifierSegment() {
return getSegment(absolutePath(), 4);
}
+ @Override
protected String getProfileIdSegment() {
return getSegment(absolutePath(), 3);
}
+ @Override
protected String getAgentLocationSegment() {
return getSegment(absolutePath(), 2);
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
index 451822ebb..5e91fd6e0 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SimpleProfileRegistry.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2007, 2017 IBM Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -57,7 +57,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
* Reference to Map of String(Profile id)->Profile.
*/
private SoftReference<Map<String, Profile>> profiles;
- private Map<String, ProfileLock> profileLocks = new HashMap<String, ProfileLock>();
+ private Map<String, ProfileLock> profileLocks = new HashMap<>();
private String self;
@@ -171,10 +171,12 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return changed;
}
+ @Override
public synchronized String toString() {
return "Profile registry for location: " + store.getAbsolutePath() + "\n" + getProfileMap().toString(); //$NON-NLS-1$ //$NON-NLS-2$
}
+ @Override
public synchronized IProfile getProfile(String id) {
Profile profile = internalGetProfile(id);
if (profile == null)
@@ -182,6 +184,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return profile.snapshot();
}
+ @Override
public synchronized IProfile getProfile(String id, long timestamp) {
if (SELF.equals(id))
id = self;
@@ -212,6 +215,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return parser.getProfileMap().get(id);
}
+ @Override
public synchronized long[] listProfileTimestamps(String id) {
if (SELF.equals(id))
id = self;
@@ -224,6 +228,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return new long[0];
File[] profileFiles = profileDirectory.listFiles(new FileFilter() {
+ @Override
public boolean accept(File pathname) {
return (pathname.getName().endsWith(PROFILE_EXT) || pathname.getName().endsWith(PROFILE_GZ_EXT)) && pathname.isFile() && !pathname.getName().startsWith("._"); //$NON-NLS-1$
}
@@ -346,6 +351,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return getProfileMap().get(id);
}
+ @Override
public synchronized IProfile[] getProfiles() {
Map<String, Profile> profileMap = getProfileMap();
Profile[] result = new Profile[profileMap.size()];
@@ -367,8 +373,8 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
Map<String, Profile> result = restore();
if (result == null)
- result = new LinkedHashMap<String, Profile>(8);
- profiles = new SoftReference<Map<String, Profile>>(result);
+ result = new LinkedHashMap<>(8);
+ profiles = new SoftReference<>(result);
if (updateSelfProfile) {
//update self profile on first load
updateSelfProfile(result);
@@ -403,10 +409,12 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
broadcastChangeEvent(id, IProfileEvent.CHANGED);
}
+ @Override
public IProfile addProfile(String id) throws ProvisionException {
return addProfile(id, null, null);
}
+ @Override
public IProfile addProfile(String id, Map<String, String> profileProperties) throws ProvisionException {
return addProfile(id, profileProperties, null);
}
@@ -436,6 +444,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
return profile.snapshot();
}
+ @Override
public synchronized void removeProfile(String profileId) {
if (SELF.equals(profileId))
profileId = self;
@@ -469,6 +478,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
broadcastChangeEvent(profileId, IProfileEvent.REMOVED);
}
+ @Override
public synchronized void removeProfile(String id, long timestamp) throws ProvisionException {
if (SELF.equals(id))
id = self;
@@ -511,6 +521,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
Parser parser = new Parser(EngineActivator.getContext(), EngineActivator.ID);
File[] profileDirectories = store.listFiles(new FileFilter() {
+ @Override
public boolean accept(File pathname) {
return pathname.getName().endsWith(PROFILE_EXT) && pathname.isDirectory();
}
@@ -555,6 +566,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
File latest = null;
long latestTimestamp = 0;
File[] profileFiles = profileDirectory.listFiles(new FileFilter() {
+ @Override
public boolean accept(File pathname) {
return (pathname.getName().endsWith(PROFILE_GZ_EXT) || pathname.getName().endsWith(PROFILE_EXT)) && !pathname.isDirectory();
}
@@ -699,7 +711,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
* as written by the Writer class.
*/
class Parser extends ProfileParser {
- private final Map<String, ProfileHandler> profileHandlers = new HashMap<String, ProfileHandler>();
+ private final Map<String, ProfileHandler> profileHandlers = new HashMap<>();
public Map<String, ProfileHandler> getProfileHandlers() {
return Collections.unmodifiableMap(profileHandlers);
@@ -746,12 +758,13 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
}
+ @Override
protected Object getRootObject() {
return this;
}
public Map<String, Profile> getProfileMap() {
- Map<String, Profile> profileMap = new HashMap<String, Profile>();
+ Map<String, Profile> profileMap = new HashMap<>();
for (String profileId : profileHandlers.keySet()) {
addProfile(profileId, profileMap);
}
@@ -800,6 +813,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
super(rootName, rootHandler);
}
+ @Override
public void processingInstruction(String target, String data) throws SAXException {
if (ProfileXMLConstants.PROFILE_TARGET.equals(target)) {
Version repositoryVersion = extractPIVersion(target, data);
@@ -810,10 +824,12 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
}
+ @Override
protected String getErrorMessage() {
return Messages.SimpleProfileRegistry_Parser_Error_Parsing_Registry;
}
+ @Override
public String toString() {
// TODO:
return null;
@@ -821,6 +837,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
+ @Override
public synchronized boolean isCurrent(IProfile profile) {
Profile internalProfile = getProfileMap().get(profile.getProfileId());
if (internalProfile == null)
@@ -897,6 +914,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry#containsProfile(java.lang.String)
*/
+ @Override
public synchronized boolean containsProfile(String id) {
if (SELF.equals(id))
id = self;
@@ -913,6 +931,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
if (!profileDirectory.isDirectory())
return false;
File[] profileFiles = profileDirectory.listFiles(new FileFilter() {
+ @Override
public boolean accept(File pathname) {
return (pathname.getName().endsWith(PROFILE_GZ_EXT) || pathname.getName().endsWith(PROFILE_EXT)) && pathname.isFile();
}
@@ -955,6 +974,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/*(non-Javadoc)
* @see org.eclipse.equinox.p2.core.spi.IAgentService#start()
*/
+ @Override
public void start() {
//nothing to do
}
@@ -962,6 +982,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/*(non-Javadoc)
* @see org.eclipse.equinox.p2.core.spi.IAgentService#stop()
*/
+ @Override
public void stop() {
try {
//ensure there are no more profile preference save jobs running
@@ -1090,7 +1111,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
private Properties pruneStateProperties(String id, Properties properties) {
Properties result = new Properties();
long[] timestamps = listProfileTimestamps(id);
- HashSet<String> timestampsSet = new HashSet<String>(timestamps.length);
+ HashSet<String> timestampsSet = new HashSet<>(timestamps.length);
for (int i = 0; i < timestamps.length; i++) {
timestampsSet.add(String.valueOf(timestamps[i]));
}
@@ -1124,6 +1145,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProfileRegistry#setProfileStateProperties(java.lang.String, long, java.util.Map)
*/
+ @Override
public IStatus setProfileStateProperties(String id, long timestamp, Map<String, String> propertiesToAdd) {
if (id == null || propertiesToAdd == null)
throw new NullPointerException();
@@ -1160,6 +1182,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProfileRegistry#setProfileStateProperty(java.lang.String, long, java.lang.String, java.lang.String)
*/
+ @Override
public IStatus setProfileStateProperty(String id, long timestamp, String key, String value) {
if (id == null)
throw new NullPointerException();
@@ -1172,12 +1195,13 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
private IStatus internalSetProfileStateProperty(IProfile profile, long timestamp, String key, String value) {
if (key == null || value == null)
throw new NullPointerException();
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put(key, value);
return internalSetProfileStateProperties(profile, timestamp, properties);
}
+ @Override
public Map<String, String> getProfileStateProperties(String id, long timestamp) {
if (id == null)
throw new NullPointerException();
@@ -1188,7 +1212,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
private Map<String, String> internalGetProfileStateProperties(IProfile profile, long timestamp, boolean lock) {
- Map<String, String> result = new HashMap<String, String>();
+ Map<String, String> result = new HashMap<>();
String timestampString = String.valueOf(timestamp);
int keyOffset = timestampString.length() + 1;
lock = lock || lastAccessedProperties == null;
@@ -1215,6 +1239,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProfileRegistry#getProfileStateProperties(java.lang.String, java.lang.String)
*/
+ @Override
public Map<String, String> getProfileStateProperties(String id, String userKey) {
if (id == null || userKey == null)
throw new NullPointerException();
@@ -1226,7 +1251,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
}
private Map<String, String> internalGetProfileStateProperties(IProfile profile, String userKey, boolean lock) {
- Map<String, String> result = new HashMap<String, String>();
+ Map<String, String> result = new HashMap<>();
lock = lock || lastAccessedProperties == null;
if (lock)
if (!internalLockProfile(profile))
@@ -1254,6 +1279,7 @@ public class SimpleProfileRegistry implements IProfileRegistry, IAgentService {
/* (non-Javadoc)
* @see org.eclipse.equinox.p2.engine.IProfileRegistry#removeProfileStateProperties(java.lang.String, long, java.util.Collection)
*/
+ @Override
public IStatus removeProfileStateProperties(String id, long timestamp, Collection<String> keys) {
if (id == null)
throw new NullPointerException();
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SizingPhaseSet.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SizingPhaseSet.java
index b82a208b3..3bc7b0e0e 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SizingPhaseSet.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/SizingPhaseSet.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -22,16 +22,12 @@ public class SizingPhaseSet extends PhaseSet implements ISizingPhaseSet {
super(new Phase[] {sizing = new Sizing(100)});
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.ISizingPhaseSet#getDiskSize()
- */
+ @Override
public long getDiskSize() {
return sizing.getDiskSize();
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.engine.ISizingPhaseSet#getDownloadSize()
- */
+ @Override
public long getDownloadSize() {
return sizing.getDownloadSize();
}
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 3d7e313fa..ee97dc20d 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -76,12 +76,12 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
iuDescription.setId("SharedProfile_" + sharedProfile.getProfileId()); //$NON-NLS-1$
iuDescription.setVersion(Version.createOSGi(1, 0, 0, Long.toString(sharedProfile.getTimestamp())));
- ArrayList<IProvidedCapability> iuCapabilities = new ArrayList<IProvidedCapability>();
+ ArrayList<IProvidedCapability> iuCapabilities = new ArrayList<>();
IProvidedCapability selfCapability = MetadataFactory.createProvidedCapability(IInstallableUnit.NAMESPACE_IU_ID, iuDescription.getId(), iuDescription.getVersion());
iuCapabilities.add(selfCapability);
iuDescription.addProvidedCapabilities(iuCapabilities);
- ArrayList<IRequirement> iuRequirements = new ArrayList<IRequirement>();
+ 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();
@@ -203,9 +203,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
}
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#createProfile(java.lang.String)
- */
+ @Override
public IProfile createProfile(String id) {
final Profile sharedProfile = (Profile) getSharedProfile(id);
if (sharedProfile == null)
@@ -222,7 +220,7 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
}
File[] extensionLocations = EngineActivator.getExtensionsDirectories();
- Set<IInstallableUnit> added = new HashSet<IInstallableUnit>();
+ Set<IInstallableUnit> added = new HashSet<>();
for (File extension : extensionLocations) {
try {
IMetadataRepositoryManager metaManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
@@ -266,23 +264,19 @@ public class SurrogateProfileHandler implements ISurrogateProfileHandler {
return userProfile;
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#isSurrogate(org.eclipse.equinox.internal.provisional.p2.engine.IProfile)
- */
+ @Override
public boolean isSurrogate(IProfile profile) {
return Boolean.parseBoolean(profile.getProperty(PROP_SURROGATE));
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.engine.ISurrogateProfileHandler#queryProfile(org.eclipse.equinox.internal.provisional.p2.engine.IProfile, org.eclipse.equinox.internal.provisional.p2.query.Query, org.eclipse.equinox.internal.provisional.p2.query.Collector, org.eclipse.core.runtime.IProgressMonitor)
- */
+ @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<IInstallableUnit>();
+ Collector<IInstallableUnit> result = new Collector<>();
result.addAll(sharedProfile.query(query, monitor));
result.addAll(profile.query(query, monitor));
return result;
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
index f62f6e1cf..1775eeee5 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/TouchpointManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -76,6 +76,7 @@ public class TouchpointManager implements IRegistryChangeListener {
}
}
+ @Override
public String toString() {
StringBuffer result = new StringBuffer(element.toString());
if (createdExtension) {
@@ -134,7 +135,7 @@ public class TouchpointManager implements IRegistryChangeListener {
IExtensionPoint point = RegistryFactory.getRegistry().getExtensionPoint(EngineActivator.ID, PT_TOUCHPOINTS);
IExtension[] extensions = point.getExtensions();
- touchpointEntries = new HashMap<String, TouchpointEntry>(extensions.length);
+ touchpointEntries = new HashMap<>(extensions.length);
for (int i = 0; i < extensions.length; i++) {
try {
IConfigurationElement[] elements = extensions[i].getConfigurationElements();
@@ -167,9 +168,7 @@ public class TouchpointManager implements IRegistryChangeListener {
LogHelper.log(errorStatus);
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IRegistryChangeListener#registryChanged(org.eclipse.core.runtime.IRegistryChangeEvent)
- */
+ @Override
public synchronized void registryChanged(IRegistryChangeEvent event) {
// just flush the cache when something changed. It will be recomputed on demand.
touchpointEntries = null;
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 671f1eeb1..9d4aa310f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2012 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,8 @@ import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.engine.*;
-import org.eclipse.equinox.p2.core.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.UIServices;
import org.eclipse.equinox.p2.core.UIServices.TrustInfo;
import org.eclipse.osgi.service.security.TrustEngine;
import org.eclipse.osgi.signedcontent.*;
@@ -43,7 +44,7 @@ public class CertificateChecker {
public CertificateChecker(IProvisioningAgent agent) {
this.agent = agent;
- artifacts = new ArrayList<File>();
+ artifacts = new ArrayList<>();
}
public IStatus start() {
@@ -61,10 +62,10 @@ public class CertificateChecker {
UIServices serviceUI = (UIServices) agent.getService(UIServices.SERVICE_NAME);
SignedContent content = null;
SignerInfo[] signerInfo = null;
- ArrayList<Certificate> untrusted = new ArrayList<Certificate>();
- ArrayList<File> unsigned = new ArrayList<File>();
- ArrayList<Certificate[]> untrustedChain = new ArrayList<Certificate[]>();
- Map<Certificate, Collection<File>> untrustedArtifacts = new HashMap<Certificate, Collection<File>>();
+ ArrayList<Certificate> untrusted = new ArrayList<>();
+ ArrayList<File> unsigned = new ArrayList<>();
+ ArrayList<Certificate[]> untrustedChain = new ArrayList<>();
+ Map<Certificate, Collection<File>> untrustedArtifacts = new HashMap<>();
IStatus status = Status.OK_STATUS;
if (artifacts.size() == 0 || serviceUI == null)
return status;
@@ -92,7 +93,7 @@ public class CertificateChecker {
if (untrustedArtifacts.containsKey(certificateChain[0])) {
untrustedArtifacts.get(certificateChain[0]).add(artifact);
} else {
- untrustedArtifacts.put(certificateChain[0], new ArrayList<File>(Arrays.asList(artifact)));
+ untrustedArtifacts.put(certificateChain[0], new ArrayList<>(Arrays.asList(artifact)));
}
}
}
@@ -181,7 +182,7 @@ public class CertificateChecker {
if (trustedCertificates == null)
// I'm pretty sure this would be a bug; trustedCertificates should never be null here.
return new Status(IStatus.INFO, EngineActivator.ID, Messages.CertificateChecker_CertificateRejected);
- ServiceTracker<TrustEngine, TrustEngine> trustEngineTracker = new ServiceTracker<TrustEngine, TrustEngine>(EngineActivator.getContext(), TrustEngine.class, null);
+ ServiceTracker<TrustEngine, TrustEngine> trustEngineTracker = new ServiceTracker<>(EngineActivator.getContext(), TrustEngine.class, null);
trustEngineTracker.open();
Object[] trustEngines = trustEngineTracker.getServices();
try {
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
index a72af6a42..814c74009 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/CheckTrust.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,8 +17,8 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitOperand;
import org.eclipse.equinox.internal.p2.engine.InstallableUnitPhase;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.metadata.ITouchpointType;
@@ -35,10 +35,12 @@ public class CheckTrust extends InstallableUnitPhase {
super(PhaseSetFactory.PHASE_CHECK_TRUST, weight);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.second() != null);
}
+ @Override
protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
@SuppressWarnings("unchecked")
Collection<File> artifactRequests = (Collection<File>) parameters.get(PARM_ARTIFACT_FILES);
@@ -52,6 +54,7 @@ public class CheckTrust extends InstallableUnitPhase {
return status;
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
@@ -70,6 +73,7 @@ public class CheckTrust extends InstallableUnitPhase {
return Collections.singletonList(action);
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
parameters.put(PARM_IU, iu);
@@ -77,6 +81,7 @@ public class CheckTrust extends InstallableUnitPhase {
return super.initializeOperand(profile, operand, parameters, monitor);
}
+ @Override
protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(PARM_ARTIFACT_FILES, new ArrayList<File>());
return super.initializePhase(monitor, profile, parameters);
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 e53c94754..9e83c6d33 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,10 +40,12 @@ public class Collect extends InstallableUnitPhase {
postPerformWork = 1000;
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.second() != null && !op.second().equals(op.first()));
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
@@ -62,10 +64,12 @@ public class Collect extends InstallableUnitPhase {
return Collections.singletonList(action);
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Collect_Error;
}
+ @Override
protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
// do nothing for rollback if the provisioning has been cancelled
if (monitor.isCanceled())
@@ -90,7 +94,7 @@ public class Collect extends InstallableUnitPhase {
return Status.CANCEL_STATUS;
}
- List<IArtifactRequest> totalArtifactRequests = new ArrayList<IArtifactRequest>(artifactRequests.size());
+ 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++) {
@@ -113,6 +117,7 @@ public class Collect extends InstallableUnitPhase {
}
}
+ @Override
protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
return null;
@@ -134,6 +139,7 @@ public class Collect extends InstallableUnitPhase {
}
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IStatus status = super.initializeOperand(profile, operand, parameters, monitor);
// defer setting the IU until after the super method to avoid triggering touchpoint initialization
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 f7fc7c871..1d69262cb 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -29,6 +29,7 @@ public class Configure extends InstallableUnitPhase {
final static class BeforeConfigureEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -38,6 +39,7 @@ public class Configure extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -50,6 +52,7 @@ public class Configure extends InstallableUnitPhase {
final static class AfterConfigureEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -59,6 +62,7 @@ public class Configure extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -73,10 +77,12 @@ public class Configure extends InstallableUnitPhase {
super(PhaseSetFactory.PHASE_CONFIGURE, weight);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.second() != null);
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
IInstallableUnit unit = currentOperand.second();
@@ -87,7 +93,7 @@ public class Configure extends InstallableUnitPhase {
beforeAction.setTouchpoint(touchpoint);
afterAction.setTouchpoint(touchpoint);
}
- ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ ArrayList<ProvisioningAction> actions = new ArrayList<>();
actions.add(beforeAction);
if (!QueryUtil.isFragment(unit)) {
List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
@@ -98,10 +104,12 @@ public class Configure extends InstallableUnitPhase {
return actions;
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Configure_Error;
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
monitor.subTask(NLS.bind(Messages.Phase_Configure_Task, iu.getId()));
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 60b6c2c98..b90dc89d1 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,8 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.equinox.p2.engine.spi.Touchpoint;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
@@ -28,6 +28,7 @@ public class Install extends InstallableUnitPhase {
final static class BeforeInstallEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -37,6 +38,7 @@ public class Install extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -50,6 +52,7 @@ public class Install extends InstallableUnitPhase {
final static class AfterInstallEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -60,6 +63,7 @@ public class Install extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -74,10 +78,12 @@ public class Install extends InstallableUnitPhase {
super(PhaseSetFactory.PHASE_INSTALL, weight);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.second() != null && !op.second().equals(op.first()));
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Installing_IU, unit.getId()));
@@ -91,7 +97,7 @@ public class Install extends InstallableUnitPhase {
afterAction.setTouchpoint(touchpoint);
}
- ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ ArrayList<ProvisioningAction> actions = new ArrayList<>();
actions.add(beforeAction);
if (QueryUtil.isFragment(unit)) {
@@ -106,10 +112,12 @@ public class Install extends InstallableUnitPhase {
return actions;
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Install_Error;
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.second();
monitor.subTask(NLS.bind(Messages.Phase_Install_Task, iu.getId()));
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
index f1b27fccd..2fb4d8d7b 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Property.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,6 +21,7 @@ public class Property extends Phase {
public class ProfilePropertyAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND);
@@ -33,6 +34,7 @@ public class Property extends Phase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
PropertyOperand propertyOperand = (PropertyOperand) parameters.get(PARM_OPERAND);
@@ -73,6 +75,7 @@ public class Property extends Phase {
Map<String, String> originalSourceProperties;
Map<String, String> originalTargetProperties;
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -89,6 +92,7 @@ public class Property extends Phase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -111,6 +115,7 @@ public class Property extends Phase {
Map<String, String> originalSourceProperties;
Map<String, String> originalTargetProperties;
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -122,6 +127,7 @@ public class Property extends Phase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
InstallableUnitOperand iuOperand = (InstallableUnitOperand) parameters.get(PARM_OPERAND);
@@ -138,6 +144,7 @@ public class Property extends Phase {
super(PhaseSetFactory.PHASE_PROPERTY, weight);
}
+ @Override
protected List<ProvisioningAction> getActions(Operand operand) {
if (operand instanceof PropertyOperand)
return Collections.<ProvisioningAction> singletonList(new ProfilePropertyAction());
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
index be30a8f11..b2ad69971 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/internal/p2/engine/phases/Sizing.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -34,6 +34,7 @@ public class Sizing extends InstallableUnitPhase {
super(PHASE_ID, weight);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.second() != null && !op.second().equals(op.first()));
}
@@ -46,6 +47,7 @@ public class Sizing extends InstallableUnitPhase {
return dlSize;
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand operand) {
IInstallableUnit unit = operand.second();
List<ProvisioningAction> parsedActions = getActions(unit, COLLECT_PHASE_ID);
@@ -64,17 +66,19 @@ public class Sizing extends InstallableUnitPhase {
return Collections.singletonList(action);
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Sizing_Error;
}
+ @Override
protected IStatus completePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
@SuppressWarnings("unchecked")
List<IArtifactRequest[]> artifactRequests = (List<IArtifactRequest[]>) parameters.get(Collect.PARM_ARTIFACT_REQUESTS);
ProvisioningContext context = (ProvisioningContext) parameters.get(PARM_CONTEXT);
int statusCode = 0;
- Set<IArtifactRequest> artifactsToObtain = new HashSet<IArtifactRequest>(artifactRequests.size());
+ Set<IArtifactRequest> artifactsToObtain = new HashSet<>(artifactRequests.size());
for (IArtifactRequest[] requests : artifactRequests) {
if (requests == null)
@@ -89,7 +93,7 @@ public class Sizing extends InstallableUnitPhase {
SubMonitor sub = SubMonitor.convert(monitor, 1000);
IQueryable<IArtifactRepository> repoQueryable = context.getArtifactRepositories(sub.newChild(500));
- IQuery<IArtifactRepository> all = new ExpressionMatchQuery<IArtifactRepository>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
+ IQuery<IArtifactRepository> all = new ExpressionMatchQuery<>(IArtifactRepository.class, ExpressionUtil.TRUE_EXPRESSION);
IArtifactRepository[] repositories = repoQueryable.query(all, sub.newChild(500)).toArray(IArtifactRepository.class);
for (IArtifactRequest artifactRequest : artifactsToObtain) {
@@ -123,11 +127,13 @@ public class Sizing extends InstallableUnitPhase {
return null;
}
+ @Override
protected IStatus initializePhase(IProgressMonitor monitor, IProfile profile, Map<String, Object> parameters) {
parameters.put(Collect.PARM_ARTIFACT_REQUESTS, new ArrayList<IArtifactRequest[]>());
return null;
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IStatus status = super.initializeOperand(profile, operand, parameters, monitor);
// defer setting the IU until after the super method to avoid triggering touchpoint initialization
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 76a8d6341..431ceaa20 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,7 @@ public class Unconfigure extends InstallableUnitPhase {
final static class BeforeUnConfigureEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -37,6 +38,7 @@ public class Unconfigure extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -49,6 +51,7 @@ public class Unconfigure extends InstallableUnitPhase {
final static class AfterUnConfigureEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -58,6 +61,7 @@ public class Unconfigure extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -76,10 +80,12 @@ public class Unconfigure extends InstallableUnitPhase {
this(weight, false);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.first() != null);
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Unconfiguring_IU, unit.getId()));
@@ -92,7 +98,7 @@ public class Unconfigure extends InstallableUnitPhase {
beforeAction.setTouchpoint(touchpoint);
afterAction.setTouchpoint(touchpoint);
}
- ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ ArrayList<ProvisioningAction> actions = new ArrayList<>();
actions.add(beforeAction);
if (!QueryUtil.isFragment(unit)) {
List<ProvisioningAction> parsedActions = getActions(unit, phaseId);
@@ -103,10 +109,12 @@ public class Unconfigure extends InstallableUnitPhase {
return actions;
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Unconfigure_Error;
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.first();
parameters.put(PARM_IU, iu);
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 5d7c3936a..9b1c071e4 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -15,8 +15,8 @@ import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.engine.*;
import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
-import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.engine.PhaseSetFactory;
import org.eclipse.equinox.p2.engine.spi.ProvisioningAction;
import org.eclipse.equinox.p2.engine.spi.Touchpoint;
import org.eclipse.equinox.p2.metadata.IArtifactKey;
@@ -26,6 +26,7 @@ import org.eclipse.equinox.p2.query.QueryUtil;
public class Uninstall extends InstallableUnitPhase {
final static class BeforeUninstallEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -35,6 +36,7 @@ public class Uninstall extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -47,6 +49,7 @@ public class Uninstall extends InstallableUnitPhase {
}
final static class AfterUninstallEventAction extends ProvisioningAction {
+ @Override
public IStatus execute(Map<String, Object> parameters) {
Profile profile = (Profile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -57,6 +60,7 @@ public class Uninstall extends InstallableUnitPhase {
return null;
}
+ @Override
public IStatus undo(Map<String, Object> parameters) {
IProfile profile = (IProfile) parameters.get(PARM_PROFILE);
String phaseId = (String) parameters.get(PARM_PHASE_ID);
@@ -75,10 +79,12 @@ public class Uninstall extends InstallableUnitPhase {
this(weight, false);
}
+ @Override
protected boolean isApplicable(InstallableUnitOperand op) {
return (op.first() != null && !op.first().equals(op.second()));
}
+ @Override
protected List<ProvisioningAction> getActions(InstallableUnitOperand currentOperand) {
//TODO: monitor.subTask(NLS.bind(Messages.Engine_Uninstalling_IU, unit.getId()));
@@ -92,7 +98,7 @@ public class Uninstall extends InstallableUnitPhase {
afterAction.setTouchpoint(touchpoint);
}
- ArrayList<ProvisioningAction> actions = new ArrayList<ProvisioningAction>();
+ ArrayList<ProvisioningAction> actions = new ArrayList<>();
actions.add(beforeAction);
if (QueryUtil.isFragment(unit)) {
@@ -107,10 +113,12 @@ public class Uninstall extends InstallableUnitPhase {
return actions;
}
+ @Override
protected String getProblemMessage() {
return Messages.Phase_Uninstall_Error;
}
+ @Override
protected IStatus initializeOperand(IProfile profile, InstallableUnitOperand operand, Map<String, Object> parameters, IProgressMonitor monitor) {
IInstallableUnit iu = operand.first();
parameters.put(PARM_IU, iu);
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/PhaseSetFactory.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/PhaseSetFactory.java
index aec765487..16e25b884 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/PhaseSetFactory.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/PhaseSetFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -80,7 +80,7 @@ public class PhaseSetFactory {
if (exclude == null || exclude.length == 0)
return createDefaultPhaseSet();
List<String> excludeList = Arrays.asList(exclude);
- List<String> includeList = new ArrayList<String>(ALL_PHASES_LIST);
+ List<String> includeList = new ArrayList<>(ALL_PHASES_LIST);
includeList.removeAll(excludeList);
return createPhaseSetIncluding(includeList.toArray(new String[includeList.size()]));
}
@@ -97,7 +97,7 @@ public class PhaseSetFactory {
if (include == null || include.length == 0)
return new PhaseSet(new Phase[0]);
List<String> includeList = Arrays.asList(include);
- ArrayList<Phase> phases = new ArrayList<Phase>();
+ ArrayList<Phase> phases = new ArrayList<>();
if (includeList.contains(PHASE_COLLECT))
phases.add(new Collect(100));
if (includeList.contains(PHASE_CHECK_TRUST))
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileScope.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileScope.java
index bbb297945..dd769ee1f 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileScope.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProfileScope.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 IBM Corporation and others.
+ * Copyright (c) 2009, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,17 +49,13 @@ public final class ProfileScope implements IScopeContext {
this.location = agentLocation;
}
- /*(non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getLocation()
- */
+ @Override
public IPath getLocation() {
// Null returned as the location should only be used when the profile is locked
return null;
}
- /*(non-Javadoc)
- * @see org.eclipse.core.runtime.preferences.IScopeContext#getName()
- */
+ @Override
public String getName() {
return SCOPE;
}
@@ -69,6 +65,7 @@ public final class ProfileScope implements IScopeContext {
*
* @see org.eclipse.core.runtime.preferences.IScopeContext#getNode(java.lang.String)
*/
+ @Override
public IEclipsePreferences getNode(String qualifier) {
if (qualifier == null)
throw new IllegalArgumentException();
@@ -77,9 +74,7 @@ public final class ProfileScope implements IScopeContext {
return (IEclipsePreferences) PreferencesService.getDefault().getRootNode().node(getName()).node(locationString).node(profileId).node(qualifier);
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -91,9 +86,7 @@ public final class ProfileScope implements IScopeContext {
return profileId.equals(other.profileId);
}
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
+ @Override
public int hashCode() {
return super.hashCode() + profileId.hashCode();
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
index 403c924cb..2308effd9 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/ProvisioningContext.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2016 IBM Corporation and others.
+ * Copyright (c) 2008, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -37,7 +37,7 @@ public class ProvisioningContext {
private URI[] artifactRepositories; //artifact repositories to consult
private final List<IInstallableUnit> extraIUs = Collections.synchronizedList(new ArrayList<IInstallableUnit>());
private URI[] metadataRepositories; //metadata repositories to consult
- private final Map<String, String> properties = new HashMap<String, String>();
+ private final Map<String, String> properties = new HashMap<>();
private Map<String, URI> referencedArtifactRepositories = null;
private static final String FILE_PROTOCOL = "file"; //$NON-NLS-1$
@@ -49,6 +49,7 @@ public class ProvisioningContext {
this.repositories = repositories;
}
+ @Override
public IQueryResult<IArtifactRepository> query(IQuery<IArtifactRepository> query, IProgressMonitor mon) {
return query.perform(repositories.listIterator());
}
@@ -59,6 +60,7 @@ public class ProvisioningContext {
*/
private static final Comparator<URI> LOCAL_FIRST_COMPARATOR = new Comparator<URI>() {
+ @Override
public int compare(URI arg0, URI arg1) {
String protocol0 = arg0.getScheme();
String protocol1 = arg1.getScheme();
@@ -123,7 +125,7 @@ public class ProvisioningContext {
*/
public IQueryable<IArtifactDescriptor> getArtifactDescriptors(IProgressMonitor monitor) {
List<IArtifactRepository> repos = getLoadedArtifactRepositories(monitor);
- List<IQueryable<IArtifactDescriptor>> descriptorQueryables = new ArrayList<IQueryable<IArtifactDescriptor>>();
+ List<IQueryable<IArtifactDescriptor>> descriptorQueryables = new ArrayList<>();
for (IArtifactRepository repo : repos) {
descriptorQueryables.add(repo.descriptorQueryable());
}
@@ -151,7 +153,7 @@ public class ProvisioningContext {
URI[] repositories = artifactRepositories == null ? repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL) : artifactRepositories;
Arrays.sort(repositories, LOCAL_FIRST_COMPARATOR);
- List<IArtifactRepository> repos = new ArrayList<IArtifactRepository>();
+ List<IArtifactRepository> repos = new ArrayList<>();
SubMonitor sub = SubMonitor.convert(monitor, (repositories.length + 1) * 100);
for (int i = 0; i < repositories.length; i++) {
if (sub.isCanceled())
@@ -183,17 +185,17 @@ public class ProvisioningContext {
IMetadataRepositoryManager repoManager = (IMetadataRepositoryManager) agent.getService(IMetadataRepositoryManager.SERVICE_NAME);
URI[] repositories = metadataRepositories == null ? repoManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL) : metadataRepositories;
- HashMap<String, IMetadataRepository> repos = new HashMap<String, IMetadataRepository>();
+ HashMap<String, IMetadataRepository> repos = new HashMap<>();
SubMonitor sub = SubMonitor.convert(monitor, repositories.length * 100);
// Clear out the list of remembered artifact repositories
- referencedArtifactRepositories = new HashMap<String, URI>();
+ referencedArtifactRepositories = new HashMap<>();
for (int i = 0; i < repositories.length; i++) {
if (sub.isCanceled())
throw new OperationCanceledException();
loadMetadataRepository(repoManager, repositories[i], repos, shouldFollowReferences(), sub.newChild(100));
}
- Set<IMetadataRepository> set = new HashSet<IMetadataRepository>();
+ Set<IMetadataRepository> set = new HashSet<>();
set.addAll(repos.values());
return set;
}
@@ -361,6 +363,7 @@ public class ProvisioningContext {
* (non-Javadoc)
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("{artifactRepos=" + DebugHelper.formatArray(null != artifactRepositories ? Arrays.asList(artifactRepositories) : null, true, false)); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
index 501f04f00..cb57866f9 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Memento.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2017 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -20,7 +20,7 @@ public final class Memento {
private static final Collection<Class<?>> simpleArrays = Arrays.<Class<?>> asList(String[].class, Integer[].class, Long[].class, Float[].class, Double[].class, Byte[].class, Short[].class, Character[].class, Boolean[].class);
private static final Collection<Class<?>> primitiveArrays = Arrays.<Class<?>> asList(long[].class, int[].class, short[].class, char[].class, byte[].class, double[].class, float[].class, boolean[].class);
- Map<String, Object> mementoMap = new HashMap<String, Object>();
+ Map<String, Object> mementoMap = new HashMap<>();
public Object remove(String key) {
if (key == null)
@@ -51,10 +51,12 @@ public final class Memento {
return new Enumeration<String>() {
Iterator<String> keysIterator = mementoMap.keySet().iterator();
+ @Override
public boolean hasMoreElements() {
return keysIterator.hasNext();
}
+ @Override
public String nextElement() {
return keysIterator.next();
}
diff --git a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Value.java b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Value.java
index b0cb15613..4d3773326 100644
--- a/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Value.java
+++ b/bundles/org.eclipse.equinox.p2.engine/src/org/eclipse/equinox/p2/engine/spi/Value.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012, 2013 Landmark Graphics Corporation and others
+ * Copyright (c) 2012, 2017 Landmark Graphics Corporation and others
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,7 +18,7 @@ package org.eclipse.equinox.p2.engine.spi;
* @since 2.3
*/
public class Value<T> {
- public static final Value<Object> NO_VALUE = new Value<Object>(null);
+ public static final Value<Object> NO_VALUE = new Value<>(null);
private T value;
private Class<T> clazz;

Back to the top