From f24cdcbd1396f9b40ef9de8897b0b2fa7c714c32 Mon Sep 17 00:00:00 2001 From: Brett Porter Date: Wed, 9 Apr 2008 15:31:57 +0000 Subject: [PATCH] remove unnecessary component definitions git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@646403 13f79535-47bb-0310-9956-ffa450edef68 --- .../archiva/configuration/FileTypes.java | 22 ++- .../ProjectModelToDatabaseConsumer.java | 22 +-- .../dependency/DependencyGraphFactory.java | 2 - .../graph/tasks/FlagCyclicEdgesTask.java | 5 - .../graph/tasks/FlagExcludedEdgesTask.java | 5 - .../PopulateDependencyManagementTask.java | 5 - .../graph/tasks/PopulateGraphMasterTask.java | 5 - .../graph/tasks/ReduceEnabledEdgesTask.java | 5 - .../graph/tasks/ReduceScopeTask.java | 5 - .../tasks/ReduceTransitiveEdgesTask.java | 5 - .../graph/tasks/RefineConflictsTask.java | 5 - .../graph/tasks/ResolveGraphTask.java | 5 - .../graph/tasks/UpdateScopesTask.java | 5 - .../functors/IndexExistsPredicate.java | 4 - .../AbstractDefaultRepositoryContent.java | 5 +- .../repository/content/DefaultPathParser.java | 2 - .../repository/content/LegacyPathParser.java | 1 + .../ManagedDefaultRepositoryContent.java | 2 + .../ManagedLegacyRepositoryContent.java | 2 + .../RemoteLegacyRepositoryContent.java | 2 + .../repository/content/RepositoryRequest.java | 17 +- .../project/ProjectModelResolverFactory.java | 22 +-- .../readers/ProjectModel300Reader.java | 4 - .../readers/ProjectModel400Reader.java | 4 - .../resolvers/ProjectModelResolverStack.java | 2 - .../writers/ProjectModel400Writer.java | 4 - .../writers/ProjectModel400WriterTest.java | 2 +- .../database/jdo/JdoProjectModelDAOTest.java | 3 +- .../maven/archiva/security/ArchivaUser.java | 36 ---- .../archiva/web/action/BrowseAction.java | 15 +- .../archiva/web/action/SearchAction.java | 17 +- .../web/action/ShowArtifactAction.java | 15 +- .../archiva/web/action/UploadAction.java | 35 ++-- .../web/repository/ProxiedDavServer.java | 32 ++-- .../archiva/web/startup/ArchivaStartup.java | 2 +- .../maven/archiva/web/startup/Banner.java | 4 - .../archiva/web/tags/CopyPasteSnippet.java | 157 ------------------ .../archiva/web/tags/CopyPasteSnippetTag.java | 126 ++++++++++++-- .../archiva/web/util/ArchivaXworkUser.java | 17 +- 39 files changed, 207 insertions(+), 421 deletions(-) delete mode 100644 archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaUser.java delete mode 100644 archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java index 07bcc1b9a..66be709b6 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/FileTypes.java @@ -19,6 +19,14 @@ package org.apache.maven.archiva.configuration; * under the License. */ +import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.Predicate; import org.apache.commons.configuration.CombinedConfiguration; @@ -32,16 +40,6 @@ import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.registry.RegistryListener; import org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry; import org.codehaus.plexus.util.SelectorUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; /** * FileTypes @@ -54,8 +52,6 @@ import java.util.Map; public class FileTypes implements Initializable, RegistryListener { - private Logger log = LoggerFactory.getLogger(FileTypes.class); - public static final String ARTIFACTS = "artifacts"; public static final String AUTO_REMOVE = "auto-remove"; @@ -174,6 +170,8 @@ public class FileTypes throws InitializationException { // TODO: why is this done by hand? + + // TODO: ideally, this would be instantiated by configuration instead, and not need to be a component String errMsg = "Unable to load default archiva configuration for FileTypes: "; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java index 97b2d1f47..58e1dd9cc 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-database-consumers/src/main/java/org/apache/maven/archiva/consumers/database/ProjectModelToDatabaseConsumer.java @@ -44,6 +44,8 @@ import org.apache.maven.archiva.repository.project.ProjectModelException; import org.apache.maven.archiva.repository.project.ProjectModelFilter; import org.apache.maven.archiva.repository.project.ProjectModelReader; import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter; +import org.apache.maven.archiva.repository.project.readers.ProjectModel300Reader; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; import org.codehaus.plexus.cache.Cache; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -83,16 +85,6 @@ public class ProjectModelToDatabaseConsumer */ private RepositoryContentFactory repositoryFactory; - /** - * @plexus.requirement role-hint="model400" - */ - private ProjectModelReader project400Reader; - - /** - * @plexus.requirement role-hint="model300" - */ - private ProjectModelReader project300Reader; - /** * @plexus.requirement role-hint="expression" */ @@ -153,11 +145,15 @@ public class ProjectModelToDatabaseConsumer ManagedRepositoryContent repo = getRepository( artifact ); File artifactFile = repo.toFile( artifact ); - ProjectModelReader reader = project400Reader; - + + ProjectModelReader reader; if ( repo instanceof ManagedLegacyRepositoryContent ) { - reader = project300Reader; + reader = new ProjectModel300Reader(); + } + else + { + reader = new ProjectModel400Reader(); } try diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/DependencyGraphFactory.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/DependencyGraphFactory.java index 66d3066ea..3b20c858e 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/DependencyGraphFactory.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/DependencyGraphFactory.java @@ -46,8 +46,6 @@ import java.util.List; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.dependency.DependencyGraphFactory" */ public class DependencyGraphFactory { diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagCyclicEdgesTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagCyclicEdgesTask.java index 6e3d89f43..bc54dffe3 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagCyclicEdgesTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagCyclicEdgesTask.java @@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="flag-cyclic-edges" - * instantiation-strategy="per-lookup" */ public class FlagCyclicEdgesTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagExcludedEdgesTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagExcludedEdgesTask.java index e7d5586de..34a64467a 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagExcludedEdgesTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/FlagExcludedEdgesTask.java @@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="flag-excluded-edges" - * instantiation-strategy="per-lookup" */ public class FlagExcludedEdgesTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateDependencyManagementTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateDependencyManagementTask.java index 60dba3750..33dc107b0 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateDependencyManagementTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateDependencyManagementTask.java @@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="populate-dependency-management" - * instantiation-strategy="per-lookup" */ public class PopulateDependencyManagementTask implements GraphTask, PotentialCyclicEdgeProducer diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateGraphMasterTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateGraphMasterTask.java index 8a93fa30f..300c74e4f 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateGraphMasterTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/PopulateGraphMasterTask.java @@ -32,11 +32,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="populate-graph" - * instantiation-strategy="per-lookup" */ public class PopulateGraphMasterTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceEnabledEdgesTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceEnabledEdgesTask.java index 1845b8364..aca1504f9 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceEnabledEdgesTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceEnabledEdgesTask.java @@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="reduce-enabled-edges" - * instantiation-strategy="per-lookup" */ public class ReduceEnabledEdgesTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceScopeTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceScopeTask.java index 5b77c9990..5a35eafff 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceScopeTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceScopeTask.java @@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="reduce-scope" - * instantiation-strategy="per-lookup" */ public class ReduceScopeTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceTransitiveEdgesTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceTransitiveEdgesTask.java index d65d2096a..061af5abd 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceTransitiveEdgesTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ReduceTransitiveEdgesTask.java @@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkBreadthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="reduce-transitive-edges" - * instantiation-strategy="per-lookup" */ public class ReduceTransitiveEdgesTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/RefineConflictsTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/RefineConflictsTask.java index b9bb3d9a0..cc55539f9 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/RefineConflictsTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/RefineConflictsTask.java @@ -42,11 +42,6 @@ import java.util.Map.Entry; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="refine-conflicts" - * instantiation-strategy="per-lookup" */ public class RefineConflictsTask implements GraphTask, PotentialCyclicEdgeProducer diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ResolveGraphTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ResolveGraphTask.java index ebe784109..9888d00ba 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ResolveGraphTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/ResolveGraphTask.java @@ -34,11 +34,6 @@ import org.apache.maven.archiva.model.VersionedReference; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="resolve-graph" - * instantiation-strategy="per-lookup" */ public class ResolveGraphTask implements GraphTask, PotentialCyclicEdgeProducer diff --git a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/UpdateScopesTask.java b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/UpdateScopesTask.java index a01548a9f..fc340ec62 100644 --- a/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/UpdateScopesTask.java +++ b/archiva-modules/archiva-base/archiva-dependency-graph/src/main/java/org/apache/maven/archiva/dependency/graph/tasks/UpdateScopesTask.java @@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.dependency.graph.GraphTask" - * role-hint="update-scopes" - * instantiation-strategy="per-lookup" */ public class UpdateScopesTask implements GraphTask diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/IndexExistsPredicate.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/IndexExistsPredicate.java index 1dcf17c69..11848fbd3 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/IndexExistsPredicate.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/maven/archiva/indexer/functors/IndexExistsPredicate.java @@ -30,10 +30,6 @@ import org.slf4j.LoggerFactory; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.commons.collections.Predicate" - * role-hint="index-exists" */ public class IndexExistsPredicate implements Predicate diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java index 920cf8ed5..7ee03d16a 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/AbstractDefaultRepositoryContent.java @@ -43,10 +43,7 @@ public abstract class AbstractDefaultRepositoryContent protected static final char ARTIFACT_SEPARATOR = '-'; - /** - * @plexus.requirement role-hint="default" - */ - private PathParser defaultPathParser; + private PathParser defaultPathParser = new DefaultPathParser(); public ArtifactReference toArtifactReference( String path ) throws LayoutException diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java index 7c14233ba..a6674c31e 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/DefaultPathParser.java @@ -29,8 +29,6 @@ import org.apache.maven.archiva.repository.layout.LayoutException; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.repository.content.PathParser" role-hint="default" */ public class DefaultPathParser implements PathParser { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java index 2d2baa97d..99a8de4d6 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/LegacyPathParser.java @@ -43,6 +43,7 @@ public class LegacyPathParser private static final String INVALID_ARTIFACT_PATH = "Invalid path to Artifact: "; /** + * @todo pass these in on construction instead, since this can't be long lived (no config listener), then no need to be a component * @plexus.requirement */ protected ArchivaConfiguration configuration; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java index 21a75c278..53bfc1bcb 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedDefaultRepositoryContent.java @@ -42,6 +42,8 @@ import java.util.Set; * @author Joakim Erdfelt * @version $Id$ * + * @todo no need to be a component when filetypes is not + * * @plexus.component * role="org.apache.maven.archiva.repository.ManagedRepositoryContent" * role-hint="default" diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java index 40d3ff117..6b59d86f3 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/ManagedLegacyRepositoryContent.java @@ -42,6 +42,8 @@ import java.util.Set; * @author Joakim Erdfelt * @version $Id$ * + * @todo no need to be a component when filetypes, legacy path parser is not + * * @plexus.component * role="org.apache.maven.archiva.repository.ManagedRepositoryContent" * role-hint="legacy" diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java index da45d43ec..13be1f0fe 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RemoteLegacyRepositoryContent.java @@ -31,6 +31,8 @@ import org.apache.maven.archiva.repository.layout.LayoutException; * @author Joakim Erdfelt * @version $Id$ * + * @todo no need to be a component once legacy path parser is not + * * @plexus.component * role="org.apache.maven.archiva.repository.RemoteRepositoryContent" * role-hint="legacy" diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java index 6d28d12f2..fd9a278f1 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/content/RepositoryRequest.java @@ -34,25 +34,14 @@ import org.apache.maven.archiva.repository.metadata.MetadataTools; * @author Joakim Erdfelt * @version $Id$ * + * @todo no need to be a component once legacy path parser is not + * * @plexus.component * role="org.apache.maven.archiva.repository.content.RepositoryRequest" */ public class RepositoryRequest { - /** - * @plexus.requirement - */ - private FileTypes filetypes; - - /** - * @plexus.requirement - */ - private ArchivaConfiguration archivaConfiguration; - - /** - * @plexus.requirement role-hint="default" - */ - private PathParser defaultPathParser; + private PathParser defaultPathParser = new DefaultPathParser(); /** * @plexus.requirement role-hint="legacy" diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java index df7bd0fa2..870cbcbbe 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/ProjectModelResolverFactory.java @@ -28,6 +28,8 @@ import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; import org.apache.maven.archiva.repository.ManagedRepositoryContent; import org.apache.maven.archiva.repository.RepositoryContentFactory; import org.apache.maven.archiva.repository.RepositoryException; +import org.apache.maven.archiva.repository.project.readers.ProjectModel300Reader; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; import org.apache.maven.archiva.repository.project.resolvers.ManagedRepositoryProjectResolver; import org.apache.maven.archiva.repository.project.resolvers.NopProjectResolver; import org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack; @@ -60,16 +62,6 @@ public class ProjectModelResolverFactory */ private RepositoryContentFactory repositoryFactory; - /** - * @plexus.requirement role-hint="model400" - */ - private ProjectModelReader project400Reader; - - /** - * @plexus.requirement role-hint="model300" - */ - private ProjectModelReader project300Reader; - private ProjectModelResolverStack currentResolverStack = new ProjectModelResolverStack(); public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue ) @@ -101,11 +93,15 @@ public class ProjectModelResolverFactory throws RepositoryException { ManagedRepositoryContent repoContent = repositoryFactory.getManagedRepositoryContent( repo.getId() ); - ProjectModelReader reader = project400Reader; - + + ProjectModelReader reader; if ( StringUtils.equals( "legacy", repo.getLayout() ) ) { - reader = project300Reader; + reader = new ProjectModel300Reader(); + } + else + { + reader = new ProjectModel400Reader(); } return new ManagedRepositoryProjectResolver( repoContent, reader ); diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java index 18cef92d6..95aa27c6c 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel300Reader.java @@ -47,10 +47,6 @@ import java.util.Properties; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.repository.project.ProjectModelReader" - * role-hint="model300" */ public class ProjectModel300Reader implements ProjectModelReader diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java index f619275d2..38509be26 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/readers/ProjectModel400Reader.java @@ -51,10 +51,6 @@ import java.util.Properties; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.repository.project.ProjectModelReader" - * role-hint="model400" */ public class ProjectModel400Reader implements ProjectModelReader diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ProjectModelResolverStack.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ProjectModelResolverStack.java index 459d90506..f7da1c9fb 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ProjectModelResolverStack.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/resolvers/ProjectModelResolverStack.java @@ -35,8 +35,6 @@ import java.util.List; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack" */ public class ProjectModelResolverStack { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java index be23449a3..a5955e346 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400Writer.java @@ -58,10 +58,6 @@ import java.util.List; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.repository.project.ProjectModelWriter" - * role-hint="model400" */ public class ProjectModel400Writer implements ProjectModelWriter diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java index efecd84f1..4ce21b8c8 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/test/java/org/apache/maven/archiva/repository/project/writers/ProjectModel400WriterTest.java @@ -52,7 +52,7 @@ public class ProjectModel400WriterTest { super.setUp(); - modelWriter = (ProjectModelWriter) lookup( ProjectModelWriter.class, "model400" ); + modelWriter = new ProjectModel400Writer(); } public void testSimpleWrite() diff --git a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAOTest.java b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAOTest.java index 17c935cf7..e9a79a377 100644 --- a/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAOTest.java +++ b/archiva-modules/archiva-database/src/test/java/org/apache/maven/archiva/database/jdo/JdoProjectModelDAOTest.java @@ -25,6 +25,7 @@ import org.apache.maven.archiva.database.AbstractArchivaDatabaseTestCase; import org.apache.maven.archiva.database.ProjectModelDAO; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.repository.project.ProjectModelReader; +import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader; import java.io.File; import java.util.ArrayList; @@ -109,7 +110,7 @@ public class JdoProjectModelDAOTest ProjectModelDAO projectDao = dao.getProjectModelDAO(); - ProjectModelReader modelReader = (ProjectModelReader) lookup( ProjectModelReader.class, "model400" ); + ProjectModelReader modelReader = new ProjectModel400Reader(); File pomFile = getTestFile( "src/test/resources/projects/maven-shared-jar-1.0-SNAPSHOT.pom" ); diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaUser.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaUser.java deleted file mode 100644 index da63a8854..000000000 --- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaUser.java +++ /dev/null @@ -1,36 +0,0 @@ -package org.apache.maven.archiva.security; - -/* - * 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. - */ - -/** - * ArchivaUser- interface to access the active principal. - * - * @author Joakim Erdfelt - * @version $Id$ - */ -public interface ArchivaUser -{ - /** - * Get the active principal from the security system. - * - * @return the active principal. (if not authenticated, the guest principal is returned) - */ - public String getActivePrincipal(); -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java index 2bc042231..09ab2d3df 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java @@ -19,20 +19,20 @@ package org.apache.maven.archiva.web.action; * under the License. */ +import java.util.Collections; +import java.util.List; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.database.browsing.BrowsingResults; import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; import org.apache.maven.archiva.security.AccessDeniedException; import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaUser; import org.apache.maven.archiva.security.PrincipalNotFoundException; import org.apache.maven.archiva.security.UserRepositories; +import org.apache.maven.archiva.web.util.ArchivaXworkUser; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import java.util.Collections; -import java.util.List; - /** * Browse the repository. * @@ -54,11 +54,6 @@ public class BrowseAction */ private UserRepositories userRepositories; - /** - * @plexus.requirement role-hint="xwork" - */ - private ArchivaUser archivaUser; - private BrowsingResults results; private String groupId; @@ -126,7 +121,7 @@ public class BrowseAction private String getPrincipal() { - return archivaUser.getActivePrincipal(); + return ArchivaXworkUser.getActivePrincipal(); } private List getObservableRepos() diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java index 2785f7414..fbce024a4 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java @@ -19,6 +19,10 @@ package org.apache.maven.archiva.web.action; * under the License. */ +import java.net.MalformedURLException; +import java.util.Collections; +import java.util.List; + import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.database.ArchivaDAO; @@ -31,15 +35,11 @@ import org.apache.maven.archiva.indexer.search.SearchResultLimits; import org.apache.maven.archiva.indexer.search.SearchResults; import org.apache.maven.archiva.security.AccessDeniedException; import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaUser; import org.apache.maven.archiva.security.PrincipalNotFoundException; import org.apache.maven.archiva.security.UserRepositories; +import org.apache.maven.archiva.web.util.ArchivaXworkUser; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import java.net.MalformedURLException; -import java.util.Collections; -import java.util.List; - /** * Search all indexed fields by the given criteria. * @@ -73,11 +73,6 @@ public class SearchAction */ private UserRepositories userRepositories; - /** - * @plexus.requirement role-hint="xwork" - */ - private ArchivaUser archivaUser; - private static final String RESULTS = "results"; private static final String ARTIFACT = "artifact"; @@ -160,7 +155,7 @@ public class SearchAction private String getPrincipal() { - return archivaUser.getActivePrincipal(); + return ArchivaXworkUser.getActivePrincipal(); } private List getObservableRepos() diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index faaa8261d..8f5fab1be 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -19,7 +19,8 @@ package org.apache.maven.archiva.web.action; * under the License. */ -import com.opensymphony.xwork.Validateable; +import java.util.Collections; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.database.ArchivaDatabaseException; @@ -28,13 +29,12 @@ import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; import org.apache.maven.archiva.model.ArchivaProjectModel; import org.apache.maven.archiva.security.AccessDeniedException; import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaUser; import org.apache.maven.archiva.security.PrincipalNotFoundException; import org.apache.maven.archiva.security.UserRepositories; +import org.apache.maven.archiva.web.util.ArchivaXworkUser; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import java.util.Collections; -import java.util.List; +import com.opensymphony.xwork.Validateable; /** * Browse the repository. @@ -58,11 +58,6 @@ public class ShowArtifactAction */ private UserRepositories userRepositories; - /** - * @plexus.requirement role-hint="xwork" - */ - private ArchivaUser archivaUser; - /* .\ Input Parameters \.________________________________________ */ private String groupId; @@ -178,7 +173,7 @@ public class ShowArtifactAction private String getPrincipal() { - return archivaUser.getActivePrincipal(); + return ArchivaXworkUser.getActivePrincipal(); } private List getObservableRepos() diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java index 8df8f8e2e..26b7800d8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java @@ -19,7 +19,15 @@ package org.apache.maven.archiva.web.action; * under the License. */ -import org.codehaus.plexus.xwork.action.PlexusActionSupport; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + import org.apache.maven.archiva.common.utils.Checksums; import org.apache.maven.archiva.common.utils.VersionComparator; import org.apache.maven.archiva.common.utils.VersionUtil; @@ -38,23 +46,16 @@ import org.apache.maven.archiva.repository.metadata.RepositoryMetadataReader; import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter; import org.apache.maven.archiva.repository.project.ProjectModelException; import org.apache.maven.archiva.repository.project.ProjectModelWriter; +import org.apache.maven.archiva.repository.project.writers.ProjectModel400Writer; import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaUser; import org.apache.maven.archiva.security.PrincipalNotFoundException; import org.apache.maven.archiva.security.UserRepositories; +import org.apache.maven.archiva.web.util.ArchivaXworkUser; +import org.codehaus.plexus.xwork.action.PlexusActionSupport; import com.opensymphony.xwork.Preparable; import com.opensymphony.xwork.Validateable; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.List; - /** * Upload an artifact using Jakarta file upload in webwork. If set by the user a pom will also be generated. Metadata * will also be updated if one exists, otherwise it would be created. @@ -122,11 +123,6 @@ public class UploadAction */ private List managedRepoIdList; - /** - * @plexus.requirement role-hint="xwork" - */ - private ArchivaUser archivaUser; - /** * @plexus.requirement */ @@ -142,10 +138,7 @@ public class UploadAction */ private RepositoryContentFactory repositoryFactory; - /** - * @plexus.requirement role-hint="model400" - */ - private ProjectModelWriter pomWriter; + private ProjectModelWriter pomWriter = new ProjectModel400Writer(); /** * @plexus.requirement @@ -334,7 +327,7 @@ public class UploadAction private String getPrincipal() { - return archivaUser.getActivePrincipal(); + return ArchivaXworkUser.getActivePrincipal(); } private void copyFile( File targetPath, String artifactFilename ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java index da8b31f5c..32168b7f5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java @@ -19,6 +19,18 @@ package org.apache.maven.archiva.web.repository; * under the License. */ +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.PrintWriter; +import java.util.ArrayList; +import java.util.List; + +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletResponse; + import org.apache.maven.archiva.common.utils.PathUtil; import org.apache.maven.archiva.model.ArtifactReference; import org.apache.maven.archiva.model.ProjectReference; @@ -36,7 +48,7 @@ import org.apache.maven.archiva.repository.content.RepositoryRequest; import org.apache.maven.archiva.repository.layout.LayoutException; import org.apache.maven.archiva.repository.metadata.MetadataTools; import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException; -import org.apache.maven.archiva.security.ArchivaUser; +import org.apache.maven.archiva.web.util.ArchivaXworkUser; import org.apache.maven.archiva.webdav.AbstractDavServerComponent; import org.apache.maven.archiva.webdav.DavServerComponent; import org.apache.maven.archiva.webdav.DavServerException; @@ -49,17 +61,6 @@ import org.apache.maven.model.Relocation; import org.apache.maven.model.io.xpp3.MavenXpp3Reader; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; -import javax.servlet.ServletConfig; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.ArrayList; -import java.util.List; - /** * ProxiedDavServer * @@ -102,11 +103,6 @@ public class ProxiedDavServer */ private MetadataTools metadataTools; - /** - * @plexus.requirement role-hint="xwork" - */ - private ArchivaUser archivaUser; - private ManagedRepositoryContent managedRepository; public String getPrefix() @@ -576,7 +572,7 @@ public class ProxiedDavServer private void triggerAuditEvent( DavServerRequest request, String resource, String action ) { - triggerAuditEvent( archivaUser.getActivePrincipal(), getRemoteIP( request ), resource, + triggerAuditEvent( ArchivaXworkUser.getActivePrincipal(), getRemoteIP( request ), resource, action ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java index 82113ed76..a3e058080 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java @@ -54,7 +54,7 @@ public class ArchivaStartup ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class)); TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update")); TaskQueueExecutor repositoryScanningQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning")); - Banner banner = (Banner) wac.getBean(PlexusToSpringUtils.buildSpringId(Banner.class)); + Banner banner = new Banner(); try { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java index 76a5223ee..fb5cd2b54 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/Banner.java @@ -31,10 +31,6 @@ import org.slf4j.LoggerFactory; * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component - * role="org.apache.maven.archiva.web.startup.Banner" - * role-hint="default" */ public class Banner { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java deleted file mode 100644 index ab7387b75..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippet.java +++ /dev/null @@ -1,157 +0,0 @@ -package org.apache.maven.archiva.web.tags; - -/* - * 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. - */ - -import java.io.IOException; - -import javax.servlet.jsp.JspException; -import javax.servlet.jsp.JspWriter; -import javax.servlet.jsp.PageContext; - -import org.apache.commons.lang.StringEscapeUtils; -import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; -import org.apache.maven.archiva.web.util.ContextUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * CopyPasteSnippet - * - * @author Joakim Erdfelt - * @version $Id$ - * @plexus.component role="org.apache.maven.archiva.web.tags.CopyPasteSnippet" - */ -public class CopyPasteSnippet -{ - private Logger log = LoggerFactory.getLogger( CopyPasteSnippet.class ); - - public static final String PRE = "pre"; - - public static final String TOGGLE = "toggle"; - - public void write( String wrapper, Object o, PageContext pageContext ) - throws JspException - { - StringBuffer prefix = new StringBuffer(); - StringBuffer buf = new StringBuffer(); - StringBuffer suffix = new StringBuffer(); - - if ( o == null ) - { - buf.append( "Error generating snippet." ); - log.error( "Unable to generate snippet for null object." ); - } - else if ( o instanceof ManagedRepositoryConfiguration ) - { - ManagedRepositoryConfiguration repo = (ManagedRepositoryConfiguration) o; - - if ( TOGGLE.equals( wrapper ) ) - { - prefix.append( "Show POM Snippet
" ); - prefix.append( "
" );
-
-                suffix.append( "
" ); - } - else if ( PRE.equals( wrapper ) ) - { - prefix.append( "
" );
-                suffix.append( "
" ); - } - - createSnippet( buf, repo, pageContext ); - } - else - { - buf.append( "Unable to generate snippet for object " ).append( o.getClass().getName() ); - } - - try - { - JspWriter out = pageContext.getOut(); - - out.write( prefix.toString() ); - out.write( StringEscapeUtils.escapeXml( buf.toString() ) ); - out.write( suffix.toString() ); - - out.flush(); - } - catch ( IOException e ) - { - throw new JspException( "Unable to write snippet to output: " + e.getMessage(), e ); - } - } - - private void createSnippet( StringBuffer snippet, ManagedRepositoryConfiguration repo, PageContext pageContext ) - { - snippet.append( "\n" ); - snippet.append( " ...\n" ); - snippet.append( " \n" ); - - String distRepoName = "repository"; - if ( repo.isSnapshots() ) - { - distRepoName = "snapshotRepository"; - } - - snippet.append( " <" ).append( distRepoName ).append( ">\n" ); - snippet.append( " " ).append( repo.getId() ).append( "\n" ); - snippet.append( " dav:" ).append( ContextUtils.getBaseURL( pageContext, "repository" ) ); - snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "\n" ); - - if ( !"default".equals( repo.getLayout() ) ) - { - snippet.append( " " ).append( repo.getLayout() ).append( "" ); - } - - snippet.append( " \n" ); - snippet.append( " \n" ); - snippet.append( "\n" ); - - snippet.append( " \n" ); - snippet.append( " \n" ); - snippet.append( " " ).append( repo.getId() ).append( "\n" ); - snippet.append( " " ).append( repo.getName() ).append( "\n" ); - - snippet.append( " " ); - snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) ); - snippet.append( "/" ).append( repo.getId() ).append( "/" ); - - snippet.append( "\n" ); - - if ( !"default".equals( repo.getLayout() ) ) - { - snippet.append( " " ).append( repo.getLayout() ).append( "\n" ); - } - - snippet.append( " \n" ); - snippet.append( " " ).append( Boolean.valueOf( repo.isReleases() ) ).append( "\n" ); - snippet.append( " \n" ); - snippet.append( " \n" ); - snippet.append( " " ).append( Boolean.valueOf( repo.isSnapshots() ) ).append( "\n" ); - snippet.append( " \n" ); - snippet.append( " \n" ); - snippet.append( " \n" ); - - snippet.append( " ...\n" ); - snippet.append( "\n" ); - } -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java index 47054e82f..0a18effe6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/CopyPasteSnippetTag.java @@ -19,11 +19,19 @@ package org.apache.maven.archiva.web.tags; * under the License. */ -import org.codehaus.plexus.component.repository.exception.ComponentLookupException; +import java.io.IOException; import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspWriter; +import javax.servlet.jsp.PageContext; import javax.servlet.jsp.tagext.TagSupport; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration; +import org.apache.maven.archiva.web.util.ContextUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** * CopyPasteSnippetTag * @@ -33,10 +41,16 @@ import javax.servlet.jsp.tagext.TagSupport; public class CopyPasteSnippetTag extends TagSupport { + private Logger log = LoggerFactory.getLogger( CopyPasteSnippetTag.class ); + private Object object; - private String wrapper = CopyPasteSnippet.PRE; + private String wrapper = PRE; + public static final String PRE = "pre"; + + public static final String TOGGLE = "toggle"; + public void release() { object = null; @@ -46,22 +60,55 @@ public class CopyPasteSnippetTag public int doEndTag() throws JspException { - CopyPasteSnippet snippet; - try + StringBuffer prefix = new StringBuffer(); + StringBuffer buf = new StringBuffer(); + StringBuffer suffix = new StringBuffer(); + + if ( object == null ) { - snippet = (CopyPasteSnippet) PlexusTagUtil.lookup( pageContext, CopyPasteSnippet.class.getName() ); + buf.append( "Error generating snippet." ); + log.error( "Unable to generate snippet for null object." ); } - catch ( ComponentLookupException e ) + else if ( object instanceof ManagedRepositoryConfiguration ) { - throw new JspException( "Unable to lookup CopyPasteSnippet: " + e.getMessage(), e ); + ManagedRepositoryConfiguration repo = (ManagedRepositoryConfiguration) object; + + if ( TOGGLE.equals( wrapper ) ) + { + prefix.append( "Show POM Snippet
" ); + prefix.append( "
" );
+        
+                suffix.append( "
" ); + } + else if ( PRE.equals( wrapper ) ) + { + prefix.append( "
" );
+                suffix.append( "
" ); + } + + createSnippet( buf, repo, pageContext ); } - - if ( snippet == null ) + else { - throw new JspException( "Unable to process snippet. Component not found." ); + buf.append( "Unable to generate snippet for object " ).append( object.getClass().getName() ); + } + + try + { + JspWriter out = pageContext.getOut(); + + out.write( prefix.toString() ); + out.write( StringEscapeUtils.escapeXml( buf.toString() ) ); + out.write( suffix.toString() ); + + out.flush(); + } + catch ( IOException e ) + { + throw new JspException( "Unable to write snippet to output: " + e.getMessage(), e ); } - - snippet.write( wrapper, object, pageContext ); return super.doEndTag(); } @@ -75,4 +122,59 @@ public class CopyPasteSnippetTag { this.wrapper = wrapper; } + + private void createSnippet( StringBuffer snippet, ManagedRepositoryConfiguration repo, PageContext pageContext ) + { + snippet.append( "\n" ); + snippet.append( " ...\n" ); + snippet.append( " \n" ); + + String distRepoName = "repository"; + if ( repo.isSnapshots() ) + { + distRepoName = "snapshotRepository"; + } + + snippet.append( " <" ).append( distRepoName ).append( ">\n" ); + snippet.append( " " ).append( repo.getId() ).append( "\n" ); + snippet.append( " dav:" ).append( ContextUtils.getBaseURL( pageContext, "repository" ) ); + snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "\n" ); + + if ( !"default".equals( repo.getLayout() ) ) + { + snippet.append( " " ).append( repo.getLayout() ).append( "" ); + } + + snippet.append( " \n" ); + snippet.append( " \n" ); + snippet.append( "\n" ); + + snippet.append( " \n" ); + snippet.append( " \n" ); + snippet.append( " " ).append( repo.getId() ).append( "\n" ); + snippet.append( " " ).append( repo.getName() ).append( "\n" ); + + snippet.append( " " ); + snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) ); + snippet.append( "/" ).append( repo.getId() ).append( "/" ); + + snippet.append( "\n" ); + + if ( !"default".equals( repo.getLayout() ) ) + { + snippet.append( " " ).append( repo.getLayout() ).append( "\n" ); + } + + snippet.append( " \n" ); + snippet.append( " " ).append( Boolean.valueOf( repo.isReleases() ) ).append( "\n" ); + snippet.append( " \n" ); + snippet.append( " \n" ); + snippet.append( " " ).append( Boolean.valueOf( repo.isSnapshots() ) ).append( "\n" ); + snippet.append( " \n" ); + snippet.append( " \n" ); + snippet.append( " \n" ); + + snippet.append( " ...\n" ); + snippet.append( "\n" ); + } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ArchivaXworkUser.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ArchivaXworkUser.java index 37df624f2..208d82ebe 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ArchivaXworkUser.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ArchivaXworkUser.java @@ -19,30 +19,25 @@ package org.apache.maven.archiva.web.util; * under the License. */ -import com.opensymphony.xwork.ActionContext; +import java.util.HashMap; +import java.util.Map; import org.apache.maven.archiva.security.ArchivaRoleConstants; -import org.apache.maven.archiva.security.ArchivaUser; import org.codehaus.plexus.redback.system.SecuritySession; import org.codehaus.plexus.redback.system.SecuritySystemConstants; import org.codehaus.plexus.redback.users.User; -import java.util.HashMap; -import java.util.Map; +import com.opensymphony.xwork.ActionContext; /** * ArchivaXworkUser * * @author Joakim Erdfelt * @version $Id$ - * - * @plexus.component role="org.apache.maven.archiva.security.ArchivaUser" - * role-hint="xwork" */ public class ArchivaXworkUser - implements ArchivaUser { - private Map getContextSession() + private static Map getContextSession() { ActionContext context = ActionContext.getContext(); Map sessionMap = context.getSession(); @@ -54,7 +49,7 @@ public class ArchivaXworkUser return sessionMap; } - private SecuritySession getSecuritySession() + private static SecuritySession getSecuritySession() { SecuritySession securitySession = (SecuritySession) getContextSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY ); @@ -67,7 +62,7 @@ public class ArchivaXworkUser return securitySession; } - public String getActivePrincipal() + public static String getActivePrincipal() { SecuritySession securitySession = getSecuritySession(); -- 2.39.5