Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-09-04 13:03:51 +0000
committerAlexander Kurtakov2017-09-04 13:03:51 +0000
commit61dd236707838aef30d2f849b4ffd4df3093717a (patch)
tree4a78675766343dc20375fa7b4e85c6ea4db42205
parent71ce503c0e1dabec9f7d65841ee4852c59f0432f (diff)
downloadrt.equinox.p2-61dd236707838aef30d2f849b4ffd4df3093717a.tar.gz
rt.equinox.p2-61dd236707838aef30d2f849b4ffd4df3093717a.tar.xz
rt.equinox.p2-61dd236707838aef30d2f849b4ffd4df3093717a.zip
Bug 521827 - Move artifact.repository bundle to Java 8
* Bump BREE. * Bump minor version for the BREE change. * Enable more warnings. * Add missing Override annotations. * Remove redundant type declarations. * Try-with-resources. * Lambda conversion. Change-Id: I198af985183d1429fb18ed3198f238f42afd0c25 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs24
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processing/AbstractBufferingStep.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java19
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java20
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java3
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/UniversalUniqueIdentifier.java14
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/XZedSimpleArtifactRepositoryFactory.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ZipVerifierStep.java4
29 files changed, 227 insertions, 95 deletions
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.classpath
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
index fff7552a8..e23fbe1ef 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/.settings/org.eclipse.jdt.core.prefs
@@ -9,13 +9,17 @@ org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
@@ -49,7 +53,7 @@ org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
@@ -58,7 +62,7 @@ org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
@@ -66,20 +70,22 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
+org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
@@ -94,6 +100,9 @@ org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=warning
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
+org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
+org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
@@ -101,6 +110,7 @@ org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedImport=error
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
org.eclipse.jdt.core.compiler.problem.unusedLocal=error
@@ -113,7 +123,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
index c0bfeab5c..8ded70a9b 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.artifact.repository;singleton:=true
-Bundle-Version: 1.1.600.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.artifact.repository.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
@@ -61,4 +61,4 @@ Import-Package: javax.xml.parsers,
org.xml.sax;resolution:=optional
Service-Component: OSGI-INF/repositoryManager.xml
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml
index c7ba3be64..1c25ae216 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.artifact.repository</artifactId>
- <version>1.1.600-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processing/AbstractBufferingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processing/AbstractBufferingStep.java
index 1152226a1..fe5646f12 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processing/AbstractBufferingStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processing/AbstractBufferingStep.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2008 compeople AG and others.
+ * Copyright (c) 2007, 2017 compeople AG 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 abstract class AbstractBufferingStep extends ProcessingStep {
super();
}
+ @Override
public void write(int b) throws IOException {
OutputStream stream = getOutputStream();
stream.write(b);
@@ -49,6 +50,7 @@ public abstract class AbstractBufferingStep extends ProcessingStep {
protected abstract OutputStream createIncomingStream() throws IOException;
+ @Override
public void close() throws IOException {
// When we go to close we must have seen all the content we are going to see.
// If no one wrote to the temp stream then we return an error. If there is
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java
index 36406cade..e94e40297 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/md5/MD5Verifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 compeople AG and others.
+ * Copyright (c) 2007, 2017 compeople AG 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 MD5Verifier extends ProcessingStep {
}
//This handle the case where the MD5 verification is initiated by a processing step
+ @Override
public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
super.initialize(agent, descriptor, context);
String data = descriptor.getData();
@@ -63,11 +64,13 @@ public class MD5Verifier extends ProcessingStep {
}
}
+ @Override
public void write(int b) throws IOException {
md5.update((byte) b);
getDestination().write(b);
}
+ @Override
public void close() throws IOException {
byte[] digest = md5.digest();
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
index 5397b2c4b..904771bc5 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/processors/pack200/Pack200ProcessorStep.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 compeople AG and others.
+ * Copyright (c) 2007, 2017 compeople AG 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,11 +34,13 @@ public class Pack200ProcessorStep extends AbstractBufferingStep {
private File incoming;
+ @Override
protected OutputStream createIncomingStream() throws IOException {
incoming = File.createTempFile(INCOMING_ROOT, JAR_SUFFIX + PACKED_SUFFIX);
return new BufferedOutputStream(new FileOutputStream(incoming));
}
+ @Override
public void initialize(IProvisioningAgent agent, IProcessingStepDescriptor descriptor, IArtifactDescriptor context) {
super.initialize(agent, descriptor, context);
if (!UnpackStep.canUnpack()) {
@@ -58,12 +60,14 @@ public class Pack200ProcessorStep extends AbstractBufferingStep {
}
}
+ @Override
protected void cleanupTempFiles() {
super.cleanupTempFiles();
if (incoming != null)
incoming.delete();
}
+ @Override
protected void performProcessing() throws IOException {
File resultFile = null;
try {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
index cab3263cd..7d518de40 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/Activator.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
@@ -37,12 +37,14 @@ public class Activator implements BundleActivator {
return Activator.context;
}
+ @Override
public void start(BundleContext aContext) throws Exception {
Activator.context = aContext;
Activator.instance = this;
- this.locationCache = new HashMap<URI, Location>();
+ this.locationCache = new HashMap<>();
}
+ @Override
public void stop(BundleContext aContext) throws Exception {
Activator.context = null;
Activator.instance = null;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java
index d1576bcbb..035bc341f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryComponent.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
@@ -19,6 +19,7 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
*/
public class ArtifactRepositoryComponent implements IAgentServiceFactory {
+ @Override
public Object createService(IProvisioningAgent agent) {
return new ArtifactRepositoryManager(agent);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
index 97b1f60f1..0ca9f3b86 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRepositoryManager.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
@@ -41,14 +41,17 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
super.addRepository(repository, true, null);
}
+ @Override
public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties) {
return createMirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties, null);
}
+ @Override
public IArtifactRequest createMirrorRequest(IArtifactKey key, IArtifactRepository destination, Map<String, String> destinationDescriptorProperties, Map<String, String> destinationRepositoryProperties, String downloadStatsParameters) {
return new MirrorRequest(key, destination, destinationDescriptorProperties, destinationRepositoryProperties, getTransport(), downloadStatsParameters);
}
+ @Override
public IArtifactRepository createRepository(URI location, String name, String type, Map<String, String> properties) throws ProvisionException {
return (IArtifactRepository) doCreateRepository(location, name, type, properties);
}
@@ -57,6 +60,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
return (IArtifactRepository) basicGetRepository(location);
}
+ @Override
protected IRepository<IArtifactKey> factoryCreate(URI location, String name, String type, Map<String, String> properties, IExtension extension) throws ProvisionException {
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
@@ -65,6 +69,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
return factory.create(location, name, type, properties);
}
+ @Override
protected IRepository<IArtifactKey> factoryLoad(URI location, IExtension extension, int flags, SubMonitor monitor) throws ProvisionException {
ArtifactRepositoryFactory factory = (ArtifactRepositoryFactory) createExecutableExtension(extension, EL_FACTORY);
if (factory == null)
@@ -73,14 +78,17 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
return factory.load(location, flags, monitor);
}
+ @Override
protected String getBundleId() {
return Activator.ID;
}
+ @Override
protected String getDefaultSuffix() {
return "artifacts.xml"; //$NON-NLS-1$
}
+ @Override
protected String getRepositoryProviderExtensionPointId() {
return Activator.REPO_PROVIDER_XPT;
}
@@ -88,26 +96,32 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
/**
* Restores metadata repositories specified as system properties.
*/
+ @Override
protected String getRepositorySystemProperty() {
return "eclipse.p2.artifactRepository"; //$NON-NLS-1$
}
+ @Override
protected int getRepositoryType() {
return IRepository.TYPE_ARTIFACT;
}
+ @Override
public IArtifactRepository loadRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
return loadRepository(location, 0, monitor);
}
+ @Override
public IArtifactRepository loadRepository(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
return (IArtifactRepository) loadRepository(location, monitor, null, flags);
}
+ @Override
public IArtifactRepository refreshRepository(URI location, IProgressMonitor monitor) throws ProvisionException {
return (IArtifactRepository) basicRefreshRepository(location, monitor);
}
+ @Override
protected String[] getPreferredRepositorySearchOrder(LocationProperties properties) {
return properties.getArtifactFactorySearchOrder();
}
@@ -115,6 +129,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
/**
* Restore the download cache
*/
+ @Override
protected void restoreSpecialRepositories() {
// TODO while recreating, we may want to have proxies on repo instead of the real repo object to limit what is activated.
IAgentLocation location = (IAgentLocation) getAgent().getService(IAgentLocation.SERVICE_NAME);
@@ -132,7 +147,7 @@ public class ArtifactRepositoryManager extends AbstractRepositoryManager<IArtifa
LogHelper.log(new Status(IStatus.ERROR, Activator.ID, "Error occurred while loading download cache.", e)); //$NON-NLS-1$
}
try {
- Map<String, String> properties = new HashMap<String, String>(1);
+ Map<String, String> properties = new HashMap<>(1);
properties.put(IRepository.PROP_SYSTEM, Boolean.TRUE.toString());
createRepository(cacheLocation, "download cache", TYPE_SIMPLE_REPOSITORY, properties); //$NON-NLS-1$
} catch (ProvisionException e) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java
index 35c0b0aca..69c394188 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/ArtifactRequest.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
@@ -33,6 +33,7 @@ public abstract class ArtifactRequest implements IArtifactRequest {
this.transport = transport;
}
+ @Override
public IArtifactKey getArtifactKey() {
return artifact;
}
@@ -43,6 +44,7 @@ public abstract class ArtifactRequest implements IArtifactRequest {
*
* @return The result of the previous perform call.
*/
+ @Override
public IStatus getResult() {
if (result == DEFAULT_STATUS)
return new Status(IStatus.ERROR, Activator.ID, "No repository found containing: " + getArtifactKey().toString());
@@ -61,6 +63,7 @@ public abstract class ArtifactRequest implements IArtifactRequest {
* @param monitor a progress monitor, or <code>null</code> if progress
* reporting is not desired
*/
+ @Override
abstract public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor);
/**
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
index 5d63e9780..666e8be2a 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepository.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
@@ -44,9 +44,9 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
// keep a list of the child URIs. they can be absolute or relative. they may or may not point
// to a valid reachable repo
- private List<URI> childrenURIs = new ArrayList<URI>();
+ private List<URI> childrenURIs = new ArrayList<>();
// keep a list of the repositories that we have successfully loaded
- private List<ChildInfo> loadedRepos = new ArrayList<ChildInfo>();
+ private List<ChildInfo> loadedRepos = new ArrayList<>();
private IArtifactRepositoryManager manager;
private boolean disableSave;
@@ -90,7 +90,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
super(manager.getAgent(), state.getName(), state.getType(), state.getVersion(), state.getLocation(), state.getDescription(), state.getProvider(), state.getProperties());
this.manager = manager;
SubMonitor sub = SubMonitor.convert(monitor, 100 * state.getChildren().length);
- List<URI> repositoriesToBeRemovedOnFailure = new ArrayList<URI>();
+ List<URI> repositoriesToBeRemovedOnFailure = new ArrayList<>();
boolean failOnChildFailure = shouldFailOnChildFailure(state);
for (URI child : state.getChildren())
addChild(child, false, sub.newChild(100), failOnChildFailure, repositoriesToBeRemovedOnFailure);
@@ -144,10 +144,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$
}
+ @Override
public boolean isModifiable() {
return isLocal();
}
+ @Override
public void addChild(URI childURI) {
try {
addChild(childURI, true, null, false, null);
@@ -200,6 +202,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
// return false;
// }
+ @Override
public void removeChild(URI childURI) {
boolean removed = childrenURIs.remove(childURI);
// if the child wasn't there make sure and try the other permutation
@@ -224,21 +227,23 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
}
+ @Override
public void removeAllChildren() {
childrenURIs.clear();
loadedRepos.clear();
save();
}
+ @Override
public List<URI> getChildren() {
- List<URI> result = new ArrayList<URI>();
+ List<URI> result = new ArrayList<>();
for (URI uri : childrenURIs)
result.add(URIUtil.makeAbsolute(uri, getLocation()));
return result;
}
public List<IArtifactRepository> getLoadedChildren() {
- List<IArtifactRepository> result = new ArrayList<IArtifactRepository>(loadedRepos.size());
+ List<IArtifactRepository> result = new ArrayList<>(loadedRepos.size());
for (ChildInfo info : loadedRepos) {
result.add(info.repo);
}
@@ -248,6 +253,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public synchronized void addDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedAddToComposite);
}
@@ -255,6 +261,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedAddToComposite);
}
@@ -262,6 +269,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedRemoveFromComposite);
}
@@ -269,6 +277,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedRemoveFromComposite);
}
@@ -276,6 +285,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedRemoveFromComposite);
}
@@ -283,6 +293,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedRemoveFromComposite);
}
@@ -290,6 +301,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
/**
* Composite repositories should be unable to directly modify their child repositories
*/
+ @Override
public synchronized void removeAll(IProgressMonitor monitor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedRemoveFromComposite);
}
@@ -299,10 +311,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
* Composite repositories should not have their own content.
* Therefore, they should not be allowed to have OutputStreams
*/
+ @Override
public OutputStream getOutputStream(IArtifactDescriptor descriptor) {
throw new UnsupportedOperationException(Messages.exception_unsupportedGetOutputStream);
}
+ @Override
public boolean contains(IArtifactKey key) {
for (ChildInfo current : loadedRepos) {
if (current.isGood() && current.repo.contains(key))
@@ -311,6 +325,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return false;
}
+ @Override
public boolean contains(IArtifactDescriptor descriptor) {
for (ChildInfo current : loadedRepos) {
if (current.isGood() && current.repo.contains(descriptor))
@@ -319,8 +334,9 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return false;
}
+ @Override
public IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
- ArrayList<IArtifactDescriptor> result = new ArrayList<IArtifactDescriptor>();
+ ArrayList<IArtifactDescriptor> result = new ArrayList<>();
for (ChildInfo current : loadedRepos) {
if (current.isGood()) {
IArtifactDescriptor[] tempResult = current.repo.getArtifactDescriptors(key);
@@ -331,6 +347,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return result.toArray(new IArtifactDescriptor[result.size()]);
}
+ @Override
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
SubMonitor subMonitor = SubMonitor.convert(monitor, requests.length);
MultiStatus multiStatus = new MultiStatus(Activator.ID, IStatus.OK, Messages.message_artifactsFromChildRepos, null);
@@ -352,10 +369,12 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return multiStatus;
}
+ @Override
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
return getRawOrNormalArtifact(descriptor, destination, monitor, false);
}
+ @Override
public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
return getRawOrNormalArtifact(descriptor, destination, monitor, true);
}
@@ -401,7 +420,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private IArtifactRequest[] filterUnfetched(IArtifactRequest[] requests) {
- ArrayList<IArtifactRequest> filteredRequests = new ArrayList<IArtifactRequest>();
+ ArrayList<IArtifactRequest> filteredRequests = new ArrayList<>();
for (int i = 0; i < requests.length; i++) {
if (requests[i].getResult() == null || !requests[i].getResult().isOK()) {
filteredRequests.add(requests[i]);
@@ -414,7 +433,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
private IArtifactRequest[] getRequestsForRepository(IArtifactRepository repository, IArtifactRequest[] requests) {
- ArrayList<IArtifactRequest> applicable = new ArrayList<IArtifactRequest>();
+ ArrayList<IArtifactRequest> applicable = new ArrayList<>();
for (int i = 0; i < requests.length; i++) {
if (repository.contains(requests[i].getArtifactKey()))
applicable.add(requests[i]);
@@ -566,9 +585,10 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
}
}
+ @Override
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
// Query all the all the repositories this composite repo contains
- List<IArtifactRepository> repos = new ArrayList<IArtifactRepository>();
+ List<IArtifactRepository> repos = new ArrayList<>();
for (ChildInfo info : loadedRepos) {
if (info.isGood())
repos.add(info.repo);
@@ -577,9 +597,10 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return queryable.query(query, monitor);
}
+ @Override
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
// Query all the all the repositories this composite repo contains
- List<IQueryable<IArtifactDescriptor>> repos = new ArrayList<IQueryable<IArtifactDescriptor>>();
+ List<IQueryable<IArtifactDescriptor>> repos = new ArrayList<>();
for (ChildInfo info : loadedRepos) {
if (info.isGood())
repos.add(info.repo.descriptorQueryable());
@@ -587,6 +608,7 @@ public class CompositeArtifactRepository extends AbstractArtifactRepository impl
return QueryUtil.compoundQueryable(repos);
}
+ @Override
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) {
IStatus result = null;
synchronized (this) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
index 78b8be27f..bdfc5d64f 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/CompositeArtifactRepositoryFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 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
@@ -74,6 +74,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
return localFile;
}
+ @Override
public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
long time = 0;
final String debugMsg = "Restoring artifact repository "; //$NON-NLS-1$
@@ -135,6 +136,7 @@ public class CompositeArtifactRepositoryFactory extends ArtifactRepositoryFactor
}
}
+ @Override
public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return new CompositeArtifactRepository(getManager(), location, name, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
index 03ead3f79..686f457b8 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorRequest.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
@@ -83,24 +83,22 @@ public class MirrorRequest extends ArtifactRequest {
if (targetDescriptorProperties == null || targetDescriptorProperties.isEmpty()) {
this.targetDescriptorProperties = null;
} else {
- this.targetDescriptorProperties = new HashMap<String, String>();
+ this.targetDescriptorProperties = new HashMap<>();
this.targetDescriptorProperties.putAll(targetDescriptorProperties);
}
if (targetRepositoryProperties == null || targetRepositoryProperties.isEmpty()) {
this.targetRepositoryProperties = null;
} else {
- this.targetRepositoryProperties = new HashMap<String, String>();
+ this.targetRepositoryProperties = new HashMap<>();
this.targetRepositoryProperties.putAll(targetRepositoryProperties);
}
this.downloadStatsParamters = statsParameters;
}
@Override
- protected void setSourceRepository(IArtifactRepository value)
- {
- if (value != getSourceRepository())
- {
+ protected void setSourceRepository(IArtifactRepository value) {
+ if (value != getSourceRepository()) {
// This refreshes the descriptor from the new repository as it might be different.
// If a MirrorRequest fails for a local repository the descriptor might indicate a "folder based" artifact
// which causes the MirrorRequest to fail again with a remote repository if the descriptor is not fetched again.
@@ -110,6 +108,7 @@ public class MirrorRequest extends ArtifactRequest {
super.setSourceRepository(value);
}
+ @Override
public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor) {
monitor.subTask(NLS.bind(Messages.downloading, getArtifactKey().getId()));
setSourceRepository(sourceRepository);
@@ -222,8 +221,7 @@ public class MirrorRequest extends ArtifactRequest {
do {
lastResult = transferSingle(destinationDescriptor, sourceDescriptor, monitor);
allResults.add(lastResult);
- if (lastResult.getException() instanceof Error)
- {
+ if (lastResult.getException() instanceof Error) {
// Error is more severe than Exception - e.g. an OutOfMemoryError should not be ignored and might hinder further processing
throw (Error) lastResult.getException();
}
@@ -292,8 +290,7 @@ public class MirrorRequest extends ArtifactRequest {
Throwable e = root != null ? root.getException() : null;
((IStateful) destination).setStatus(new MultiStatus(Activator.ID, status.getCode(), new IStatus[] {status, destStatus}, status.getMessage(), e));
}
- } catch (RuntimeException e)
- {
+ } catch (RuntimeException e) {
priorException = e;
throw e;
} catch (Error e) {
@@ -348,6 +345,7 @@ public class MirrorRequest extends ArtifactRequest {
return status.getSeverity() == IStatus.ERROR && status.getException() != null ? status : null;
}
+ @Override
public String toString() {
return Messages.mirroring + getArtifactKey() + " into " + target; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
index a8cf92c71..4e87c3fe5 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/MirrorSelector.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2011 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
@@ -225,6 +225,7 @@ public class MirrorSelector {
this.qel = sqrt(qBytesPerSeconds * qBytesPerSeconds + (qFailureCount * 1d) * (qFailureCount * 1d) + qRank * qRank);
}
+ @Override
public int compare(MirrorInfo o1, MirrorInfo o2) {
if (o1 == o2) {
return 0; // shortest way
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
index 800da28bf..de6508d31 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/RawMirrorRequest.java
@@ -36,6 +36,7 @@ public class RawMirrorRequest extends MirrorRequest {
this.targetDescriptor = targetDescriptor;
}
+ @Override
public void perform(IArtifactRepository sourceRepository, IProgressMonitor monitor) {
monitor.subTask(NLS.bind(Messages.downloading, getArtifactKey().getId()));
setSourceRepository(sourceRepository);
@@ -77,6 +78,7 @@ public class RawMirrorRequest extends MirrorRequest {
}
// Perform the mirror operation without any processing steps
+ @Override
protected IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
ProcessingStepHandler handler = new ProcessingStepHandler();
if (SimpleArtifactRepository.DOWNLOAD_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null)
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
index ee6cc083b..f69ded829 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/SignatureVerifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2015 compeople AG and others.
+* Copyright (c) 2007, 2017 compeople AG 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
@@ -33,10 +33,12 @@ public class SignatureVerifier extends ProcessingStep {
return true;
}
+ @Override
public void write(int b) throws IOException {
getOutputStream().write(b);
}
+ @Override
public void write(byte[] bytes, int off, int len) throws IOException {
getOutputStream().write(bytes, off, len);
}
@@ -86,7 +88,7 @@ public class SignatureVerifier extends ProcessingStep {
// will be detected for the invalid artifact later.
return Status.OK_STATUS;
}
- ArrayList<IStatus> allStatus = new ArrayList<IStatus>(0);
+ ArrayList<IStatus> allStatus = new ArrayList<>(0);
SignedContentEntry[] entries = signedContent.getSignedEntries();
for (int i = 0; i < entries.length; i++)
try {
@@ -102,6 +104,7 @@ public class SignatureVerifier extends ProcessingStep {
return Status.OK_STATUS;
}
+ @Override
public void close() throws IOException {
// When we go to close we must have seen all the content we are going to see
// So before closing, verify and write the result to the destination
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
index dcbac6ffa..4eb2f8cb4 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/DownloadJob.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Genuitec, LLC and others. All rights reserved. This
+ * Copyright (c) 2008, 2017 Genuitec, LLC 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
@@ -34,16 +34,12 @@ public class DownloadJob extends Job {
this.overallStatus = overallStatus;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#belongsTo(java.lang.Object)
- */
+ @Override
public boolean belongsTo(Object family) {
return family == FAMILY;
}
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
- */
+ @Override
protected IStatus run(IProgressMonitor jobMonitor) {
jobMonitor.beginTask("Downloading software", IProgressMonitor.UNKNOWN);
do {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java
index 24c42743c..c04fed648 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/KeyIndex.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 Cloudsmith Inc. and others.
+ * Copyright (c) 2010, 2017 Cloudsmith Inc. 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,7 +28,7 @@ public class KeyIndex extends Index<IArtifactKey> {
private final Map<String, Object> artifactMap;
public KeyIndex(Collection<IArtifactKey> artifactKeys) {
- artifactMap = new HashMap<String, Object>(artifactKeys.size());
+ artifactMap = new HashMap<>(artifactKeys.size());
for (IArtifactKey ak : artifactKeys) {
Object prev = artifactMap.put(ak.getId(), ak);
if (prev != null) {
@@ -45,6 +45,7 @@ public class KeyIndex extends Index<IArtifactKey> {
}
}
+ @Override
public Iterator<IArtifactKey> getCandidates(IEvaluationContext ctx, IExpression variable, IExpression booleanExpr) {
Object queriedKeys = getQueriedIDs(ctx, variable, ArtifactKey.MEMBER_ID, booleanExpr, null);
if (queriedKeys == null)
@@ -59,7 +60,7 @@ public class KeyIndex extends Index<IArtifactKey> {
if (v == null)
continue;
if (collector == null)
- collector = new ArrayList<IArtifactKey>();
+ collector = new ArrayList<>();
if (v instanceof IArtifactKey)
collector.add((IArtifactKey) v);
else {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java
index 9d3897868..51d238edc 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/Mapper.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
@@ -53,7 +53,7 @@ public class Mapper {
public URI map(URI repositoryLocation, String classifier, String id, String version, String format) {
String locationString = URIUtil.toUnencodedString(repositoryLocation);
- Dictionary<String, Object> values = new Hashtable<String, Object>(5);
+ Dictionary<String, Object> values = new Hashtable<>(5);
if (repositoryLocation != null)
values.put(REPOURL, locationString);
@@ -119,6 +119,7 @@ public class Mapper {
}
}
+ @Override
public String toString() {
StringBuffer result = new StringBuffer();
for (int i = 0; i < filters.length; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
index a48c9a912..bcfbefa34 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactDescriptor.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
@@ -52,6 +52,7 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
return OrderedProperties.unmodifiableProperties(repositoryProperties);
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -70,6 +71,7 @@ public class SimpleArtifactDescriptor extends ArtifactDescriptor {
return super.equals(obj);
}
+ @Override
public int hashCode() {
int superHash = super.hashCode();
String ref = getRepositoryProperty(ARTIFACT_REFERENCE);
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
index 130bc2c97..75f3761bc 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepository.java
@@ -122,6 +122,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
this.file = file;
}
+ @Override
public void close() throws IOException {
if (closed)
return;
@@ -151,6 +152,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
delete(file);
}
+ @Override
public IStatus getStatus() {
return status;
}
@@ -159,20 +161,24 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return destination;
}
+ @Override
public void setStatus(IStatus status) {
this.status = status == null ? Status.OK_STATUS : status;
}
+ @Override
public void write(byte[] b) throws IOException {
destination.write(b);
count += b.length;
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
destination.write(b, off, len);
count += len;
}
+ @Override
public void write(int b) throws IOException {
destination.write(b);
count++;
@@ -197,6 +203,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
fos = new FileOutputStream(zipFile);
}
+ @Override
public void close() throws IOException {
fos.close();
try {
@@ -206,22 +213,27 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public void flush() throws IOException {
fos.flush();
}
+ @Override
public String toString() {
return fos.toString();
}
+ @Override
public void write(byte[] b) throws IOException {
fos.write(b);
}
+ @Override
public void write(byte[] b, int off, int len) throws IOException {
fos.write(b, off, len);
}
+ @Override
public void write(int b) throws IOException {
fos.write(b);
}
@@ -244,11 +256,11 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
static final private Integer REPOSITORY_VERSION = 1;
private static final String XML_EXTENSION = ".xml"; //$NON-NLS-1$
- protected Set<SimpleArtifactDescriptor> artifactDescriptors = new HashSet<SimpleArtifactDescriptor>();
+ protected Set<SimpleArtifactDescriptor> artifactDescriptors = new HashSet<>();
/**
* Map<IArtifactKey,List<IArtifactDescriptor>> containing the index of artifacts in the repository.
*/
- private Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<IArtifactKey, List<IArtifactDescriptor>>();
+ private Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<>();
private transient BlobStore blobStore;
transient private Mapper mapper = new Mapper();
private KeyIndex keyIndex;
@@ -307,7 +319,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null) {
- descriptors = new ArrayList<IArtifactDescriptor>();
+ descriptors = new ArrayList<>();
artifactMap.put(key, descriptors);
}
descriptors.add(descriptor);
@@ -332,9 +344,9 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private void cloneAritfactMap() {
- HashMap<IArtifactKey, List<IArtifactDescriptor>> clone = new HashMap<IArtifactKey, List<IArtifactDescriptor>>(artifactMap.size());
+ HashMap<IArtifactKey, List<IArtifactDescriptor>> clone = new HashMap<>(artifactMap.size());
for (Entry<IArtifactKey, List<IArtifactDescriptor>> entry : artifactMap.entrySet())
- clone.put(entry.getKey(), new ArrayList<IArtifactDescriptor>(entry.getValue()));
+ clone.put(entry.getKey(), new ArrayList<>(entry.getValue()));
artifactMap = clone;
}
@@ -371,6 +383,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public synchronized void addDescriptor(IArtifactDescriptor toAdd, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -393,6 +406,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) {
return new SimpleArtifactDescriptor(key);
}
@@ -418,6 +432,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return internal;
}
+ @Override
public synchronized void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -442,7 +457,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private synchronized OutputStream addPostSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
- ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>();
+ ArrayList<ProcessingStep> steps = new ArrayList<>();
steps.add(new SignatureVerifier());
if (ARTIFACT_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5) != null)
steps.add(new MD5Verifier(descriptor.getProperty(IArtifactDescriptor.ARTIFACT_MD5)));
@@ -454,7 +469,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
private OutputStream addPreSteps(ProcessingStepHandler handler, IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
- ArrayList<ProcessingStep> steps = new ArrayList<ProcessingStep>();
+ ArrayList<ProcessingStep> steps = new ArrayList<>();
if (IArtifactDescriptor.TYPE_ZIP.equals(descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_CONTENTTYPE)))
steps.add(new ZipVerifierStep());
if (DOWNLOAD_MD5_CHECKSUM_ENABLED && descriptor.getProperty(IArtifactDescriptor.DOWNLOAD_MD5) != null)
@@ -491,6 +506,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return buffer.toString();
}
+ @Override
public synchronized boolean contains(IArtifactDescriptor descriptor) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -499,6 +515,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return artifactDescriptors.contains(simpleDescriptor);
}
+ @Override
public synchronized boolean contains(IArtifactKey key) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -648,15 +665,13 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
IStatus status = new DownloadStatus(IStatus.OK, Activator.ID, Status.OK_STATUS.getMessage());
try {
long start = System.currentTimeMillis();
- FileInputStream stream = new FileInputStream(in);
- try {
+
+ try (FileInputStream stream = new FileInputStream(in)) {
int len;
while ((len = stream.read(buffer)) != -1) {
out.write(buffer, 0, len);
sub.worked(1);
}
- } finally {
- stream.close();
}
long end = System.currentTimeMillis();
((DownloadStatus) status).setFileSize(in.length());
@@ -704,6 +719,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return mirrors.getMirrorLocation(baseLocation, monitor);
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
// if we are adapting to file or writable repositories then make sure we have a file location
if (adapter == IFileArtifactRepository.class)
@@ -717,6 +733,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return request.getResult();
}
+ @Override
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -732,6 +749,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return downloadArtifact(descriptor, destination, monitor);
}
+ @Override
public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -741,6 +759,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return downloadArtifact(descriptor, destination, monitor);
}
+ @Override
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -753,6 +772,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return result.toArray(new IArtifactDescriptor[result.size()]);
}
+ @Override
public File getArtifactFile(IArtifactDescriptor descriptor) {
URI result = getLocation(descriptor);
if (result == null || !URIUtil.isFileURI(result))
@@ -760,6 +780,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return URIUtil.toFile(result);
}
+ @Override
public File getArtifactFile(IArtifactKey key) {
IArtifactDescriptor descriptor = getCompleteArtifactDescriptor(key);
if (descriptor == null)
@@ -767,6 +788,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return getArtifactFile(descriptor);
}
+ @Override
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -775,7 +797,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return Status.CANCEL_STATUS;
final MultiStatus overallStatus = new MultiStatus(Activator.ID, IStatus.OK, NLS.bind(Messages.message_problemReadingArtifact, getLocation()), null);
- LinkedList<IArtifactRequest> requestsPending = new LinkedList<IArtifactRequest>(Arrays.asList(requests));
+ LinkedList<IArtifactRequest> requestsPending = new LinkedList<>(Arrays.asList(requests));
int numberOfJobs = Math.min(requests.length, getMaximumThreads());
if (numberOfJobs <= 1 || (!isForceThreading() && isLocal())) {
@@ -926,6 +948,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return Math.min(repoMaxThreads, userMaxThreads);
}
+ @Override
public OutputStream getOutputStream(IArtifactDescriptor descriptor) throws ProvisionException {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -1067,6 +1090,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return "file".equalsIgnoreCase(getLocation().getScheme()); //$NON-NLS-1$
}
+ @Override
public boolean isModifiable() {
return isLocal();
}
@@ -1078,6 +1102,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return destination;
}
+ @Override
public synchronized void removeAll(IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1099,6 +1124,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public synchronized void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1116,6 +1142,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public synchronized void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1136,6 +1163,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public synchronized void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1159,6 +1187,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
}
}
+ @Override
public synchronized void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1290,6 +1319,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return oldValue;
}
+ @Override
public String setProperty(String key, String newValue, IProgressMonitor monitor) {
boolean lockAcquired = false;
try {
@@ -1309,26 +1339,28 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
mappingRules = rules;
}
+ @Override
public String toString() {
return getLocation().toString();
}
+ @Override
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
- return new IQueryable<IArtifactDescriptor>() {
- public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) {
- synchronized (SimpleArtifactRepository.this) {
- snapshotNeeded = true;
- Collection<List<IArtifactDescriptor>> descs = SimpleArtifactRepository.this.artifactMap.values();
- return query.perform(new CompoundIterator<IArtifactDescriptor>(descs.iterator()));
- }
+ return (query, monitor) -> {
+ synchronized (SimpleArtifactRepository.this) {
+ snapshotNeeded = true;
+ Collection<List<IArtifactDescriptor>> descs = SimpleArtifactRepository.this.artifactMap.values();
+ return query.perform(new CompoundIterator<IArtifactDescriptor>(descs.iterator()));
}
};
}
+ @Override
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
return IndexProvider.query(this, query, monitor);
}
+ @Override
public synchronized Iterator<IArtifactKey> everything() {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -1337,6 +1369,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return artifactMap.keySet().iterator();
}
+ @Override
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) {
IStatus result = null;
@@ -1375,6 +1408,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return result;
}
+ @Override
public synchronized IIndex<IArtifactKey> getIndex(String memberName) {
if (!holdsLock() && URIUtil.isFileURI(getLocation())) {
load(new NullProgressMonitor());
@@ -1388,6 +1422,7 @@ public class SimpleArtifactRepository extends AbstractArtifactRepository impleme
return null;
}
+ @Override
public Object getManagedProperty(Object client, String memberName, Object key) {
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryFactory.java
index 041e9f6d7..d2a08409c 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryFactory.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
@@ -72,6 +72,7 @@ public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
return localFile;
}
+ @Override
public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
return load(location, flags, monitor, true);
}
@@ -130,6 +131,7 @@ public class SimpleArtifactRepositoryFactory extends ArtifactRepositoryFactory {
}
}
+ @Override
public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return new SimpleArtifactRepository(getAgent(), name, location, properties);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
index 334119a02..5d7193203 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/SimpleArtifactRepositoryIO.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
@@ -330,6 +330,7 @@ public class SimpleArtifactRepositoryIO {
return theRepository;
}
+ @Override
protected Object getRootObject() {
return theRepository;
}
@@ -340,6 +341,7 @@ public class SimpleArtifactRepositoryIO {
super(rootName, rootHandler);
}
+ @Override
public void processingInstruction(String target, String data) throws SAXException {
if (PI_REPOSITORY_TARGET.equals(target)) {
// TODO: should the root handler be constructed based on class
@@ -376,11 +378,13 @@ public class SimpleArtifactRepositoryIO {
return repository;
}
+ @Override
protected void handleRootAttributes(Attributes attributes) {
attrValues = parseAttributes(attributes, required, optional);
attrValues[2] = checkVersion(REPOSITORY_ELEMENT, VERSION_ATTRIBUTE, attrValues[2]).toString();
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (MAPPING_RULES_ELEMENT.equals(name)) {
if (mappingRulesHandler == null) {
@@ -405,13 +409,14 @@ public class SimpleArtifactRepositoryIO {
}
}
+ @Override
protected void finished() {
if (isValidXML()) {
String[][] mappingRules = (mappingRulesHandler == null ? new String[0][0] //
: mappingRulesHandler.getMappingRules());
Map<String, String> properties = (propertiesHandler == null ? new OrderedProperties(0) //
: propertiesHandler.getProperties());
- Set<SimpleArtifactDescriptor> artifacts = (artifactsHandler == null ? new HashSet<SimpleArtifactDescriptor>(0) //
+ Set<SimpleArtifactDescriptor> artifacts = (artifactsHandler == null ? new HashSet<>(0) //
: artifactsHandler.getArtifacts());
repository = new SimpleArtifactRepository(agent, attrValues[0], attrValues[1], attrValues[2], attrValues[3], //
attrValues[4], artifacts, mappingRules, properties);
@@ -426,7 +431,7 @@ public class SimpleArtifactRepositoryIO {
public MappingRulesHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, MAPPING_RULES_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- mappingRules = (size != null ? new ArrayList<String[]>(Integer.parseInt(size)) : new ArrayList<String[]>(4));
+ mappingRules = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>(4));
}
public String[][] getMappingRules() {
@@ -438,6 +443,7 @@ public class SimpleArtifactRepositoryIO {
return rules;
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (name.equals(MAPPING_RULE_ELEMENT)) {
new MappingRuleHandler(this, attributes, mappingRules);
@@ -456,6 +462,7 @@ public class SimpleArtifactRepositoryIO {
mappingRules.add(parseRequiredAttributes(attributes, required));
}
+ @Override
public void startElement(String name, Attributes attributes) {
invalidElement(name, attributes);
}
@@ -468,13 +475,14 @@ public class SimpleArtifactRepositoryIO {
public ArtifactsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, ARTIFACTS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- artifacts = (size != null ? new LinkedHashSet<SimpleArtifactDescriptor>(Integer.parseInt(size)) : new LinkedHashSet<SimpleArtifactDescriptor>(4));
+ artifacts = (size != null ? new LinkedHashSet<>(Integer.parseInt(size)) : new LinkedHashSet<>(4));
}
public Set<SimpleArtifactDescriptor> getArtifacts() {
return artifacts;
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (name.equals(ARTIFACT_ELEMENT)) {
new ArtifactHandler(this, attributes, artifacts);
@@ -504,6 +512,7 @@ public class SimpleArtifactRepositoryIO {
currentArtifact = new SimpleArtifactDescriptor(new ArtifactKey(values[0], values[1], version));
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (PROCESSING_STEPS_ELEMENT.equals(name)) {
if (processingStepsHandler == null) {
@@ -528,6 +537,7 @@ public class SimpleArtifactRepositoryIO {
}
}
+ @Override
protected void finished() {
if (isValidXML() && currentArtifact != null) {
Map<String, String> properties = (propertiesHandler == null ? new OrderedProperties(0) : propertiesHandler.getProperties());
@@ -551,13 +561,14 @@ public class SimpleArtifactRepositoryIO {
public ProcessingStepsHandler(AbstractHandler parentHandler, Attributes attributes) {
super(parentHandler, PROCESSING_STEPS_ELEMENT);
String size = parseOptionalAttribute(attributes, COLLECTION_SIZE_ATTRIBUTE);
- processingSteps = (size != null ? new ArrayList<IProcessingStepDescriptor>(Integer.parseInt(size)) : new ArrayList<IProcessingStepDescriptor>(4));
+ processingSteps = (size != null ? new ArrayList<>(Integer.parseInt(size)) : new ArrayList<>(4));
}
public IProcessingStepDescriptor[] getProcessingSteps() {
return processingSteps.isEmpty() ? EMPTY_STEPS : processingSteps.toArray(new ProcessingStepDescriptor[processingSteps.size()]);
}
+ @Override
public void startElement(String name, Attributes attributes) {
if (name.equals(PROCESSING_STEP_ELEMENT)) {
new ProcessingStepHandler(this, attributes, processingSteps);
@@ -578,15 +589,18 @@ public class SimpleArtifactRepositoryIO {
processingSteps.add(new ProcessingStepDescriptor(attributeValues[0], attributeValues[2], checkBoolean(PROCESSING_STEP_ELEMENT, STEP_REQUIRED_ATTRIBUTE, attributeValues[1]).booleanValue()));
}
+ @Override
public void startElement(String name, Attributes attributes) {
invalidElement(name, attributes);
}
}
+ @Override
protected String getErrorMessage() {
return Messages.io_parseError;
}
+ @Override
public String toString() {
// TODO:
return null;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/UniversalUniqueIdentifier.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/UniversalUniqueIdentifier.java
index 636893afa..9d64c83b8 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/UniversalUniqueIdentifier.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/UniversalUniqueIdentifier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2007 IBM Corporation and others.
+ * Copyright (c) 2000, 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
@@ -83,9 +83,9 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
/**
Constructor that accepts the bytes to use for the instance.&nbsp;&nbsp; The format
of the byte array is compatible with the <code>toBytes()</code> method.
-
+
<p>The constructor returns the undefined uuid if the byte array is invalid.
-
+
@see #toBytes()
@see #BYTES_SIZE
*/
@@ -119,6 +119,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
Simply increases the visibility of <code>Object</code>'s clone.
Otherwise, no new behaviour.
*/
+ @Override
public Object clone() {
try {
return super.clone();
@@ -174,6 +175,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
return address;
}
+ @Override
public boolean equals(Object obj) {
if (this == obj)
return true;
@@ -195,7 +197,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
/**
Answers the IP address of the local machine using the
Java API class <code>InetAddress</code>.
-
+
@return byte[] the network address in network order
@see java.net.InetAddress#getLocalHost()
@see java.net.InetAddress#getAddress()
@@ -214,6 +216,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
return nodeAddress;
}
+ @Override
public int hashCode() {
return fBits[0] + fBits[3] + fBits[7] + fBits[11] + fBits[15];
}
@@ -319,7 +322,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
/**
This representation is compatible with the (byte[]) constructor.
-
+
@see #UniversalUniqueIdentifier(byte[])
*/
public byte[] toBytes() {
@@ -329,6 +332,7 @@ public class UniversalUniqueIdentifier implements java.io.Serializable {
return result;
}
+ @Override
public String toString() {
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < fBits.length; i++)
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/XZedSimpleArtifactRepositoryFactory.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/XZedSimpleArtifactRepositoryFactory.java
index 2ed52fd10..9e8eba239 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/XZedSimpleArtifactRepositoryFactory.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/p2/artifact/repository/simple/XZedSimpleArtifactRepositoryFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 Rapicorp, Inc and others.
+ * Copyright (c) 2015, 2017 Rapicorp, Inc 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,10 +29,12 @@ public class XZedSimpleArtifactRepositoryFactory extends ArtifactRepositoryFacto
private static final String REPOSITORY_FILENAME = "artifacts.xml.xz"; //$NON-NLS-1$
private static final String PROTOCOL_FILE = "file"; //$NON-NLS-1$
+ @Override
public IArtifactRepository create(URI location, String name, String type, Map<String, String> properties) {
return new SimpleArtifactRepository(getAgent(), name, location, properties);
}
+ @Override
public IArtifactRepository load(URI location, int flags, IProgressMonitor monitor) throws ProvisionException {
return load(location, flags, monitor, true);
}
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
index a2f02b164..be4104abf 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStep.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2010 compeople AG and others.
+* Copyright (c) 2007, 2017 compeople AG 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
@@ -60,6 +60,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
* Process the given byte and pass the result on to the configured destination stream
* @param b the byte being written
*/
+ @Override
public void write(int b) throws IOException {
// nothing to do here!
}
@@ -67,6 +68,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
/**
* Flush any unwritten data from this stream.
*/
+ @Override
public void flush() throws IOException {
super.flush();
if (destination != null)
@@ -79,6 +81,7 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
* output stream. Implementors of this method should ensure they set the
* status of the step.
*/
+ @Override
public void close() throws IOException {
super.close();
if (destination instanceof ProcessingStep)
@@ -86,10 +89,12 @@ public abstract class ProcessingStep extends OutputStream implements IStateful {
monitor = null;
}
+ @Override
public IStatus getStatus() {
return status;
}
+ @Override
public void setStatus(IStatus value) {
if (value == null)
value = Status.OK_STATUS;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
index feb6bb4d7..6e95fcf16 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ProcessingStepHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
-* Copyright (c) 2007, 2010 compeople AG and others.
+* Copyright (c) 2007, 2017 compeople AG 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
@@ -62,7 +62,7 @@ public class ProcessingStepHandler {
public static IStatus getStatus(OutputStream stream, boolean deep) {
if (!deep)
return getStatus(stream);
- ArrayList<IStatus> list = new ArrayList<IStatus>();
+ ArrayList<IStatus> list = new ArrayList<>();
int severity = collectStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
@@ -76,7 +76,7 @@ public class ProcessingStepHandler {
* @return the requested status
*/
public static IStatus getErrorStatus(OutputStream stream) {
- ArrayList<IStatus> list = new ArrayList<IStatus>();
+ ArrayList<IStatus> list = new ArrayList<>();
int severity = collectErrorStatus(stream, list);
if (severity == IStatus.OK)
return Status.OK_STATUS;
diff --git a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ZipVerifierStep.java b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ZipVerifierStep.java
index a649b0c23..ba24f81eb 100644
--- a/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ZipVerifierStep.java
+++ b/bundles/org.eclipse.equinox.p2.artifact.repository/src/org/eclipse/equinox/internal/provisional/p2/artifact/repository/processing/ZipVerifierStep.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * 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 http://www.eclipse.org/legal/epl-v10.html
@@ -18,6 +18,7 @@ public class ZipVerifierStep extends ProcessingStep {
private int valid = 0; //-1 indicates that it is not a zip, >3 indicates that we are done the verification
+ @Override
public void write(int b) throws IOException {
getDestination().write(b);
if (valid > 3)
@@ -32,6 +33,7 @@ public class ZipVerifierStep extends ProcessingStep {
}
}
+ @Override
public void close() throws IOException {
if (valid > 3) {
setStatus(Status.OK_STATUS);

Back to the top