From 88d62a6976b928a566800e43a2ea7c50fedbd8fa Mon Sep 17 00:00:00 2001
From: Nicolas Lalevee
Date: Tue, 14 Dec 2010 16:28:01 +0000
Subject: [PATCH] svn_apply_autoprops, mainly for line endings
git-svn-id: https://svn.apache.org/repos/asf/ant/ivy/core/trunk@1049146 13f79535-47bb-0310-9956-ffa450edef68
---
.project | 94 +-
ivysettings-release.xml | 76 +-
.../ivy/core/cache/CacheDownloadOptions.java | 78 +-
.../ivy/core/cache/DownloadListener.java | 68 +-
.../core/cache/RepositoryCacheManager.java | 336 +++----
.../core/cache/ResolutionCacheManager.java | 78 +-
.../retrieve/EndRetrieveArtifactEvent.java | 62 +-
.../core/event/retrieve/EndRetrieveEvent.java | 166 ++--
.../event/retrieve/RetrieveArtifactEvent.java | 114 +--
.../core/event/retrieve/RetrieveEvent.java | 92 +-
.../retrieve/StartRetrieveArtifactEvent.java | 62 +-
.../event/retrieve/StartRetrieveEvent.java | 58 +-
.../module/descriptor/ConfigurationGroup.java | 144 +--
.../descriptor/ConfigurationIntersection.java | 144 +--
.../descriptor/DefaultExtendsDescriptor.java | 158 ++--
.../module/descriptor/ExtendsDescriptor.java | 126 +--
.../module/descriptor/InheritableItem.java | 68 +-
.../apache/ivy/core/module/id/package.html | 120 +--
.../RepositoryManagementEngine.java | 672 +++++++-------
.../RepositoryManagementEngineSettings.java | 48 +-
.../ivy/core/resolve/IvyNodeBlacklist.java | 138 +--
.../core/resolve/ResolveProcessException.java | 92 +-
.../core/resolve/RestartResolveProcess.java | 68 +-
...AbstractLogCircularDependencyStrategy.java | 112 +--
.../LatestCompatibleConflictManager.java | 622 ++++++-------
.../plugins/lock/AbstractLockStrategy.java | 88 +-
.../plugins/lock/ArtifactLockStrategy.java | 92 +-
.../plugins/lock/FileBasedLockStrategy.java | 460 +++++-----
.../apache/ivy/plugins/lock/LockStrategy.java | 146 +--
.../ivy/plugins/lock/NoLockStrategy.java | 70 +-
.../plugins/parser/m2/PomWriterOptions.java | 382 ++++----
.../repository/ArtifactResourceResolver.java | 58 +-
.../repository/ResourceDownloader.java | 76 +-
.../plugins/signer/SignatureGenerator.java | 62 +-
.../OpenPGPSignatureGenerator.java | 352 +++----
.../ivy/plugins/trigger/LogTrigger.java | 250 ++---
src/java/org/apache/ivy/util/MemoryUtil.java | 178 ++--
test/buildlist/E2/build.xml | 36 +-
test/buildlist/E2/ivy.xml | 42 +-
test/buildlist/H/build.xml | 36 +-
.../ivy/ant/IvyAntSettingsBuildFile.xml | 94 +-
.../IvyAntSettingsBuildFileStackOverflow.xml | 64 +-
.../ivy/ant/IvyAntSettingsBuildFileTest.java | 138 +--
.../apache/ivy/ant/IvyRetrieveBuildFile.xml | 68 +-
.../ivy/ant/IvyRetrieveBuildFileTest.java | 72 +-
test/java/org/apache/ivy/ant/ivy-630.xml | 48 +-
test/java/org/apache/ivy/ant/ivy-631.xml | 48 +-
.../org/apache/ivy/ant/ivy-artifact-info.xml | 72 +-
.../org/apache/ivy/ant/ivy-extends-merged.xml | 100 +-
.../ivy/ant/ivy-extends-minimal-merged.xml | 82 +-
.../apache/ivy/ant/ivy-extends-minimal.xml | 52 +-
.../apache/ivy/ant/ivy-extends-multiconf.xml | 80 +-
.../ivy/ant/ivysettings-defaultCacheDir.xml | 42 +-
.../ivy/ant/ivysettings-include-twice.xml | 44 +-
.../ivy/ant/ivysettings-noDefaultCacheDir.xml | 42 +-
.../apache/ivy/core/deliver/DeliverTest.java | 200 ++--
.../org/apache/ivy/core/deliver/ivy-1111.xml | 52 +-
.../ivy/core/publish/PublishEngineTest.java | 286 +++---
.../RepositoryManagementEngineTest.java | 136 +--
.../ivy/core/resolve/ResolveEngineTest.java | 200 ++--
.../org/apache/ivy/core/resolve/ivy-1178.xml | 56 +-
.../org/apache/ivy/core/resolve/ivy-590.xml | 58 +-
.../org/apache/ivy/core/resolve/ivy-874.xml | 72 +-
.../org/apache/ivy/core/resolve/ivy-956.xml | 50 +-
.../org/apache/ivy/core/resolve/ivy-999.xml | 52 +-
.../ivy-extra-att-multipledependencies.xml | 80 +-
.../ivy-extra-att-multipledependencies2.xml | 80 +-
.../ivy-extra-attrib-forced-dependencies.xml | 80 +-
.../ivy/core/resolve/ivy-m2-with-src.xml | 48 +-
.../ivy/core/resolve/ivy-mod1.2-1.5.xml | 52 +-
.../ivy/core/settings/IvySettingsTest.java | 96 +-
.../ivysettings-extra-module-attribute.xml | 48 +-
.../settings/ivysettings-include-special.xml | 50 +-
.../ivy/core/settings/ivysettings-macro#2.xml | 90 +-
.../ivysettings-properties-missing-file.xml | 104 +--
.../IgnoreCircularDependencyStrategyTest.java | 100 +-
.../WarnCircularDependencyStrategyTest.java | 180 ++--
.../LatestCompatibleConflictManagerTest.java | 376 ++++----
.../plugins/conflict/ivy-conflict-dynamic.xml | 50 +-
.../conflict/ivy-noconflict-dynamic.xml | 50 +-
.../ivysettings-latest-compatible.xml | 60 +-
.../lock/ArtifactLockStrategyTest.java | 386 ++++----
.../m2/test-write-compile-dependencies.xml | 86 +-
.../parser/m2/test-write-packaging.xml | 58 +-
...est-defaultconf-withdefaultconfmapping.xml | 70 +-
.../plugins/parser/xml/test-extends-all.xml | 64 +-
.../parser/xml/test-extends-cached.xml | 64 +-
.../xml/test-extends-configurations.xml | 66 +-
.../parser/xml/test-extends-dependencies.xml | 60 +-
.../xml/test-extends-description-override.xml | 62 +-
.../parser/xml/test-extends-description.xml | 60 +-
.../plugins/parser/xml/test-extends-mixed.xml | 66 +-
.../parser/xml/test-extends-parent.xml | 68 +-
.../ivy/plugins/parser/xml/test-info.xml | 54 +-
.../parser/xml/test-update-withvar.xml | 220 ++---
.../plugins/parser/xml/test-with-comments.xml | 76 +-
.../plugins/parser/xml/test-write-extends.xml | 88 +-
.../plugins/parser/xml/test-write-info.xml | 76 +-
.../org/apache/ivy/plugins/report/ivy-635.xml | 50 +-
.../resolver/util/ResolverHelperTest.java | 82 +-
.../ivy/plugins/trigger/LogTriggerTest.java | 182 ++--
.../version/LatestVersionMatcherTest.java | 94 +-
.../version/PatternVersionMatcherTest.java | 202 ++---
.../ivy/util/url/AbstractURLHandlerTest.java | 168 ++--
.../ivy/util/url/ArtifactoryListingTest.java | 70 +-
.../ivy/util/url/artifactory-dir-listing.html | 856 +++++++++---------
.../1/IVY-644/M1/ivys/ivy-1.0.xml | 18 +-
.../1/IVY-644/M2/ivys/ivy-1.0.xml | 10 +-
.../1/IVY-644/M3/ivys/ivy-1.0.xml | 12 +-
.../1/IVY-644/M4/ivys/ivy-1.0.xml | 10 +-
.../1/IVY-644/M4/ivys/ivy-1.1.xml | 10 +-
.../1/IVY-644/M4/ivys/ivy-1.2.xml | 10 +-
.../multiple-same-deps/mod1/ivys/ivy-1.0.xml | 62 +-
.../multiple-same-deps/mod2/ivys/ivy-1.0.xml | 64 +-
.../multiple-same-deps/mod3/ivys/ivy-1.0.xml | 66 +-
.../multiple-same-deps/mod31/ivys/ivy-1.0.xml | 52 +-
.../multiple-same-deps/mod32/ivys/ivy-1.0.xml | 52 +-
.../multiple-same-deps/mod33/ivys/ivy-1.0.xml | 52 +-
.../1/org2/mod2.1/ivys/ivy-0.5.xml | 70 +-
.../1/org2/mod2.1/ivys/ivy-0.6.xml | 68 +-
.../1/org2/mod2.2/ivys/ivy-0.9.xml | 68 +-
.../1/org2/mod2.8/ivys/ivy-0.6.xml | 84 +-
.../1/org20/mod20.1/ivys/ivy-1.0.xml | 60 +-
.../1/org20/mod20.1/ivys/ivy-1.1.xml | 60 +-
.../1/org20/mod20.2/ivys/ivy-1.0.xml | 60 +-
.../1/org20/mod20.3/ivys/ivy-1.0.xml | 60 +-
.../1/org20/mod20.4/ivys/ivy-1.0.xml | 62 +-
.../modB/ivys/ivy-1.0.xml | 10 +-
.../root/ivys/ivy-1.0.xml | 68 +-
.../1/usecacheonly/mod1/ivys/ivy-1.0.xml | 54 +-
.../1/usecacheonly/mod2/ivys/ivy-1.0.xml | 52 +-
test/repositories/2/mod15.3/ivy-1.1.xml | 60 +-
test/repositories/2/mod15.4/ivy-1.1.xml | 60 +-
test/repositories/2/mod16.1/ivy-1.0.xml | 60 +-
test/repositories/2/mod17.1/ivy-1.0.xml | 4 +-
test/repositories/2/mod5.1/ivy-4.4.xml | 92 +-
test/repositories/2/mod5.1/ivy-4.5.xml | 90 +-
test/repositories/2/mod5.2/ivy-3.0.xml | 76 +-
test/repositories/2/mod5.2/ivy-3.1.xml | 74 +-
test/repositories/2/modpom-dbunit/ivy-2.2.xml | 108 +--
.../repositories/2/modpom-junit/ivy-3.8.1.xml | 78 +-
.../repositories/2/modpom-junit/ivy-3.8.2.xml | 78 +-
test/repositories/IVY-1037/ivysettings.xml | 64 +-
.../IVY-1037/rep1/org/module/ivy-1.xml | 44 +-
.../IVY-1037/rep2/org/module/ivy-2.xml | 44 +-
test/repositories/IVY-1111/ivysettings.xml | 54 +-
.../IVY-1111/junit/junit/ivy-3.8.xml | 44 +-
.../IVY-1111/junit/junit/ivy-4.4.xml | 44 +-
test/repositories/IVY-1111/test/a/ivy-1.xml | 50 +-
test/repositories/IVY-1111/test/b/ivy-1.5.xml | 52 +-
test/repositories/IVY-1128/ivysettings.xml | 54 +-
.../test/a/extraatt.a/extraatt2.a/ivy-1.xml | 44 +-
.../test/a/extraatt.a/extraatt2.a/ivy-2.xml | 44 +-
.../test/a/extraatt.a/extraatt2/ivy-1.xml | 44 +-
.../test/a/extraatt.a/extraatt2/ivy-2.xml | 44 +-
.../test/a/extraatt/extraatt2.a/ivy-1.xml | 44 +-
.../test/a/extraatt/extraatt2.a/ivy-2.xml | 44 +-
.../test/a/extraatt/extraatt2/ivy-1.xml | 44 +-
.../test/a/extraatt/extraatt2/ivy-2.xml | 44 +-
test/repositories/IVY-1159/ivysettings.xml | 54 +-
.../IVY-1159/myorg/modA/1/ivy.xml | 54 +-
.../IVY-1159/myorg/modB/1/ivy.xml | 60 +-
test/repositories/IVY-1178/ivysettings.xml | 54 +-
.../IVY-1178/myorg/modA/1.0/ivy-1.0.xml | 56 +-
.../IVY-1178/myorg/modB/1.0/ivy-1.0.xml | 54 +-
.../IVY-1178/myorg/modC/1.0/ivy-1.0.xml | 54 +-
.../IVY-1178/myorg/modD/1.0/ivy-1.0.xml | 68 +-
.../IVY-1178/myorg/modD/1.1/ivy-1.1.xml | 72 +-
.../IVY-1178/myorg/modE/1.0/ivy-1.0.xml | 44 +-
.../IVY-1178/myorg/modE/1.1/ivy-1.1.xml | 68 +-
.../IVY-1179/repo/org/A/1.0/ivy.xml | 58 +-
.../IVY-1179/repo/org/A/1.0/packager.xml | 68 +-
.../IVY-1179/repo/org/B/1.0/ivy.xml | 58 +-
.../IVY-1179/repo/org/B/1.0/packager.xml | 68 +-
.../IVY-1238/ivy-org/modA/v1.0/ivy.xml | 46 +-
.../IVY-1238/ivy-org/modA/v2.0/ivy.xml | 46 +-
test/repositories/IVY-630/ivysettings.xml | 54 +-
test/repositories/IVY-635/ivysettings.xml | 54 +-
test/repositories/IVY-635/mod1/ivy.xml | 50 +-
test/repositories/IVY-716/ivysettings.xml | 54 +-
.../org1/branch1/mod1.1/1.0/ivy.xml.txt | 60 +-
.../org1/branch2/mod1.1/1.0/ivy.xml.txt | 60 +-
test/repositories/IVY-999/ivysettings.xml | 54 +-
.../IVY-999/junit/junit/ivy-3.8.xml | 44 +-
.../IVY-999/junit/junit/ivy-4.4.xml | 44 +-
test/repositories/IVY-999/test/a/ivy-1.xml | 50 +-
test/repositories/IVY-999/test/b/ivy-1.5.xml | 52 +-
.../checksums/allright/ivy-1.0.xml | 62 +-
.../checksums/badartcs/ivy-1.0.xml | 50 +-
.../checksums/badivycs/ivy-1.0.xml | 50 +-
.../CAE-VSK/VSK-FC/0.53.0.1/ivy-0.53.0.1.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.0.0/ivy-0.54.0.0.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.1.0/ivy-0.54.1.0.xml | 88 +-
.../RTS/6.2.1.20/ivy-6.2.1.20.xml | 40 +-
.../SGL/6.2.34.17/ivy-6.2.34.17.xml | 40 +-
.../SGL/6.2.34.7/ivy-6.2.34.7.xml | 40 +-
.../CAE-VSK/VSK-FC/0.53.0.1/ivy-0.53.0.1.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.0.0/ivy-0.54.0.0.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.1.0/ivy-0.54.1.0.xml | 88 +-
.../RTS/6.2.1.20/ivy-6.2.1.20.xml | 40 +-
.../SGL/6.2.34.17/ivy-6.2.34.17.xml | 40 +-
.../SGL/6.2.34.7/ivy-6.2.34.7.xml | 40 +-
.../ivysettings-filerepo-attribs.xml | 66 +-
.../ivysettings-filerepo-noattribs.xml | 66 +-
.../CAE-VSK/VSK-FC/0.53.0.1/ivy-0.53.0.1.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.0.0/ivy-0.54.0.0.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.1.0/ivy-0.54.1.0.xml | 88 +-
.../CAE-VSK/VSK-FC/0.53.0.1/ivy-0.53.0.1.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.0.0/ivy-0.54.0.0.xml | 88 +-
.../CAE-VSK/VSK-FC/0.54.1.0/ivy-0.54.1.0.xml | 88 +-
.../ivysettings-filerepo-attribs.xml | 66 +-
.../ivysettings-filerepo-noattribs.xml | 66 +-
.../ivysettings-artifact-lock.xml | 98 +-
test/repositories/ivysettings-checksums.xml | 56 +-
test/repositories/ivysettings-url.xml | 66 +-
.../multi-ivypattern/ivy2/ivy-1.0.xml | 54 +-
test/repositories/norev/ivy-latest.xml | 54 +-
.../parentPom/ivysettings-namespace.xml | 86 +-
test/repositories/parentPom/ivysettings.xml | 82 +-
219 files changed, 9878 insertions(+), 9878 deletions(-)
diff --git a/.project b/.project
index 26e22112..dfa48187 100644
--- a/.project
+++ b/.project
@@ -1,47 +1,47 @@
-
-
-
- ivy
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
- org.eclipse.pde.ManifestBuilder
-
-
-
-
- com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder
-
-
-
-
-
- org.eclipse.pde.PluginNature
- org.eclipse.jdt.core.javanature
- com.atlassw.tools.eclipse.checkstyle.CheckstyleNature
-
-
+
+
+
+ ivy
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ com.atlassw.tools.eclipse.checkstyle.CheckstyleBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+ com.atlassw.tools.eclipse.checkstyle.CheckstyleNature
+
+
diff --git a/ivysettings-release.xml b/ivysettings-release.xml
index 4c8c0689..d4033cec 100644
--- a/ivysettings-release.xml
+++ b/ivysettings-release.xml
@@ -1,38 +1,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java b/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
index d2d9dca5..a77f3b4c 100644
--- a/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
+++ b/src/java/org/apache/ivy/core/cache/CacheDownloadOptions.java
@@ -1,39 +1,39 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.cache;
-
-
-public class CacheDownloadOptions {
- private DownloadListener listener = null;
- private boolean force = false;
-
- public DownloadListener getListener() {
- return listener;
- }
- public CacheDownloadOptions setListener(DownloadListener listener) {
- this.listener = listener;
- return this;
- }
- public boolean isForce() {
- return force;
- }
- public CacheDownloadOptions setForce(boolean force) {
- this.force = force;
- return this;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.cache;
+
+
+public class CacheDownloadOptions {
+ private DownloadListener listener = null;
+ private boolean force = false;
+
+ public DownloadListener getListener() {
+ return listener;
+ }
+ public CacheDownloadOptions setListener(DownloadListener listener) {
+ this.listener = listener;
+ return this;
+ }
+ public boolean isForce() {
+ return force;
+ }
+ public CacheDownloadOptions setForce(boolean force) {
+ this.force = force;
+ return this;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/cache/DownloadListener.java b/src/java/org/apache/ivy/core/cache/DownloadListener.java
index b319b595..00f0dbb2 100644
--- a/src/java/org/apache/ivy/core/cache/DownloadListener.java
+++ b/src/java/org/apache/ivy/core/cache/DownloadListener.java
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.cache;
-
-import java.io.File;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-import org.apache.ivy.plugins.resolver.util.ResolvedResource;
-
-public interface DownloadListener {
- public void needArtifact(RepositoryCacheManager cache, Artifact artifact);
- public void startArtifactDownload(
- RepositoryCacheManager cache, ResolvedResource rres,
- Artifact artifact, ArtifactOrigin origin);
- public void endArtifactDownload(
- RepositoryCacheManager cache, Artifact artifact,
- ArtifactDownloadReport adr, File archiveFile);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.cache;
+
+import java.io.File;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+
+public interface DownloadListener {
+ public void needArtifact(RepositoryCacheManager cache, Artifact artifact);
+ public void startArtifactDownload(
+ RepositoryCacheManager cache, ResolvedResource rres,
+ Artifact artifact, ArtifactOrigin origin);
+ public void endArtifactDownload(
+ RepositoryCacheManager cache, Artifact artifact,
+ ArtifactDownloadReport adr, File archiveFile);
+}
diff --git a/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java b/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
index cca1b4c0..231bd9a2 100644
--- a/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/RepositoryCacheManager.java
@@ -1,168 +1,168 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.cache;
-
-import java.text.ParseException;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-import org.apache.ivy.core.resolve.ResolvedModuleRevision;
-import org.apache.ivy.plugins.repository.ArtifactResourceResolver;
-import org.apache.ivy.plugins.repository.ResourceDownloader;
-import org.apache.ivy.plugins.resolver.DependencyResolver;
-import org.apache.ivy.plugins.resolver.util.ResolvedResource;
-
-public interface RepositoryCacheManager {
-
- /**
- * Returns the name of the repository cache manager.
- * @return the name of the repository cache manager.
- */
- public abstract String getName();
-
- /**
- * Saves the information of which resolvers were used to resolve a module (both for metadata and
- * artifact), so that this info can be loaded later (even after a jvm restart) for the use of
- * {@link #findModuleInCache(DependencyDescriptor, CacheMetadataOptions, String)}.
- *
- * @param md
- * the module descriptor resolved
- * @param metadataResolverName
- * metadata resolver name
- * @param artifactResolverName
- * artifact resolver name
- */
- public abstract void saveResolvers(
- ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName);
-
- /**
- * Returns the artifact origin of the given artifact as saved in this cache.
- *
- * If the origin is unknown, the returned ArtifactOrigin instance will return true when
- * {@link ArtifactOrigin#isUnknown(ArtifactOrigin)} is called.
- *
- * @param artifact
- * the artifact for which the saved artifact origin should be returned.
- * @return the artifact origin of the given artifact as saved in this cache
- */
- public abstract ArtifactOrigin getSavedArtifactOrigin(Artifact artifact);
-
- /**
- * Search a module descriptor in cache for a mrid
- *
- * @param dd
- * the dependency descriptor identifying the module to search
- * @param requestedRevisionId
- * the requested dependency module revision id identifying the module to search
- * @param options
- * options on how caching should be handled
- * @param expectedResolver
- * the resolver with which the md in cache must have been resolved to be returned,
- * null if this doesn't matter
- * @return the ResolvedModuleRevision corresponding to the module found, null if none correct
- * has been found in cache
- */
- public abstract ResolvedModuleRevision findModuleInCache(
- DependencyDescriptor dd, ModuleRevisionId requestedRevisionId,
- CacheMetadataOptions options, String expectedResolver);
-
- /**
- * Downloads an artifact to this cache.
- *
- * @param artifact
- * the artifact to download
- * @param resourceResolver
- * a resource resolver to use if the artifact needs to be resolved to a Resource for
- * downloading
- * @param resourceDownloader
- * a resource downloader to use if actual download of the resource is needed
- * @param options
- * a set of options to adjust the download
- * @return a report indicating how the download was performed
- */
- public abstract ArtifactDownloadReport download(
- Artifact artifact,
- ArtifactResourceResolver resourceResolver,
- ResourceDownloader resourceDownloader,
- CacheDownloadOptions options);
-
- /**
- * Caches an original module descriptor.
- *
- * After this call, the original module descriptor file (with no modification nor conversion)
- * should be available as a local file.
- *
- *
- * @param resolver
- * the dependency resolver from which the cache request comes from
- * @param orginalMetadataRef
- * a resolved resource pointing to the remote original module descriptor
- * @param dd
- * the dependency descriptor for which the module descriptor should be cached
- * @param requestedMetadataArtifact
- * the module descriptor artifact as requested originally
- * @param downloader
- * a ResourceDownloader able to download the original module descriptor resource if
- * required by this cache implementation
- * @param options
- * options to apply to cache this module descriptor
- * @return a {@link ResolvedModuleRevision} representing the local cached module descriptor, or
- * null if it failed
- * @throws ParseException
- * if an exception occurred while parsing the module descriptor
- */
- public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
- ResolvedResource orginalMetadataRef, DependencyDescriptor dd,
- Artifact requestedMetadataArtifact, ResourceDownloader downloader,
- CacheMetadataOptions options) throws ParseException;
-
- /**
- * Stores a standardized version of an original module descriptor in the cache for later use.
- *
- * @param resolver
- * the dependency resolver from which the cache request comes from
- * @param orginalMetadataRef
- * a resolved resource pointing to the remote original module descriptor
- * @param requestedMetadataArtifact
- * the module descriptor artifact as requested originally
- * @param rmr
- * the {@link ResolvedModuleRevision} representing the local cached module descriptor
- * @param writer
- * a {@link ModuleDescriptorWriter} able to write the module descriptor to a stream.
- */
- public void originalToCachedModuleDescriptor(DependencyResolver resolver,
- ResolvedResource orginalMetadataRef, Artifact requestedMetadataArtifact,
- ResolvedModuleRevision rmr, ModuleDescriptorWriter writer);
-
- /**
- * Cleans the whole cache.
- */
- public void clean();
-
- /**
- * Caches a dynamic revision constraint resolution.
- *
- * @param dynamicMrid the dynamic module revision id
- * @param revision the resolved revision
- */
- public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.cache;
+
+import java.text.ParseException;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.plugins.repository.ArtifactResourceResolver;
+import org.apache.ivy.plugins.repository.ResourceDownloader;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+
+public interface RepositoryCacheManager {
+
+ /**
+ * Returns the name of the repository cache manager.
+ * @return the name of the repository cache manager.
+ */
+ public abstract String getName();
+
+ /**
+ * Saves the information of which resolvers were used to resolve a module (both for metadata and
+ * artifact), so that this info can be loaded later (even after a jvm restart) for the use of
+ * {@link #findModuleInCache(DependencyDescriptor, CacheMetadataOptions, String)}.
+ *
+ * @param md
+ * the module descriptor resolved
+ * @param metadataResolverName
+ * metadata resolver name
+ * @param artifactResolverName
+ * artifact resolver name
+ */
+ public abstract void saveResolvers(
+ ModuleDescriptor descriptor, String metadataResolverName, String artifactResolverName);
+
+ /**
+ * Returns the artifact origin of the given artifact as saved in this cache.
+ *
+ * If the origin is unknown, the returned ArtifactOrigin instance will return true when
+ * {@link ArtifactOrigin#isUnknown(ArtifactOrigin)} is called.
+ *
+ * @param artifact
+ * the artifact for which the saved artifact origin should be returned.
+ * @return the artifact origin of the given artifact as saved in this cache
+ */
+ public abstract ArtifactOrigin getSavedArtifactOrigin(Artifact artifact);
+
+ /**
+ * Search a module descriptor in cache for a mrid
+ *
+ * @param dd
+ * the dependency descriptor identifying the module to search
+ * @param requestedRevisionId
+ * the requested dependency module revision id identifying the module to search
+ * @param options
+ * options on how caching should be handled
+ * @param expectedResolver
+ * the resolver with which the md in cache must have been resolved to be returned,
+ * null if this doesn't matter
+ * @return the ResolvedModuleRevision corresponding to the module found, null if none correct
+ * has been found in cache
+ */
+ public abstract ResolvedModuleRevision findModuleInCache(
+ DependencyDescriptor dd, ModuleRevisionId requestedRevisionId,
+ CacheMetadataOptions options, String expectedResolver);
+
+ /**
+ * Downloads an artifact to this cache.
+ *
+ * @param artifact
+ * the artifact to download
+ * @param resourceResolver
+ * a resource resolver to use if the artifact needs to be resolved to a Resource for
+ * downloading
+ * @param resourceDownloader
+ * a resource downloader to use if actual download of the resource is needed
+ * @param options
+ * a set of options to adjust the download
+ * @return a report indicating how the download was performed
+ */
+ public abstract ArtifactDownloadReport download(
+ Artifact artifact,
+ ArtifactResourceResolver resourceResolver,
+ ResourceDownloader resourceDownloader,
+ CacheDownloadOptions options);
+
+ /**
+ * Caches an original module descriptor.
+ *
+ * After this call, the original module descriptor file (with no modification nor conversion)
+ * should be available as a local file.
+ *
+ *
+ * @param resolver
+ * the dependency resolver from which the cache request comes from
+ * @param orginalMetadataRef
+ * a resolved resource pointing to the remote original module descriptor
+ * @param dd
+ * the dependency descriptor for which the module descriptor should be cached
+ * @param requestedMetadataArtifact
+ * the module descriptor artifact as requested originally
+ * @param downloader
+ * a ResourceDownloader able to download the original module descriptor resource if
+ * required by this cache implementation
+ * @param options
+ * options to apply to cache this module descriptor
+ * @return a {@link ResolvedModuleRevision} representing the local cached module descriptor, or
+ * null if it failed
+ * @throws ParseException
+ * if an exception occurred while parsing the module descriptor
+ */
+ public ResolvedModuleRevision cacheModuleDescriptor(DependencyResolver resolver,
+ ResolvedResource orginalMetadataRef, DependencyDescriptor dd,
+ Artifact requestedMetadataArtifact, ResourceDownloader downloader,
+ CacheMetadataOptions options) throws ParseException;
+
+ /**
+ * Stores a standardized version of an original module descriptor in the cache for later use.
+ *
+ * @param resolver
+ * the dependency resolver from which the cache request comes from
+ * @param orginalMetadataRef
+ * a resolved resource pointing to the remote original module descriptor
+ * @param requestedMetadataArtifact
+ * the module descriptor artifact as requested originally
+ * @param rmr
+ * the {@link ResolvedModuleRevision} representing the local cached module descriptor
+ * @param writer
+ * a {@link ModuleDescriptorWriter} able to write the module descriptor to a stream.
+ */
+ public void originalToCachedModuleDescriptor(DependencyResolver resolver,
+ ResolvedResource orginalMetadataRef, Artifact requestedMetadataArtifact,
+ ResolvedModuleRevision rmr, ModuleDescriptorWriter writer);
+
+ /**
+ * Cleans the whole cache.
+ */
+ public void clean();
+
+ /**
+ * Caches a dynamic revision constraint resolution.
+ *
+ * @param dynamicMrid the dynamic module revision id
+ * @param revision the resolved revision
+ */
+ public void saveResolvedRevision(ModuleRevisionId dynamicMrid, String revision);
+
+}
diff --git a/src/java/org/apache/ivy/core/cache/ResolutionCacheManager.java b/src/java/org/apache/ivy/core/cache/ResolutionCacheManager.java
index afabe995..201c29ab 100644
--- a/src/java/org/apache/ivy/core/cache/ResolutionCacheManager.java
+++ b/src/java/org/apache/ivy/core/cache/ResolutionCacheManager.java
@@ -1,39 +1,39 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.cache;
-
-import java.io.File;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-
-public interface ResolutionCacheManager {
- public abstract File getResolutionCacheRoot();
-
- public abstract File getResolvedIvyFileInCache(ModuleRevisionId mrid);
-
- public abstract File getResolvedIvyPropertiesInCache(ModuleRevisionId mrid);
-
- public abstract File getConfigurationResolveReportInCache(String resolveId, String conf);
-
- public abstract File[] getConfigurationResolveReportsInCache(final String resolveId);
-
- /**
- * Cleans the whole cache.
- */
- public void clean();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.cache;
+
+import java.io.File;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+public interface ResolutionCacheManager {
+ public abstract File getResolutionCacheRoot();
+
+ public abstract File getResolvedIvyFileInCache(ModuleRevisionId mrid);
+
+ public abstract File getResolvedIvyPropertiesInCache(ModuleRevisionId mrid);
+
+ public abstract File getConfigurationResolveReportInCache(String resolveId, String conf);
+
+ public abstract File[] getConfigurationResolveReportsInCache(final String resolveId);
+
+ /**
+ * Cleans the whole cache.
+ */
+ public void clean();
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveArtifactEvent.java b/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveArtifactEvent.java
index 13370a83..3755b481 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveArtifactEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveArtifactEvent.java
@@ -1,31 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import java.io.File;
-
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-
-public class EndRetrieveArtifactEvent extends RetrieveArtifactEvent {
- public static final String NAME = "post-retrieve-artifact";
-
- public EndRetrieveArtifactEvent(
- ArtifactDownloadReport report, File destFile) {
- super(NAME, report, destFile);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import java.io.File;
+
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+
+public class EndRetrieveArtifactEvent extends RetrieveArtifactEvent {
+ public static final String NAME = "post-retrieve-artifact";
+
+ public EndRetrieveArtifactEvent(
+ ArtifactDownloadReport report, File destFile) {
+ super(NAME, report, destFile);
+ }
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveEvent.java b/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveEvent.java
index 9a1f551b..067d0d7d 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/EndRetrieveEvent.java
@@ -1,83 +1,83 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.retrieve.RetrieveOptions;
-
-public class EndRetrieveEvent extends RetrieveEvent {
- public static final String NAME = "post-retrieve";
-
- private long duration;
-
- private int nbCopied;
-
- private int nbUpToDate;
-
- private long totalCopiedSize;
-
- public EndRetrieveEvent(ModuleRevisionId mrid, String[] confs, long elapsedTime,
- int targetsCopied, int targetsUpToDate, long totalCopiedSize, RetrieveOptions options) {
- super(NAME, mrid, confs, options);
-
- this.duration = elapsedTime;
- this.nbCopied = targetsCopied;
- this.nbUpToDate = targetsUpToDate;
- this.totalCopiedSize = totalCopiedSize;
- addAttribute("duration", String.valueOf(elapsedTime));
- addAttribute("size", String.valueOf(totalCopiedSize));
- addAttribute("nbCopied", String.valueOf(targetsCopied));
- addAttribute("nbUptodate", String.valueOf(targetsUpToDate));
- }
-
- /**
- * Duration of the retrieve operation, in ms.
- *
- * @return Duration of the retrieve operation, in ms.
- */
- public long getDuration() {
- return duration;
- }
-
- /**
- * Number of artifacts which were copied (or symlinked) during the retrieve
- *
- * @return Number of artifacts which were copied during the retrieve.
- */
- public int getNbCopied() {
- return nbCopied;
- }
-
- /**
- * Number of artifacts which were not copied since they were already present and up to date.
- *
- * @return Number of artifacts which were not copied since they were already present and up to
- * date.
- */
- public int getNbUpToDate() {
- return nbUpToDate;
- }
-
- /**
- * Total size of all copied (or symlinked) artifacts, in bytes.
- * @return Total size of all copied (or symlinked) artifacts, in bytes.
- */
- public long getTotalCopiedSize() {
- return totalCopiedSize;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.retrieve.RetrieveOptions;
+
+public class EndRetrieveEvent extends RetrieveEvent {
+ public static final String NAME = "post-retrieve";
+
+ private long duration;
+
+ private int nbCopied;
+
+ private int nbUpToDate;
+
+ private long totalCopiedSize;
+
+ public EndRetrieveEvent(ModuleRevisionId mrid, String[] confs, long elapsedTime,
+ int targetsCopied, int targetsUpToDate, long totalCopiedSize, RetrieveOptions options) {
+ super(NAME, mrid, confs, options);
+
+ this.duration = elapsedTime;
+ this.nbCopied = targetsCopied;
+ this.nbUpToDate = targetsUpToDate;
+ this.totalCopiedSize = totalCopiedSize;
+ addAttribute("duration", String.valueOf(elapsedTime));
+ addAttribute("size", String.valueOf(totalCopiedSize));
+ addAttribute("nbCopied", String.valueOf(targetsCopied));
+ addAttribute("nbUptodate", String.valueOf(targetsUpToDate));
+ }
+
+ /**
+ * Duration of the retrieve operation, in ms.
+ *
+ * @return Duration of the retrieve operation, in ms.
+ */
+ public long getDuration() {
+ return duration;
+ }
+
+ /**
+ * Number of artifacts which were copied (or symlinked) during the retrieve
+ *
+ * @return Number of artifacts which were copied during the retrieve.
+ */
+ public int getNbCopied() {
+ return nbCopied;
+ }
+
+ /**
+ * Number of artifacts which were not copied since they were already present and up to date.
+ *
+ * @return Number of artifacts which were not copied since they were already present and up to
+ * date.
+ */
+ public int getNbUpToDate() {
+ return nbUpToDate;
+ }
+
+ /**
+ * Total size of all copied (or symlinked) artifacts, in bytes.
+ * @return Total size of all copied (or symlinked) artifacts, in bytes.
+ */
+ public long getTotalCopiedSize() {
+ return totalCopiedSize;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/RetrieveArtifactEvent.java b/src/java/org/apache/ivy/core/event/retrieve/RetrieveArtifactEvent.java
index e35feaf2..64f14400 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/RetrieveArtifactEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/RetrieveArtifactEvent.java
@@ -1,57 +1,57 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import java.io.File;
-
-import org.apache.ivy.core.event.IvyEvent;
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-
-public class RetrieveArtifactEvent extends IvyEvent {
- private ArtifactDownloadReport report;
-
- private File destFile;
-
- public RetrieveArtifactEvent(
- String name,
- ArtifactDownloadReport report, File destFile) {
- super(name);
- addArtifactAttributes(report.getArtifact());
-
- this.report = report;
- this.destFile = destFile;
- addAttribute("from", report.getLocalFile().getAbsolutePath());
- addAttribute("to", destFile.getAbsolutePath());
- addAttribute("size", String.valueOf(destFile.length()));
- }
-
- protected void addArtifactAttributes(Artifact artifact) {
- addMridAttributes(artifact.getModuleRevisionId());
- addAttributes(artifact.getAttributes());
- addAttribute("metadata", String.valueOf(artifact.isMetadata()));
- }
-
- public File getDestFile() {
- return destFile;
- }
-
- public ArtifactDownloadReport getReport() {
- return report;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import java.io.File;
+
+import org.apache.ivy.core.event.IvyEvent;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+
+public class RetrieveArtifactEvent extends IvyEvent {
+ private ArtifactDownloadReport report;
+
+ private File destFile;
+
+ public RetrieveArtifactEvent(
+ String name,
+ ArtifactDownloadReport report, File destFile) {
+ super(name);
+ addArtifactAttributes(report.getArtifact());
+
+ this.report = report;
+ this.destFile = destFile;
+ addAttribute("from", report.getLocalFile().getAbsolutePath());
+ addAttribute("to", destFile.getAbsolutePath());
+ addAttribute("size", String.valueOf(destFile.length()));
+ }
+
+ protected void addArtifactAttributes(Artifact artifact) {
+ addMridAttributes(artifact.getModuleRevisionId());
+ addAttributes(artifact.getAttributes());
+ addAttribute("metadata", String.valueOf(artifact.isMetadata()));
+ }
+
+ public File getDestFile() {
+ return destFile;
+ }
+
+ public ArtifactDownloadReport getReport() {
+ return report;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/RetrieveEvent.java b/src/java/org/apache/ivy/core/event/retrieve/RetrieveEvent.java
index e7cc5733..084475a0 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/RetrieveEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/RetrieveEvent.java
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import org.apache.ivy.core.event.IvyEvent;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.retrieve.RetrieveOptions;
-
-public class RetrieveEvent extends IvyEvent {
- private ModuleRevisionId mrid;
- private RetrieveOptions options;
-
- protected RetrieveEvent(String name, ModuleRevisionId mrid,
- String[] confs, RetrieveOptions options) {
- super(name);
- this.mrid = mrid;
- addMridAttributes(mrid);
- addConfsAttribute(confs);
- addAttribute("symlink", String.valueOf(options.isMakeSymlinks()));
- addAttribute("sync", String.valueOf(options.isSync()));
- this.options = options;
- }
-
- public ModuleRevisionId getModuleRevisionId() {
- return mrid;
- }
-
- public RetrieveOptions getOptions() {
- return options;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import org.apache.ivy.core.event.IvyEvent;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.retrieve.RetrieveOptions;
+
+public class RetrieveEvent extends IvyEvent {
+ private ModuleRevisionId mrid;
+ private RetrieveOptions options;
+
+ protected RetrieveEvent(String name, ModuleRevisionId mrid,
+ String[] confs, RetrieveOptions options) {
+ super(name);
+ this.mrid = mrid;
+ addMridAttributes(mrid);
+ addConfsAttribute(confs);
+ addAttribute("symlink", String.valueOf(options.isMakeSymlinks()));
+ addAttribute("sync", String.valueOf(options.isSync()));
+ this.options = options;
+ }
+
+ public ModuleRevisionId getModuleRevisionId() {
+ return mrid;
+ }
+
+ public RetrieveOptions getOptions() {
+ return options;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveArtifactEvent.java b/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveArtifactEvent.java
index 9faefa2b..81a1da46 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveArtifactEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveArtifactEvent.java
@@ -1,31 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import java.io.File;
-
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-
-public class StartRetrieveArtifactEvent extends RetrieveArtifactEvent {
- public static final String NAME = "pre-retrieve-artifact";
-
- public StartRetrieveArtifactEvent(
- ArtifactDownloadReport report, File destFile) {
- super(NAME, report, destFile);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import java.io.File;
+
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+
+public class StartRetrieveArtifactEvent extends RetrieveArtifactEvent {
+ public static final String NAME = "pre-retrieve-artifact";
+
+ public StartRetrieveArtifactEvent(
+ ArtifactDownloadReport report, File destFile) {
+ super(NAME, report, destFile);
+ }
+}
diff --git a/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveEvent.java b/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveEvent.java
index ea961559..66b16786 100644
--- a/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveEvent.java
+++ b/src/java/org/apache/ivy/core/event/retrieve/StartRetrieveEvent.java
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.event.retrieve;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.retrieve.RetrieveOptions;
-
-public class StartRetrieveEvent extends RetrieveEvent {
- public static final String NAME = "pre-retrieve";
-
- public StartRetrieveEvent(ModuleRevisionId mrid, String[] confs, RetrieveOptions options) {
- super(NAME, mrid, confs, options);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.event.retrieve;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.retrieve.RetrieveOptions;
+
+public class StartRetrieveEvent extends RetrieveEvent {
+ public static final String NAME = "pre-retrieve";
+
+ public StartRetrieveEvent(ModuleRevisionId mrid, String[] confs, RetrieveOptions options) {
+ super(NAME, mrid, confs, options);
+ }
+}
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
index e1d80aa1..3d1b698f 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationGroup.java
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.module.descriptor;
-
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A configuration which is actually a group of several configurations.
- */
-public class ConfigurationGroup extends Configuration {
-
- private final Map/**/ members;
-
- public ConfigurationGroup(String confName, Map /**/ members) {
- super(confName);
- this.members = members;
- }
-
- /**
- * Returns the list of configurations' names this object is a group of.
- *
- * This list is built from the configuration name, if some of these configuration names have
- * actually not been recognized in the module, they will be null when accessed from
- * {@link #getIntersectedConfiguration(String)}.
- *
- *
- * @return the list of configurations' names this object is an intersection of.
- */
- public String[] getMembersConfigurationNames() {
- return (String[]) members.keySet()
- .toArray(new String[members.size()]);
- }
-
- /**
- * Returns the {@link Configuration} object for the given conf name, or
- * null if the given conf name is not part of this group or if this conf
- * name isn't defined in the module in which this group has been built.
- *
- * @param confName
- * the name of the configuration to return.
- * @return the member {@link Configuration} object for the given conf name
- */
- public Configuration getMemberConfiguration(String confName) {
- return (Configuration) members.get(confName);
- }
-
- public Visibility getVisibility() {
- for (Iterator it = members.values().iterator(); it.hasNext();) {
- Configuration c = (Configuration) it.next();
- if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
- return Visibility.PRIVATE;
- }
- }
- return Visibility.PUBLIC;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.descriptor;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A configuration which is actually a group of several configurations.
+ */
+public class ConfigurationGroup extends Configuration {
+
+ private final Map/**/ members;
+
+ public ConfigurationGroup(String confName, Map /**/ members) {
+ super(confName);
+ this.members = members;
+ }
+
+ /**
+ * Returns the list of configurations' names this object is a group of.
+ *
+ * This list is built from the configuration name, if some of these configuration names have
+ * actually not been recognized in the module, they will be null when accessed from
+ * {@link #getIntersectedConfiguration(String)}.
+ *
+ *
+ * @return the list of configurations' names this object is an intersection of.
+ */
+ public String[] getMembersConfigurationNames() {
+ return (String[]) members.keySet()
+ .toArray(new String[members.size()]);
+ }
+
+ /**
+ * Returns the {@link Configuration} object for the given conf name, or
+ * null if the given conf name is not part of this group or if this conf
+ * name isn't defined in the module in which this group has been built.
+ *
+ * @param confName
+ * the name of the configuration to return.
+ * @return the member {@link Configuration} object for the given conf name
+ */
+ public Configuration getMemberConfiguration(String confName) {
+ return (Configuration) members.get(confName);
+ }
+
+ public Visibility getVisibility() {
+ for (Iterator it = members.values().iterator(); it.hasNext();) {
+ Configuration c = (Configuration) it.next();
+ if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
+ return Visibility.PRIVATE;
+ }
+ }
+ return Visibility.PUBLIC;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
index 9be47425..98986d1d 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ConfigurationIntersection.java
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.module.descriptor;
-
-import java.util.Iterator;
-import java.util.Map;
-
-/**
- * A configuration which is actually the intersection of several configurations.
- */
-public class ConfigurationIntersection extends Configuration {
-
- private final Map/**/ intersectedConfs;
-
- public ConfigurationIntersection(String confName, Map /**/ intersectedConfs) {
- super(confName);
- this.intersectedConfs = intersectedConfs;
- }
-
- /**
- * Returns the list of configurations' names this object is an intersection of.
- *
- * This list is built from the configuration name, if some of these configuration names have
- * actually not been recognized in the module, they will be null when accessed from
- * {@link #getIntersectedConfiguration(String)}.
- *
- *
- * @return the list of configurations' names this object is an intersection of.
- */
- public String[] getIntersectedConfigurationNames() {
- return (String[]) intersectedConfs.keySet()
- .toArray(new String[intersectedConfs.size()]);
- }
-
- /**
- * Returns the intersected {@link Configuration} object for the given conf name, or
- * null if the given conf name is not part of this intersection or if this conf
- * name isn't defined in the module in which this intersection has been built.
- *
- * @param confName
- * the name of the configuration to return.
- * @return the intersected {@link Configuration} object for the given conf name
- */
- public Configuration getIntersectedConfiguration(String confName) {
- return (Configuration) intersectedConfs.get(confName);
- }
-
- public Visibility getVisibility() {
- for (Iterator it = intersectedConfs.values().iterator(); it.hasNext();) {
- Configuration c = (Configuration) it.next();
- if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
- return Visibility.PRIVATE;
- }
- }
- return Visibility.PUBLIC;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.descriptor;
+
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A configuration which is actually the intersection of several configurations.
+ */
+public class ConfigurationIntersection extends Configuration {
+
+ private final Map/**/ intersectedConfs;
+
+ public ConfigurationIntersection(String confName, Map /**/ intersectedConfs) {
+ super(confName);
+ this.intersectedConfs = intersectedConfs;
+ }
+
+ /**
+ * Returns the list of configurations' names this object is an intersection of.
+ *
+ * This list is built from the configuration name, if some of these configuration names have
+ * actually not been recognized in the module, they will be null when accessed from
+ * {@link #getIntersectedConfiguration(String)}.
+ *
+ *
+ * @return the list of configurations' names this object is an intersection of.
+ */
+ public String[] getIntersectedConfigurationNames() {
+ return (String[]) intersectedConfs.keySet()
+ .toArray(new String[intersectedConfs.size()]);
+ }
+
+ /**
+ * Returns the intersected {@link Configuration} object for the given conf name, or
+ * null if the given conf name is not part of this intersection or if this conf
+ * name isn't defined in the module in which this intersection has been built.
+ *
+ * @param confName
+ * the name of the configuration to return.
+ * @return the intersected {@link Configuration} object for the given conf name
+ */
+ public Configuration getIntersectedConfiguration(String confName) {
+ return (Configuration) intersectedConfs.get(confName);
+ }
+
+ public Visibility getVisibility() {
+ for (Iterator it = intersectedConfs.values().iterator(); it.hasNext();) {
+ Configuration c = (Configuration) it.next();
+ if (c != null && Visibility.PRIVATE.equals(c.getVisibility())) {
+ return Visibility.PRIVATE;
+ }
+ }
+ return Visibility.PUBLIC;
+ }
+}
diff --git a/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
index 3d0f779e..1d8b4b74 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/DefaultExtendsDescriptor.java
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.module.descriptor;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-
-public class DefaultExtendsDescriptor implements ExtendsDescriptor {
-
- private ModuleRevisionId parentRevisionId;
- private ModuleRevisionId resolvedParentRevisionId;
- private String location;
- private List extendsTypes;
-
- public DefaultExtendsDescriptor(ModuleRevisionId parentRevisionId,
- ModuleRevisionId resolvedParentRevisionId,
- String location, String[] types) {
- this.parentRevisionId = parentRevisionId;
- this.resolvedParentRevisionId = resolvedParentRevisionId;
- this.location = location;
- this.extendsTypes = new ArrayList(types.length);
- for (int i = 0; i < types.length; ++i) {
- extendsTypes.add(types[i]);
- }
- }
-
- public ModuleRevisionId getParentRevisionId() {
- return parentRevisionId;
- }
-
- public ModuleRevisionId getResolvedParentRevisionId() {
- return resolvedParentRevisionId;
- }
-
- public String getLocation() {
- return location;
- }
-
- public String[] getExtendsTypes() {
- return (String[]) extendsTypes.toArray(new String[extendsTypes.size()]);
- }
-
- public boolean isAllInherited() {
- return extendsTypes.contains("all");
- }
-
- public boolean isInfoInherited() {
- return isAllInherited() || extendsTypes.contains("info");
- }
-
- public boolean isDescriptionInherited() {
- return isAllInherited() || extendsTypes.contains("description");
- }
-
- public boolean areConfigurationsInherited() {
- return isAllInherited() || extendsTypes.contains("configurations");
- }
-
- public boolean areDependenciesInherited() {
- return isAllInherited() || extendsTypes.contains("dependencies");
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.descriptor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+public class DefaultExtendsDescriptor implements ExtendsDescriptor {
+
+ private ModuleRevisionId parentRevisionId;
+ private ModuleRevisionId resolvedParentRevisionId;
+ private String location;
+ private List extendsTypes;
+
+ public DefaultExtendsDescriptor(ModuleRevisionId parentRevisionId,
+ ModuleRevisionId resolvedParentRevisionId,
+ String location, String[] types) {
+ this.parentRevisionId = parentRevisionId;
+ this.resolvedParentRevisionId = resolvedParentRevisionId;
+ this.location = location;
+ this.extendsTypes = new ArrayList(types.length);
+ for (int i = 0; i < types.length; ++i) {
+ extendsTypes.add(types[i]);
+ }
+ }
+
+ public ModuleRevisionId getParentRevisionId() {
+ return parentRevisionId;
+ }
+
+ public ModuleRevisionId getResolvedParentRevisionId() {
+ return resolvedParentRevisionId;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String[] getExtendsTypes() {
+ return (String[]) extendsTypes.toArray(new String[extendsTypes.size()]);
+ }
+
+ public boolean isAllInherited() {
+ return extendsTypes.contains("all");
+ }
+
+ public boolean isInfoInherited() {
+ return isAllInherited() || extendsTypes.contains("info");
+ }
+
+ public boolean isDescriptionInherited() {
+ return isAllInherited() || extendsTypes.contains("description");
+ }
+
+ public boolean areConfigurationsInherited() {
+ return isAllInherited() || extendsTypes.contains("configurations");
+ }
+
+ public boolean areDependenciesInherited() {
+ return isAllInherited() || extendsTypes.contains("dependencies");
+ }
+}
diff --git a/src/java/org/apache/ivy/core/module/descriptor/ExtendsDescriptor.java b/src/java/org/apache/ivy/core/module/descriptor/ExtendsDescriptor.java
index 0137539c..e5142ab4 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/ExtendsDescriptor.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/ExtendsDescriptor.java
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.module.descriptor;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-
-/**
- * Describes parent descriptor information for a module descriptor.
- */
-public interface ExtendsDescriptor {
-
- /** get the module revision id of the declared parent descriptor */
- public ModuleRevisionId getParentRevisionId();
- /**
- * get the resolved revision id for {@link #getParentRevisionId}, see
- * {@link org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId()} }
- */
- public ModuleRevisionId getResolvedParentRevisionId();
-
- /**
- * If there is an explicit path to check for the parent descriptor, return it.
- * Otherwise returns null.
- */
- public String getLocation();
-
- /**
- * Get the parts of the parent descriptor that are inherited. Default
- * supported types are info, description,
- * configurations, dependencies, and/or all.
- * Ivy extensions may add support for additional extends types.
- */
- public String[] getExtendsTypes();
-
- /** @return true if the all extend type is specified, implying all other types */
- public boolean isAllInherited();
-
- /** @return true if parent info attributes are inherited (organisation, branch, revision, etc)*/
- public boolean isInfoInherited();
-
- /** @return true if parent description is inherited */
- public boolean isDescriptionInherited();
-
- /** @return true if parent configurations are inherited */
- public boolean areConfigurationsInherited();
-
- /** @return true if parent dependencies are inherited */
- public boolean areDependenciesInherited();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.descriptor;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+/**
+ * Describes parent descriptor information for a module descriptor.
+ */
+public interface ExtendsDescriptor {
+
+ /** get the module revision id of the declared parent descriptor */
+ public ModuleRevisionId getParentRevisionId();
+ /**
+ * get the resolved revision id for {@link #getParentRevisionId}, see
+ * {@link org.apache.ivy.core.module.descriptor.ModuleDescriptor#getResolvedModuleRevisionId()} }
+ */
+ public ModuleRevisionId getResolvedParentRevisionId();
+
+ /**
+ * If there is an explicit path to check for the parent descriptor, return it.
+ * Otherwise returns null.
+ */
+ public String getLocation();
+
+ /**
+ * Get the parts of the parent descriptor that are inherited. Default
+ * supported types are info, description,
+ * configurations, dependencies, and/or all.
+ * Ivy extensions may add support for additional extends types.
+ */
+ public String[] getExtendsTypes();
+
+ /** @return true if the all extend type is specified, implying all other types */
+ public boolean isAllInherited();
+
+ /** @return true if parent info attributes are inherited (organisation, branch, revision, etc)*/
+ public boolean isInfoInherited();
+
+ /** @return true if parent description is inherited */
+ public boolean isDescriptionInherited();
+
+ /** @return true if parent configurations are inherited */
+ public boolean areConfigurationsInherited();
+
+ /** @return true if parent dependencies are inherited */
+ public boolean areDependenciesInherited();
+}
diff --git a/src/java/org/apache/ivy/core/module/descriptor/InheritableItem.java b/src/java/org/apache/ivy/core/module/descriptor/InheritableItem.java
index e98e25ed..fb259dc8 100644
--- a/src/java/org/apache/ivy/core/module/descriptor/InheritableItem.java
+++ b/src/java/org/apache/ivy/core/module/descriptor/InheritableItem.java
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.module.descriptor;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-
-/**
- * Interface for elements that can be inherited from a parent descriptor
- * by a child descriptor.
- * @see Configuration
- * @see DependencyDescriptor
- */
-public interface InheritableItem {
- /**
- * @return the module in which this item was actually defined, if different
- * from the module in which the item appears. May be null.
- */
- public ModuleRevisionId getSourceModule();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.module.descriptor;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+/**
+ * Interface for elements that can be inherited from a parent descriptor
+ * by a child descriptor.
+ * @see Configuration
+ * @see DependencyDescriptor
+ */
+public interface InheritableItem {
+ /**
+ * @return the module in which this item was actually defined, if different
+ * from the module in which the item appears. May be null.
+ */
+ public ModuleRevisionId getSourceModule();
+}
diff --git a/src/java/org/apache/ivy/core/module/id/package.html b/src/java/org/apache/ivy/core/module/id/package.html
index 11b1d2f0..9e572421 100644
--- a/src/java/org/apache/ivy/core/module/id/package.html
+++ b/src/java/org/apache/ivy/core/module/id/package.html
@@ -1,61 +1,61 @@
-
-
-
-
-
-
-
-This packages gathers classes used to represent identifiers of objects involved in dependency management.
-
-
-As identifiers, they do not store any information on the module content and detailed metadata (like dependencies).
-
-
Classes
-
-
-
ModuleId
is used as the identifier of module, without considering its version. It's basically an organization and module name couple.
-
ModuleRevisionId
is used as the identifier of a module in a particular version or version constraint. It is composed of a ModuleId, a revision, and optionally a branch and extra attributes.
-
ArtifactId
identifies an artifact without considering its version. It's basically a ModuleId and an artifact name, type and extension, plus optional extra attributes.
-
ArtifactRevisionId
identifies an artifact of a module in a particular version. It is composed of a ModuleRevisionId along with artifact identifier like the name type and extension.
-
-
-
Text Representation
-
-These classes share an homogeneous text representation, which can be easily obtained through the toString() method.
-
-
-The general pattern is: [organisation]#[module]#[branch];[revision]![artifact].[ext]([type])
-The # before the branch is present only if the branch is not empty.
-The type and surrounding parenthesis are present only if different from the extension.
-
-
-A textual representation can be parsed into an object (supported for ModuleRevisionId only yet), as long as a strict set of characters is used for each field (which is recommended).
-Allowed characters are:
-
-
organisation
a-z A-Z 0-9 - / . _ + =
-
module
a-z A-Z 0-9 - / . _ + =
-
branch
a-z A-Z 0-9 - / . _ + =
-
revision
a-z A-Z 0-9 - / . _ + = , [ ] { } ( ) : @
-
artifact
a-z A-Z 0-9 - / . _ + =
-
extension
a-z A-Z 0-9 - / . _ + =
-
type
a-z A-Z 0-9 - / . _ + =
-
-
+
+
+
+
+
+
+
+This packages gathers classes used to represent identifiers of objects involved in dependency management.
+
+
+As identifiers, they do not store any information on the module content and detailed metadata (like dependencies).
+
+
Classes
+
+
+
ModuleId
is used as the identifier of module, without considering its version. It's basically an organization and module name couple.
+
ModuleRevisionId
is used as the identifier of a module in a particular version or version constraint. It is composed of a ModuleId, a revision, and optionally a branch and extra attributes.
+
ArtifactId
identifies an artifact without considering its version. It's basically a ModuleId and an artifact name, type and extension, plus optional extra attributes.
+
ArtifactRevisionId
identifies an artifact of a module in a particular version. It is composed of a ModuleRevisionId along with artifact identifier like the name type and extension.
+
+
+
Text Representation
+
+These classes share an homogeneous text representation, which can be easily obtained through the toString() method.
+
+
+The general pattern is: [organisation]#[module]#[branch];[revision]![artifact].[ext]([type])
+The # before the branch is present only if the branch is not empty.
+The type and surrounding parenthesis are present only if different from the extension.
+
+
+A textual representation can be parsed into an object (supported for ModuleRevisionId only yet), as long as a strict set of characters is used for each field (which is recommended).
+Allowed characters are:
+
+
organisation
a-z A-Z 0-9 - / . _ + =
+
module
a-z A-Z 0-9 - / . _ + =
+
branch
a-z A-Z 0-9 - / . _ + =
+
revision
a-z A-Z 0-9 - / . _ + = , [ ] { } ( ) : @
+
artifact
a-z A-Z 0-9 - / . _ + =
+
extension
a-z A-Z 0-9 - / . _ + =
+
type
a-z A-Z 0-9 - / . _ + =
+
+
\ No newline at end of file
diff --git a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
index e97ac1c4..00b006e6 100644
--- a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
+++ b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngine.java
@@ -1,336 +1,336 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.repository;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.resolve.ResolveData;
-import org.apache.ivy.core.resolve.ResolveEngine;
-import org.apache.ivy.core.resolve.ResolveOptions;
-import org.apache.ivy.core.resolve.ResolvedModuleRevision;
-import org.apache.ivy.core.search.SearchEngine;
-import org.apache.ivy.plugins.latest.ArtifactInfo;
-import org.apache.ivy.plugins.matcher.PatternMatcher;
-import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
-import org.apache.ivy.plugins.version.VersionMatcher;
-import org.apache.ivy.util.MemoryUtil;
-import org.apache.ivy.util.Message;
-
-/**
- * The repository management can be used to load all metadata from a repository, analyze them, and
- * provide a bunch of information about the whole repository state.
- *
- * Since loading all metadata from a repository is not a light task, this engine should only be used
- * on a machine having good access to the repository (on the same filesystem being usually the best
- * suited).
- *
- *
- * To access information, you usually have before to call a method to init the data: {@link #load()}
- * is used to load repository metadata, {@link #analyze()} is used to analyze them. These methods
- * being very time consuming, they must always be called explicitly.
- *
- *
- * On a large repository, this engine can be very memory consuming to use, it is not suited to be
- * used in a long running process, but rather in short process loading data and taking action about
- * the current state of the repository.
- *
- *
- * This engine is not intended to be used concurrently with publish, the order of repository loaded
- * being undeterministic and long, it could end up in having an inconsistent in memory state.
- *
- *
- * For better performance, we strongly suggest using this engine with cache in useOrigin mode.
- *
- */
-public class RepositoryManagementEngine {
- private static final double THOUSAND = 1000.0;
- private static final int KILO = 1024;
-
- ///////////////////////////////////////////
- // state loaded on #load()
- ///////////////////////////////////////////
-
- /**
- * True if the repository has already been loaded, false otherwise.
- */
- private boolean loaded;
- /**
- * ModuleDescriptors stored by ModuleRevisionId
- */
- private Map/**/ revisions = new HashMap();
- /**
- * ModuleRevisionId for which loading was not possible, with corresponding error message.
- */
- private Map/**/ errors = new HashMap();
- /**
- * List of ModuleRevisionId per ModuleId.
- */
- private Map/*>*/ modules = new HashMap();
-
- ///////////////////////////////////////////
- // state loaded on #analyze()
- ///////////////////////////////////////////
-
- /**
- * True when the repository has been analyzed, false otherwise
- */
- private boolean analyzed;
- /**
- * Cache from requested module revision id to actual module revision id.
- */
- private Map/**/ cache = new HashMap();
- /**
- * list of dependers per ModuleRevisionId.
- */
- private Map/*>*/ dependers = new HashMap();
-
- ///////////////////////////////////////////
- // dependencies
- ///////////////////////////////////////////
- private SearchEngine searchEngine;
- private ResolveEngine resolveEngine;
- private RepositoryManagementEngineSettings settings;
-
-
- public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
- SearchEngine searchEngine, ResolveEngine resolveEngine) {
- this.settings = settings;
- this.searchEngine = searchEngine;
- this.resolveEngine = resolveEngine;
- }
-
- /**
- * Loads data from the repository.
- *
- * This method usually takes a long time to proceed. It should never be called from event
- * dispatch thread in a GUI.
- *
- * This method may take a long time to proceed. It should never be called from event
- * dispatch thread in a GUI.
- *
- * @throws IllegalStateException
- * if the repository has not been loaded yet
- * @see #load()
- */
- public void analyze() {
- ensureLoaded();
- Message.info("\nanalyzing dependencies...");
- for (Iterator iterator = revisions.values().iterator(); iterator.hasNext();) {
- ModuleDescriptor md = (ModuleDescriptor) iterator.next();
- DependencyDescriptor[] dds = md.getDependencies();
- for (int i = 0; i < dds.length; i++) {
- ModuleRevisionId dep = getDependency(dds[i]);
- if (dep == null) {
- Message.warn(
- "inconsistent repository: declared dependency not found: " + dds[i]);
- } else {
- getDependers(dep).add(md.getModuleRevisionId());
- }
- }
- Message.progress();
- }
- analyzed = true;
- }
-
- /**
- * Returns the number of Module Revision in the repository.
- *
- * @return the number of module revisions in the repository.
- * @throws IllegalStateException
- * if the repository has not been loaded yet
- * @see #load()
- */
- public int getRevisionsNumber() {
- ensureLoaded();
- return revisions.size();
- }
-
- /**
- * Returns the number of ModuleId in the repository.
- *
- * @return the number of ModuleId in the repository.
- * @throws IllegalStateException
- * if the repository has not been loaded yet
- * @see #load()
- */
- public int getModuleIdsNumber() {
- ensureLoaded();
- return modules.size();
- }
-
- /**
- * Returns Module Revisions which have no dependers.
- *
- * @return a Collection of the {@link ModuleRevisionId} of module revisions which have no
- * dependers in the repository.
- * @throws IllegalStateException
- * if the repository has not been analyzed yet
- * @see #analyze()
- */
- public Collection getOrphans() {
- ensureAnalyzed();
- Collection orphans = new HashSet(revisions.keySet());
- orphans.removeAll(dependers.keySet());
- return orphans;
- }
-
-
- private ModuleRevisionId[] searchModules() {
- ModuleRevisionId[] mrids = searchEngine.listModules(
- ModuleRevisionId.newInstance(
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION,
- PatternMatcher.ANY_EXPRESSION),
- RegexpPatternMatcher.INSTANCE);
- return mrids;
- }
-
- private ModuleRevisionId getDependency(DependencyDescriptor dd) {
- ModuleRevisionId askedMrid = dd.getDependencyRevisionId();
- VersionMatcher vmatcher = settings.getVersionMatcher();
- if (vmatcher.isDynamic(askedMrid)) {
- ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
- if (mrid == null) {
- Collection revs = getAllRevisions(askedMrid);
- for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
- ModuleDescriptor md = (ModuleDescriptor) iterator.next();
- if (vmatcher.needModuleDescriptor(
- askedMrid, md.getResolvedModuleRevisionId())) {
- if (vmatcher.accept(askedMrid, md)) {
- mrid = md.getResolvedModuleRevisionId();
- break;
- }
- } else {
- if (vmatcher.accept(askedMrid, md.getResolvedModuleRevisionId())) {
- mrid = md.getResolvedModuleRevisionId();
- break;
- }
- }
- }
- if (mrid == null) {
- return null;
- } else {
- cache.put(askedMrid, mrid);
- }
- }
- return mrid;
- } else {
- return askedMrid;
- }
- }
-
- private Collection getDependers(ModuleRevisionId id) {
- Collection depders = (Collection) dependers.get(id);
- if (depders == null) {
- depders = new ArrayList();
- dependers.put(id, depders);
- }
- return depders;
- }
-
- private void loadModuleRevision(ModuleRevisionId mrid) throws Exception {
- ResolvedModuleRevision module = settings.getResolver(mrid)
- .getDependency(new DefaultDependencyDescriptor(mrid, false),
- newResolveData());
- if (module == null) {
- Message.warn("module not found while listed: " + mrid);
- } else {
- revisions.put(module.getId(), module.getDescriptor());
- getAllRevisions(module.getId()).add(module.getDescriptor());
- }
- Message.progress();
- }
-
- private Collection getAllRevisions(ModuleRevisionId id) {
- Collection revisions = (Collection) modules.get(id.getModuleId());
- if (revisions == null) {
- revisions = new TreeSet(new Comparator() {
- public int compare(Object o1, Object o2) {
- ModuleDescriptor md1 = (ModuleDescriptor) o1;
- ModuleDescriptor md2 = (ModuleDescriptor) o2;
- // we use reverse order compared to latest revision, to have latest revision
- // first
- return settings.getDefaultLatestStrategy()
- .sort(new ArtifactInfo[] {md1, md2}).get(0).equals(md1) ? 1 : -1;
- }
- });
- modules.put(id.getModuleId(), revisions);
- }
- return revisions;
- }
-
- private ResolveData newResolveData() {
- return new ResolveData(resolveEngine, new ResolveOptions());
- }
-
- private void ensureAnalyzed() {
- if (!analyzed) {
- throw new IllegalStateException(
- "repository must have been analyzed to perform this method");
- }
- }
-
- private void ensureLoaded() {
- if (!loaded) {
- throw new IllegalStateException(
- "repository must have be loaded to perform this method");
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.repository;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeSet;
+
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.core.search.SearchEngine;
+import org.apache.ivy.plugins.latest.ArtifactInfo;
+import org.apache.ivy.plugins.matcher.PatternMatcher;
+import org.apache.ivy.plugins.matcher.RegexpPatternMatcher;
+import org.apache.ivy.plugins.version.VersionMatcher;
+import org.apache.ivy.util.MemoryUtil;
+import org.apache.ivy.util.Message;
+
+/**
+ * The repository management can be used to load all metadata from a repository, analyze them, and
+ * provide a bunch of information about the whole repository state.
+ *
+ * Since loading all metadata from a repository is not a light task, this engine should only be used
+ * on a machine having good access to the repository (on the same filesystem being usually the best
+ * suited).
+ *
+ *
+ * To access information, you usually have before to call a method to init the data: {@link #load()}
+ * is used to load repository metadata, {@link #analyze()} is used to analyze them. These methods
+ * being very time consuming, they must always be called explicitly.
+ *
+ *
+ * On a large repository, this engine can be very memory consuming to use, it is not suited to be
+ * used in a long running process, but rather in short process loading data and taking action about
+ * the current state of the repository.
+ *
+ *
+ * This engine is not intended to be used concurrently with publish, the order of repository loaded
+ * being undeterministic and long, it could end up in having an inconsistent in memory state.
+ *
+ *
+ * For better performance, we strongly suggest using this engine with cache in useOrigin mode.
+ *
+ */
+public class RepositoryManagementEngine {
+ private static final double THOUSAND = 1000.0;
+ private static final int KILO = 1024;
+
+ ///////////////////////////////////////////
+ // state loaded on #load()
+ ///////////////////////////////////////////
+
+ /**
+ * True if the repository has already been loaded, false otherwise.
+ */
+ private boolean loaded;
+ /**
+ * ModuleDescriptors stored by ModuleRevisionId
+ */
+ private Map/**/ revisions = new HashMap();
+ /**
+ * ModuleRevisionId for which loading was not possible, with corresponding error message.
+ */
+ private Map/**/ errors = new HashMap();
+ /**
+ * List of ModuleRevisionId per ModuleId.
+ */
+ private Map/*>*/ modules = new HashMap();
+
+ ///////////////////////////////////////////
+ // state loaded on #analyze()
+ ///////////////////////////////////////////
+
+ /**
+ * True when the repository has been analyzed, false otherwise
+ */
+ private boolean analyzed;
+ /**
+ * Cache from requested module revision id to actual module revision id.
+ */
+ private Map/**/ cache = new HashMap();
+ /**
+ * list of dependers per ModuleRevisionId.
+ */
+ private Map/*>*/ dependers = new HashMap();
+
+ ///////////////////////////////////////////
+ // dependencies
+ ///////////////////////////////////////////
+ private SearchEngine searchEngine;
+ private ResolveEngine resolveEngine;
+ private RepositoryManagementEngineSettings settings;
+
+
+ public RepositoryManagementEngine(RepositoryManagementEngineSettings settings,
+ SearchEngine searchEngine, ResolveEngine resolveEngine) {
+ this.settings = settings;
+ this.searchEngine = searchEngine;
+ this.resolveEngine = resolveEngine;
+ }
+
+ /**
+ * Loads data from the repository.
+ *
+ * This method usually takes a long time to proceed. It should never be called from event
+ * dispatch thread in a GUI.
+ *
+ * This method may take a long time to proceed. It should never be called from event
+ * dispatch thread in a GUI.
+ *
+ * @throws IllegalStateException
+ * if the repository has not been loaded yet
+ * @see #load()
+ */
+ public void analyze() {
+ ensureLoaded();
+ Message.info("\nanalyzing dependencies...");
+ for (Iterator iterator = revisions.values().iterator(); iterator.hasNext();) {
+ ModuleDescriptor md = (ModuleDescriptor) iterator.next();
+ DependencyDescriptor[] dds = md.getDependencies();
+ for (int i = 0; i < dds.length; i++) {
+ ModuleRevisionId dep = getDependency(dds[i]);
+ if (dep == null) {
+ Message.warn(
+ "inconsistent repository: declared dependency not found: " + dds[i]);
+ } else {
+ getDependers(dep).add(md.getModuleRevisionId());
+ }
+ }
+ Message.progress();
+ }
+ analyzed = true;
+ }
+
+ /**
+ * Returns the number of Module Revision in the repository.
+ *
+ * @return the number of module revisions in the repository.
+ * @throws IllegalStateException
+ * if the repository has not been loaded yet
+ * @see #load()
+ */
+ public int getRevisionsNumber() {
+ ensureLoaded();
+ return revisions.size();
+ }
+
+ /**
+ * Returns the number of ModuleId in the repository.
+ *
+ * @return the number of ModuleId in the repository.
+ * @throws IllegalStateException
+ * if the repository has not been loaded yet
+ * @see #load()
+ */
+ public int getModuleIdsNumber() {
+ ensureLoaded();
+ return modules.size();
+ }
+
+ /**
+ * Returns Module Revisions which have no dependers.
+ *
+ * @return a Collection of the {@link ModuleRevisionId} of module revisions which have no
+ * dependers in the repository.
+ * @throws IllegalStateException
+ * if the repository has not been analyzed yet
+ * @see #analyze()
+ */
+ public Collection getOrphans() {
+ ensureAnalyzed();
+ Collection orphans = new HashSet(revisions.keySet());
+ orphans.removeAll(dependers.keySet());
+ return orphans;
+ }
+
+
+ private ModuleRevisionId[] searchModules() {
+ ModuleRevisionId[] mrids = searchEngine.listModules(
+ ModuleRevisionId.newInstance(
+ PatternMatcher.ANY_EXPRESSION,
+ PatternMatcher.ANY_EXPRESSION,
+ PatternMatcher.ANY_EXPRESSION,
+ PatternMatcher.ANY_EXPRESSION),
+ RegexpPatternMatcher.INSTANCE);
+ return mrids;
+ }
+
+ private ModuleRevisionId getDependency(DependencyDescriptor dd) {
+ ModuleRevisionId askedMrid = dd.getDependencyRevisionId();
+ VersionMatcher vmatcher = settings.getVersionMatcher();
+ if (vmatcher.isDynamic(askedMrid)) {
+ ModuleRevisionId mrid = (ModuleRevisionId) cache.get(askedMrid);
+ if (mrid == null) {
+ Collection revs = getAllRevisions(askedMrid);
+ for (Iterator iterator = revs.iterator(); iterator.hasNext();) {
+ ModuleDescriptor md = (ModuleDescriptor) iterator.next();
+ if (vmatcher.needModuleDescriptor(
+ askedMrid, md.getResolvedModuleRevisionId())) {
+ if (vmatcher.accept(askedMrid, md)) {
+ mrid = md.getResolvedModuleRevisionId();
+ break;
+ }
+ } else {
+ if (vmatcher.accept(askedMrid, md.getResolvedModuleRevisionId())) {
+ mrid = md.getResolvedModuleRevisionId();
+ break;
+ }
+ }
+ }
+ if (mrid == null) {
+ return null;
+ } else {
+ cache.put(askedMrid, mrid);
+ }
+ }
+ return mrid;
+ } else {
+ return askedMrid;
+ }
+ }
+
+ private Collection getDependers(ModuleRevisionId id) {
+ Collection depders = (Collection) dependers.get(id);
+ if (depders == null) {
+ depders = new ArrayList();
+ dependers.put(id, depders);
+ }
+ return depders;
+ }
+
+ private void loadModuleRevision(ModuleRevisionId mrid) throws Exception {
+ ResolvedModuleRevision module = settings.getResolver(mrid)
+ .getDependency(new DefaultDependencyDescriptor(mrid, false),
+ newResolveData());
+ if (module == null) {
+ Message.warn("module not found while listed: " + mrid);
+ } else {
+ revisions.put(module.getId(), module.getDescriptor());
+ getAllRevisions(module.getId()).add(module.getDescriptor());
+ }
+ Message.progress();
+ }
+
+ private Collection getAllRevisions(ModuleRevisionId id) {
+ Collection revisions = (Collection) modules.get(id.getModuleId());
+ if (revisions == null) {
+ revisions = new TreeSet(new Comparator() {
+ public int compare(Object o1, Object o2) {
+ ModuleDescriptor md1 = (ModuleDescriptor) o1;
+ ModuleDescriptor md2 = (ModuleDescriptor) o2;
+ // we use reverse order compared to latest revision, to have latest revision
+ // first
+ return settings.getDefaultLatestStrategy()
+ .sort(new ArtifactInfo[] {md1, md2}).get(0).equals(md1) ? 1 : -1;
+ }
+ });
+ modules.put(id.getModuleId(), revisions);
+ }
+ return revisions;
+ }
+
+ private ResolveData newResolveData() {
+ return new ResolveData(resolveEngine, new ResolveOptions());
+ }
+
+ private void ensureAnalyzed() {
+ if (!analyzed) {
+ throw new IllegalStateException(
+ "repository must have been analyzed to perform this method");
+ }
+ }
+
+ private void ensureLoaded() {
+ if (!loaded) {
+ throw new IllegalStateException(
+ "repository must have be loaded to perform this method");
+ }
+ }
+}
diff --git a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngineSettings.java b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngineSettings.java
index 73616d9e..ff946f68 100644
--- a/src/java/org/apache/ivy/core/repository/RepositoryManagementEngineSettings.java
+++ b/src/java/org/apache/ivy/core/repository/RepositoryManagementEngineSettings.java
@@ -1,24 +1,24 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.repository;
-
-import org.apache.ivy.core.resolve.ResolveEngineSettings;
-
-public interface RepositoryManagementEngineSettings extends ResolveEngineSettings {
- public boolean dumpMemoryUsage();
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.repository;
+
+import org.apache.ivy.core.resolve.ResolveEngineSettings;
+
+public interface RepositoryManagementEngineSettings extends ResolveEngineSettings {
+ public boolean dumpMemoryUsage();
+}
diff --git a/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java b/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java
index 4a045db8..730fdbde 100644
--- a/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java
+++ b/src/java/org/apache/ivy/core/resolve/IvyNodeBlacklist.java
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.resolve;
-
-
-/**
- * Information about a blacklisted module, providing context information in which it has been
- * blacklisted
- */
-public class IvyNodeBlacklist {
- private IvyNode conflictParent;
-
- private IvyNode selectedNode;
-
- private IvyNode evictedNode;
-
- private IvyNode blacklistedNode;
-
- private String rootModuleConf;
-
- public IvyNodeBlacklist(IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
- IvyNode blacklistedNode, String rootModuleConf) {
- this.conflictParent = conflictParent;
- this.selectedNode = selectedNode;
- this.evictedNode = evictedNode;
- this.blacklistedNode = blacklistedNode;
- this.rootModuleConf = rootModuleConf;
- }
-
- public IvyNode getConflictParent() {
- return conflictParent;
- }
-
- public IvyNode getSelectedNode() {
- return selectedNode;
- }
-
- public IvyNode getEvictedNode() {
- return evictedNode;
- }
-
- public IvyNode getBlacklistedNode() {
- return blacklistedNode;
- }
-
- public String getRootModuleConf() {
- return rootModuleConf;
- }
-
- public String toString() {
- return "[" + blacklistedNode + " blacklisted to evict " + evictedNode + " in favor of "
- + selectedNode + " in " + conflictParent + " for " + rootModuleConf + "]";
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.resolve;
+
+
+/**
+ * Information about a blacklisted module, providing context information in which it has been
+ * blacklisted
+ */
+public class IvyNodeBlacklist {
+ private IvyNode conflictParent;
+
+ private IvyNode selectedNode;
+
+ private IvyNode evictedNode;
+
+ private IvyNode blacklistedNode;
+
+ private String rootModuleConf;
+
+ public IvyNodeBlacklist(IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
+ IvyNode blacklistedNode, String rootModuleConf) {
+ this.conflictParent = conflictParent;
+ this.selectedNode = selectedNode;
+ this.evictedNode = evictedNode;
+ this.blacklistedNode = blacklistedNode;
+ this.rootModuleConf = rootModuleConf;
+ }
+
+ public IvyNode getConflictParent() {
+ return conflictParent;
+ }
+
+ public IvyNode getSelectedNode() {
+ return selectedNode;
+ }
+
+ public IvyNode getEvictedNode() {
+ return evictedNode;
+ }
+
+ public IvyNode getBlacklistedNode() {
+ return blacklistedNode;
+ }
+
+ public String getRootModuleConf() {
+ return rootModuleConf;
+ }
+
+ public String toString() {
+ return "[" + blacklistedNode + " blacklisted to evict " + evictedNode + " in favor of "
+ + selectedNode + " in " + conflictParent + " for " + rootModuleConf + "]";
+ }
+}
diff --git a/src/java/org/apache/ivy/core/resolve/ResolveProcessException.java b/src/java/org/apache/ivy/core/resolve/ResolveProcessException.java
index d3ab3289..07ccea84 100644
--- a/src/java/org/apache/ivy/core/resolve/ResolveProcessException.java
+++ b/src/java/org/apache/ivy/core/resolve/ResolveProcessException.java
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.resolve;
-
-/**
- * ResolveProcessException is an exception which is used to control the resolve process.
- *
- * All {@link ResolveProcessException} subclasses have the ability to interrupt the resolve process
- * when thrown while resolving dependencies, instead of only marking the module with a problem and
- * continuing the resolve process as part of the best effort strategy during resolve process.
- *
- * Some subclasses have even a stronger power over the resolve process, like
- * {@link RestartResolveProcess} which orders to restart the resolve process at the start.
- */
-public class ResolveProcessException extends RuntimeException {
-
- public ResolveProcessException() {
- }
-
- public ResolveProcessException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ResolveProcessException(String message) {
- super(message);
- }
-
- public ResolveProcessException(Throwable cause) {
- super(cause);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.resolve;
+
+/**
+ * ResolveProcessException is an exception which is used to control the resolve process.
+ *
+ * All {@link ResolveProcessException} subclasses have the ability to interrupt the resolve process
+ * when thrown while resolving dependencies, instead of only marking the module with a problem and
+ * continuing the resolve process as part of the best effort strategy during resolve process.
+ *
+ * Some subclasses have even a stronger power over the resolve process, like
+ * {@link RestartResolveProcess} which orders to restart the resolve process at the start.
+ */
+public class ResolveProcessException extends RuntimeException {
+
+ public ResolveProcessException() {
+ }
+
+ public ResolveProcessException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ResolveProcessException(String message) {
+ super(message);
+ }
+
+ public ResolveProcessException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/src/java/org/apache/ivy/core/resolve/RestartResolveProcess.java b/src/java/org/apache/ivy/core/resolve/RestartResolveProcess.java
index f6d59302..c0740673 100644
--- a/src/java/org/apache/ivy/core/resolve/RestartResolveProcess.java
+++ b/src/java/org/apache/ivy/core/resolve/RestartResolveProcess.java
@@ -1,34 +1,34 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.resolve;
-
-/**
- * This RuntimeException is used during the resolve process to ask the engine to restart the resolve
- * process.
- *
- * Users of this feature should be very careful to make sure they handle a termination condition,
- * since the resolve engine itself won't check the same exception is not thrown ad libitum
- *
- */
-public class RestartResolveProcess extends ResolveProcessException {
-
- public RestartResolveProcess(String message) {
- super(message);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.resolve;
+
+/**
+ * This RuntimeException is used during the resolve process to ask the engine to restart the resolve
+ * process.
+ *
+ * Users of this feature should be very careful to make sure they handle a termination condition,
+ * since the resolve engine itself won't check the same exception is not thrown ad libitum
+ *
+ */
+public class RestartResolveProcess extends ResolveProcessException {
+
+ public RestartResolveProcess(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java b/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
index 308e1a6d..4991c6a6 100644
--- a/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
+++ b/src/java/org/apache/ivy/plugins/circular/AbstractLogCircularDependencyStrategy.java
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.circular;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.apache.ivy.core.IvyContext;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.resolve.ResolveData;
-
-public abstract class AbstractLogCircularDependencyStrategy
- extends AbstractCircularDependencyStrategy {
-
- protected AbstractLogCircularDependencyStrategy(String name) {
- super(name);
- }
-
- private Collection/**/ circularDependencies = new HashSet();
-
- public void handleCircularDependency(ModuleRevisionId[] mrids) {
- String circularDependencyId = getCircularDependencyId(mrids);
- if (!circularDependencies.contains(circularDependencyId)) {
- circularDependencies.add(circularDependencyId);
- logCircularDependency(mrids);
- }
- }
-
- protected abstract void logCircularDependency(ModuleRevisionId[] mrids);
-
- protected String getCircularDependencyId(ModuleRevisionId[] mrids) {
- String contextPrefix = "";
- ResolveData data = IvyContext.getContext().getResolveData();
- if (data != null) {
- contextPrefix = data.getOptions().getResolveId() + " ";
- }
- return contextPrefix + Arrays.asList(mrids);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.circular;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolveData;
+
+public abstract class AbstractLogCircularDependencyStrategy
+ extends AbstractCircularDependencyStrategy {
+
+ protected AbstractLogCircularDependencyStrategy(String name) {
+ super(name);
+ }
+
+ private Collection/**/ circularDependencies = new HashSet();
+
+ public void handleCircularDependency(ModuleRevisionId[] mrids) {
+ String circularDependencyId = getCircularDependencyId(mrids);
+ if (!circularDependencies.contains(circularDependencyId)) {
+ circularDependencies.add(circularDependencyId);
+ logCircularDependency(mrids);
+ }
+ }
+
+ protected abstract void logCircularDependency(ModuleRevisionId[] mrids);
+
+ protected String getCircularDependencyId(ModuleRevisionId[] mrids) {
+ String contextPrefix = "";
+ ResolveData data = IvyContext.getContext().getResolveData();
+ if (data != null) {
+ contextPrefix = data.getOptions().getResolveId() + " ";
+ }
+ return contextPrefix + Arrays.asList(mrids);
+ }
+
+}
diff --git a/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java b/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
index c105f45c..63d9f1be 100644
--- a/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
+++ b/src/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManager.java
@@ -1,311 +1,311 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.conflict;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Stack;
-
-import org.apache.ivy.core.IvyContext;
-import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.resolve.IvyNode;
-import org.apache.ivy.core.resolve.IvyNodeBlacklist;
-import org.apache.ivy.core.resolve.ResolveData;
-import org.apache.ivy.core.resolve.RestartResolveProcess;
-import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
-import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.plugins.latest.LatestStrategy;
-import org.apache.ivy.plugins.version.VersionMatcher;
-import org.apache.ivy.util.Message;
-
-/**
- * This conflict manager can be used to allow only compatible dependencies to be used together (like
- * the strict conflict manager), but it has the advantage of using a best effort algorithm to find a
- * set of compatible dependencies, even if it requires stepping back to older revisions (as long as
- * they are in the set of compatibility).
- *
- * Here is an example of what this conflict manager is able to do:
- * Available Modules:
- *
- *
- * Result: #B;1.4, #C;2.5, #D;1.5
- * DetailsThe conflict manager finds that the latest matching version
- * of #B (1.5) depends on a version of #D incompatible with what is expected by the latest matching
- * version of #C. Hence the conflict manager blacklists #B;1.5, and the version range [1.0,1.5] is
- * resolved again to end up with #B;1.4 which depends on #D;1.5, which is fine to work with #C;2.5.
- *
- */
-public class LatestCompatibleConflictManager extends LatestConflictManager {
- public LatestCompatibleConflictManager() {
- }
-
- public LatestCompatibleConflictManager(String name, LatestStrategy strategy) {
- super(name, strategy);
- }
-
-
- public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
- if (conflicts.size() < 2) {
- return conflicts;
- }
- VersionMatcher versionMatcher = getSettings().getVersionMatcher();
-
- Iterator iter = conflicts.iterator();
- IvyNode node = (IvyNode) iter.next();
- ModuleRevisionId mrid = node.getResolvedId();
-
- if (versionMatcher.isDynamic(mrid)) {
- while (iter.hasNext()) {
- IvyNode other = (IvyNode) iter.next();
- if (versionMatcher.isDynamic(other.getResolvedId())) {
- // two dynamic versions in conflict, not enough information yet
- return null;
- } else if (!versionMatcher.accept(mrid, other.getResolvedId())) {
- // incompatibility found
- if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
- return null;
- }
- }
- }
- // no incompatibility nor dynamic version found, let's return the latest static version
- if (conflicts.size() == 2) {
- // very common special case of only two modules in conflict,
- // let's return the second one (static)
- Iterator it = conflicts.iterator();
- it.next();
- return Collections.singleton(it.next());
- }
- Collection newConflicts = new LinkedHashSet(conflicts);
- newConflicts.remove(node);
- return super.resolveConflicts(parent, newConflicts);
- } else {
- // the first node is a static revision, let's see if all other versions match
- while (iter.hasNext()) {
- IvyNode other = (IvyNode) iter.next();
- if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
- // incompatibility found
- if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
- return null;
- }
- }
- }
- // no incompatibility found, let's return this static version
- return Collections.singleton(node);
- }
- }
-
- /**
- * Handles an incompatible conflict
- *
- * An incompatible conflicts is handled with this pseudo algorithm:
- *
- *
- * take latest among two nodes in conflict
- * for all callers
- * if dependency is a version constraint (dynamic)
- * blacklist the mapped version
- * else
- * recurse for all callers
- * if a version constraint has been found
- * restart resolve
- * else
- * throw strict conflict exception
- *
- *
- *
- *
- * @param parent
- * the parent node of nodes in conflict
- * @param conflicts
- * all the nodes in conflict
- * @param node
- * one of the two incompatible nodes
- * @param other
- * the other incompatible node
- * @return true if the incompatible conflict has been handled, false otherwise (in which case
- * resolveConflicts should return null)
- */
- private boolean handleIncompatibleConflict(
- IvyNode parent, Collection conflicts, IvyNode node, IvyNode other) {
- // we never actually return anything else than false or throw an exception,
- // but returning a boolean make the calling code cleaner
- try {
- IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo)
- getStrategy().findLatest(
- toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), null);
- if (latest != null) {
- IvyNode latestNode = latest.getNode();
- IvyNode oldestNode = latestNode == node ? other : node;
- blackListIncompatibleCallerAndRestartResolveIfPossible(
- getSettings(), parent, oldestNode, latestNode);
- // if we arrive here, we haven' managed to blacklist all paths to the latest
- // node, we try with the oldest
- blackListIncompatibleCallerAndRestartResolveIfPossible(
- getSettings(), parent, latestNode, oldestNode);
- // still not possible, we aren't able to find a solution to the incompatibility
- handleUnsolvableConflict(parent, conflicts, node, other);
-
- return true; // never actually reached
- } else {
- return false;
- }
- } catch (NoConflictResolvedYetException ex) {
- // we have not enough informations in the nodes to resolve conflict
- // according to the resolveConflicts contract, resolveConflicts must return null
- return false;
- }
- }
-
- private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
- IvyNode parent, IvyNode selected, IvyNode evicted) {
- Stack callerStack = new Stack();
- callerStack.push(evicted);
- final Collection toBlacklist = blackListIncompatibleCaller(
- settings.getVersionMatcher(), parent, selected, evicted, callerStack);
- if (toBlacklist != null) {
- final StringBuffer blacklisted = new StringBuffer();
- for (Iterator iterator = toBlacklist.iterator(); iterator.hasNext();) {
- IvyNodeBlacklist blacklist = (IvyNodeBlacklist) iterator.next();
- blacklist.getBlacklistedNode().blacklist(blacklist);
- blacklisted.append(blacklist.getBlacklistedNode());
- if (iterator.hasNext()) {
- blacklisted.append(" ");
- }
- }
-
- String rootModuleConf =
- parent.getData().getReport().getConfiguration();
- evicted.markEvicted(
- new EvictionData(rootModuleConf, parent, this, Collections.singleton(selected),
- "with blacklisting of " + blacklisted));
-
- if (settings.debugConflictResolution()) {
- Message.debug("evicting " + evicted + " by "
- + evicted.getEvictedData(rootModuleConf));
- }
- throw new RestartResolveProcess("trying to handle incompatibilities between "
- + selected + " and " + evicted);
- }
- }
-
- /**
- * Tries to blacklist exactly one version for all callers paths.
- *
- * @param versionMatcher
- * the version matcher to use to interpret versions
- * @param conflictParent
- * the node in which the conflict is occurring
- * @param selectedNode
- * the node in favor of which the conflict is resolved
- * @param evictedNode
- * the node which will be evicted if we are able to blacklist all paths
- * @param node
- * the node for which callers should be considered
- * @return the collection of blacklisting to do, null if a blacklist is not possible in at least
- * one caller path
- */
- private Collection/**/ blackListIncompatibleCaller(
- VersionMatcher versionMatcher,
- IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
- Stack/**/ callerStack) {
- Collection/**/ blacklisted = new ArrayList/**/();
- IvyNode node = (IvyNode) callerStack.peek();
- String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
- Caller[] callers = node.getCallers(rootModuleConf);
- for (int i = 0; i < callers.length; i++) {
- IvyNode callerNode = node.findNode(callers[i].getModuleRevisionId());
- if (callerNode.isBlacklisted(rootModuleConf)) {
- continue;
- }
- if (versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
- blacklisted.add(new IvyNodeBlacklist(
- conflictParent, selectedNode, evictedNode, node, rootModuleConf));
- } else {
- if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
- // circular dependency found and handled: the current top of the stack (node)
- // was already contained in the rest of the stack, the circle is closed, nothing
- // else to do
- } else {
- if (callerNode == null) {
- // we have reached the root without finding a way to change the blacklist a
- // caller in a particular path, this is a strict conflict
- return null;
- }
- callerStack.push(callerNode);
- Collection sub = blackListIncompatibleCaller(
- versionMatcher, conflictParent, selectedNode, evictedNode, callerStack);
- callerStack.pop();
- if (sub == null) {
- // propagate the fact that a path with unblacklistable caller has been found
- return null;
- } else {
- blacklisted.addAll(sub);
- }
- }
- }
- }
- if (blacklisted.isEmpty()
- && !callerStack.subList(0, callerStack.size() - 1).contains(node)) {
- return null;
- }
- return blacklisted;
- }
-
- protected void handleUnsolvableConflict(
- IvyNode parent, Collection conflicts, IvyNode node1, IvyNode node2) {
- throw new StrictConflictException(node1, node2);
- }
-
- public void handleAllBlacklistedRevisions(
- DependencyDescriptor dd, Collection/**/ foundBlacklisted) {
- ResolveData resolveData = IvyContext.getContext().getResolveData();
- Collection/**/ blacklisted = new HashSet();
- for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
- ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
- blacklisted.add(resolveData.getNode(mrid));
- }
-
- for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
- IvyNode node = (IvyNode) iterator.next();
- IvyNodeBlacklist bdata = node.getBlacklistData(
- resolveData.getReport().getConfiguration());
- handleUnsolvableConflict(
- bdata.getConflictParent(),
- Arrays.asList(new Object[] {
- bdata.getEvictedNode(), bdata.getSelectedNode()}),
- bdata.getEvictedNode(),
- bdata.getSelectedNode());
- }
- }
-
- public String toString() {
- return getName();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.conflict;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Stack;
+
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.module.descriptor.DependencyDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.IvyNode;
+import org.apache.ivy.core.resolve.IvyNodeBlacklist;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.RestartResolveProcess;
+import org.apache.ivy.core.resolve.IvyNodeCallers.Caller;
+import org.apache.ivy.core.resolve.IvyNodeEviction.EvictionData;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.plugins.latest.LatestStrategy;
+import org.apache.ivy.plugins.version.VersionMatcher;
+import org.apache.ivy.util.Message;
+
+/**
+ * This conflict manager can be used to allow only compatible dependencies to be used together (like
+ * the strict conflict manager), but it has the advantage of using a best effort algorithm to find a
+ * set of compatible dependencies, even if it requires stepping back to older revisions (as long as
+ * they are in the set of compatibility).
+ *
+ * Here is an example of what this conflict manager is able to do:
+ * Available Modules:
+ *
+ *
+ * Result: #B;1.4, #C;2.5, #D;1.5
+ * DetailsThe conflict manager finds that the latest matching version
+ * of #B (1.5) depends on a version of #D incompatible with what is expected by the latest matching
+ * version of #C. Hence the conflict manager blacklists #B;1.5, and the version range [1.0,1.5] is
+ * resolved again to end up with #B;1.4 which depends on #D;1.5, which is fine to work with #C;2.5.
+ *
+ */
+public class LatestCompatibleConflictManager extends LatestConflictManager {
+ public LatestCompatibleConflictManager() {
+ }
+
+ public LatestCompatibleConflictManager(String name, LatestStrategy strategy) {
+ super(name, strategy);
+ }
+
+
+ public Collection resolveConflicts(IvyNode parent, Collection conflicts) {
+ if (conflicts.size() < 2) {
+ return conflicts;
+ }
+ VersionMatcher versionMatcher = getSettings().getVersionMatcher();
+
+ Iterator iter = conflicts.iterator();
+ IvyNode node = (IvyNode) iter.next();
+ ModuleRevisionId mrid = node.getResolvedId();
+
+ if (versionMatcher.isDynamic(mrid)) {
+ while (iter.hasNext()) {
+ IvyNode other = (IvyNode) iter.next();
+ if (versionMatcher.isDynamic(other.getResolvedId())) {
+ // two dynamic versions in conflict, not enough information yet
+ return null;
+ } else if (!versionMatcher.accept(mrid, other.getResolvedId())) {
+ // incompatibility found
+ if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
+ return null;
+ }
+ }
+ }
+ // no incompatibility nor dynamic version found, let's return the latest static version
+ if (conflicts.size() == 2) {
+ // very common special case of only two modules in conflict,
+ // let's return the second one (static)
+ Iterator it = conflicts.iterator();
+ it.next();
+ return Collections.singleton(it.next());
+ }
+ Collection newConflicts = new LinkedHashSet(conflicts);
+ newConflicts.remove(node);
+ return super.resolveConflicts(parent, newConflicts);
+ } else {
+ // the first node is a static revision, let's see if all other versions match
+ while (iter.hasNext()) {
+ IvyNode other = (IvyNode) iter.next();
+ if (!versionMatcher.accept(other.getResolvedId(), mrid)) {
+ // incompatibility found
+ if (!handleIncompatibleConflict(parent, conflicts, node, other)) {
+ return null;
+ }
+ }
+ }
+ // no incompatibility found, let's return this static version
+ return Collections.singleton(node);
+ }
+ }
+
+ /**
+ * Handles an incompatible conflict
+ *
+ * An incompatible conflicts is handled with this pseudo algorithm:
+ *
+ *
+ * take latest among two nodes in conflict
+ * for all callers
+ * if dependency is a version constraint (dynamic)
+ * blacklist the mapped version
+ * else
+ * recurse for all callers
+ * if a version constraint has been found
+ * restart resolve
+ * else
+ * throw strict conflict exception
+ *
+ *
+ *
+ *
+ * @param parent
+ * the parent node of nodes in conflict
+ * @param conflicts
+ * all the nodes in conflict
+ * @param node
+ * one of the two incompatible nodes
+ * @param other
+ * the other incompatible node
+ * @return true if the incompatible conflict has been handled, false otherwise (in which case
+ * resolveConflicts should return null)
+ */
+ private boolean handleIncompatibleConflict(
+ IvyNode parent, Collection conflicts, IvyNode node, IvyNode other) {
+ // we never actually return anything else than false or throw an exception,
+ // but returning a boolean make the calling code cleaner
+ try {
+ IvyNodeArtifactInfo latest = (IvyNodeArtifactInfo)
+ getStrategy().findLatest(
+ toArtifactInfo(Arrays.asList(new IvyNode[] {node, other})), null);
+ if (latest != null) {
+ IvyNode latestNode = latest.getNode();
+ IvyNode oldestNode = latestNode == node ? other : node;
+ blackListIncompatibleCallerAndRestartResolveIfPossible(
+ getSettings(), parent, oldestNode, latestNode);
+ // if we arrive here, we haven' managed to blacklist all paths to the latest
+ // node, we try with the oldest
+ blackListIncompatibleCallerAndRestartResolveIfPossible(
+ getSettings(), parent, latestNode, oldestNode);
+ // still not possible, we aren't able to find a solution to the incompatibility
+ handleUnsolvableConflict(parent, conflicts, node, other);
+
+ return true; // never actually reached
+ } else {
+ return false;
+ }
+ } catch (NoConflictResolvedYetException ex) {
+ // we have not enough informations in the nodes to resolve conflict
+ // according to the resolveConflicts contract, resolveConflicts must return null
+ return false;
+ }
+ }
+
+ private void blackListIncompatibleCallerAndRestartResolveIfPossible(IvySettings settings,
+ IvyNode parent, IvyNode selected, IvyNode evicted) {
+ Stack callerStack = new Stack();
+ callerStack.push(evicted);
+ final Collection toBlacklist = blackListIncompatibleCaller(
+ settings.getVersionMatcher(), parent, selected, evicted, callerStack);
+ if (toBlacklist != null) {
+ final StringBuffer blacklisted = new StringBuffer();
+ for (Iterator iterator = toBlacklist.iterator(); iterator.hasNext();) {
+ IvyNodeBlacklist blacklist = (IvyNodeBlacklist) iterator.next();
+ blacklist.getBlacklistedNode().blacklist(blacklist);
+ blacklisted.append(blacklist.getBlacklistedNode());
+ if (iterator.hasNext()) {
+ blacklisted.append(" ");
+ }
+ }
+
+ String rootModuleConf =
+ parent.getData().getReport().getConfiguration();
+ evicted.markEvicted(
+ new EvictionData(rootModuleConf, parent, this, Collections.singleton(selected),
+ "with blacklisting of " + blacklisted));
+
+ if (settings.debugConflictResolution()) {
+ Message.debug("evicting " + evicted + " by "
+ + evicted.getEvictedData(rootModuleConf));
+ }
+ throw new RestartResolveProcess("trying to handle incompatibilities between "
+ + selected + " and " + evicted);
+ }
+ }
+
+ /**
+ * Tries to blacklist exactly one version for all callers paths.
+ *
+ * @param versionMatcher
+ * the version matcher to use to interpret versions
+ * @param conflictParent
+ * the node in which the conflict is occurring
+ * @param selectedNode
+ * the node in favor of which the conflict is resolved
+ * @param evictedNode
+ * the node which will be evicted if we are able to blacklist all paths
+ * @param node
+ * the node for which callers should be considered
+ * @return the collection of blacklisting to do, null if a blacklist is not possible in at least
+ * one caller path
+ */
+ private Collection/**/ blackListIncompatibleCaller(
+ VersionMatcher versionMatcher,
+ IvyNode conflictParent, IvyNode selectedNode, IvyNode evictedNode,
+ Stack/**/ callerStack) {
+ Collection/**/ blacklisted = new ArrayList/**/();
+ IvyNode node = (IvyNode) callerStack.peek();
+ String rootModuleConf = conflictParent.getData().getReport().getConfiguration();
+ Caller[] callers = node.getCallers(rootModuleConf);
+ for (int i = 0; i < callers.length; i++) {
+ IvyNode callerNode = node.findNode(callers[i].getModuleRevisionId());
+ if (callerNode.isBlacklisted(rootModuleConf)) {
+ continue;
+ }
+ if (versionMatcher.isDynamic(callers[i].getAskedDependencyId(node.getData()))) {
+ blacklisted.add(new IvyNodeBlacklist(
+ conflictParent, selectedNode, evictedNode, node, rootModuleConf));
+ } else {
+ if (callerStack.subList(0, callerStack.size() - 1).contains(node)) {
+ // circular dependency found and handled: the current top of the stack (node)
+ // was already contained in the rest of the stack, the circle is closed, nothing
+ // else to do
+ } else {
+ if (callerNode == null) {
+ // we have reached the root without finding a way to change the blacklist a
+ // caller in a particular path, this is a strict conflict
+ return null;
+ }
+ callerStack.push(callerNode);
+ Collection sub = blackListIncompatibleCaller(
+ versionMatcher, conflictParent, selectedNode, evictedNode, callerStack);
+ callerStack.pop();
+ if (sub == null) {
+ // propagate the fact that a path with unblacklistable caller has been found
+ return null;
+ } else {
+ blacklisted.addAll(sub);
+ }
+ }
+ }
+ }
+ if (blacklisted.isEmpty()
+ && !callerStack.subList(0, callerStack.size() - 1).contains(node)) {
+ return null;
+ }
+ return blacklisted;
+ }
+
+ protected void handleUnsolvableConflict(
+ IvyNode parent, Collection conflicts, IvyNode node1, IvyNode node2) {
+ throw new StrictConflictException(node1, node2);
+ }
+
+ public void handleAllBlacklistedRevisions(
+ DependencyDescriptor dd, Collection/**/ foundBlacklisted) {
+ ResolveData resolveData = IvyContext.getContext().getResolveData();
+ Collection/**/ blacklisted = new HashSet();
+ for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
+ ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
+ blacklisted.add(resolveData.getNode(mrid));
+ }
+
+ for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
+ IvyNode node = (IvyNode) iterator.next();
+ IvyNodeBlacklist bdata = node.getBlacklistData(
+ resolveData.getReport().getConfiguration());
+ handleUnsolvableConflict(
+ bdata.getConflictParent(),
+ Arrays.asList(new Object[] {
+ bdata.getEvictedNode(), bdata.getSelectedNode()}),
+ bdata.getEvictedNode(),
+ bdata.getSelectedNode());
+ }
+ }
+
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/src/java/org/apache/ivy/plugins/lock/AbstractLockStrategy.java b/src/java/org/apache/ivy/plugins/lock/AbstractLockStrategy.java
index 0be26b7a..d4dea54f 100644
--- a/src/java/org/apache/ivy/plugins/lock/AbstractLockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/AbstractLockStrategy.java
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-public abstract class AbstractLockStrategy implements LockStrategy {
- private String name;
-
- private boolean debugLocking = false;
-
- protected AbstractLockStrategy() {
- }
-
- protected AbstractLockStrategy(boolean debugLocking) {
- this.debugLocking = debugLocking;
- }
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
- public String toString() {
- return name;
- }
- public boolean isDebugLocking() {
- return debugLocking;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.lock;
+
+public abstract class AbstractLockStrategy implements LockStrategy {
+ private String name;
+
+ private boolean debugLocking = false;
+
+ protected AbstractLockStrategy() {
+ }
+
+ protected AbstractLockStrategy(boolean debugLocking) {
+ this.debugLocking = debugLocking;
+ }
+
+ public String getName() {
+ return name;
+ }
+ public void setName(String name) {
+ this.name = name;
+ }
+ public String toString() {
+ return name;
+ }
+ public boolean isDebugLocking() {
+ return debugLocking;
+ }
+}
diff --git a/src/java/org/apache/ivy/plugins/lock/ArtifactLockStrategy.java b/src/java/org/apache/ivy/plugins/lock/ArtifactLockStrategy.java
index f776af11..7253278f 100644
--- a/src/java/org/apache/ivy/plugins/lock/ArtifactLockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/ArtifactLockStrategy.java
@@ -1,46 +1,46 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-import java.io.File;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-
-public class ArtifactLockStrategy extends FileBasedLockStrategy {
- public ArtifactLockStrategy() {
- init();
- }
-
- public ArtifactLockStrategy(boolean debugLocking) {
- super(debugLocking);
- init();
- }
-
- private void init() {
- setName("artifact-lock");
- }
-
- public boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
- throws InterruptedException {
- return acquireLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
- }
-
- public void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
- releaseLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.lock;
+
+import java.io.File;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+
+public class ArtifactLockStrategy extends FileBasedLockStrategy {
+ public ArtifactLockStrategy() {
+ init();
+ }
+
+ public ArtifactLockStrategy(boolean debugLocking) {
+ super(debugLocking);
+ init();
+ }
+
+ private void init() {
+ setName("artifact-lock");
+ }
+
+ public boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
+ throws InterruptedException {
+ return acquireLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
+ }
+
+ public void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
+ releaseLock(new File(artifactFileToDownload.getAbsolutePath() + ".lck"));
+ }
+}
diff --git a/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java b/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
index 8a9fd3c0..5ebe6878 100644
--- a/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/FileBasedLockStrategy.java
@@ -1,230 +1,230 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.nio.channels.FileChannel;
-import java.nio.channels.FileLock;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.ivy.util.Message;
-
-public abstract class FileBasedLockStrategy extends AbstractLockStrategy {
- private static final int SLEEP_TIME = 100;
-
- private static final long DEFAULT_TIMEOUT = 2 * 60 * 1000;
-
- /**
- * The locker to use to make file lock attempts.
- *
- * Two implementations of FileLocker are provided below, according to our tests the
- * CreateFileLocker is both performing better and much more reliable than NIOFileLocker.
- *
- */
- private FileLocker locker;
-
- private long timeout = DEFAULT_TIMEOUT;
-
- private Map/**/ currentLockCounters = new HashMap();
-
- protected FileBasedLockStrategy() {
- this(new CreateFileLocker(false), false);
- }
-
- protected FileBasedLockStrategy(boolean debugLocking) {
- this(new CreateFileLocker(debugLocking), debugLocking);
- }
-
- protected FileBasedLockStrategy(FileLocker locker, boolean debugLocking) {
- super(debugLocking);
- this.locker = locker;
- }
-
-
- protected boolean acquireLock(File file) throws InterruptedException {
- if (isDebugLocking()) {
- debugLocking("acquiring lock on " + file);
- }
- long start = System.currentTimeMillis();
- do {
- synchronized (this) {
- if (hasLock(file)) {
- int holdLocks = incrementLock(file);
- if (isDebugLocking()) {
- debugLocking("reentrant lock acquired on " + file
- + " in " + (System.currentTimeMillis() - start) + "ms"
- + " - hold locks = " + holdLocks);
- }
- return true;
- }
- if (locker.tryLock(file)) {
- if (isDebugLocking()) {
- debugLocking("lock acquired on " + file
- + " in " + (System.currentTimeMillis() - start) + "ms");
- }
- incrementLock(file);
- return true;
- }
- }
- Thread.sleep(SLEEP_TIME);
- } while (System.currentTimeMillis() - start < timeout);
- return false;
- }
-
- protected void releaseLock(File file) {
- synchronized (this) {
- int holdLocks = decrementLock(file);
- if (holdLocks == 0) {
- locker.unlock(file);
- if (isDebugLocking()) {
- debugLocking("lock released on " + file);
- }
- } else {
- if (isDebugLocking()) {
- debugLocking("reentrant lock released on " + file
- + " - hold locks = " + holdLocks);
- }
- }
- }
- }
-
-
- private static void debugLocking(String msg) {
- Message.info(Thread.currentThread() + " " + System.currentTimeMillis() + " " + msg);
- }
-
- private boolean hasLock(File file) {
- Integer c = (Integer) currentLockCounters.get(file);
- return c != null && c.intValue() > 0;
- }
-
- private int incrementLock(File file) {
- Integer c = (Integer) currentLockCounters.get(file);
- int holdLocks = c == null ? 1 : c.intValue() + 1;
- currentLockCounters.put(file, new Integer(holdLocks));
- return holdLocks;
- }
-
- private int decrementLock(File file) {
- Integer c = (Integer) currentLockCounters.get(file);
- int dc = c == null ? 0 : c.intValue() - 1;
- currentLockCounters.put(file, new Integer(dc));
- return dc;
- }
-
- public static interface FileLocker {
- boolean tryLock(File f);
- void unlock(File f);
- }
-
- /**
- * "locks" a file by creating it if it doesn't exist, relying on the
- * {@link File#createNewFile()} atomicity.
- */
- public static class CreateFileLocker implements FileLocker {
- private boolean debugLocking;
-
- public CreateFileLocker(boolean debugLocking) {
- this.debugLocking = debugLocking;
- }
-
- public boolean tryLock(File file) {
- try {
- if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
- if (file.createNewFile()) {
- return true;
- } else {
- if (debugLocking) {
- debugLocking("file creation failed " + file);
- }
- }
- }
- } catch (IOException e) {
- // ignored
- Message.verbose("file creation failed due to an exception: "
- + e.getMessage() + " (" + file + ")");
- }
- return false;
- }
-
- public void unlock(File file) {
- file.delete();
- }
- }
- /**
- * Locks a file using the {@link FileLock} mechanism.
- */
- public static class NIOFileLocker implements FileLocker {
-
- private Map locks = new HashMap();
- private boolean debugLocking;
-
- public NIOFileLocker(boolean debugLocking) {
- this.debugLocking = debugLocking;
- }
-
- public boolean tryLock(File file) {
- try {
- if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
- RandomAccessFile raf =
- new RandomAccessFile(file, "rw");
- FileChannel channel = raf.getChannel();
- try {
- FileLock l = channel.tryLock();
- if (l != null) {
- synchronized (this) {
- locks.put(file, l);
- }
- return true;
- } else {
- if (debugLocking) {
- debugLocking("failed to acquire lock on " + file);
- }
- }
- } finally {
- raf.close();
- }
- }
- } catch (IOException e) {
- // ignored
- Message.verbose("file lock failed due to an exception: "
- + e.getMessage() + " (" + file + ")");
- }
- return false;
- }
-
- public void unlock(File file) {
- synchronized (this) {
- FileLock l = (FileLock) locks.get(file);
- if (l == null) {
- throw new IllegalArgumentException("file not previously locked: " + file);
- }
- try {
- l.release();
- } catch (IOException e) {
- Message.error(
- "problem while releasing lock on " + file + ": " + e.getMessage());
- }
- }
- }
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.lock;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.ivy.util.Message;
+
+public abstract class FileBasedLockStrategy extends AbstractLockStrategy {
+ private static final int SLEEP_TIME = 100;
+
+ private static final long DEFAULT_TIMEOUT = 2 * 60 * 1000;
+
+ /**
+ * The locker to use to make file lock attempts.
+ *
+ * Two implementations of FileLocker are provided below, according to our tests the
+ * CreateFileLocker is both performing better and much more reliable than NIOFileLocker.
+ *
+ */
+ private FileLocker locker;
+
+ private long timeout = DEFAULT_TIMEOUT;
+
+ private Map/**/ currentLockCounters = new HashMap();
+
+ protected FileBasedLockStrategy() {
+ this(new CreateFileLocker(false), false);
+ }
+
+ protected FileBasedLockStrategy(boolean debugLocking) {
+ this(new CreateFileLocker(debugLocking), debugLocking);
+ }
+
+ protected FileBasedLockStrategy(FileLocker locker, boolean debugLocking) {
+ super(debugLocking);
+ this.locker = locker;
+ }
+
+
+ protected boolean acquireLock(File file) throws InterruptedException {
+ if (isDebugLocking()) {
+ debugLocking("acquiring lock on " + file);
+ }
+ long start = System.currentTimeMillis();
+ do {
+ synchronized (this) {
+ if (hasLock(file)) {
+ int holdLocks = incrementLock(file);
+ if (isDebugLocking()) {
+ debugLocking("reentrant lock acquired on " + file
+ + " in " + (System.currentTimeMillis() - start) + "ms"
+ + " - hold locks = " + holdLocks);
+ }
+ return true;
+ }
+ if (locker.tryLock(file)) {
+ if (isDebugLocking()) {
+ debugLocking("lock acquired on " + file
+ + " in " + (System.currentTimeMillis() - start) + "ms");
+ }
+ incrementLock(file);
+ return true;
+ }
+ }
+ Thread.sleep(SLEEP_TIME);
+ } while (System.currentTimeMillis() - start < timeout);
+ return false;
+ }
+
+ protected void releaseLock(File file) {
+ synchronized (this) {
+ int holdLocks = decrementLock(file);
+ if (holdLocks == 0) {
+ locker.unlock(file);
+ if (isDebugLocking()) {
+ debugLocking("lock released on " + file);
+ }
+ } else {
+ if (isDebugLocking()) {
+ debugLocking("reentrant lock released on " + file
+ + " - hold locks = " + holdLocks);
+ }
+ }
+ }
+ }
+
+
+ private static void debugLocking(String msg) {
+ Message.info(Thread.currentThread() + " " + System.currentTimeMillis() + " " + msg);
+ }
+
+ private boolean hasLock(File file) {
+ Integer c = (Integer) currentLockCounters.get(file);
+ return c != null && c.intValue() > 0;
+ }
+
+ private int incrementLock(File file) {
+ Integer c = (Integer) currentLockCounters.get(file);
+ int holdLocks = c == null ? 1 : c.intValue() + 1;
+ currentLockCounters.put(file, new Integer(holdLocks));
+ return holdLocks;
+ }
+
+ private int decrementLock(File file) {
+ Integer c = (Integer) currentLockCounters.get(file);
+ int dc = c == null ? 0 : c.intValue() - 1;
+ currentLockCounters.put(file, new Integer(dc));
+ return dc;
+ }
+
+ public static interface FileLocker {
+ boolean tryLock(File f);
+ void unlock(File f);
+ }
+
+ /**
+ * "locks" a file by creating it if it doesn't exist, relying on the
+ * {@link File#createNewFile()} atomicity.
+ */
+ public static class CreateFileLocker implements FileLocker {
+ private boolean debugLocking;
+
+ public CreateFileLocker(boolean debugLocking) {
+ this.debugLocking = debugLocking;
+ }
+
+ public boolean tryLock(File file) {
+ try {
+ if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
+ if (file.createNewFile()) {
+ return true;
+ } else {
+ if (debugLocking) {
+ debugLocking("file creation failed " + file);
+ }
+ }
+ }
+ } catch (IOException e) {
+ // ignored
+ Message.verbose("file creation failed due to an exception: "
+ + e.getMessage() + " (" + file + ")");
+ }
+ return false;
+ }
+
+ public void unlock(File file) {
+ file.delete();
+ }
+ }
+ /**
+ * Locks a file using the {@link FileLock} mechanism.
+ */
+ public static class NIOFileLocker implements FileLocker {
+
+ private Map locks = new HashMap();
+ private boolean debugLocking;
+
+ public NIOFileLocker(boolean debugLocking) {
+ this.debugLocking = debugLocking;
+ }
+
+ public boolean tryLock(File file) {
+ try {
+ if (file.getParentFile().exists() || file.getParentFile().mkdirs()) {
+ RandomAccessFile raf =
+ new RandomAccessFile(file, "rw");
+ FileChannel channel = raf.getChannel();
+ try {
+ FileLock l = channel.tryLock();
+ if (l != null) {
+ synchronized (this) {
+ locks.put(file, l);
+ }
+ return true;
+ } else {
+ if (debugLocking) {
+ debugLocking("failed to acquire lock on " + file);
+ }
+ }
+ } finally {
+ raf.close();
+ }
+ }
+ } catch (IOException e) {
+ // ignored
+ Message.verbose("file lock failed due to an exception: "
+ + e.getMessage() + " (" + file + ")");
+ }
+ return false;
+ }
+
+ public void unlock(File file) {
+ synchronized (this) {
+ FileLock l = (FileLock) locks.get(file);
+ if (l == null) {
+ throw new IllegalArgumentException("file not previously locked: " + file);
+ }
+ try {
+ l.release();
+ } catch (IOException e) {
+ Message.error(
+ "problem while releasing lock on " + file + ": " + e.getMessage());
+ }
+ }
+ }
+
+ }
+}
diff --git a/src/java/org/apache/ivy/plugins/lock/LockStrategy.java b/src/java/org/apache/ivy/plugins/lock/LockStrategy.java
index a026abe3..cefec1a0 100644
--- a/src/java/org/apache/ivy/plugins/lock/LockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/LockStrategy.java
@@ -1,73 +1,73 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-import java.io.File;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-
-/**
- * A lock strategy determines when and how lock should be performed when downloading data to a
- * cache.
- *
- * Note that some implementations may actually choose to NOT perform locking, when no lock is
- * necessary (cache not shared). Some other implementations may choose to lock the cache for the
- * download of a whole module (not possible yet), or at the artifact level.
- *
- *
- * The lock methods should return true when the lock is either actually acquired or not performed by
- * the strategy.
- *
- *
- * Locking used in the locking strategy must support reentrant lock. Reentrant locking should be
- * performed for the whole strategy.
- *
- */
-public interface LockStrategy {
-
- /**
- * Returns the name of the strategy
- * @return the name of the strategy
- */
- String getName();
-
- /**
- * Performs a lock before downloading the given {@link Artifact} to the given file.
- *
- * @param artifact
- * the artifact about to be downloaded
- * @param artifactFileToDownload
- * the file where the artifact will be downloaded
- * @return true if the artifact is locked, false otherwise
- * @throws InterruptedException
- * if the thread is interrupted while waiting to acquire the lock
- */
- boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
- throws InterruptedException;
-
- /**
- * Release the lock acquired for an artifact download.
- *
- * @param artifact
- * the artifact for which the lock was acquired
- * @param artifactFileToDownload
- * the file where the artifact is supposed to have been downloaded
- */
- void unlockArtifact(Artifact artifact, File artifactFileToDownload);
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.lock;
+
+import java.io.File;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+
+/**
+ * A lock strategy determines when and how lock should be performed when downloading data to a
+ * cache.
+ *
+ * Note that some implementations may actually choose to NOT perform locking, when no lock is
+ * necessary (cache not shared). Some other implementations may choose to lock the cache for the
+ * download of a whole module (not possible yet), or at the artifact level.
+ *
+ *
+ * The lock methods should return true when the lock is either actually acquired or not performed by
+ * the strategy.
+ *
+ *
+ * Locking used in the locking strategy must support reentrant lock. Reentrant locking should be
+ * performed for the whole strategy.
+ *
+ */
+public interface LockStrategy {
+
+ /**
+ * Returns the name of the strategy
+ * @return the name of the strategy
+ */
+ String getName();
+
+ /**
+ * Performs a lock before downloading the given {@link Artifact} to the given file.
+ *
+ * @param artifact
+ * the artifact about to be downloaded
+ * @param artifactFileToDownload
+ * the file where the artifact will be downloaded
+ * @return true if the artifact is locked, false otherwise
+ * @throws InterruptedException
+ * if the thread is interrupted while waiting to acquire the lock
+ */
+ boolean lockArtifact(Artifact artifact, File artifactFileToDownload)
+ throws InterruptedException;
+
+ /**
+ * Release the lock acquired for an artifact download.
+ *
+ * @param artifact
+ * the artifact for which the lock was acquired
+ * @param artifactFileToDownload
+ * the file where the artifact is supposed to have been downloaded
+ */
+ void unlockArtifact(Artifact artifact, File artifactFileToDownload);
+
+}
diff --git a/src/java/org/apache/ivy/plugins/lock/NoLockStrategy.java b/src/java/org/apache/ivy/plugins/lock/NoLockStrategy.java
index 135ec263..6ca735ce 100644
--- a/src/java/org/apache/ivy/plugins/lock/NoLockStrategy.java
+++ b/src/java/org/apache/ivy/plugins/lock/NoLockStrategy.java
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-import java.io.File;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-
-public class NoLockStrategy extends AbstractLockStrategy {
- public NoLockStrategy() {
- setName("no-lock");
- }
-
- public final boolean lockArtifact(Artifact artifact, File artifactFileToDownload) {
- return true;
- }
-
- public final void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.lock;
+
+import java.io.File;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+
+public class NoLockStrategy extends AbstractLockStrategy {
+ public NoLockStrategy() {
+ setName("no-lock");
+ }
+
+ public final boolean lockArtifact(Artifact artifact, File artifactFileToDownload) {
+ return true;
+ }
+
+ public final void unlockArtifact(Artifact artifact, File artifactFileToDownload) {
+ }
+}
diff --git a/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java b/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
index 0d94362c..54ede1d1 100644
--- a/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
+++ b/src/java/org/apache/ivy/plugins/parser/m2/PomWriterOptions.java
@@ -1,191 +1,191 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.parser.m2;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class PomWriterOptions {
-
- private String[] confs;
-
- private String licenseHeader;
-
- private ConfigurationScopeMapping mapping;
-
- private boolean printIvyInfo = true;
-
- private String artifactName;
-
- private String artifactPackaging;
-
- private List/**/ extraDependencies = new ArrayList();
-
- private String description;
-
- private File template;
-
- public File getTemplate() {
- return template;
- }
-
- public PomWriterOptions setTemplate(File template) {
- this.template = template;
- return this;
- }
-
- public String[] getConfs() {
- return confs;
- }
-
- public PomWriterOptions setConfs(String[] confs) {
- this.confs = confs;
- return this;
- }
-
- public String getLicenseHeader() {
- return licenseHeader;
- }
-
- public PomWriterOptions setLicenseHeader(String licenseHeader) {
- this.licenseHeader = licenseHeader;
- if (this.licenseHeader != null) {
- this.licenseHeader = this.licenseHeader.trim();
- }
- return this;
- }
-
- public ConfigurationScopeMapping getMapping() {
- return mapping;
- }
-
- public PomWriterOptions setMapping(ConfigurationScopeMapping mapping) {
- this.mapping = mapping;
- return this;
- }
-
- public boolean isPrintIvyInfo() {
- return printIvyInfo;
- }
-
- public PomWriterOptions setPrintIvyInfo(boolean printIvyInfo) {
- this.printIvyInfo = printIvyInfo;
- return this;
- }
-
- public List/**/ getExtraDependencies() {
- return extraDependencies;
- }
-
- public PomWriterOptions setExtraDependencies(List/**/ extraDependencies) {
- this.extraDependencies = extraDependencies;
- return this;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public PomWriterOptions setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- return this;
- }
-
- public String getArtifactPackaging() {
- return artifactPackaging;
- }
-
- public PomWriterOptions setArtifactPackaging(String artifactPackaging) {
- this.artifactPackaging = artifactPackaging;
- return this;
- }
-
- public String getDescription() {
- return description;
- }
-
- public PomWriterOptions setDescription(String description) {
- this.description = description;
- return this;
- }
-
- public static class ConfigurationScopeMapping {
- private Map/**/ scopes;
-
- public ConfigurationScopeMapping(Map/**/ scopesMapping) {
- this.scopes = new HashMap(scopesMapping);
- }
-
- /**
- * Returns the scope mapped to the given configuration array.
- *
- * @param confs the configurations for which the scope should be returned
- * @return the scope to which the conf is mapped
- */
- public String getScope(String[] confs) {
- for (int i = 0; i < confs.length; i++) {
- if (scopes.containsKey(confs[i])) {
- return (String) scopes.get(confs[i]);
- }
- }
-
- return null;
- }
-
- public boolean isOptional(String[] confs) {
- return getScope(confs) == null;
- }
- }
-
- public static class ExtraDependency {
- private String group;
- private String artifact;
- private String version;
- private String scope;
- private boolean optional;
-
- public ExtraDependency(String group, String artifact, String version, String scope, boolean optional) {
- this.group = group;
- this.artifact = artifact;
- this.version = version;
- this.scope = scope;
- this.optional = optional;
- }
-
- public String getGroup() {
- return group;
- }
- public String getArtifact() {
- return artifact;
- }
- public String getVersion() {
- return version;
- }
- public String getScope() {
- return scope;
- }
- public boolean isOptional() {
- return optional;
- }
- }
-
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.parser.m2;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class PomWriterOptions {
+
+ private String[] confs;
+
+ private String licenseHeader;
+
+ private ConfigurationScopeMapping mapping;
+
+ private boolean printIvyInfo = true;
+
+ private String artifactName;
+
+ private String artifactPackaging;
+
+ private List/**/ extraDependencies = new ArrayList();
+
+ private String description;
+
+ private File template;
+
+ public File getTemplate() {
+ return template;
+ }
+
+ public PomWriterOptions setTemplate(File template) {
+ this.template = template;
+ return this;
+ }
+
+ public String[] getConfs() {
+ return confs;
+ }
+
+ public PomWriterOptions setConfs(String[] confs) {
+ this.confs = confs;
+ return this;
+ }
+
+ public String getLicenseHeader() {
+ return licenseHeader;
+ }
+
+ public PomWriterOptions setLicenseHeader(String licenseHeader) {
+ this.licenseHeader = licenseHeader;
+ if (this.licenseHeader != null) {
+ this.licenseHeader = this.licenseHeader.trim();
+ }
+ return this;
+ }
+
+ public ConfigurationScopeMapping getMapping() {
+ return mapping;
+ }
+
+ public PomWriterOptions setMapping(ConfigurationScopeMapping mapping) {
+ this.mapping = mapping;
+ return this;
+ }
+
+ public boolean isPrintIvyInfo() {
+ return printIvyInfo;
+ }
+
+ public PomWriterOptions setPrintIvyInfo(boolean printIvyInfo) {
+ this.printIvyInfo = printIvyInfo;
+ return this;
+ }
+
+ public List/**/ getExtraDependencies() {
+ return extraDependencies;
+ }
+
+ public PomWriterOptions setExtraDependencies(List/**/ extraDependencies) {
+ this.extraDependencies = extraDependencies;
+ return this;
+ }
+
+ public String getArtifactName() {
+ return artifactName;
+ }
+
+ public PomWriterOptions setArtifactName(String artifactName) {
+ this.artifactName = artifactName;
+ return this;
+ }
+
+ public String getArtifactPackaging() {
+ return artifactPackaging;
+ }
+
+ public PomWriterOptions setArtifactPackaging(String artifactPackaging) {
+ this.artifactPackaging = artifactPackaging;
+ return this;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public PomWriterOptions setDescription(String description) {
+ this.description = description;
+ return this;
+ }
+
+ public static class ConfigurationScopeMapping {
+ private Map/**/ scopes;
+
+ public ConfigurationScopeMapping(Map/**/ scopesMapping) {
+ this.scopes = new HashMap(scopesMapping);
+ }
+
+ /**
+ * Returns the scope mapped to the given configuration array.
+ *
+ * @param confs the configurations for which the scope should be returned
+ * @return the scope to which the conf is mapped
+ */
+ public String getScope(String[] confs) {
+ for (int i = 0; i < confs.length; i++) {
+ if (scopes.containsKey(confs[i])) {
+ return (String) scopes.get(confs[i]);
+ }
+ }
+
+ return null;
+ }
+
+ public boolean isOptional(String[] confs) {
+ return getScope(confs) == null;
+ }
+ }
+
+ public static class ExtraDependency {
+ private String group;
+ private String artifact;
+ private String version;
+ private String scope;
+ private boolean optional;
+
+ public ExtraDependency(String group, String artifact, String version, String scope, boolean optional) {
+ this.group = group;
+ this.artifact = artifact;
+ this.version = version;
+ this.scope = scope;
+ this.optional = optional;
+ }
+
+ public String getGroup() {
+ return group;
+ }
+ public String getArtifact() {
+ return artifact;
+ }
+ public String getVersion() {
+ return version;
+ }
+ public String getScope() {
+ return scope;
+ }
+ public boolean isOptional() {
+ return optional;
+ }
+ }
+
+
+}
diff --git a/src/java/org/apache/ivy/plugins/repository/ArtifactResourceResolver.java b/src/java/org/apache/ivy/plugins/repository/ArtifactResourceResolver.java
index 253de88d..6cf719fc 100644
--- a/src/java/org/apache/ivy/plugins/repository/ArtifactResourceResolver.java
+++ b/src/java/org/apache/ivy/plugins/repository/ArtifactResourceResolver.java
@@ -1,29 +1,29 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.repository;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.plugins.resolver.util.ResolvedResource;
-
-/**
- * An {@link ArtifactResourceResolver} is responsible for the resolution of an artifact into a
- * {@link ResolvedResource}.
- */
-public interface ArtifactResourceResolver {
- public ResolvedResource resolve(Artifact artifact);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.repository;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.plugins.resolver.util.ResolvedResource;
+
+/**
+ * An {@link ArtifactResourceResolver} is responsible for the resolution of an artifact into a
+ * {@link ResolvedResource}.
+ */
+public interface ArtifactResourceResolver {
+ public ResolvedResource resolve(Artifact artifact);
+}
diff --git a/src/java/org/apache/ivy/plugins/repository/ResourceDownloader.java b/src/java/org/apache/ivy/plugins/repository/ResourceDownloader.java
index f6033b0d..a2cb8296 100644
--- a/src/java/org/apache/ivy/plugins/repository/ResourceDownloader.java
+++ b/src/java/org/apache/ivy/plugins/repository/ResourceDownloader.java
@@ -1,38 +1,38 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.repository;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.ivy.core.module.descriptor.Artifact;
-
-/**
- * A {@link ResourceDownloader} is able to download a Resource to a File.
- *
- * Depending on the implementation, the downloader may also choose to download checksums
- * automatically and check the consistency of the downloaded resource.
- *
- *
- * The implementation is also responsible for using a .part file during download, to ensure the
- * destination file will exist only if the download is completed successfully.
- *
- */
-public interface ResourceDownloader {
- public void download(Artifact artifact, Resource resource, File dest) throws IOException;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.repository;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.ivy.core.module.descriptor.Artifact;
+
+/**
+ * A {@link ResourceDownloader} is able to download a Resource to a File.
+ *
+ * Depending on the implementation, the downloader may also choose to download checksums
+ * automatically and check the consistency of the downloaded resource.
+ *
+ *
+ * The implementation is also responsible for using a .part file during download, to ensure the
+ * destination file will exist only if the download is completed successfully.
+ *
+ */
+public interface ResourceDownloader {
+ public void download(Artifact artifact, Resource resource, File dest) throws IOException;
+}
diff --git a/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java
index 0d99a222..17ebba4e 100644
--- a/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java
+++ b/src/java/org/apache/ivy/plugins/signer/SignatureGenerator.java
@@ -1,31 +1,31 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.signer;
-
-import java.io.File;
-import java.io.IOException;
-
-public interface SignatureGenerator {
-
- String getName();
-
- void sign(File src, File dest) throws IOException;
-
- String getExtension();
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.signer;
+
+import java.io.File;
+import java.io.IOException;
+
+public interface SignatureGenerator {
+
+ String getName();
+
+ void sign(File src, File dest) throws IOException;
+
+ String getExtension();
+
+}
diff --git a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
index 86592386..b62fd32b 100644
--- a/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
+++ b/src/java/org/apache/ivy/plugins/signer/bouncycastle/OpenPGPSignatureGenerator.java
@@ -1,176 +1,176 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.signer.bouncycastle;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.NoSuchAlgorithmException;
-import java.security.NoSuchProviderException;
-import java.security.Security;
-import java.security.SignatureException;
-import java.util.Iterator;
-
-import org.apache.ivy.plugins.signer.SignatureGenerator;
-import org.bouncycastle.bcpg.ArmoredOutputStream;
-import org.bouncycastle.bcpg.BCPGOutputStream;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openpgp.PGPException;
-import org.bouncycastle.openpgp.PGPPrivateKey;
-import org.bouncycastle.openpgp.PGPSecretKey;
-import org.bouncycastle.openpgp.PGPSecretKeyRing;
-import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
-import org.bouncycastle.openpgp.PGPSignature;
-import org.bouncycastle.openpgp.PGPSignatureGenerator;
-import org.bouncycastle.openpgp.PGPUtil;
-
-public class OpenPGPSignatureGenerator implements SignatureGenerator {
-
- private static final long MASK = 0xFFFFFFFFL;
-
- static {
- Security.addProvider(new BouncyCastleProvider());
- }
-
- private String name;
- private String secring;
- private String password;
- private String keyId;
-
- private PGPSecretKey pgpSec;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getExtension() {
- return "asc";
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public void setSecring(String secring) {
- this.secring = secring;
- }
-
- public void setKeyId(String keyId) {
- if (!"auto".equals(keyId)) {
- this.keyId = keyId;
- }
- }
-
- public void sign(File src, File dest) throws IOException {
- OutputStream out = null;
- InputStream in = null;
- InputStream keyIn = null;
-
- try {
- if (secring == null) {
- secring = System.getProperty("user.home") + "/.gnupg/secring.gpg";
- }
-
- if (pgpSec == null) {
- keyIn = new FileInputStream(secring);
- pgpSec = readSecretKey(keyIn);
- }
-
- PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
- PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
- sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
-
- in = new FileInputStream(src);
- out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
-
- int ch = 0;
- while ((ch = in.read()) >= 0) {
- sGen.update((byte) ch);
- }
-
- sGen.generate().encode(out);
- } catch (SignatureException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
- } catch (PGPException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
- } catch (NoSuchAlgorithmException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
- } catch (NoSuchProviderException e) {
- IOException ioexc = new IOException();
- ioexc.initCause(e);
- throw ioexc;
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {}
- }
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {}
- }
- if (keyIn != null) {
- try {
- keyIn.close();
- } catch (IOException e) {}
- }
- }
- }
-
- private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
- in = PGPUtil.getDecoderStream(in);
- PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
-
- PGPSecretKey key = null;
- for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext(); ) {
- PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
-
- for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext(); ) {
- PGPSecretKey k = (PGPSecretKey) it2.next();
- if ((keyId == null) && k.isSigningKey()) {
- key = k;
- }
- if ((keyId != null) && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
- key = k;
- }
- }
- }
-
- if (key == null) {
- throw new IllegalArgumentException("Can't find encryption key" +
- (keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
- }
-
- return key;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.signer.bouncycastle;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.Security;
+import java.security.SignatureException;
+import java.util.Iterator;
+
+import org.apache.ivy.plugins.signer.SignatureGenerator;
+import org.bouncycastle.bcpg.ArmoredOutputStream;
+import org.bouncycastle.bcpg.BCPGOutputStream;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openpgp.PGPException;
+import org.bouncycastle.openpgp.PGPPrivateKey;
+import org.bouncycastle.openpgp.PGPSecretKey;
+import org.bouncycastle.openpgp.PGPSecretKeyRing;
+import org.bouncycastle.openpgp.PGPSecretKeyRingCollection;
+import org.bouncycastle.openpgp.PGPSignature;
+import org.bouncycastle.openpgp.PGPSignatureGenerator;
+import org.bouncycastle.openpgp.PGPUtil;
+
+public class OpenPGPSignatureGenerator implements SignatureGenerator {
+
+ private static final long MASK = 0xFFFFFFFFL;
+
+ static {
+ Security.addProvider(new BouncyCastleProvider());
+ }
+
+ private String name;
+ private String secring;
+ private String password;
+ private String keyId;
+
+ private PGPSecretKey pgpSec;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getExtension() {
+ return "asc";
+ }
+
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ public void setSecring(String secring) {
+ this.secring = secring;
+ }
+
+ public void setKeyId(String keyId) {
+ if (!"auto".equals(keyId)) {
+ this.keyId = keyId;
+ }
+ }
+
+ public void sign(File src, File dest) throws IOException {
+ OutputStream out = null;
+ InputStream in = null;
+ InputStream keyIn = null;
+
+ try {
+ if (secring == null) {
+ secring = System.getProperty("user.home") + "/.gnupg/secring.gpg";
+ }
+
+ if (pgpSec == null) {
+ keyIn = new FileInputStream(secring);
+ pgpSec = readSecretKey(keyIn);
+ }
+
+ PGPPrivateKey pgpPrivKey = pgpSec.extractPrivateKey(password.toCharArray(), BouncyCastleProvider.PROVIDER_NAME);
+ PGPSignatureGenerator sGen = new PGPSignatureGenerator(pgpSec.getPublicKey().getAlgorithm(), PGPUtil.SHA1, BouncyCastleProvider.PROVIDER_NAME);
+ sGen.initSign(PGPSignature.BINARY_DOCUMENT, pgpPrivKey);
+
+ in = new FileInputStream(src);
+ out = new BCPGOutputStream(new ArmoredOutputStream(new FileOutputStream(dest)));
+
+ int ch = 0;
+ while ((ch = in.read()) >= 0) {
+ sGen.update((byte) ch);
+ }
+
+ sGen.generate().encode(out);
+ } catch (SignatureException e) {
+ IOException ioexc = new IOException();
+ ioexc.initCause(e);
+ throw ioexc;
+ } catch (PGPException e) {
+ IOException ioexc = new IOException();
+ ioexc.initCause(e);
+ throw ioexc;
+ } catch (NoSuchAlgorithmException e) {
+ IOException ioexc = new IOException();
+ ioexc.initCause(e);
+ throw ioexc;
+ } catch (NoSuchProviderException e) {
+ IOException ioexc = new IOException();
+ ioexc.initCause(e);
+ throw ioexc;
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {}
+ }
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException e) {}
+ }
+ if (keyIn != null) {
+ try {
+ keyIn.close();
+ } catch (IOException e) {}
+ }
+ }
+ }
+
+ private PGPSecretKey readSecretKey(InputStream in) throws IOException, PGPException {
+ in = PGPUtil.getDecoderStream(in);
+ PGPSecretKeyRingCollection pgpSec = new PGPSecretKeyRingCollection(in);
+
+ PGPSecretKey key = null;
+ for (Iterator it = pgpSec.getKeyRings(); key == null && it.hasNext(); ) {
+ PGPSecretKeyRing kRing = (PGPSecretKeyRing) it.next();
+
+ for (Iterator it2 = kRing.getSecretKeys(); key == null && it2.hasNext(); ) {
+ PGPSecretKey k = (PGPSecretKey) it2.next();
+ if ((keyId == null) && k.isSigningKey()) {
+ key = k;
+ }
+ if ((keyId != null) && (Long.valueOf(keyId, 16).longValue() == (k.getKeyID() & MASK))) {
+ key = k;
+ }
+ }
+ }
+
+ if (key == null) {
+ throw new IllegalArgumentException("Can't find encryption key" +
+ (keyId != null ? " '" + keyId + "' " : " ") + "in key ring.");
+ }
+
+ return key;
+ }
+
+}
diff --git a/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java b/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
index 66c19cca..d9a92a17 100644
--- a/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
+++ b/src/java/org/apache/ivy/plugins/trigger/LogTrigger.java
@@ -1,125 +1,125 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.trigger;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-
-import org.apache.ivy.core.IvyPatternHelper;
-import org.apache.ivy.core.event.IvyEvent;
-import org.apache.ivy.core.resolve.ResolveProcessException;
-import org.apache.ivy.util.Message;
-
-/**
- * A trigger performing logging.
- *
- * The implementation is widely inspired by Ant Echo task.
- *
- */
-public class LogTrigger extends AbstractTrigger {
- private static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
- private String message = "";
-
- private File file = null;
-
- private boolean append = true;
- /** encoding; set to null or empty means 'default' */
- private String encoding = "";
-
- public void progress(IvyEvent event) {
- log(IvyPatternHelper.substituteVariables(message, event.getAttributes()));
- }
-
- /**
- * Logs the given message.
- *
- * @param message the message to log
- */
- protected void log(String message) {
- if (file == null) {
- Message.info(message);
- } else {
- Writer out = null;
- try {
- // we add a line separator here for consistency with Message.info which creates a
- // new line each time.
- // we use the system dependent line separator to ease reading the log file
- message += LINE_SEPARATOR;
- String filename = file.getAbsolutePath();
- if (encoding == null || encoding.length() == 0) {
- out = new FileWriter(filename, append);
- } else {
- out = new BufferedWriter(
- new OutputStreamWriter(
- new FileOutputStream(filename, append), encoding));
- }
- out.write(message, 0, message.length());
- } catch (IOException e) {
- throw new ResolveProcessException(e);
- } finally {
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- throw new ResolveProcessException(e);
- }
- }
- }
- }
- }
-
- /**
- * Message to write.
- *
- * @param msg Sets the value for the message variable.
- */
- public void setMessage(String msg) {
- this.message = msg;
- }
-
- /**
- * File to write to.
- * @param file the file to write to, if not set, echo to standard Ivy logging
- */
- public void setFile(File file) {
- this.file = file;
- }
-
- /**
- * If true, append to existing file.
- * @param append if true, append to existing file, default is false.
- */
- public void setAppend(boolean append) {
- this.append = append;
- }
-
- /**
- * Declare the encoding to use when outputting to a file;
- * Use "" for the platform's default encoding.
- * @param encoding the character encoding to use.
- */
- public void setEncoding(String encoding) {
- this.encoding = encoding;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.trigger;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.apache.ivy.core.IvyPatternHelper;
+import org.apache.ivy.core.event.IvyEvent;
+import org.apache.ivy.core.resolve.ResolveProcessException;
+import org.apache.ivy.util.Message;
+
+/**
+ * A trigger performing logging.
+ *
+ * The implementation is widely inspired by Ant Echo task.
+ *
+ */
+public class LogTrigger extends AbstractTrigger {
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ private String message = "";
+
+ private File file = null;
+
+ private boolean append = true;
+ /** encoding; set to null or empty means 'default' */
+ private String encoding = "";
+
+ public void progress(IvyEvent event) {
+ log(IvyPatternHelper.substituteVariables(message, event.getAttributes()));
+ }
+
+ /**
+ * Logs the given message.
+ *
+ * @param message the message to log
+ */
+ protected void log(String message) {
+ if (file == null) {
+ Message.info(message);
+ } else {
+ Writer out = null;
+ try {
+ // we add a line separator here for consistency with Message.info which creates a
+ // new line each time.
+ // we use the system dependent line separator to ease reading the log file
+ message += LINE_SEPARATOR;
+ String filename = file.getAbsolutePath();
+ if (encoding == null || encoding.length() == 0) {
+ out = new FileWriter(filename, append);
+ } else {
+ out = new BufferedWriter(
+ new OutputStreamWriter(
+ new FileOutputStream(filename, append), encoding));
+ }
+ out.write(message, 0, message.length());
+ } catch (IOException e) {
+ throw new ResolveProcessException(e);
+ } finally {
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException e) {
+ throw new ResolveProcessException(e);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Message to write.
+ *
+ * @param msg Sets the value for the message variable.
+ */
+ public void setMessage(String msg) {
+ this.message = msg;
+ }
+
+ /**
+ * File to write to.
+ * @param file the file to write to, if not set, echo to standard Ivy logging
+ */
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+ /**
+ * If true, append to existing file.
+ * @param append if true, append to existing file, default is false.
+ */
+ public void setAppend(boolean append) {
+ this.append = append;
+ }
+
+ /**
+ * Declare the encoding to use when outputting to a file;
+ * Use "" for the platform's default encoding.
+ * @param encoding the character encoding to use.
+ */
+ public void setEncoding(String encoding) {
+ this.encoding = encoding;
+ }
+}
diff --git a/src/java/org/apache/ivy/util/MemoryUtil.java b/src/java/org/apache/ivy/util/MemoryUtil.java
index 2e991359..d74bffda 100644
--- a/src/java/org/apache/ivy/util/MemoryUtil.java
+++ b/src/java/org/apache/ivy/util/MemoryUtil.java
@@ -1,90 +1,90 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.util;
-
-/**
- * Memory related utilities.
- */
-public final class MemoryUtil {
- private static final int SAMPLING_SIZE = 100;
- private static final int SLEEP_TIME = 100;
-
- private MemoryUtil() {
- }
-
- /**
- * Returns the approximate size of a default instance of the given class.
- *
- * @param clazz
- * the class to evaluate.
- * @return the estimated size of instance, in bytes.
- */
- public static long sizeOf(Class clazz) {
- long size = 0;
- Object[] objects = new Object[SAMPLING_SIZE];
- try {
- clazz.newInstance();
- long startingMemoryUse = getUsedMemory();
- for (int i = 0; i < objects.length; i++) {
- objects[i] = clazz.newInstance();
- }
- long endingMemoryUse = getUsedMemory();
- float approxSize = (endingMemoryUse - startingMemoryUse) / (float) objects.length;
- size = Math.round(approxSize);
- } catch (Exception e) {
- System.out.println("WARNING:couldn't instantiate" + clazz);
- e.printStackTrace();
- }
- return size;
- }
-
- /**
- * Returns the currently used memory, after calling garbage collector and waiting enough to get
- * maximal chance it is actually called. But since {@link Runtime#gc()} is only advisory,
- * results returned by this method should be treated as rough approximation only.
- *
- * @return the currently used memory, in bytes.
- */
- public static long getUsedMemory() {
- gc();
- long totalMemory = Runtime.getRuntime().totalMemory();
- gc();
- long freeMemory = Runtime.getRuntime().freeMemory();
- long usedMemory = totalMemory - freeMemory;
- return usedMemory;
- }
-
- private static void gc() {
- try {
- System.gc();
- Thread.sleep(SLEEP_TIME);
- System.runFinalization();
- Thread.sleep(SLEEP_TIME);
- System.gc();
- Thread.sleep(SLEEP_TIME);
- System.runFinalization();
- Thread.sleep(SLEEP_TIME);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public static void main(String[] args) throws ClassNotFoundException {
- System.out.println(sizeOf(Class.forName(args[0])));
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.util;
+
+/**
+ * Memory related utilities.
+ */
+public final class MemoryUtil {
+ private static final int SAMPLING_SIZE = 100;
+ private static final int SLEEP_TIME = 100;
+
+ private MemoryUtil() {
+ }
+
+ /**
+ * Returns the approximate size of a default instance of the given class.
+ *
+ * @param clazz
+ * the class to evaluate.
+ * @return the estimated size of instance, in bytes.
+ */
+ public static long sizeOf(Class clazz) {
+ long size = 0;
+ Object[] objects = new Object[SAMPLING_SIZE];
+ try {
+ clazz.newInstance();
+ long startingMemoryUse = getUsedMemory();
+ for (int i = 0; i < objects.length; i++) {
+ objects[i] = clazz.newInstance();
+ }
+ long endingMemoryUse = getUsedMemory();
+ float approxSize = (endingMemoryUse - startingMemoryUse) / (float) objects.length;
+ size = Math.round(approxSize);
+ } catch (Exception e) {
+ System.out.println("WARNING:couldn't instantiate" + clazz);
+ e.printStackTrace();
+ }
+ return size;
+ }
+
+ /**
+ * Returns the currently used memory, after calling garbage collector and waiting enough to get
+ * maximal chance it is actually called. But since {@link Runtime#gc()} is only advisory,
+ * results returned by this method should be treated as rough approximation only.
+ *
+ * @return the currently used memory, in bytes.
+ */
+ public static long getUsedMemory() {
+ gc();
+ long totalMemory = Runtime.getRuntime().totalMemory();
+ gc();
+ long freeMemory = Runtime.getRuntime().freeMemory();
+ long usedMemory = totalMemory - freeMemory;
+ return usedMemory;
+ }
+
+ private static void gc() {
+ try {
+ System.gc();
+ Thread.sleep(SLEEP_TIME);
+ System.runFinalization();
+ Thread.sleep(SLEEP_TIME);
+ System.gc();
+ Thread.sleep(SLEEP_TIME);
+ System.runFinalization();
+ Thread.sleep(SLEEP_TIME);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) throws ClassNotFoundException {
+ System.out.println(sizeOf(Class.forName(args[0])));
+ }
}
\ No newline at end of file
diff --git a/test/buildlist/E2/build.xml b/test/buildlist/E2/build.xml
index 84312b7a..1c1b8cf7 100644
--- a/test/buildlist/E2/build.xml
+++ b/test/buildlist/E2/build.xml
@@ -1,18 +1,18 @@
-
+
diff --git a/test/buildlist/E2/ivy.xml b/test/buildlist/E2/ivy.xml
index f2103e37..24b6f2f1 100644
--- a/test/buildlist/E2/ivy.xml
+++ b/test/buildlist/E2/ivy.xml
@@ -1,21 +1,21 @@
-
-
-
-
+
+
+
+
diff --git a/test/buildlist/H/build.xml b/test/buildlist/H/build.xml
index 84312b7a..1c1b8cf7 100644
--- a/test/buildlist/H/build.xml
+++ b/test/buildlist/H/build.xml
@@ -1,18 +1,18 @@
-
+
diff --git a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml
index b3916ed7..e89965d0 100644
--- a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml
+++ b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml
@@ -1,48 +1,48 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml
index 9a81c9ef..1a30f98d 100644
--- a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml
+++ b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java
index 2322ed9e..0896c0c7 100644
--- a/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java
+++ b/test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileTest.java
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.ant;
-
-import org.apache.ivy.core.report.ResolveReport;
-import org.apache.tools.ant.BuildFileTest;
-
-public class IvyAntSettingsBuildFileTest extends BuildFileTest {
-
- protected void setUp() throws Exception {
- configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
- }
-
- public void testOverrideNotSpecified() {
- executeTarget("testOverrideNotSpecified");
- ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
- assertNotNull(report);
- assertFalse(report.hasError());
- assertEquals(1, report.getDependencies().size());
- }
-
- public void testOverrideSetToFalse() {
- executeTarget("testOverrideSetToFalse");
- ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
- assertNotNull(report);
- assertFalse(report.hasError());
- assertEquals(1, report.getDependencies().size());
- }
-
- public void testUnnecessaryDefaultIvyInstance() {
- executeTarget("testUnnecessaryDefaultIvyInstance");
- assertNull("Default ivy.instance settings shouldn't have been loaded",
- getProject().getReference("ivy.instance"));
- }
-
- public void testSettingsWithIdIvyInstance() {
- // IVY-925
- executeTarget("testSettingsWithPropertyAsId");
- ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
- assertNotNull(report);
- assertFalse(report.hasError());
- assertEquals(1, report.getDependencies().size());
- }
-
- public void testStackOverflow() {
- // IVY-924
- configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
- executeTarget("testStackOverflow");
- ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
- assertNotNull(report);
- assertFalse(report.hasError());
- assertEquals(1, report.getDependencies().size());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.ant;
+
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.tools.ant.BuildFileTest;
+
+public class IvyAntSettingsBuildFileTest extends BuildFileTest {
+
+ protected void setUp() throws Exception {
+ configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFile.xml");
+ }
+
+ public void testOverrideNotSpecified() {
+ executeTarget("testOverrideNotSpecified");
+ ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+ assertNotNull(report);
+ assertFalse(report.hasError());
+ assertEquals(1, report.getDependencies().size());
+ }
+
+ public void testOverrideSetToFalse() {
+ executeTarget("testOverrideSetToFalse");
+ ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+ assertNotNull(report);
+ assertFalse(report.hasError());
+ assertEquals(1, report.getDependencies().size());
+ }
+
+ public void testUnnecessaryDefaultIvyInstance() {
+ executeTarget("testUnnecessaryDefaultIvyInstance");
+ assertNull("Default ivy.instance settings shouldn't have been loaded",
+ getProject().getReference("ivy.instance"));
+ }
+
+ public void testSettingsWithIdIvyInstance() {
+ // IVY-925
+ executeTarget("testSettingsWithPropertyAsId");
+ ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+ assertNotNull(report);
+ assertFalse(report.hasError());
+ assertEquals(1, report.getDependencies().size());
+ }
+
+ public void testStackOverflow() {
+ // IVY-924
+ configureProject("test/java/org/apache/ivy/ant/IvyAntSettingsBuildFileStackOverflow.xml");
+ executeTarget("testStackOverflow");
+ ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+ assertNotNull(report);
+ assertFalse(report.hasError());
+ assertEquals(1, report.getDependencies().size());
+ }
+}
diff --git a/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml b/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml
index bb674e84..359f17c8 100644
--- a/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml
+++ b/test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml
@@ -1,35 +1,35 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java b/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
index 0fe21d99..345eb1ac 100644
--- a/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
+++ b/test/java/org/apache/ivy/ant/IvyRetrieveBuildFileTest.java
@@ -1,36 +1,36 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.ant;
-
-import org.apache.ivy.core.report.ResolveReport;
-import org.apache.tools.ant.BuildFileTest;
-
-public class IvyRetrieveBuildFileTest extends BuildFileTest {
-
- protected void setUp() throws Exception {
- configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
- }
-
- public void testMultipleInlineRetrievesWithCacheCleaning() {
- executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
- ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
- assertNotNull(report);
- assertFalse(report.hasError());
- assertEquals(1, report.getDependencies().size());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.ant;
+
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.tools.ant.BuildFileTest;
+
+public class IvyRetrieveBuildFileTest extends BuildFileTest {
+
+ protected void setUp() throws Exception {
+ configureProject("test/java/org/apache/ivy/ant/IvyRetrieveBuildFile.xml");
+ }
+
+ public void testMultipleInlineRetrievesWithCacheCleaning() {
+ executeTarget("testMultipleInlineRetrievesWithCacheCleaning");
+ ResolveReport report = (ResolveReport) getProject().getReference("ivy.resolved.report");
+ assertNotNull(report);
+ assertFalse(report.hasError());
+ assertEquals(1, report.getDependencies().size());
+ }
+}
diff --git a/test/java/org/apache/ivy/ant/ivy-630.xml b/test/java/org/apache/ivy/ant/ivy-630.xml
index 8d0eccd5..3a4abdf6 100644
--- a/test/java/org/apache/ivy/ant/ivy-630.xml
+++ b/test/java/org/apache/ivy/ant/ivy-630.xml
@@ -1,24 +1,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/ant/ivy-631.xml b/test/java/org/apache/ivy/ant/ivy-631.xml
index cb51ed05..9be1c44d 100644
--- a/test/java/org/apache/ivy/ant/ivy-631.xml
+++ b/test/java/org/apache/ivy/ant/ivy-631.xml
@@ -1,24 +1,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/ant/ivy-artifact-info.xml b/test/java/org/apache/ivy/ant/ivy-artifact-info.xml
index 5c7245ae..164f1c89 100644
--- a/test/java/org/apache/ivy/ant/ivy-artifact-info.xml
+++ b/test/java/org/apache/ivy/ant/ivy-artifact-info.xml
@@ -1,36 +1,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/ant/ivy-extends-merged.xml b/test/java/org/apache/ivy/ant/ivy-extends-merged.xml
index 3a2a5bc7..27460194 100644
--- a/test/java/org/apache/ivy/ant/ivy-extends-merged.xml
+++ b/test/java/org/apache/ivy/ant/ivy-extends-merged.xml
@@ -1,51 +1,51 @@
-
-
-
-
-
-
-
- Demonstrates configuration-specific dependencies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Demonstrates configuration-specific dependencies
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/ivy-extends-minimal-merged.xml b/test/java/org/apache/ivy/ant/ivy-extends-minimal-merged.xml
index 5c99079d..0b5955e0 100644
--- a/test/java/org/apache/ivy/ant/ivy-extends-minimal-merged.xml
+++ b/test/java/org/apache/ivy/ant/ivy-extends-minimal-merged.xml
@@ -1,42 +1,42 @@
-
-
-
-
-
-
-
- Demonstrates configuration-specific dependencies
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Demonstrates configuration-specific dependencies
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/ivy-extends-minimal.xml b/test/java/org/apache/ivy/ant/ivy-extends-minimal.xml
index 0cba6bb9..46730c13 100644
--- a/test/java/org/apache/ivy/ant/ivy-extends-minimal.xml
+++ b/test/java/org/apache/ivy/ant/ivy-extends-minimal.xml
@@ -1,27 +1,27 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml b/test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml
index 6fb66b53..50684728 100644
--- a/test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml
+++ b/test/java/org/apache/ivy/ant/ivy-extends-multiconf.xml
@@ -1,41 +1,41 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/test/java/org/apache/ivy/ant/ivysettings-defaultCacheDir.xml b/test/java/org/apache/ivy/ant/ivysettings-defaultCacheDir.xml
index 3304820b..e9981c35 100644
--- a/test/java/org/apache/ivy/ant/ivysettings-defaultCacheDir.xml
+++ b/test/java/org/apache/ivy/ant/ivysettings-defaultCacheDir.xml
@@ -1,21 +1,21 @@
-
-
-
-
+
+
+
+
diff --git a/test/java/org/apache/ivy/ant/ivysettings-include-twice.xml b/test/java/org/apache/ivy/ant/ivysettings-include-twice.xml
index ca503815..c81a41c3 100644
--- a/test/java/org/apache/ivy/ant/ivysettings-include-twice.xml
+++ b/test/java/org/apache/ivy/ant/ivysettings-include-twice.xml
@@ -1,22 +1,22 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml b/test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml
index 3e440c38..e9588f42 100644
--- a/test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml
+++ b/test/java/org/apache/ivy/ant/ivysettings-noDefaultCacheDir.xml
@@ -1,21 +1,21 @@
-
-
-
-
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/deliver/DeliverTest.java b/test/java/org/apache/ivy/core/deliver/DeliverTest.java
index 18b5d34e..5e3657ea 100644
--- a/test/java/org/apache/ivy/core/deliver/DeliverTest.java
+++ b/test/java/org/apache/ivy/core/deliver/DeliverTest.java
@@ -1,100 +1,100 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.deliver;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.ant.IvyDeliver;
-import org.apache.ivy.ant.IvyResolve;
-import org.apache.ivy.util.FileUtil;
-import org.apache.tools.ant.Project;
-
-public class DeliverTest extends TestCase {
- private File cache;
- private File deliverDir;
-
- private IvyDeliver ivyDeliver;
-
- protected void setUp() throws Exception {
- cache = new File("build/cache");
- System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
- createCache();
-
- deliverDir = new File("build/test/deliver");
- deliverDir.mkdirs();
-
- Project project = new Project();
- project.init();
-
- ivyDeliver = new IvyDeliver();
- ivyDeliver.setProject(project);
- ivyDeliver.setDeliverpattern(deliverDir.getAbsolutePath() + "/[type]s/[artifact]-[revision](-[classifier]).[ext]");
- }
-
- protected void tearDown() throws Exception {
- FileUtil.forceDelete(cache);
- FileUtil.forceDelete(deliverDir);
- }
-
- private void createCache() {
- cache.mkdirs();
- }
-
- public void testIVY1111() throws Exception {
- Project project = ivyDeliver.getProject();
- project.setProperty("ivy.settings.file", "test/repositories/IVY-1111/ivysettings.xml");
- String ivyFileName = DeliverTest.class.getResource("ivy-1111.xml").getFile();
- File ivyFile = new File(ivyFileName);
-
- resolve(ivyFile);
-
- ivyDeliver.setReplacedynamicrev(true);
- ivyDeliver.doExecute();
-
- String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
- assertTrue(deliverContent.indexOf("rev=\"latest.integration\"") == -1);
- assertTrue(deliverContent.indexOf("name=\"b\" rev=\"1.5\"") >= 0);
- }
-
- private void resolve(File ivyFile) {
- IvyResolve ivyResolve = new IvyResolve();
- ivyResolve.setProject(ivyDeliver.getProject());
- ivyResolve.setFile(ivyFile);
- ivyResolve.doExecute();
- }
-
- private String readFile(String fileName) throws IOException {
- StringBuffer retval = new StringBuffer();
-
- File ivyFile = new File(fileName);
- BufferedReader reader = new BufferedReader(new FileReader(ivyFile));
-
- String line = null;
- while ((line = reader.readLine()) != null) {
- retval.append(line + "\n");
- }
-
- reader.close();
- return retval.toString();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.deliver;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.ant.IvyDeliver;
+import org.apache.ivy.ant.IvyResolve;
+import org.apache.ivy.util.FileUtil;
+import org.apache.tools.ant.Project;
+
+public class DeliverTest extends TestCase {
+ private File cache;
+ private File deliverDir;
+
+ private IvyDeliver ivyDeliver;
+
+ protected void setUp() throws Exception {
+ cache = new File("build/cache");
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
+ createCache();
+
+ deliverDir = new File("build/test/deliver");
+ deliverDir.mkdirs();
+
+ Project project = new Project();
+ project.init();
+
+ ivyDeliver = new IvyDeliver();
+ ivyDeliver.setProject(project);
+ ivyDeliver.setDeliverpattern(deliverDir.getAbsolutePath() + "/[type]s/[artifact]-[revision](-[classifier]).[ext]");
+ }
+
+ protected void tearDown() throws Exception {
+ FileUtil.forceDelete(cache);
+ FileUtil.forceDelete(deliverDir);
+ }
+
+ private void createCache() {
+ cache.mkdirs();
+ }
+
+ public void testIVY1111() throws Exception {
+ Project project = ivyDeliver.getProject();
+ project.setProperty("ivy.settings.file", "test/repositories/IVY-1111/ivysettings.xml");
+ String ivyFileName = DeliverTest.class.getResource("ivy-1111.xml").getFile();
+ File ivyFile = new File(ivyFileName);
+
+ resolve(ivyFile);
+
+ ivyDeliver.setReplacedynamicrev(true);
+ ivyDeliver.doExecute();
+
+ String deliverContent = readFile(deliverDir.getAbsolutePath() + "/ivys/ivy-1.0.xml");
+ assertTrue(deliverContent.indexOf("rev=\"latest.integration\"") == -1);
+ assertTrue(deliverContent.indexOf("name=\"b\" rev=\"1.5\"") >= 0);
+ }
+
+ private void resolve(File ivyFile) {
+ IvyResolve ivyResolve = new IvyResolve();
+ ivyResolve.setProject(ivyDeliver.getProject());
+ ivyResolve.setFile(ivyFile);
+ ivyResolve.doExecute();
+ }
+
+ private String readFile(String fileName) throws IOException {
+ StringBuffer retval = new StringBuffer();
+
+ File ivyFile = new File(fileName);
+ BufferedReader reader = new BufferedReader(new FileReader(ivyFile));
+
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ retval.append(line + "\n");
+ }
+
+ reader.close();
+ return retval.toString();
+ }
+}
diff --git a/test/java/org/apache/ivy/core/deliver/ivy-1111.xml b/test/java/org/apache/ivy/core/deliver/ivy-1111.xml
index 98ad18a9..3c2663b4 100644
--- a/test/java/org/apache/ivy/core/deliver/ivy-1111.xml
+++ b/test/java/org/apache/ivy/core/deliver/ivy-1111.xml
@@ -1,26 +1,26 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/publish/PublishEngineTest.java b/test/java/org/apache/ivy/core/publish/PublishEngineTest.java
index bc3cd7cf..c35c2761 100644
--- a/test/java/org/apache/ivy/core/publish/PublishEngineTest.java
+++ b/test/java/org/apache/ivy/core/publish/PublishEngineTest.java
@@ -1,143 +1,143 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.publish;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.ParseException;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.core.event.EventManager;
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
-import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.resolve.ResolveData;
-import org.apache.ivy.core.resolve.ResolveEngine;
-import org.apache.ivy.core.resolve.ResolveOptions;
-import org.apache.ivy.core.resolve.ResolvedModuleRevision;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.core.sort.SortEngine;
-import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
-import org.apache.ivy.plugins.resolver.FileSystemResolver;
-import org.apache.ivy.util.FileUtil;
-
-public class PublishEngineTest extends TestCase {
- protected void setUp() throws Exception {
- System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
- FileUtil.forceDelete(new File("build/test/publish"));
- }
- protected void tearDown() throws Exception {
- FileUtil.forceDelete(new File("build/test/publish"));
- }
-
- public void testAtomicity() throws Exception {
- IvySettings settings = new IvySettings();
- final PublishEngine engine = new PublishEngine(settings, new EventManager());
- final int[] counter = new int[] {0};
-
- final DefaultModuleDescriptor md = DefaultModuleDescriptor
- .newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
- final FileSystemResolver resolver = new FileSystemResolver() {
- public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
- super.publish(artifact, src, overwrite);
- synchronized (PublishEngineTest.this) {
- counter[0] ++;
- }
- sleepSilently(50);
- synchronized (PublishEngineTest.this) {
- counter[0] ++;
- }
- }
- };
- resolver.setName("test");
- resolver.setSettings(settings);
- String publishRepoDir = new File("build/test/publish/repo").getAbsolutePath();
- resolver.addIvyPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
- resolver.addArtifactPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
-
- FileUtil.copy(
- new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
- new File("build/test/publish/module/A.jar"), null);
- XmlModuleDescriptorWriter.write(md, new File("build/test/publish/module/ivy.xml"));
-
- resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "before publishing");
-
- // run publish asynchronously
- new Thread() {
- public void run() {
- try {
- engine.publish(
- md,
- Arrays.asList(new String[] {"build/test/publish/module/[artifact].[ext]"}),
- resolver,
- new PublishOptions().setSrcIvyPattern("build/test/publish/module/[artifact].[ext]"));
- synchronized (PublishEngineTest.this) {
- counter[0] ++;
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
- }.start();
-
- while(true) {
- sleepSilently(5);
- synchronized (this) {
- if (counter[0] == 5) {
- break;
- } else if (counter[0] < 4) {
- resolveAndAssertNotFound(settings, resolver,
- "#A;latest.integration", "after "+(counter[0] / 2)+" artifacts published");
- }
- }
- }
- resolveAndAssertFound(settings, resolver, "#A;1.0");
- }
- private void resolveAndAssertNotFound(
- IvySettings settings, FileSystemResolver resolver, String module, String context)
- throws ParseException {
- ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
- assertNull("module found " + context + ". module="+rmr, rmr);
- }
-
- private void resolveAndAssertFound(
- IvySettings settings, FileSystemResolver resolver, String module)
- throws ParseException {
- ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
- assertNotNull(rmr);
- assertEquals(module, rmr.getId().toString());
- }
- private ResolvedModuleRevision resolveModule(
- IvySettings settings, FileSystemResolver resolver, String module)
- throws ParseException {
- return resolver.getDependency(
- new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
- new ResolveData(
- new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
- new ResolveOptions()));
- }
- private void sleepSilently(int timeout) {
- try {
- Thread.sleep(timeout);
- } catch (InterruptedException e) {
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.publish;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.ParseException;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.core.event.EventManager;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
+import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.resolve.ResolvedModuleRevision;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.sort.SortEngine;
+import org.apache.ivy.plugins.parser.xml.XmlModuleDescriptorWriter;
+import org.apache.ivy.plugins.resolver.FileSystemResolver;
+import org.apache.ivy.util.FileUtil;
+
+public class PublishEngineTest extends TestCase {
+ protected void setUp() throws Exception {
+ System.setProperty("ivy.cache.dir", new File("build/test/publish/cache").getAbsolutePath());
+ FileUtil.forceDelete(new File("build/test/publish"));
+ }
+ protected void tearDown() throws Exception {
+ FileUtil.forceDelete(new File("build/test/publish"));
+ }
+
+ public void testAtomicity() throws Exception {
+ IvySettings settings = new IvySettings();
+ final PublishEngine engine = new PublishEngine(settings, new EventManager());
+ final int[] counter = new int[] {0};
+
+ final DefaultModuleDescriptor md = DefaultModuleDescriptor
+ .newDefaultInstance(ModuleRevisionId.parse("#A;1.0"));
+ final FileSystemResolver resolver = new FileSystemResolver() {
+ public void publish(Artifact artifact, File src, boolean overwrite) throws IOException {
+ super.publish(artifact, src, overwrite);
+ synchronized (PublishEngineTest.this) {
+ counter[0] ++;
+ }
+ sleepSilently(50);
+ synchronized (PublishEngineTest.this) {
+ counter[0] ++;
+ }
+ }
+ };
+ resolver.setName("test");
+ resolver.setSettings(settings);
+ String publishRepoDir = new File("build/test/publish/repo").getAbsolutePath();
+ resolver.addIvyPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
+ resolver.addArtifactPattern(publishRepoDir + "/[module]/[revision]/[artifact].[ext]");
+
+ FileUtil.copy(
+ new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"),
+ new File("build/test/publish/module/A.jar"), null);
+ XmlModuleDescriptorWriter.write(md, new File("build/test/publish/module/ivy.xml"));
+
+ resolveAndAssertNotFound(settings, resolver, "#A;latest.integration", "before publishing");
+
+ // run publish asynchronously
+ new Thread() {
+ public void run() {
+ try {
+ engine.publish(
+ md,
+ Arrays.asList(new String[] {"build/test/publish/module/[artifact].[ext]"}),
+ resolver,
+ new PublishOptions().setSrcIvyPattern("build/test/publish/module/[artifact].[ext]"));
+ synchronized (PublishEngineTest.this) {
+ counter[0] ++;
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }.start();
+
+ while(true) {
+ sleepSilently(5);
+ synchronized (this) {
+ if (counter[0] == 5) {
+ break;
+ } else if (counter[0] < 4) {
+ resolveAndAssertNotFound(settings, resolver,
+ "#A;latest.integration", "after "+(counter[0] / 2)+" artifacts published");
+ }
+ }
+ }
+ resolveAndAssertFound(settings, resolver, "#A;1.0");
+ }
+ private void resolveAndAssertNotFound(
+ IvySettings settings, FileSystemResolver resolver, String module, String context)
+ throws ParseException {
+ ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
+ assertNull("module found " + context + ". module="+rmr, rmr);
+ }
+
+ private void resolveAndAssertFound(
+ IvySettings settings, FileSystemResolver resolver, String module)
+ throws ParseException {
+ ResolvedModuleRevision rmr = resolveModule(settings, resolver, module);
+ assertNotNull(rmr);
+ assertEquals(module, rmr.getId().toString());
+ }
+ private ResolvedModuleRevision resolveModule(
+ IvySettings settings, FileSystemResolver resolver, String module)
+ throws ParseException {
+ return resolver.getDependency(
+ new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
+ new ResolveData(
+ new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
+ new ResolveOptions()));
+ }
+ private void sleepSilently(int timeout) {
+ try {
+ Thread.sleep(timeout);
+ } catch (InterruptedException e) {
+ }
+ }
+}
diff --git a/test/java/org/apache/ivy/core/repository/RepositoryManagementEngineTest.java b/test/java/org/apache/ivy/core/repository/RepositoryManagementEngineTest.java
index 09594acd..2503125f 100644
--- a/test/java/org/apache/ivy/core/repository/RepositoryManagementEngineTest.java
+++ b/test/java/org/apache/ivy/core/repository/RepositoryManagementEngineTest.java
@@ -1,68 +1,68 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.repository;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.TestFixture;
-import org.apache.ivy.TestHelper;
-import org.apache.ivy.core.event.EventManager;
-import org.apache.ivy.core.resolve.ResolveEngine;
-import org.apache.ivy.core.search.SearchEngine;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.core.sort.SortEngine;
-
-public class RepositoryManagementEngineTest extends TestCase {
- private RepositoryManagementEngine repository;
- private TestFixture fixture;
-
- protected void setUp() throws Exception {
- fixture = new TestFixture();
- IvySettings settings = fixture.getSettings();
- repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
- new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
- }
-
- protected void tearDown() throws Exception {
- fixture.clean();
- }
-
- public void testLoad() throws Exception {
- fixture
- .addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
- .addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
- .addMD("o2#C;1->{o1#B;1 o1#A;1}")
- .init();
-
- repository.load();
- assertEquals(3, repository.getModuleIdsNumber());
- assertEquals(6, repository.getRevisionsNumber());
- }
-
- public void testOrphans() throws Exception {
- fixture
- .addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
- .addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
- .addMD("o2#C;1->{o1#B;1 o1#A;1}")
- .init();
-
- repository.load();
- repository.analyze();
- TestHelper.assertModuleRevisionIds("o1#A;3 o1#B;2 o2#C;1", repository.getOrphans());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.repository;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.TestFixture;
+import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.event.EventManager;
+import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.search.SearchEngine;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.sort.SortEngine;
+
+public class RepositoryManagementEngineTest extends TestCase {
+ private RepositoryManagementEngine repository;
+ private TestFixture fixture;
+
+ protected void setUp() throws Exception {
+ fixture = new TestFixture();
+ IvySettings settings = fixture.getSettings();
+ repository = new RepositoryManagementEngine(settings, new SearchEngine(settings),
+ new ResolveEngine(settings, new EventManager(), new SortEngine(settings)));
+ }
+
+ protected void tearDown() throws Exception {
+ fixture.clean();
+ }
+
+ public void testLoad() throws Exception {
+ fixture
+ .addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
+ .addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
+ .addMD("o2#C;1->{o1#B;1 o1#A;1}")
+ .init();
+
+ repository.load();
+ assertEquals(3, repository.getModuleIdsNumber());
+ assertEquals(6, repository.getRevisionsNumber());
+ }
+
+ public void testOrphans() throws Exception {
+ fixture
+ .addMD("o1#A;1").addMD("o1#A;2").addMD("o1#A;3")
+ .addMD("o1#B;1").addMD("o1#B;2->o1#A;2")
+ .addMD("o2#C;1->{o1#B;1 o1#A;1}")
+ .init();
+
+ repository.load();
+ repository.analyze();
+ TestHelper.assertModuleRevisionIds("o1#A;3 o1#B;2 o2#C;1", repository.getOrphans());
+ }
+}
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java b/test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java
index 2275d1d6..3c23b265 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveEngineTest.java
@@ -1,100 +1,100 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.resolve;
-
-import java.io.File;
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.Ivy;
-import org.apache.ivy.core.cache.ArtifactOrigin;
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.module.descriptor.DefaultArtifact;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.report.ArtifactDownloadReport;
-import org.apache.ivy.core.report.DownloadStatus;
-import org.apache.ivy.core.report.ResolveReport;
-import org.apache.ivy.util.CacheCleaner;
-
-public class ResolveEngineTest extends TestCase {
-
- private Ivy ivy;
-
- private File cache;
-
- protected void setUp() throws Exception {
- cache = new File("build/cache");
- System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
- createCache();
-
- ivy = Ivy.newInstance();
- ivy.configure(new File("test/repositories/ivysettings.xml"));
- }
-
- protected void tearDown() throws Exception {
- CacheCleaner.deleteDir(cache);
- }
-
- public void testInlineResolveWithNonExistingModule() throws Exception {
- ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
- ivy.getEventManager(), ivy.getSortEngine());
-
- ResolveOptions options = new ResolveOptions();
- options.setConfs(new String[] {"*"});
-
- ModuleRevisionId mRevId = ModuleRevisionId.newInstance("org1XX", "mod1.0XX", "1.0XX");
- ResolveReport report = engine.resolve(mRevId, options, true);
-
- assertNotNull("The ResolveReport may never be null", report);
- assertTrue(report.hasError());
- }
-
- public void testLocateThenDownload() throws Exception {
- ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
- ivy.getEventManager(), ivy.getSortEngine());
-
- testLocateThenDownload(
- engine,
- DefaultArtifact.newIvyArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date()),
- new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"));
- testLocateThenDownload(
- engine,
- new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar"),
- new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"));
- }
-
- private void testLocateThenDownload(ResolveEngine engine, Artifact artifact, File artifactFile) {
- ArtifactOrigin origin = engine.locate(artifact);
- assertNotNull(origin);
- assertTrue(origin.isLocal());
- assertEquals(
- artifactFile.getAbsolutePath(),
- new File(origin.getLocation()).getAbsolutePath());
-
- ArtifactDownloadReport r = engine.download(origin, new DownloadOptions());
- assertNotNull(r);
- assertEquals(DownloadStatus.SUCCESSFUL, r.getDownloadStatus());
- assertNotNull(r.getLocalFile());
- assertTrue(r.getLocalFile().exists());
- }
-
- private void createCache() {
- cache.mkdirs();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.resolve;
+
+import java.io.File;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.core.cache.ArtifactOrigin;
+import org.apache.ivy.core.module.descriptor.Artifact;
+import org.apache.ivy.core.module.descriptor.DefaultArtifact;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.report.ArtifactDownloadReport;
+import org.apache.ivy.core.report.DownloadStatus;
+import org.apache.ivy.core.report.ResolveReport;
+import org.apache.ivy.util.CacheCleaner;
+
+public class ResolveEngineTest extends TestCase {
+
+ private Ivy ivy;
+
+ private File cache;
+
+ protected void setUp() throws Exception {
+ cache = new File("build/cache");
+ System.setProperty("ivy.cache.dir", cache.getAbsolutePath());
+ createCache();
+
+ ivy = Ivy.newInstance();
+ ivy.configure(new File("test/repositories/ivysettings.xml"));
+ }
+
+ protected void tearDown() throws Exception {
+ CacheCleaner.deleteDir(cache);
+ }
+
+ public void testInlineResolveWithNonExistingModule() throws Exception {
+ ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
+ ivy.getEventManager(), ivy.getSortEngine());
+
+ ResolveOptions options = new ResolveOptions();
+ options.setConfs(new String[] {"*"});
+
+ ModuleRevisionId mRevId = ModuleRevisionId.newInstance("org1XX", "mod1.0XX", "1.0XX");
+ ResolveReport report = engine.resolve(mRevId, options, true);
+
+ assertNotNull("The ResolveReport may never be null", report);
+ assertTrue(report.hasError());
+ }
+
+ public void testLocateThenDownload() throws Exception {
+ ResolveEngine engine = new ResolveEngine(ivy.getSettings(),
+ ivy.getEventManager(), ivy.getSortEngine());
+
+ testLocateThenDownload(
+ engine,
+ DefaultArtifact.newIvyArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date()),
+ new File("test/repositories/1/org1/mod1.1/ivys/ivy-1.0.xml"));
+ testLocateThenDownload(
+ engine,
+ new DefaultArtifact(ModuleRevisionId.parse("org1#mod1.1;1.0"), new Date(), "mod1.1", "jar", "jar"),
+ new File("test/repositories/1/org1/mod1.1/jars/mod1.1-1.0.jar"));
+ }
+
+ private void testLocateThenDownload(ResolveEngine engine, Artifact artifact, File artifactFile) {
+ ArtifactOrigin origin = engine.locate(artifact);
+ assertNotNull(origin);
+ assertTrue(origin.isLocal());
+ assertEquals(
+ artifactFile.getAbsolutePath(),
+ new File(origin.getLocation()).getAbsolutePath());
+
+ ArtifactDownloadReport r = engine.download(origin, new DownloadOptions());
+ assertNotNull(r);
+ assertEquals(DownloadStatus.SUCCESSFUL, r.getDownloadStatus());
+ assertNotNull(r.getLocalFile());
+ assertTrue(r.getLocalFile().exists());
+ }
+
+ private void createCache() {
+ cache.mkdirs();
+ }
+}
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-1178.xml b/test/java/org/apache/ivy/core/resolve/ivy-1178.xml
index 65e1984e..d9b5a5fa 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-1178.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-1178.xml
@@ -1,28 +1,28 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-590.xml b/test/java/org/apache/ivy/core/resolve/ivy-590.xml
index b9efe686..e4d1f877 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-590.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-590.xml
@@ -1,29 +1,29 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-874.xml b/test/java/org/apache/ivy/core/resolve/ivy-874.xml
index 3e9f9756..5dc0bc48 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-874.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-874.xml
@@ -1,36 +1,36 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-956.xml b/test/java/org/apache/ivy/core/resolve/ivy-956.xml
index 5883c80b..eee7b937 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-956.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-956.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-999.xml b/test/java/org/apache/ivy/core/resolve/ivy-999.xml
index fdea6e43..ea8b415c 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-999.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-999.xml
@@ -1,26 +1,26 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies.xml b/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies.xml
index 3b547bc1..5229c8c6 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies.xml
@@ -1,40 +1,40 @@
-
-
-
-
-
-
-
-
- TESTA -- Hello World Library - <a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'>Release Notes</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ TESTA -- Hello World Library - <a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'>Release Notes</a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies2.xml b/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies2.xml
index ee9a5ba0..8c04732a 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies2.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-extra-att-multipledependencies2.xml
@@ -1,40 +1,40 @@
-
-
-
-
-
-
-
-
- TESTA -- Hello World Library - <a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'>Release Notes</a>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ TESTA -- Hello World Library - <a href='http://coretech.caecorp.cae.com/clearspace/tags/testa_releasenotes'>Release Notes</a>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-extra-attrib-forced-dependencies.xml b/test/java/org/apache/ivy/core/resolve/ivy-extra-attrib-forced-dependencies.xml
index 23fdb14d..a52eb9f0 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-extra-attrib-forced-dependencies.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-extra-attrib-forced-dependencies.xml
@@ -1,40 +1,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml b/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml
index 67a05547..c54d1ba7 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-m2-with-src.xml
@@ -1,24 +1,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/resolve/ivy-mod1.2-1.5.xml b/test/java/org/apache/ivy/core/resolve/ivy-mod1.2-1.5.xml
index cc417736..dc181634 100644
--- a/test/java/org/apache/ivy/core/resolve/ivy-mod1.2-1.5.xml
+++ b/test/java/org/apache/ivy/core/resolve/ivy-mod1.2-1.5.xml
@@ -1,26 +1,26 @@
-
-
-
-
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/settings/IvySettingsTest.java b/test/java/org/apache/ivy/core/settings/IvySettingsTest.java
index 4d95c703..5b0cd74f 100644
--- a/test/java/org/apache/ivy/core/settings/IvySettingsTest.java
+++ b/test/java/org/apache/ivy/core/settings/IvySettingsTest.java
@@ -1,48 +1,48 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.core.settings;
-
-import java.io.IOException;
-import java.text.ParseException;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.Ivy;
-import org.apache.ivy.plugins.resolver.DependencyResolver;
-
-public class IvySettingsTest extends TestCase {
-
- public void testChangeDefaultResolver() throws ParseException, IOException {
- Ivy ivy = new Ivy();
- ivy.configureDefault();
-
- IvySettings settings = ivy.getSettings();
- DependencyResolver defaultResolver = settings.getDefaultResolver();
-
- assertNotNull(defaultResolver);
- assertEquals("default", defaultResolver.getName());
- assertSame("default resolver cached", defaultResolver, settings.getDefaultResolver());
-
- settings.setDefaultResolver("public");
- DependencyResolver newDefault = settings.getDefaultResolver();
- assertNotNull(newDefault);
- assertNotSame("default resolver has changed", defaultResolver, newDefault);
- assertEquals("resolver changed successfully", "public", newDefault.getName());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.core.settings;
+
+import java.io.IOException;
+import java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.plugins.resolver.DependencyResolver;
+
+public class IvySettingsTest extends TestCase {
+
+ public void testChangeDefaultResolver() throws ParseException, IOException {
+ Ivy ivy = new Ivy();
+ ivy.configureDefault();
+
+ IvySettings settings = ivy.getSettings();
+ DependencyResolver defaultResolver = settings.getDefaultResolver();
+
+ assertNotNull(defaultResolver);
+ assertEquals("default", defaultResolver.getName());
+ assertSame("default resolver cached", defaultResolver, settings.getDefaultResolver());
+
+ settings.setDefaultResolver("public");
+ DependencyResolver newDefault = settings.getDefaultResolver();
+ assertNotNull(newDefault);
+ assertNotSame("default resolver has changed", defaultResolver, newDefault);
+ assertEquals("resolver changed successfully", "public", newDefault.getName());
+ }
+
+}
diff --git a/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml b/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
index ce344390..d7edf973 100644
--- a/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
+++ b/test/java/org/apache/ivy/core/settings/ivysettings-extra-module-attribute.xml
@@ -1,24 +1,24 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml b/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
index 0cb3478d..aef59595 100644
--- a/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
+++ b/test/java/org/apache/ivy/core/settings/ivysettings-include-special.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml b/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
index baf14758..15ae1512 100644
--- a/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
+++ b/test/java/org/apache/ivy/core/settings/ivysettings-macro#2.xml
@@ -1,45 +1,45 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/core/settings/ivysettings-properties-missing-file.xml b/test/java/org/apache/ivy/core/settings/ivysettings-properties-missing-file.xml
index cbc1728d..33229886 100644
--- a/test/java/org/apache/ivy/core/settings/ivysettings-properties-missing-file.xml
+++ b/test/java/org/apache/ivy/core/settings/ivysettings-properties-missing-file.xml
@@ -1,52 +1,52 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategyTest.java b/test/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategyTest.java
index aed0b67b..fad5dd96 100644
--- a/test/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategyTest.java
+++ b/test/java/org/apache/ivy/plugins/circular/IgnoreCircularDependencyStrategyTest.java
@@ -1,50 +1,50 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.circular;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.TestHelper;
-import org.apache.ivy.util.Message;
-import org.apache.ivy.util.MockMessageLogger;
-
-public class IgnoreCircularDependencyStrategyTest extends TestCase {
- private CircularDependencyStrategy strategy;
- private MockMessageLogger mockMessageImpl;
-
- protected void setUp() throws Exception {
- strategy = IgnoreCircularDependencyStrategy.getInstance();
-
- mockMessageImpl = new MockMessageLogger();
- Message.setDefaultLogger(mockMessageImpl);
- }
-
- public void testLog() throws Exception {
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
-
- mockMessageImpl.assertLogVerboseContains("circular dependency found: #A;1.0->#B;1.0");
- }
-
- public void testRemoveDuplicates() throws Exception {
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
-
- // should only log the circular dependency once
- assertEquals(1, mockMessageImpl.getLogs().size());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.circular;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.TestHelper;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.MockMessageLogger;
+
+public class IgnoreCircularDependencyStrategyTest extends TestCase {
+ private CircularDependencyStrategy strategy;
+ private MockMessageLogger mockMessageImpl;
+
+ protected void setUp() throws Exception {
+ strategy = IgnoreCircularDependencyStrategy.getInstance();
+
+ mockMessageImpl = new MockMessageLogger();
+ Message.setDefaultLogger(mockMessageImpl);
+ }
+
+ public void testLog() throws Exception {
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
+
+ mockMessageImpl.assertLogVerboseContains("circular dependency found: #A;1.0->#B;1.0");
+ }
+
+ public void testRemoveDuplicates() throws Exception {
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+
+ // should only log the circular dependency once
+ assertEquals(1, mockMessageImpl.getLogs().size());
+ }
+}
diff --git a/test/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategyTest.java b/test/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategyTest.java
index 0ca137bc..60a877e4 100644
--- a/test/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategyTest.java
+++ b/test/java/org/apache/ivy/plugins/circular/WarnCircularDependencyStrategyTest.java
@@ -1,90 +1,90 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.circular;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.TestHelper;
-import org.apache.ivy.core.IvyContext;
-import org.apache.ivy.core.event.EventManager;
-import org.apache.ivy.core.resolve.ResolveData;
-import org.apache.ivy.core.resolve.ResolveEngine;
-import org.apache.ivy.core.resolve.ResolveOptions;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.core.sort.SortEngine;
-import org.apache.ivy.util.Message;
-import org.apache.ivy.util.MockMessageLogger;
-
-public class WarnCircularDependencyStrategyTest extends TestCase {
- private CircularDependencyStrategy strategy;
- private MockMessageLogger mockMessageImpl;
-
- protected void setUp() throws Exception {
- strategy = WarnCircularDependencyStrategy.getInstance();
-
- resetLogger();
- }
-
- private void resetLogger() {
- mockMessageImpl = new MockMessageLogger();
- Message.setDefaultLogger(mockMessageImpl);
- }
-
- public void testLog() throws Exception {
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
-
- mockMessageImpl.assertLogWarningContains("circular dependency found: #A;1.0->#B;1.0");
- }
-
- public void testRemoveDuplicates() throws Exception {
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
-
- // should only log the circular dependency once
- assertEquals(1, mockMessageImpl.getLogs().size());
- }
-
- public void testRemoveDuplicates2() throws Exception {
- setResolveContext("1");
- resetLogger();
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
-
- // should only log the circular dependency once
- assertEquals(1, mockMessageImpl.getLogs().size());
-
- setResolveContext("2");
- resetLogger();
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
- // should log the message
- assertEquals(1, mockMessageImpl.getLogs().size());
-
- strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
-
- // should not log the message again
- assertEquals(1, mockMessageImpl.getLogs().size());
- }
-
- private void setResolveContext(String resolveId) {
- IvySettings settings = new IvySettings();
- IvyContext.getContext().setResolveData(
- new ResolveData(
- new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
- new ResolveOptions().setResolveId(resolveId)));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.circular;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.IvyContext;
+import org.apache.ivy.core.event.EventManager;
+import org.apache.ivy.core.resolve.ResolveData;
+import org.apache.ivy.core.resolve.ResolveEngine;
+import org.apache.ivy.core.resolve.ResolveOptions;
+import org.apache.ivy.core.settings.IvySettings;
+import org.apache.ivy.core.sort.SortEngine;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.MockMessageLogger;
+
+public class WarnCircularDependencyStrategyTest extends TestCase {
+ private CircularDependencyStrategy strategy;
+ private MockMessageLogger mockMessageImpl;
+
+ protected void setUp() throws Exception {
+ strategy = WarnCircularDependencyStrategy.getInstance();
+
+ resetLogger();
+ }
+
+ private void resetLogger() {
+ mockMessageImpl = new MockMessageLogger();
+ Message.setDefaultLogger(mockMessageImpl);
+ }
+
+ public void testLog() throws Exception {
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.0, #B;1.0"));
+
+ mockMessageImpl.assertLogWarningContains("circular dependency found: #A;1.0->#B;1.0");
+ }
+
+ public void testRemoveDuplicates() throws Exception {
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+
+ // should only log the circular dependency once
+ assertEquals(1, mockMessageImpl.getLogs().size());
+ }
+
+ public void testRemoveDuplicates2() throws Exception {
+ setResolveContext("1");
+ resetLogger();
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+
+ // should only log the circular dependency once
+ assertEquals(1, mockMessageImpl.getLogs().size());
+
+ setResolveContext("2");
+ resetLogger();
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+ // should log the message
+ assertEquals(1, mockMessageImpl.getLogs().size());
+
+ strategy.handleCircularDependency(TestHelper.parseMridsToArray("#A;1.1, #B;1.0"));
+
+ // should not log the message again
+ assertEquals(1, mockMessageImpl.getLogs().size());
+ }
+
+ private void setResolveContext(String resolveId) {
+ IvySettings settings = new IvySettings();
+ IvyContext.getContext().setResolveData(
+ new ResolveData(
+ new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
+ new ResolveOptions().setResolveId(resolveId)));
+ }
+}
diff --git a/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java b/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
index e63b0fea..5b9688a6 100644
--- a/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
+++ b/test/java/org/apache/ivy/plugins/conflict/LatestCompatibleConflictManagerTest.java
@@ -1,188 +1,188 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.conflict;
-
-import java.io.IOException;
-import java.text.ParseException;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.Ivy;
-import org.apache.ivy.TestFixture;
-import org.apache.ivy.TestHelper;
-import org.apache.ivy.core.report.ConfigurationResolveReport;
-import org.apache.ivy.core.report.ResolveReport;
-
-public class LatestCompatibleConflictManagerTest extends TestCase {
- private TestFixture fixture;
-
- protected void setUp() throws Exception {
- fixture = new TestFixture();
- LatestCompatibleConflictManager cm = new LatestCompatibleConflictManager();
- fixture.getSettings().addConfigured(cm);
- fixture.getSettings().setDefaultConflictManager(cm);
- }
-
- protected void tearDown() throws Exception {
- fixture.clean();
- }
-
- public void testInitFromSettings() throws Exception {
- Ivy ivy = new Ivy();
- ivy.configure(LatestCompatibleConflictManagerTest
- .class.getResource("ivysettings-latest-compatible.xml"));
- ConflictManager cm = ivy.getSettings().getDefaultConflictManager();
- assertTrue(cm instanceof LatestCompatibleConflictManager);
- }
-
- public void testCompatibilityResolve1() throws Exception {
- fixture
- .addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }")
- .addMD("#B;1.4->#D;1.5")
- .addMD("#C;2.5->#D;[1.0,1.6]")
- .addMD("#D;1.5").addMD("#D;1.6")
- .init();
- resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
- }
-
- public void testCompatibilityResolve2() throws Exception {
- fixture
- .addMD("#A;2-> { #B;[1.0,1.5] #C;[2.0,2.5] }")
- .addMD("#B;1.4->#D;1.5")
- .addMD("#B;1.5->#D;2.0")
- .addMD("#C;2.5->#D;[1.0,1.6]")
- .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
- .init();
- resolveAndAssert("#A;2", "#B;1.4, #C;2.5, #D;1.5");
- }
-
- public void testCompatibilityResolve3() throws Exception {
- fixture
- .addMD("#A;3-> { #B;[2.0,2.5] #C;[3.0,3.5] }")
- .addMD("#B;2.3-> { #D;1.5 #E;1.0 }")
- .addMD("#B;2.4-> { #D;1.5 #E;2.0 }")
- .addMD("#B;2.5-> { #D;2.0 }")
- .addMD("#C;3.4-> { #D;[1.0,1.6] #E;1.0 }")
- .addMD("#C;3.5-> { #D;[1.0,1.6] #E;1.9 }")
- .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
- .addMD("#E;1.0").addMD("#E;1.9").addMD("#E;2.0")
- .init();
- resolveAndAssert("#A;3", "#B;2.3, #C;3.4, #D;1.5, #E;1.0");
- }
-
- public void testCompatibilityResolve4() throws Exception {
- fixture
- .addMD("#A;4-> { #B;[1.0,1.5] #C;[2.0,2.5] #F;[1.0,1.1] }")
- .addMD("#B;1.4->#D;1.5")
- .addMD("#B;1.5->#D;2.0")
- .addMD("#C;2.5->#D;[1.0,1.6]")
- .addMD("#F;1.0->#D;1.5")
- .addMD("#F;1.1->#D;1.6")
- .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
- .init();
- resolveAndAssert("#A;4", "#B;1.4, #C;2.5, #D;1.5, #F;1.0");
- }
-
- public void testCompatibilityResolve5() throws Exception {
- fixture
- .addMD("#A;5->{ #B;[1.0,1.5] #C;2.6 }")
- .addMD("#B;1.3->{ }")
- .addMD("#B;1.4->#D;1.5")
- .addMD("#B;1.5->#D;2.0")
- .addMD("#C;2.6->#D;1.6")
- .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
- .init();
- resolveAndAssert("#A;5", "#B;1.3, #C;2.6, #D;1.6");
- }
-
- public void testCompatibilityResolve6() throws Exception {
- fixture
- .addMD("#A;1-> { #C;[2.0,2.5] #B;1.4 }")
- .addMD("#B;1.4->#D;1.5")
- .addMD("#C;2.5->#D;[1.0,1.6]")
- .addMD("#D;1.5").addMD("#D;1.6")
- .init();
- resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
- }
-
- public void testCompatibilityResolveCircularDependency1() throws Exception {
- fixture
- .addMD("#A;6->{ #B;[3.0,3.5] #C;4.6 }")
- .addMD("#B;3.4->#D;2.5")
- .addMD("#B;3.5->#D;3.0")
- .addMD("#C;4.6->#D;2.5")
- .addMD("#D;3.0->#B;3.5") // circular dependency
- .addMD("#D;2.5->#B;3.4") // circular dependency
- .init();
- resolveAndAssert("#A;6", "#B;3.4, #C;4.6, #D;2.5");
- }
-
- public void testCompatibilityResolveCircularDependency2() throws Exception {
- fixture
- .addMD("#A;1->#C;2")
- .addMD("#C;1->#B;1")
- .addMD("#C;2->#B;2")
- .addMD("#C;3->#B;3")
- .addMD("#B;1->#C;latest.integration") // circular dependency
- .addMD("#B;2->#C;latest.integration") // circular dependency
- .addMD("#B;3->#C;latest.integration") // circular dependency
- .init();
- resolveAndAssert("#A;1", "#B;2, #C;2");
- }
-
- public void testCompatibilityResolveCircularDependency3() throws Exception {
- // same as 2, but A depends on B
- fixture
- .addMD("#A;1->#B;2")
- .addMD("#C;1->#B;1")
- .addMD("#C;2->#B;2")
- .addMD("#C;3->#B;3")
- .addMD("#B;1->#C;latest.integration") // circular dependency
- .addMD("#B;2->#C;latest.integration") // circular dependency
- .addMD("#B;3->#C;latest.integration") // circular dependency
- .init();
- resolveAndAssert("#A;1", "#B;2, #C;2");
- }
-
-
- public void testConflict() throws Exception {
- try {
- fixture
- .addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }")
- .addMD("#B;1.5->#D;2.0")
- .addMD("#B;1.6->#D;2.0")
- .addMD("#C;2.5->#D;[1.0,1.6]")
- .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
- .init();
- fixture.resolve("#A;conflict");
-
- fail("Resolve should have failed with a conflict");
- } catch (StrictConflictException e) {
- // this is expected
- }
- }
-
- private void resolveAndAssert(String mrid, String expectedModuleSet)
- throws ParseException, IOException {
- ResolveReport report = fixture.resolve(mrid);
- assertFalse(report.hasError());
- ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
- TestHelper.assertModuleRevisionIds(expectedModuleSet,
- defaultReport.getModuleRevisionIds());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.conflict;
+
+import java.io.IOException;
+import java.text.ParseException;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.Ivy;
+import org.apache.ivy.TestFixture;
+import org.apache.ivy.TestHelper;
+import org.apache.ivy.core.report.ConfigurationResolveReport;
+import org.apache.ivy.core.report.ResolveReport;
+
+public class LatestCompatibleConflictManagerTest extends TestCase {
+ private TestFixture fixture;
+
+ protected void setUp() throws Exception {
+ fixture = new TestFixture();
+ LatestCompatibleConflictManager cm = new LatestCompatibleConflictManager();
+ fixture.getSettings().addConfigured(cm);
+ fixture.getSettings().setDefaultConflictManager(cm);
+ }
+
+ protected void tearDown() throws Exception {
+ fixture.clean();
+ }
+
+ public void testInitFromSettings() throws Exception {
+ Ivy ivy = new Ivy();
+ ivy.configure(LatestCompatibleConflictManagerTest
+ .class.getResource("ivysettings-latest-compatible.xml"));
+ ConflictManager cm = ivy.getSettings().getDefaultConflictManager();
+ assertTrue(cm instanceof LatestCompatibleConflictManager);
+ }
+
+ public void testCompatibilityResolve1() throws Exception {
+ fixture
+ .addMD("#A;1-> { #B;1.4 #C;[2.0,2.5] }")
+ .addMD("#B;1.4->#D;1.5")
+ .addMD("#C;2.5->#D;[1.0,1.6]")
+ .addMD("#D;1.5").addMD("#D;1.6")
+ .init();
+ resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
+ }
+
+ public void testCompatibilityResolve2() throws Exception {
+ fixture
+ .addMD("#A;2-> { #B;[1.0,1.5] #C;[2.0,2.5] }")
+ .addMD("#B;1.4->#D;1.5")
+ .addMD("#B;1.5->#D;2.0")
+ .addMD("#C;2.5->#D;[1.0,1.6]")
+ .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
+ .init();
+ resolveAndAssert("#A;2", "#B;1.4, #C;2.5, #D;1.5");
+ }
+
+ public void testCompatibilityResolve3() throws Exception {
+ fixture
+ .addMD("#A;3-> { #B;[2.0,2.5] #C;[3.0,3.5] }")
+ .addMD("#B;2.3-> { #D;1.5 #E;1.0 }")
+ .addMD("#B;2.4-> { #D;1.5 #E;2.0 }")
+ .addMD("#B;2.5-> { #D;2.0 }")
+ .addMD("#C;3.4-> { #D;[1.0,1.6] #E;1.0 }")
+ .addMD("#C;3.5-> { #D;[1.0,1.6] #E;1.9 }")
+ .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
+ .addMD("#E;1.0").addMD("#E;1.9").addMD("#E;2.0")
+ .init();
+ resolveAndAssert("#A;3", "#B;2.3, #C;3.4, #D;1.5, #E;1.0");
+ }
+
+ public void testCompatibilityResolve4() throws Exception {
+ fixture
+ .addMD("#A;4-> { #B;[1.0,1.5] #C;[2.0,2.5] #F;[1.0,1.1] }")
+ .addMD("#B;1.4->#D;1.5")
+ .addMD("#B;1.5->#D;2.0")
+ .addMD("#C;2.5->#D;[1.0,1.6]")
+ .addMD("#F;1.0->#D;1.5")
+ .addMD("#F;1.1->#D;1.6")
+ .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
+ .init();
+ resolveAndAssert("#A;4", "#B;1.4, #C;2.5, #D;1.5, #F;1.0");
+ }
+
+ public void testCompatibilityResolve5() throws Exception {
+ fixture
+ .addMD("#A;5->{ #B;[1.0,1.5] #C;2.6 }")
+ .addMD("#B;1.3->{ }")
+ .addMD("#B;1.4->#D;1.5")
+ .addMD("#B;1.5->#D;2.0")
+ .addMD("#C;2.6->#D;1.6")
+ .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
+ .init();
+ resolveAndAssert("#A;5", "#B;1.3, #C;2.6, #D;1.6");
+ }
+
+ public void testCompatibilityResolve6() throws Exception {
+ fixture
+ .addMD("#A;1-> { #C;[2.0,2.5] #B;1.4 }")
+ .addMD("#B;1.4->#D;1.5")
+ .addMD("#C;2.5->#D;[1.0,1.6]")
+ .addMD("#D;1.5").addMD("#D;1.6")
+ .init();
+ resolveAndAssert("#A;1", "#B;1.4, #C;2.5, #D;1.5");
+ }
+
+ public void testCompatibilityResolveCircularDependency1() throws Exception {
+ fixture
+ .addMD("#A;6->{ #B;[3.0,3.5] #C;4.6 }")
+ .addMD("#B;3.4->#D;2.5")
+ .addMD("#B;3.5->#D;3.0")
+ .addMD("#C;4.6->#D;2.5")
+ .addMD("#D;3.0->#B;3.5") // circular dependency
+ .addMD("#D;2.5->#B;3.4") // circular dependency
+ .init();
+ resolveAndAssert("#A;6", "#B;3.4, #C;4.6, #D;2.5");
+ }
+
+ public void testCompatibilityResolveCircularDependency2() throws Exception {
+ fixture
+ .addMD("#A;1->#C;2")
+ .addMD("#C;1->#B;1")
+ .addMD("#C;2->#B;2")
+ .addMD("#C;3->#B;3")
+ .addMD("#B;1->#C;latest.integration") // circular dependency
+ .addMD("#B;2->#C;latest.integration") // circular dependency
+ .addMD("#B;3->#C;latest.integration") // circular dependency
+ .init();
+ resolveAndAssert("#A;1", "#B;2, #C;2");
+ }
+
+ public void testCompatibilityResolveCircularDependency3() throws Exception {
+ // same as 2, but A depends on B
+ fixture
+ .addMD("#A;1->#B;2")
+ .addMD("#C;1->#B;1")
+ .addMD("#C;2->#B;2")
+ .addMD("#C;3->#B;3")
+ .addMD("#B;1->#C;latest.integration") // circular dependency
+ .addMD("#B;2->#C;latest.integration") // circular dependency
+ .addMD("#B;3->#C;latest.integration") // circular dependency
+ .init();
+ resolveAndAssert("#A;1", "#B;2, #C;2");
+ }
+
+
+ public void testConflict() throws Exception {
+ try {
+ fixture
+ .addMD("#A;conflict-> { #B;[1.5,1.6] #C;2.5 }")
+ .addMD("#B;1.5->#D;2.0")
+ .addMD("#B;1.6->#D;2.0")
+ .addMD("#C;2.5->#D;[1.0,1.6]")
+ .addMD("#D;1.5").addMD("#D;1.6").addMD("#D;2.0")
+ .init();
+ fixture.resolve("#A;conflict");
+
+ fail("Resolve should have failed with a conflict");
+ } catch (StrictConflictException e) {
+ // this is expected
+ }
+ }
+
+ private void resolveAndAssert(String mrid, String expectedModuleSet)
+ throws ParseException, IOException {
+ ResolveReport report = fixture.resolve(mrid);
+ assertFalse(report.hasError());
+ ConfigurationResolveReport defaultReport = report.getConfigurationReport("default");
+ TestHelper.assertModuleRevisionIds(expectedModuleSet,
+ defaultReport.getModuleRevisionIds());
+ }
+}
diff --git a/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml b/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml
index d8355e1e..6f72f7b6 100644
--- a/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml
+++ b/test/java/org/apache/ivy/plugins/conflict/ivy-conflict-dynamic.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml b/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml
index c05541eb..1f0e2ca1 100644
--- a/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml
+++ b/test/java/org/apache/ivy/plugins/conflict/ivy-noconflict-dynamic.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/conflict/ivysettings-latest-compatible.xml b/test/java/org/apache/ivy/plugins/conflict/ivysettings-latest-compatible.xml
index 355736a3..5ffd8187 100644
--- a/test/java/org/apache/ivy/plugins/conflict/ivysettings-latest-compatible.xml
+++ b/test/java/org/apache/ivy/plugins/conflict/ivysettings-latest-compatible.xml
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java b/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
index 1cce64a5..5b01c6e1 100644
--- a/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
+++ b/test/java/org/apache/ivy/plugins/lock/ArtifactLockStrategyTest.java
@@ -1,193 +1,193 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.lock;
-
-import java.io.File;
-import java.text.ParseException;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.core.cache.DefaultRepositoryCacheManager;
-import org.apache.ivy.core.cache.RepositoryCacheManager;
-import org.apache.ivy.core.event.EventManager;
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.resolve.ResolveData;
-import org.apache.ivy.core.resolve.ResolveEngine;
-import org.apache.ivy.core.resolve.ResolveOptions;
-import org.apache.ivy.core.resolve.ResolvedModuleRevision;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.core.sort.SortEngine;
-import org.apache.ivy.plugins.repository.RepositoryCopyProgressListener;
-import org.apache.ivy.plugins.repository.file.FileRepository;
-import org.apache.ivy.plugins.resolver.FileSystemResolver;
-import org.apache.ivy.util.CopyProgressEvent;
-import org.apache.ivy.util.FileUtil;
-import org.apache.ivy.util.Message;
-
-public class ArtifactLockStrategyTest extends TestCase {
- protected void setUp() throws Exception {
- FileUtil.forceDelete(new File("build/test/cache"));
- }
- protected void tearDown() throws Exception {
- FileUtil.forceDelete(new File("build/test/cache"));
- }
-
- public void testConcurrentResolve() throws Exception {
- // we use different settings because Ivy do not support multi thread resolve with the same
- // settings yet and this is not what this test is about: the focus of this test is running
- // concurrent resolves in separate vms but using the same cache. We don't span the test on
- // multiple vms, but using separate settings we should only run into shared cache related
- // issues, and not multi thread related issues.
- IvySettings settings1 = new IvySettings();
- IvySettings settings2 = new IvySettings();
- IvySettings settings3 = new IvySettings();
-
- // run 3 concurrent resolves, one taking 100ms to download files, one 20ms and one 5ms
- // the first one do 10 resolves, the second one 20 and the third 50
- // note that the download time is useful only at the very beginning, then the cached file is used
- ResolveThread t1 = asyncResolve(
- settings1, createSlowResolver(settings1, 100), "org6#mod6.4;3", 10);
- ResolveThread t2 = asyncResolve(
- settings2, createSlowResolver(settings2, 20), "org6#mod6.4;3", 20);
- ResolveThread t3 = asyncResolve(
- settings3, createSlowResolver(settings3, 5), "org6#mod6.4;3", 50);
- t1.join(100000);
- t2.join(20000);
- t3.join(20000);
- assertEquals(10, t1.getCount());
- assertFound("org6#mod6.4;3", t1.getFinalResult());
- assertEquals(20, t2.getCount());
- assertFound("org6#mod6.4;3", t2.getFinalResult());
- assertEquals(50, t3.getCount());
- assertFound("org6#mod6.4;3", t3.getFinalResult());
- }
-
-
- private RepositoryCacheManager newCacheManager(IvySettings settings) {
- DefaultRepositoryCacheManager cacheManager
- = new DefaultRepositoryCacheManager("cache", settings, new File("build/test/cache"));
- cacheManager.setLockStrategy(new ArtifactLockStrategy());
- return cacheManager;
- }
-
-
- private FileSystemResolver createSlowResolver(IvySettings settings, final int sleep) {
- FileSystemResolver resolver = new FileSystemResolver();
- resolver.setRepositoryCacheManager(newCacheManager(settings));
- resolver.setRepository(new FileRepository() {
- private RepositoryCopyProgressListener progress = new RepositoryCopyProgressListener(this) {
- public void progress(CopyProgressEvent evt) {
- super.progress(evt);
- sleepSilently(sleep); // makes the file copy longer to test concurrency issues
- }
- };
- protected RepositoryCopyProgressListener getProgressListener() {
- return progress ;
- }
- });
- resolver.setName("test");
- resolver.setSettings(settings);
- resolver.addIvyPattern(
- settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
- resolver.addArtifactPattern(
- settings.getBaseDir() + "/test/repositories/1/[organisation]/[module]/[type]s/[artifact]-[revision].[ext]");
- return resolver;
- }
-
-
- private ResolveThread asyncResolve(
- IvySettings settings, FileSystemResolver resolver, String module, int loop) {
- ResolveThread thread = new ResolveThread(settings, resolver, module, loop);
- thread.start();
- return thread;
- }
-
-
- private void assertFound(String module, ResolvedModuleRevision rmr) {
- assertNotNull(rmr);
- assertEquals(module, rmr.getId().toString());
- }
- private ResolvedModuleRevision resolveModule(
- IvySettings settings, FileSystemResolver resolver, String module)
- throws ParseException {
- return resolver.getDependency(
- new DefaultDependencyDescriptor(ModuleRevisionId.parse(module), false),
- new ResolveData(
- new ResolveEngine(settings, new EventManager(), new SortEngine(settings)),
- new ResolveOptions()));
- }
- private void sleepSilently(int timeout) {
- try {
- Thread.sleep(timeout);
- } catch (InterruptedException e) {
- }
- }
- private class ResolveThread extends Thread {
- private IvySettings settings;
- private FileSystemResolver resolver;
- private String module;
- private final int loop;
-
- private ResolvedModuleRevision finalResult;
- private int count;
-
- public ResolveThread(IvySettings settings, FileSystemResolver resolver, String module, int loop) {
- this.settings = settings;
- this.resolver = resolver;
- this.module = module;
- this.loop = loop;
- }
-
- public synchronized ResolvedModuleRevision getFinalResult() {
- return finalResult;
- }
- public synchronized int getCount() {
- return count;
- }
- public void run() {
- ResolvedModuleRevision rmr = null;
- for (int i =0; i
-
-
-
- 4.0.0
- org.apache
- test
- jar
- 1.0
- http://ant.apache.org/ivy
-
-
- commons-logging
- commons-logging
- 1.0.4
- compile
-
-
- cglib
- cglib
- 2.0.2
- compile
-
-
-
+
+
+
+
+ 4.0.0
+ org.apache
+ test
+ jar
+ 1.0
+ http://ant.apache.org/ivy
+
+
+ commons-logging
+ commons-logging
+ 1.0.4
+ compile
+
+
+ cglib
+ cglib
+ 2.0.2
+ compile
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml b/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml
index 9f3ba8ed..b1ef8ff6 100644
--- a/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml
+++ b/test/java/org/apache/ivy/plugins/parser/m2/test-write-packaging.xml
@@ -1,29 +1,29 @@
-
-
-
-
- 4.0.0
- org.apache
- test
- war
- 1.0
- http://ivy.jayasoft.org/
-
+
+
+
+
+ 4.0.0
+ org.apache
+ test
+ war
+ 1.0
+ http://ivy.jayasoft.org/
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
index d02f9c40..f7ec2a03 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-defaultconf-withdefaultconfmapping.xml
@@ -1,35 +1,35 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-all.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-all.xml
index f9f26ec0..c8b48f7b 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-all.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-all.xml
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-cached.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-cached.xml
index 0e430558..5da3f587 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-cached.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-cached.xml
@@ -1,32 +1,32 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-configurations.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-configurations.xml
index 900d1846..f747bbb4 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-configurations.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-configurations.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-dependencies.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-dependencies.xml
index 3340c730..9c4479fb 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-dependencies.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-dependencies.xml
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description-override.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description-override.xml
index 4c176e05..3ec5c582 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description-override.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description-override.xml
@@ -1,31 +1,31 @@
-
-
-
-
- Child description overrides parent.
-
-
-
-
-
+
+
+
+
+ Child description overrides parent.
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description.xml
index 37a77bb2..41382085 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-description.xml
@@ -1,30 +1,30 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-mixed.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-mixed.xml
index b0e6df6c..84407ac9 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-mixed.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-mixed.xml
@@ -1,33 +1,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-parent.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-parent.xml
index 4e22f6e7..c493fdac 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-extends-parent.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-extends-parent.xml
@@ -1,34 +1,34 @@
-
-
-
- Parent module description.
-
-
-
-
-
-
-
-
-
+
+
+
+ Parent module description.
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-info.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-info.xml
index a7f00165..960fa4c0 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-info.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-info.xml
@@ -1,27 +1,27 @@
-
-
-
-
-
- My module description.
-
-
-
+
+
+
+
+
+ My module description.
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-update-withvar.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-update-withvar.xml
index 0ae85c7b..d723dfb5 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-update-withvar.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-update-withvar.xml
@@ -1,110 +1,110 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This module is great !
- You can use it especially with myconf1 & myconf2, and myconf4 is not too bad too.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This module is great !
+ You can use it especially with myconf1 & myconf2, and myconf4 is not too bad too.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml
index 8727d0ac..c6632525 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-with-comments.xml
@@ -1,38 +1,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-write-extends.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-write-extends.xml
index 95b5c993..06fd20c3 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-write-extends.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-write-extends.xml
@@ -1,44 +1,44 @@
-
-
-
-
-
-
- Parent module description.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ Parent module description.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/parser/xml/test-write-info.xml b/test/java/org/apache/ivy/plugins/parser/xml/test-write-info.xml
index b271f563..476aae81 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/test-write-info.xml
+++ b/test/java/org/apache/ivy/plugins/parser/xml/test-write-info.xml
@@ -1,38 +1,38 @@
-
-
-
-
-
-
- My module description.
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ My module description.
+
+
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/report/ivy-635.xml b/test/java/org/apache/ivy/plugins/report/ivy-635.xml
index 2d30687c..daf90608 100644
--- a/test/java/org/apache/ivy/plugins/report/ivy-635.xml
+++ b/test/java/org/apache/ivy/plugins/report/ivy-635.xml
@@ -1,25 +1,25 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java b/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java
index ba6ef1bf..b67d5deb 100644
--- a/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java
+++ b/test/java/org/apache/ivy/plugins/resolver/util/ResolverHelperTest.java
@@ -1,41 +1,41 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.resolver.util;
-
-import java.io.File;
-import java.util.Arrays;
-
-import org.apache.ivy.plugins.repository.file.FileRepository;
-
-import junit.framework.TestCase;
-
-public class ResolverHelperTest extends TestCase {
-
- public void testListTokenValuesForIvy1238() {
- FileRepository rep = new FileRepository(new File(".").getAbsoluteFile());
- String[] revisions = ResolverHelper.listTokenValues(rep, "test/repositories/IVY-1238/ivy-org/modA/v[revision]/ivy.xml", "revision");
-
- assertNotNull(revisions);
- assertEquals(2, revisions.length);
-
- Arrays.sort(revisions);
- assertEquals("1.0", revisions[0]);
- assertEquals("2.0", revisions[1]);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.resolver.util;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.apache.ivy.plugins.repository.file.FileRepository;
+
+import junit.framework.TestCase;
+
+public class ResolverHelperTest extends TestCase {
+
+ public void testListTokenValuesForIvy1238() {
+ FileRepository rep = new FileRepository(new File(".").getAbsoluteFile());
+ String[] revisions = ResolverHelper.listTokenValues(rep, "test/repositories/IVY-1238/ivy-org/modA/v[revision]/ivy.xml", "revision");
+
+ assertNotNull(revisions);
+ assertEquals(2, revisions.length);
+
+ Arrays.sort(revisions);
+ assertEquals("1.0", revisions[0]);
+ assertEquals("2.0", revisions[1]);
+ }
+
+}
diff --git a/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java b/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java
index 8a5114be..dd77eca4 100644
--- a/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java
+++ b/test/java/org/apache/ivy/plugins/trigger/LogTriggerTest.java
@@ -1,91 +1,91 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.trigger;
-
-import java.io.File;
-import java.util.Date;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.core.event.resolve.StartResolveEvent;
-import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.util.FileUtil;
-import org.apache.ivy.util.Message;
-import org.apache.ivy.util.MockMessageLogger;
-
-public class LogTriggerTest extends TestCase {
- private static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
- private StartResolveEvent ev;
- private LogTrigger trigger;
- private File testDir;
-
- protected void setUp() {
- ev = new StartResolveEvent(
- DefaultModuleDescriptor.newBasicInstance(ModuleRevisionId.parse("o#A;1"), new Date()),
- new String[] {"c"});
- trigger = new LogTrigger();
- trigger.setEvent(ev.getName());
- testDir = new File("build/test/trigger");
- testDir.mkdirs();
- }
-
- protected void tearDown() throws Exception {
- FileUtil.forceDelete(testDir);
- }
-
- public void testMessage() throws Exception {
- trigger.setMessage("msg: ${organisation} ${module} ${revision}");
-
- MockMessageLogger mockLogger = new MockMessageLogger();
- Message.setDefaultLogger(mockLogger);
- trigger.progress(ev);
-
- mockLogger.assertLogInfoContains("msg: o A 1");
- }
-
- public void testFile() throws Exception {
- trigger.setMessage("msg: ${organisation} ${module} ${revision}");
- File f = new File(testDir, "test.log");
- trigger.setFile(f);
-
- trigger.progress(ev);
-
- assertTrue(f.exists());
- assertEquals("msg: o A 1" + LINE_SEPARATOR, FileUtil.readEntirely(f));
-
- trigger.progress(ev);
-
- assertEquals("msg: o A 1" + LINE_SEPARATOR + "msg: o A 1" + LINE_SEPARATOR,
- FileUtil.readEntirely(f));
- }
-
- public void testFileNoAppend() throws Exception {
- trigger.setMessage("msg: ${organisation} ${module} ${revision}");
- File f = new File(testDir, "test.log");
- trigger.setFile(f);
- trigger.setAppend(false);
-
- trigger.progress(ev);
- trigger.progress(ev);
-
- assertTrue(f.exists());
- assertEquals("msg: o A 1" + LINE_SEPARATOR, FileUtil.readEntirely(f));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.trigger;
+
+import java.io.File;
+import java.util.Date;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.core.event.resolve.StartResolveEvent;
+import org.apache.ivy.core.module.descriptor.DefaultModuleDescriptor;
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.util.FileUtil;
+import org.apache.ivy.util.Message;
+import org.apache.ivy.util.MockMessageLogger;
+
+public class LogTriggerTest extends TestCase {
+ private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+ private StartResolveEvent ev;
+ private LogTrigger trigger;
+ private File testDir;
+
+ protected void setUp() {
+ ev = new StartResolveEvent(
+ DefaultModuleDescriptor.newBasicInstance(ModuleRevisionId.parse("o#A;1"), new Date()),
+ new String[] {"c"});
+ trigger = new LogTrigger();
+ trigger.setEvent(ev.getName());
+ testDir = new File("build/test/trigger");
+ testDir.mkdirs();
+ }
+
+ protected void tearDown() throws Exception {
+ FileUtil.forceDelete(testDir);
+ }
+
+ public void testMessage() throws Exception {
+ trigger.setMessage("msg: ${organisation} ${module} ${revision}");
+
+ MockMessageLogger mockLogger = new MockMessageLogger();
+ Message.setDefaultLogger(mockLogger);
+ trigger.progress(ev);
+
+ mockLogger.assertLogInfoContains("msg: o A 1");
+ }
+
+ public void testFile() throws Exception {
+ trigger.setMessage("msg: ${organisation} ${module} ${revision}");
+ File f = new File(testDir, "test.log");
+ trigger.setFile(f);
+
+ trigger.progress(ev);
+
+ assertTrue(f.exists());
+ assertEquals("msg: o A 1" + LINE_SEPARATOR, FileUtil.readEntirely(f));
+
+ trigger.progress(ev);
+
+ assertEquals("msg: o A 1" + LINE_SEPARATOR + "msg: o A 1" + LINE_SEPARATOR,
+ FileUtil.readEntirely(f));
+ }
+
+ public void testFileNoAppend() throws Exception {
+ trigger.setMessage("msg: ${organisation} ${module} ${revision}");
+ File f = new File(testDir, "test.log");
+ trigger.setFile(f);
+ trigger.setAppend(false);
+
+ trigger.progress(ev);
+ trigger.progress(ev);
+
+ assertTrue(f.exists());
+ assertEquals("msg: o A 1" + LINE_SEPARATOR, FileUtil.readEntirely(f));
+ }
+}
diff --git a/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java b/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
index c044f223..2c43ad28 100644
--- a/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
+++ b/test/java/org/apache/ivy/plugins/version/LatestVersionMatcherTest.java
@@ -1,47 +1,47 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.version;
-
-import junit.framework.TestCase;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-import org.apache.ivy.core.module.status.Status;
-import org.apache.ivy.core.module.status.StatusManager;
-
-public class LatestVersionMatcherTest extends TestCase {
- private LatestVersionMatcher vm = new LatestVersionMatcher();
-
- public void testNeedModuleDescriptorStandardStatus() throws Exception {
- assertNeed("latest.release", true);
- assertNeed("latest.milestone", true);
- assertNeed("latest.integration", false);
- }
-
- public void testNeedModuleDescriptorCustomStatus() throws Exception {
- StatusManager.getCurrent().addStatus(new Status("release", false));
- StatusManager.getCurrent().addStatus(new Status("snapshot", true));
-
- assertNeed("latest.release", true);
- assertNeed("latest.snapshot", false);
- }
-
- // assertion helper methods
- private void assertNeed(String askedVersion, boolean b) {
- assertEquals(b, vm.needModuleDescriptor(ModuleRevisionId.newInstance("org", "name", askedVersion), null));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.version;
+
+import junit.framework.TestCase;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+import org.apache.ivy.core.module.status.Status;
+import org.apache.ivy.core.module.status.StatusManager;
+
+public class LatestVersionMatcherTest extends TestCase {
+ private LatestVersionMatcher vm = new LatestVersionMatcher();
+
+ public void testNeedModuleDescriptorStandardStatus() throws Exception {
+ assertNeed("latest.release", true);
+ assertNeed("latest.milestone", true);
+ assertNeed("latest.integration", false);
+ }
+
+ public void testNeedModuleDescriptorCustomStatus() throws Exception {
+ StatusManager.getCurrent().addStatus(new Status("release", false));
+ StatusManager.getCurrent().addStatus(new Status("snapshot", true));
+
+ assertNeed("latest.release", true);
+ assertNeed("latest.snapshot", false);
+ }
+
+ // assertion helper methods
+ private void assertNeed(String askedVersion, boolean b) {
+ assertEquals(b, vm.needModuleDescriptor(ModuleRevisionId.newInstance("org", "name", askedVersion), null));
+ }
+}
diff --git a/test/java/org/apache/ivy/plugins/version/PatternVersionMatcherTest.java b/test/java/org/apache/ivy/plugins/version/PatternVersionMatcherTest.java
index f88f274b..11f9de69 100644
--- a/test/java/org/apache/ivy/plugins/version/PatternVersionMatcherTest.java
+++ b/test/java/org/apache/ivy/plugins/version/PatternVersionMatcherTest.java
@@ -1,101 +1,101 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.plugins.version;
-
-import org.apache.ivy.core.module.id.ModuleRevisionId;
-
-import junit.framework.TestCase;
-
-public class PatternVersionMatcherTest extends TestCase {
- public void testSingleMatch() {
- PatternVersionMatcher pvm = new PatternVersionMatcher();
- pvm.addMatch(generateRegexpMatch1());
-
- assertAccept(pvm, "foo(1,3)", "1.4.1", false);
- assertAccept(pvm, "foo(1,3)", "1.3", false);
- assertAccept(pvm, "foo(1,3)", "2.3.1", false);
-
- assertAccept(pvm, "foo(1,3)", "1.3.1", true);
- }
-
- public void testMultipleMatchEqualRevisions() {
- PatternVersionMatcher pvm = new PatternVersionMatcher();
- pvm.addMatch(generateRegexpMatch1());
- pvm.addMatch(generateRegexpMatch2());
-
- assertAccept(pvm, "foo(1,3)", "1.3", true);
- assertAccept(pvm, "foo(1,3)", "1.3.1", true);
- }
-
- public void testMultipleMatchNonEqualRevisions() {
- PatternVersionMatcher pvm = new PatternVersionMatcher();
- pvm.addMatch(generateRegexpMatch1());
- pvm.addMatch(generateRegexpMatch3());
-
- assertAccept(pvm, "foo(1,3)", "1.3", false);
- assertAccept(pvm, "bar(1,3)", "1.3", true);
- assertAccept(pvm, "foo(1,3)", "1.3.1", true);
- }
-
- /**
- * Generates a Match instance that has the following xml representation:
- *
- * @return
- */
- private Match generateRegexpMatch1() {
- Match match = new Match();
- match.setRevision("foo");
- match.setPattern("${major}\\.${minor}\\.\\d+");
- match.setArgs("major, minor");
- match.setMatcher("regexp");
-
- return match;
- }
-
- /**
- * Generates a Match instance that has the following xml representation:
- *
- * @return
- */
- private Match generateRegexpMatch2() {
- Match match = new Match();
- match.setRevision("foo");
- match.setPattern("${major}\\.${minor}");
- match.setArgs("major, minor");
- match.setMatcher("regexp");
-
- return match;
- }
-
- private Match generateRegexpMatch3() {
- Match match = new Match();
- match.setRevision("bar");
- match.setPattern("${major}\\.${minor}");
- match.setArgs("major, minor");
- match.setMatcher("regexp");
-
- return match;
- }
-
-
- private void assertAccept(PatternVersionMatcher matcher, String askedVersion,
- String depVersion, boolean b) {
- assertEquals(b, matcher.accept(ModuleRevisionId.newInstance("org", "name", askedVersion),
- ModuleRevisionId.newInstance("org", "name", depVersion)));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.plugins.version;
+
+import org.apache.ivy.core.module.id.ModuleRevisionId;
+
+import junit.framework.TestCase;
+
+public class PatternVersionMatcherTest extends TestCase {
+ public void testSingleMatch() {
+ PatternVersionMatcher pvm = new PatternVersionMatcher();
+ pvm.addMatch(generateRegexpMatch1());
+
+ assertAccept(pvm, "foo(1,3)", "1.4.1", false);
+ assertAccept(pvm, "foo(1,3)", "1.3", false);
+ assertAccept(pvm, "foo(1,3)", "2.3.1", false);
+
+ assertAccept(pvm, "foo(1,3)", "1.3.1", true);
+ }
+
+ public void testMultipleMatchEqualRevisions() {
+ PatternVersionMatcher pvm = new PatternVersionMatcher();
+ pvm.addMatch(generateRegexpMatch1());
+ pvm.addMatch(generateRegexpMatch2());
+
+ assertAccept(pvm, "foo(1,3)", "1.3", true);
+ assertAccept(pvm, "foo(1,3)", "1.3.1", true);
+ }
+
+ public void testMultipleMatchNonEqualRevisions() {
+ PatternVersionMatcher pvm = new PatternVersionMatcher();
+ pvm.addMatch(generateRegexpMatch1());
+ pvm.addMatch(generateRegexpMatch3());
+
+ assertAccept(pvm, "foo(1,3)", "1.3", false);
+ assertAccept(pvm, "bar(1,3)", "1.3", true);
+ assertAccept(pvm, "foo(1,3)", "1.3.1", true);
+ }
+
+ /**
+ * Generates a Match instance that has the following xml representation:
+ *
+ * @return
+ */
+ private Match generateRegexpMatch1() {
+ Match match = new Match();
+ match.setRevision("foo");
+ match.setPattern("${major}\\.${minor}\\.\\d+");
+ match.setArgs("major, minor");
+ match.setMatcher("regexp");
+
+ return match;
+ }
+
+ /**
+ * Generates a Match instance that has the following xml representation:
+ *
+ * @return
+ */
+ private Match generateRegexpMatch2() {
+ Match match = new Match();
+ match.setRevision("foo");
+ match.setPattern("${major}\\.${minor}");
+ match.setArgs("major, minor");
+ match.setMatcher("regexp");
+
+ return match;
+ }
+
+ private Match generateRegexpMatch3() {
+ Match match = new Match();
+ match.setRevision("bar");
+ match.setPattern("${major}\\.${minor}");
+ match.setArgs("major, minor");
+ match.setMatcher("regexp");
+
+ return match;
+ }
+
+
+ private void assertAccept(PatternVersionMatcher matcher, String askedVersion,
+ String depVersion, boolean b) {
+ assertEquals(b, matcher.accept(ModuleRevisionId.newInstance("org", "name", askedVersion),
+ ModuleRevisionId.newInstance("org", "name", depVersion)));
+ }
+}
diff --git a/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java b/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
index 0f417255..8d0b0fc1 100644
--- a/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
+++ b/test/java/org/apache/ivy/util/url/AbstractURLHandlerTest.java
@@ -1,84 +1,84 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.util.url;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.apache.ivy.util.CopyProgressListener;
-
-import junit.framework.TestCase;
-
-public class AbstractURLHandlerTest extends TestCase {
-
- /**
- * JUnit test for IVY-923.
- */
- public void testNormalizeToStringWithSpaceURL() throws Exception {
- AbstractURLHandler handler = new TestURLHandler();
- String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/url with space/ivy-1.0.xml"));
- assertEquals("http://ant.apache.org/ivy/url%20with%20space/ivy-1.0.xml", normalizedUrl);
- }
-
- /**
- * JUnit test for IVY-923.
- */
- public void testNormalizeToStringWithPlusCharacter() throws Exception {
- AbstractURLHandler handler = new TestURLHandler();
- String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/ivy-1.+.xml"));
- assertEquals("http://ant.apache.org/ivy/ivy-1.%2B.xml", normalizedUrl);
- }
-
- public void testNormalizeToStringWithUnderscoreInHostname() throws Exception {
- AbstractURLHandler handler = new TestURLHandler();
- String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2repository"));
- assertEquals("http://peat_hal.users.sourceforge.net/m2repository", normalizedUrl);
- }
-
- public void testNormalizeToStringWithUnderscoreInHostnameAndSpaceInPath() throws Exception {
- AbstractURLHandler handler = new TestURLHandler();
- String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2 repository"));
- assertEquals("http://peat_hal.users.sourceforge.net/m2%20repository", normalizedUrl);
- }
-
- private static class TestURLHandler extends AbstractURLHandler {
-
- public void download(URL src, File dest, CopyProgressListener l) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- public URLInfo getURLInfo(URL url) {
- throw new UnsupportedOperationException();
- }
-
- public URLInfo getURLInfo(URL url, int timeout) {
- throw new UnsupportedOperationException();
- }
-
- public InputStream openStream(URL url) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- public void upload(File src, URL dest, CopyProgressListener l) throws IOException {
- throw new UnsupportedOperationException();
- }
-
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.util.url;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.apache.ivy.util.CopyProgressListener;
+
+import junit.framework.TestCase;
+
+public class AbstractURLHandlerTest extends TestCase {
+
+ /**
+ * JUnit test for IVY-923.
+ */
+ public void testNormalizeToStringWithSpaceURL() throws Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/url with space/ivy-1.0.xml"));
+ assertEquals("http://ant.apache.org/ivy/url%20with%20space/ivy-1.0.xml", normalizedUrl);
+ }
+
+ /**
+ * JUnit test for IVY-923.
+ */
+ public void testNormalizeToStringWithPlusCharacter() throws Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new URL("http://ant.apache.org/ivy/ivy-1.+.xml"));
+ assertEquals("http://ant.apache.org/ivy/ivy-1.%2B.xml", normalizedUrl);
+ }
+
+ public void testNormalizeToStringWithUnderscoreInHostname() throws Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2repository"));
+ assertEquals("http://peat_hal.users.sourceforge.net/m2repository", normalizedUrl);
+ }
+
+ public void testNormalizeToStringWithUnderscoreInHostnameAndSpaceInPath() throws Exception {
+ AbstractURLHandler handler = new TestURLHandler();
+ String normalizedUrl = handler.normalizeToString(new URL("http://peat_hal.users.sourceforge.net/m2 repository"));
+ assertEquals("http://peat_hal.users.sourceforge.net/m2%20repository", normalizedUrl);
+ }
+
+ private static class TestURLHandler extends AbstractURLHandler {
+
+ public void download(URL src, File dest, CopyProgressListener l) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ public URLInfo getURLInfo(URL url) {
+ throw new UnsupportedOperationException();
+ }
+
+ public URLInfo getURLInfo(URL url, int timeout) {
+ throw new UnsupportedOperationException();
+ }
+
+ public InputStream openStream(URL url) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ public void upload(File src, URL dest, CopyProgressListener l) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+
+ }
+}
diff --git a/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java b/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
index 625fe9f5..17b79b37 100644
--- a/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
+++ b/test/java/org/apache/ivy/util/url/ArtifactoryListingTest.java
@@ -1,35 +1,35 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.ivy.util.url;
-
-import java.net.URL;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-public class ArtifactoryListingTest extends TestCase {
- // remote.test
-
- public void testWicketListing() throws Exception {
- ApacheURLLister lister = new ApacheURLLister();
-
- List content = lister.listAll(new URL("http://repo.jfrog.org/artifactory/libs-releases-local/org/apache/wicket/wicket/"));
- assertNotNull(content);
- assertEquals(2, content.size());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.ivy.util.url;
+
+import java.net.URL;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+public class ArtifactoryListingTest extends TestCase {
+ // remote.test
+
+ public void testWicketListing() throws Exception {
+ ApacheURLLister lister = new ApacheURLLister();
+
+ List content = lister.listAll(new URL("http://repo.jfrog.org/artifactory/libs-releases-local/org/apache/wicket/wicket/"));
+ assertNotNull(content);
+ assertEquals(2, content.size());
+ }
+}
diff --git a/test/java/org/apache/ivy/util/url/artifactory-dir-listing.html b/test/java/org/apache/ivy/util/url/artifactory-dir-listing.html
index 88ce936a..1ca44364 100644
--- a/test/java/org/apache/ivy/util/url/artifactory-dir-listing.html
+++ b/test/java/org/apache/ivy/util/url/artifactory-dir-listing.html
@@ -1,428 +1,428 @@
-
-
-
-
-
-
-
-
-
-Artifactory@EV001A4B5729CA :: Repository Browser
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-