Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.classpath2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs27
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF4
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml2
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java79
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java11
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java17
9 files changed, 108 insertions, 54 deletions
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath b/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
index 64c5e31b7..eca7bdba8 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/.classpath
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.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.directorywatcher/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
index 06fa52ed5..0d5a93204 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/.settings/org.eclipse.jdt.core.prefs
@@ -9,18 +9,22 @@ 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.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
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -32,7 +36,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=warning
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
@@ -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
@@ -88,12 +94,16 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
+org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
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 +111,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=warning
@@ -113,7 +124,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.directorywatcher/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
index 84846a000..85e534127 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/META-INF/MANIFEST.MF
@@ -2,13 +2,13 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.equinox.p2.directorywatcher;singleton:=true
-Bundle-Version: 1.1.100.qualifier
+Bundle-Version: 1.2.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.provisional.p2.directorywatcher.Activator
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.equinox.internal.provisional.p2.directorywatcher;x-friends:="org.eclipse.equinox.p2.reconciler.dropins,org.eclipse.equinox.p2.extensionlocation"
Require-Bundle: org.eclipse.equinox.common;bundle-version="[3.7.0,4.0)"
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: org.eclipse.equinox.internal.p2.artifact.repository.simple,
org.eclipse.equinox.internal.p2.core.helpers,
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml b/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml
index 17f40cac0..50ad7041c 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/pom.xml
@@ -9,6 +9,6 @@
</parent>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.p2.directorywatcher</artifactId>
- <version>1.1.100-SNAPSHOT</version>
+ <version>1.2.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
index 9a5e51e85..762f5be31 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 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
@@ -33,10 +33,12 @@ public class Activator implements BundleActivator {
return context;
}
+ @Override
public void start(BundleContext aContext) throws Exception {
context = aContext;
}
+ @Override
public void stop(BundleContext aContext) throws Exception {
context = null;
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
index 96400552d..117ec0f2a 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/CachingArtifactRepository.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2015 Code 9 and others. All rights reserved. This
+ * Copyright (c) 2008, 2017 Code 9 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
@@ -24,26 +24,24 @@ import org.eclipse.equinox.p2.repository.IRunnableWithProgress;
import org.eclipse.equinox.p2.repository.artifact.*;
import org.eclipse.equinox.p2.repository.artifact.spi.ArtifactDescriptor;
-public class CachingArtifactRepository implements IArtifactRepository, IFileArtifactRepository {
+public class CachingArtifactRepository implements IFileArtifactRepository {
private static final String NULL = ""; //$NON-NLS-1$
private IArtifactRepository innerRepo;
- private Set<IArtifactDescriptor> descriptorsToAdd = new HashSet<IArtifactDescriptor>();
- private Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<IArtifactKey, List<IArtifactDescriptor>>();
- private Set<IArtifactDescriptor> descriptorsToRemove = new HashSet<IArtifactDescriptor>();
- private Map<String, String> propertyChanges = new HashMap<String, String>();
+ private Set<IArtifactDescriptor> descriptorsToAdd = new HashSet<>();
+ private Map<IArtifactKey, List<IArtifactDescriptor>> artifactMap = new HashMap<>();
+ private Set<IArtifactDescriptor> descriptorsToRemove = new HashSet<>();
+ private Map<String, String> propertyChanges = new HashMap<>();
protected CachingArtifactRepository(IArtifactRepository innerRepo) {
this.innerRepo = innerRepo;
}
public void save() {
- innerRepo.executeBatch(new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- savePropertyChanges();
- saveAdditions();
- saveRemovals();
- }
+ innerRepo.executeBatch(monitor -> {
+ savePropertyChanges();
+ saveAdditions();
+ saveRemovals();
}, null);
}
@@ -73,7 +71,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
IArtifactKey key = descriptor.getArtifactKey();
List<IArtifactDescriptor> descriptors = artifactMap.get(key);
if (descriptors == null) {
- descriptors = new ArrayList<IArtifactDescriptor>();
+ descriptors = new ArrayList<>();
artifactMap.put(key, descriptors);
}
descriptors.add(descriptor);
@@ -94,6 +92,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
artifactMap.remove(key);
}
+ @Override
public synchronized void addDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, descriptors.length);
@@ -109,11 +108,13 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void addDescriptors(IArtifactDescriptor[] descriptors) {
addDescriptors(descriptors, new NullProgressMonitor());
}
+ @Override
public synchronized void addDescriptor(IArtifactDescriptor toAdd, IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
@@ -128,44 +129,53 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void addDescriptor(IArtifactDescriptor toAdd) {
addDescriptor(toAdd, new NullProgressMonitor());
}
+ @Override
public synchronized IArtifactDescriptor[] getArtifactDescriptors(IArtifactKey key) {
List<IArtifactDescriptor> result = artifactMap.get(key);
if (result == null)
return innerRepo.getArtifactDescriptors(key);
- result = new ArrayList<IArtifactDescriptor>(result);
+ result = new ArrayList<>(result);
result.addAll(Arrays.asList(innerRepo.getArtifactDescriptors(key)));
return result.toArray(new IArtifactDescriptor[result.size()]);
}
+ @Override
public synchronized boolean contains(IArtifactDescriptor descriptor) {
return descriptorsToAdd.contains(descriptor) || innerRepo.contains(descriptor);
}
+ @Override
public synchronized boolean contains(IArtifactKey key) {
return artifactMap.containsKey(key) || innerRepo.contains(key);
}
+ @Override
public IStatus getArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
return innerRepo.getArtifact(descriptor, destination, monitor);
}
+ @Override
public IStatus getRawArtifact(IArtifactDescriptor descriptor, OutputStream destination, IProgressMonitor monitor) {
return innerRepo.getRawArtifact(descriptor, destination, monitor);
}
+ @Override
public IStatus getArtifacts(IArtifactRequest[] requests, IProgressMonitor monitor) {
return Status.OK_STATUS;
}
+ @Override
public OutputStream getOutputStream(IArtifactDescriptor descriptor) {
return null;
}
+ @Override
public synchronized final void removeAll(IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
@@ -179,11 +189,13 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public synchronized void removeAll() {
this.removeAll(new NullProgressMonitor());
}
+ @Override
public synchronized void removeDescriptor(IArtifactDescriptor descriptor, IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
@@ -195,11 +207,13 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void removeDescriptor(IArtifactDescriptor descriptor) {
removeDescriptor(descriptor, new NullProgressMonitor());
}
+ @Override
public synchronized void removeDescriptor(IArtifactKey key, IProgressMonitor monitor) {
try {
IArtifactDescriptor[] toRemove = getArtifactDescriptors(key);
@@ -214,11 +228,13 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void removeDescriptor(IArtifactKey key) {
this.removeDescriptor(key, new NullProgressMonitor());
}
+ @Override
public synchronized void removeDescriptors(IArtifactDescriptor[] descriptors, IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, descriptors.length);
@@ -232,11 +248,13 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void removeDescriptors(IArtifactDescriptor[] descriptors) {
removeDescriptors(descriptors, new NullProgressMonitor());
}
+ @Override
public synchronized void removeDescriptors(IArtifactKey[] keys, IProgressMonitor monitor) {
try {
SubMonitor subMonitor = SubMonitor.convert(monitor, keys.length);
@@ -250,6 +268,7 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
@Deprecated
public final synchronized void removeDescriptors(IArtifactKey[] keys) {
removeDescriptors(keys, new NullProgressMonitor());
@@ -269,47 +288,58 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
return result;
}
+ @Override
public String getDescription() {
return innerRepo.getDescription();
}
+ @Override
public URI getLocation() {
return innerRepo.getLocation();
}
+ @Override
public String getName() {
return innerRepo.getName();
}
+ @Override
public Map<String, String> getProperties() {
// TODO need to combine the local and inner properties
return innerRepo.getProperties();
}
+ @Override
public String getProperty(String key) {
return innerRepo.getProperty(key);
}
+ @Override
public String getProvider() {
return innerRepo.getProvider();
}
+ @Override
public IProvisioningAgent getProvisioningAgent() {
return innerRepo.getProvisioningAgent();
}
+ @Override
public String getType() {
return innerRepo.getType();
}
+ @Override
public String getVersion() {
return innerRepo.getVersion();
}
+ @Override
public boolean isModifiable() {
return innerRepo.isModifiable();
}
+ @Override
public String setProperty(String key, String value, IProgressMonitor monitor) {
try {
String result = getProperties().get(key);
@@ -321,57 +351,58 @@ public class CachingArtifactRepository implements IArtifactRepository, IFileArti
}
}
+ @Override
public final String setProperty(String key, String value) {
return setProperty(key, value, new NullProgressMonitor());
}
+ @Override
public <T> T getAdapter(Class<T> adapter) {
return innerRepo.getAdapter(adapter);
}
+ @Override
public File getArtifactFile(IArtifactKey key) {
if (innerRepo instanceof IFileArtifactRepository)
return ((IFileArtifactRepository) innerRepo).getArtifactFile(key);
return null;
}
+ @Override
public File getArtifactFile(IArtifactDescriptor descriptor) {
if (innerRepo instanceof IFileArtifactRepository)
return ((IFileArtifactRepository) innerRepo).getArtifactFile(descriptor);
return null;
}
+ @Override
public IArtifactDescriptor createArtifactDescriptor(IArtifactKey key) {
return innerRepo.createArtifactDescriptor(key);
}
+ @Override
public IArtifactKey createArtifactKey(String classifier, String id, Version version) {
return innerRepo.createArtifactKey(classifier, id, version);
}
+ @Override
public IQueryable<IArtifactDescriptor> descriptorQueryable() {
final Collection<List<IArtifactDescriptor>> descs = artifactMap.values();
- IQueryable<IArtifactDescriptor> cached = new IQueryable<IArtifactDescriptor>() {
- public IQueryResult<IArtifactDescriptor> query(IQuery<IArtifactDescriptor> query, IProgressMonitor monitor) {
- return query.perform(new CompoundIterator<IArtifactDescriptor>(descs.iterator()));
- }
- };
+ IQueryable<IArtifactDescriptor> cached = (query, monitor) -> query.perform(new CompoundIterator<IArtifactDescriptor>(descs.iterator()));
return QueryUtil.compoundQueryable(cached, innerRepo.descriptorQueryable());
}
+ @Override
public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> query, IProgressMonitor monitor) {
final Iterator<IArtifactKey> keyIterator = artifactMap.keySet().iterator();
- IQueryable<IArtifactKey> cached = new IQueryable<IArtifactKey>() {
- public IQueryResult<IArtifactKey> query(IQuery<IArtifactKey> q, IProgressMonitor mon) {
- return q.perform(keyIterator);
- }
- };
+ IQueryable<IArtifactKey> cached = (q, mon) -> q.perform(keyIterator);
IQueryable<IArtifactKey> compound = QueryUtil.compoundQueryable(cached, innerRepo);
return compound.query(query, monitor);
}
+ @Override
public IStatus executeBatch(IRunnableWithProgress runnable, IProgressMonitor monitor) {
try {
runnable.run(monitor);
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
index 545d1ed9e..4a02382a5 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/DirectoryWatcher.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 aQute and others.
+ * Copyright (c) 2007, 2017 aQute 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 DirectoryWatcher {
this.pollFrequency = pollFrequency;
}
+ @Override
public void run() {
do {
try {
@@ -62,8 +63,8 @@ public class DirectoryWatcher {
final File[] directories;
long poll = 2000;
- private Set<DirectoryChangeListener> listeners = new HashSet<DirectoryChangeListener>();
- private HashSet<File> scannedFiles = new HashSet<File>();
+ private Set<DirectoryChangeListener> listeners = new HashSet<>();
+ private HashSet<File> scannedFiles = new HashSet<>();
private HashSet<File> removals;
private Set<File> pendingDeletions;
private WatcherThread watcher;
@@ -131,8 +132,8 @@ public class DirectoryWatcher {
private void startPoll() {
removals = scannedFiles;
- scannedFiles = new HashSet<File>();
- pendingDeletions = new HashSet<File>();
+ scannedFiles = new HashSet<>();
+ pendingDeletions = new HashSet<>();
for (DirectoryChangeListener listener : listeners)
listener.startPoll();
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
index 9ac9276c7..ebb583cc9 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/EntryAdvice.java
@@ -1,5 +1,6 @@
/*******************************************************************************
- * Copyright (c) 2008, 2010 Code 9 and others. All rights reserved. This
+ * Copyright (c) 2008, 2017 Code 9 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
@@ -10,16 +11,14 @@
******************************************************************************/
package org.eclipse.equinox.internal.provisional.p2.directorywatcher;
-import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
-
-import org.eclipse.equinox.p2.metadata.Version;
-
import java.io.File;
import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.equinox.internal.p2.update.Site;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.MetadataFactory.InstallableUnitDescription;
+import org.eclipse.equinox.p2.metadata.Version;
import org.eclipse.equinox.p2.publisher.actions.IPropertyAdvice;
import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
@@ -29,9 +28,10 @@ import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
* only one entry at a time and that entry is the the only entry being published.
*/
public class EntryAdvice implements IPropertyAdvice {
- private Map<String, String> metadataProps = new HashMap<String, String>();
- private Map<String, String> artifactProps = new HashMap<String, String>();
+ private Map<String, String> metadataProps = new HashMap<>();
+ private Map<String, String> artifactProps = new HashMap<>();
+ @Override
public boolean isApplicable(String configSpec, boolean includeDefault, String id, Version version) {
return true;
}
@@ -56,10 +56,12 @@ public class EntryAdvice implements IPropertyAdvice {
metadataProps.put(Site.PROP_LINK_FILE, linkFile);
}
+ @Override
public Map<String, String> getArtifactProperties(IInstallableUnit iu, IArtifactDescriptor descriptor) {
return artifactProps;
}
+ @Override
public Map<String, String> getInstallableUnitProperties(InstallableUnitDescription iu) {
return metadataProps;
}
diff --git a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
index 0f294aced..23a93369c 100644
--- a/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.java
+++ b/bundles/org.eclipse.equinox.p2.directorywatcher/src/org/eclipse/equinox/internal/provisional/p2/directorywatcher/RepositoryListener.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,8 +40,8 @@ public class RepositoryListener extends DirectoryChangeListener {
private final CachingArtifactRepository artifactRepository;
// at any point in time currentFiles is the list of files/dirs that the watcher has seen and
// believes to be on disk.
- private final Map<File, Long> currentFiles = new HashMap<File, Long>();
- private final Collection<File> polledSeenFiles = new HashSet<File>();
+ private final Map<File, Long> currentFiles = new HashMap<>();
+ private final Collection<File> polledSeenFiles = new HashSet<>();
private EntryAdvice advice = new EntryAdvice();
private PublisherInfo info;
@@ -113,14 +113,17 @@ public class RepositoryListener extends DirectoryChangeListener {
}
}
+ @Override
public boolean added(File file) {
return process(file, true);
}
+ @Override
public boolean changed(File file) {
return process(file, false);
}
+ @Override
public boolean removed(File file) {
// the IUs and artifacts associated with this file will get removed in stopPoll
return currentFiles.containsKey(file);
@@ -160,10 +163,12 @@ public class RepositoryListener extends DirectoryChangeListener {
return action.perform(info, result, new NullProgressMonitor()).isOK();
}
+ @Override
public boolean isInterested(File file) {
return true;
}
+ @Override
public Long getSeenFile(File file) {
Long lastSeen = currentFiles.get(file);
if (lastSeen != null)
@@ -171,14 +176,16 @@ public class RepositoryListener extends DirectoryChangeListener {
return lastSeen;
}
+ @Override
public void startPoll() {
iusToAdd = new PublisherResult();
iusToChange = new PublisherResult();
synchronizeCurrentFiles();
}
+ @Override
public void stopPoll() {
- final Set<File> filesToRemove = new HashSet<File>(currentFiles.keySet());
+ final Set<File> filesToRemove = new HashSet<>(currentFiles.keySet());
filesToRemove.removeAll(polledSeenFiles);
polledSeenFiles.clear();
@@ -203,7 +210,7 @@ public class RepositoryListener extends DirectoryChangeListener {
// We convert the java.io.File objects to Strings before doing the comparison
// because when we have large numbers of files, the performance is much better.
// See bug 324353.
- Collection<String> paths = new HashSet<String>(removedFiles.size());
+ Collection<String> paths = new HashSet<>(removedFiles.size());
for (File file : removedFiles)
paths.add(file.getAbsolutePath());
IQuery<IInstallableUnit> removeQuery = QueryUtil.createMatchQuery( //

Back to the top