mirror of
https://github.com/apache/archiva.git
synced 2025-02-08 02:59:43 +00:00
remove unnecessary component definitions
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@646403 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
f4e428ee64
commit
f24cdcbd13
@ -19,6 +19,14 @@
|
|||||||
* under the License.
|
* 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.CollectionUtils;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.commons.configuration.CombinedConfiguration;
|
import org.apache.commons.configuration.CombinedConfiguration;
|
||||||
@ -32,16 +40,6 @@
|
|||||||
import org.codehaus.plexus.registry.RegistryListener;
|
import org.codehaus.plexus.registry.RegistryListener;
|
||||||
import org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry;
|
import org.codehaus.plexus.registry.commons.CommonsConfigurationRegistry;
|
||||||
import org.codehaus.plexus.util.SelectorUtils;
|
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
|
* FileTypes
|
||||||
@ -54,8 +52,6 @@
|
|||||||
public class FileTypes
|
public class FileTypes
|
||||||
implements Initializable, RegistryListener
|
implements Initializable, RegistryListener
|
||||||
{
|
{
|
||||||
private Logger log = LoggerFactory.getLogger(FileTypes.class);
|
|
||||||
|
|
||||||
public static final String ARTIFACTS = "artifacts";
|
public static final String ARTIFACTS = "artifacts";
|
||||||
|
|
||||||
public static final String AUTO_REMOVE = "auto-remove";
|
public static final String AUTO_REMOVE = "auto-remove";
|
||||||
@ -174,6 +170,8 @@ public void initialize()
|
|||||||
throws InitializationException
|
throws InitializationException
|
||||||
{
|
{
|
||||||
// TODO: why is this done by hand?
|
// 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: ";
|
String errMsg = "Unable to load default archiva configuration for FileTypes: ";
|
||||||
|
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
import org.apache.maven.archiva.repository.project.ProjectModelFilter;
|
import org.apache.maven.archiva.repository.project.ProjectModelFilter;
|
||||||
import org.apache.maven.archiva.repository.project.ProjectModelReader;
|
import org.apache.maven.archiva.repository.project.ProjectModelReader;
|
||||||
import org.apache.maven.archiva.repository.project.filters.EffectiveProjectModelFilter;
|
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.codehaus.plexus.cache.Cache;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -83,16 +85,6 @@ public class ProjectModelToDatabaseConsumer
|
|||||||
*/
|
*/
|
||||||
private RepositoryContentFactory repositoryFactory;
|
private RepositoryContentFactory repositoryFactory;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="model400"
|
|
||||||
*/
|
|
||||||
private ProjectModelReader project400Reader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="model300"
|
|
||||||
*/
|
|
||||||
private ProjectModelReader project300Reader;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement role-hint="expression"
|
* @plexus.requirement role-hint="expression"
|
||||||
*/
|
*/
|
||||||
@ -153,11 +145,15 @@ public void processArchivaArtifact( ArchivaArtifact artifact )
|
|||||||
|
|
||||||
ManagedRepositoryContent repo = getRepository( artifact );
|
ManagedRepositoryContent repo = getRepository( artifact );
|
||||||
File artifactFile = repo.toFile( artifact );
|
File artifactFile = repo.toFile( artifact );
|
||||||
ProjectModelReader reader = project400Reader;
|
|
||||||
|
ProjectModelReader reader;
|
||||||
if ( repo instanceof ManagedLegacyRepositoryContent )
|
if ( repo instanceof ManagedLegacyRepositoryContent )
|
||||||
{
|
{
|
||||||
reader = project300Reader;
|
reader = new ProjectModel300Reader();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reader = new ProjectModel400Reader();
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -46,8 +46,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component role="org.apache.maven.archiva.dependency.DependencyGraphFactory"
|
|
||||||
*/
|
*/
|
||||||
public class DependencyGraphFactory
|
public class DependencyGraphFactory
|
||||||
{
|
{
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="flag-cyclic-edges"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class FlagCyclicEdgesTask
|
public class FlagCyclicEdgesTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="flag-excluded-edges"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class FlagExcludedEdgesTask
|
public class FlagExcludedEdgesTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="populate-dependency-management"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class PopulateDependencyManagementTask
|
public class PopulateDependencyManagementTask
|
||||||
implements GraphTask, PotentialCyclicEdgeProducer
|
implements GraphTask, PotentialCyclicEdgeProducer
|
||||||
|
@ -32,11 +32,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="populate-graph"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class PopulateGraphMasterTask
|
public class PopulateGraphMasterTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="reduce-enabled-edges"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class ReduceEnabledEdgesTask
|
public class ReduceEnabledEdgesTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="reduce-scope"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class ReduceScopeTask
|
public class ReduceScopeTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -29,11 +29,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="reduce-transitive-edges"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class ReduceTransitiveEdgesTask
|
public class ReduceTransitiveEdgesTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -42,11 +42,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="refine-conflicts"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class RefineConflictsTask
|
public class RefineConflictsTask
|
||||||
implements GraphTask, PotentialCyclicEdgeProducer
|
implements GraphTask, PotentialCyclicEdgeProducer
|
||||||
|
@ -34,11 +34,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="resolve-graph"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class ResolveGraphTask
|
public class ResolveGraphTask
|
||||||
implements GraphTask, PotentialCyclicEdgeProducer
|
implements GraphTask, PotentialCyclicEdgeProducer
|
||||||
|
@ -30,11 +30,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.dependency.graph.GraphTask"
|
|
||||||
* role-hint="update-scopes"
|
|
||||||
* instantiation-strategy="per-lookup"
|
|
||||||
*/
|
*/
|
||||||
public class UpdateScopesTask
|
public class UpdateScopesTask
|
||||||
implements GraphTask
|
implements GraphTask
|
||||||
|
@ -30,10 +30,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.commons.collections.Predicate"
|
|
||||||
* role-hint="index-exists"
|
|
||||||
*/
|
*/
|
||||||
public class IndexExistsPredicate
|
public class IndexExistsPredicate
|
||||||
implements Predicate
|
implements Predicate
|
||||||
|
@ -43,10 +43,7 @@ public abstract class AbstractDefaultRepositoryContent
|
|||||||
|
|
||||||
protected static final char ARTIFACT_SEPARATOR = '-';
|
protected static final char ARTIFACT_SEPARATOR = '-';
|
||||||
|
|
||||||
/**
|
private PathParser defaultPathParser = new DefaultPathParser();
|
||||||
* @plexus.requirement role-hint="default"
|
|
||||||
*/
|
|
||||||
private PathParser defaultPathParser;
|
|
||||||
|
|
||||||
public ArtifactReference toArtifactReference( String path )
|
public ArtifactReference toArtifactReference( String path )
|
||||||
throws LayoutException
|
throws LayoutException
|
||||||
|
@ -29,8 +29,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component role="org.apache.maven.archiva.repository.content.PathParser" role-hint="default"
|
|
||||||
*/
|
*/
|
||||||
public class DefaultPathParser implements PathParser
|
public class DefaultPathParser implements PathParser
|
||||||
{
|
{
|
||||||
|
@ -43,6 +43,7 @@ public class LegacyPathParser
|
|||||||
private static final String INVALID_ARTIFACT_PATH = "Invalid path to Artifact: ";
|
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
|
* @plexus.requirement
|
||||||
*/
|
*/
|
||||||
protected ArchivaConfiguration configuration;
|
protected ArchivaConfiguration configuration;
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
|
* @todo no need to be a component when filetypes is not
|
||||||
|
*
|
||||||
* @plexus.component
|
* @plexus.component
|
||||||
* role="org.apache.maven.archiva.repository.ManagedRepositoryContent"
|
* role="org.apache.maven.archiva.repository.ManagedRepositoryContent"
|
||||||
* role-hint="default"
|
* role-hint="default"
|
||||||
|
@ -42,6 +42,8 @@
|
|||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
|
* @todo no need to be a component when filetypes, legacy path parser is not
|
||||||
|
*
|
||||||
* @plexus.component
|
* @plexus.component
|
||||||
* role="org.apache.maven.archiva.repository.ManagedRepositoryContent"
|
* role="org.apache.maven.archiva.repository.ManagedRepositoryContent"
|
||||||
* role-hint="legacy"
|
* role-hint="legacy"
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
|
* @todo no need to be a component once legacy path parser is not
|
||||||
|
*
|
||||||
* @plexus.component
|
* @plexus.component
|
||||||
* role="org.apache.maven.archiva.repository.RemoteRepositoryContent"
|
* role="org.apache.maven.archiva.repository.RemoteRepositoryContent"
|
||||||
* role-hint="legacy"
|
* role-hint="legacy"
|
||||||
|
@ -34,25 +34,14 @@
|
|||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
*
|
||||||
|
* @todo no need to be a component once legacy path parser is not
|
||||||
|
*
|
||||||
* @plexus.component
|
* @plexus.component
|
||||||
* role="org.apache.maven.archiva.repository.content.RepositoryRequest"
|
* role="org.apache.maven.archiva.repository.content.RepositoryRequest"
|
||||||
*/
|
*/
|
||||||
public class RepositoryRequest
|
public class RepositoryRequest
|
||||||
{
|
{
|
||||||
/**
|
private PathParser defaultPathParser = new DefaultPathParser();
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private FileTypes filetypes;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="default"
|
|
||||||
*/
|
|
||||||
private PathParser defaultPathParser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement role-hint="legacy"
|
* @plexus.requirement role-hint="legacy"
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
import org.apache.maven.archiva.repository.ManagedRepositoryContent;
|
||||||
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
import org.apache.maven.archiva.repository.RepositoryContentFactory;
|
||||||
import org.apache.maven.archiva.repository.RepositoryException;
|
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.ManagedRepositoryProjectResolver;
|
||||||
import org.apache.maven.archiva.repository.project.resolvers.NopProjectResolver;
|
import org.apache.maven.archiva.repository.project.resolvers.NopProjectResolver;
|
||||||
import org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack;
|
import org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack;
|
||||||
@ -60,16 +62,6 @@ public class ProjectModelResolverFactory
|
|||||||
*/
|
*/
|
||||||
private RepositoryContentFactory repositoryFactory;
|
private RepositoryContentFactory repositoryFactory;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="model400"
|
|
||||||
*/
|
|
||||||
private ProjectModelReader project400Reader;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="model300"
|
|
||||||
*/
|
|
||||||
private ProjectModelReader project300Reader;
|
|
||||||
|
|
||||||
private ProjectModelResolverStack currentResolverStack = new ProjectModelResolverStack();
|
private ProjectModelResolverStack currentResolverStack = new ProjectModelResolverStack();
|
||||||
|
|
||||||
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
public void afterConfigurationChange( Registry registry, String propertyName, Object propertyValue )
|
||||||
@ -101,11 +93,15 @@ private ManagedRepositoryProjectResolver toResolver( ManagedRepositoryConfigurat
|
|||||||
throws RepositoryException
|
throws RepositoryException
|
||||||
{
|
{
|
||||||
ManagedRepositoryContent repoContent = repositoryFactory.getManagedRepositoryContent( repo.getId() );
|
ManagedRepositoryContent repoContent = repositoryFactory.getManagedRepositoryContent( repo.getId() );
|
||||||
ProjectModelReader reader = project400Reader;
|
|
||||||
|
ProjectModelReader reader;
|
||||||
if ( StringUtils.equals( "legacy", repo.getLayout() ) )
|
if ( StringUtils.equals( "legacy", repo.getLayout() ) )
|
||||||
{
|
{
|
||||||
reader = project300Reader;
|
reader = new ProjectModel300Reader();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reader = new ProjectModel400Reader();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ManagedRepositoryProjectResolver( repoContent, reader );
|
return new ManagedRepositoryProjectResolver( repoContent, reader );
|
||||||
|
@ -47,10 +47,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
|
||||||
* role-hint="model300"
|
|
||||||
*/
|
*/
|
||||||
public class ProjectModel300Reader
|
public class ProjectModel300Reader
|
||||||
implements ProjectModelReader
|
implements ProjectModelReader
|
||||||
|
@ -51,10 +51,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
|
||||||
* role-hint="model400"
|
|
||||||
*/
|
*/
|
||||||
public class ProjectModel400Reader
|
public class ProjectModel400Reader
|
||||||
implements ProjectModelReader
|
implements ProjectModelReader
|
||||||
|
@ -35,8 +35,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component role="org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack"
|
|
||||||
*/
|
*/
|
||||||
public class ProjectModelResolverStack
|
public class ProjectModelResolverStack
|
||||||
{
|
{
|
||||||
|
@ -58,10 +58,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.repository.project.ProjectModelWriter"
|
|
||||||
* role-hint="model400"
|
|
||||||
*/
|
*/
|
||||||
public class ProjectModel400Writer
|
public class ProjectModel400Writer
|
||||||
implements ProjectModelWriter
|
implements ProjectModelWriter
|
||||||
|
@ -52,7 +52,7 @@ protected void setUp()
|
|||||||
{
|
{
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
modelWriter = (ProjectModelWriter) lookup( ProjectModelWriter.class, "model400" );
|
modelWriter = new ProjectModel400Writer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSimpleWrite()
|
public void testSimpleWrite()
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
import org.apache.maven.archiva.database.ProjectModelDAO;
|
import org.apache.maven.archiva.database.ProjectModelDAO;
|
||||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
import org.apache.maven.archiva.repository.project.ProjectModelReader;
|
import org.apache.maven.archiva.repository.project.ProjectModelReader;
|
||||||
|
import org.apache.maven.archiva.repository.project.readers.ProjectModel400Reader;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -109,7 +110,7 @@ public void testSaveGetRealProjectModel()
|
|||||||
|
|
||||||
ProjectModelDAO projectDao = dao.getProjectModelDAO();
|
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" );
|
File pomFile = getTestFile( "src/test/resources/projects/maven-shared-jar-1.0-SNAPSHOT.pom" );
|
||||||
|
|
||||||
|
@ -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 <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
|
||||||
* @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();
|
|
||||||
}
|
|
@ -19,20 +19,20 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.database.browsing.BrowsingResults;
|
import org.apache.maven.archiva.database.browsing.BrowsingResults;
|
||||||
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
||||||
import org.apache.maven.archiva.security.AccessDeniedException;
|
import org.apache.maven.archiva.security.AccessDeniedException;
|
||||||
import org.apache.maven.archiva.security.ArchivaSecurityException;
|
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.PrincipalNotFoundException;
|
||||||
import org.apache.maven.archiva.security.UserRepositories;
|
import org.apache.maven.archiva.security.UserRepositories;
|
||||||
|
import org.apache.maven.archiva.web.util.ArchivaXworkUser;
|
||||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
||||||
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse the repository.
|
* Browse the repository.
|
||||||
*
|
*
|
||||||
@ -54,11 +54,6 @@ public class BrowseAction
|
|||||||
*/
|
*/
|
||||||
private UserRepositories userRepositories;
|
private UserRepositories userRepositories;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="xwork"
|
|
||||||
*/
|
|
||||||
private ArchivaUser archivaUser;
|
|
||||||
|
|
||||||
private BrowsingResults results;
|
private BrowsingResults results;
|
||||||
|
|
||||||
private String groupId;
|
private String groupId;
|
||||||
@ -126,7 +121,7 @@ public String browseArtifact()
|
|||||||
|
|
||||||
private String getPrincipal()
|
private String getPrincipal()
|
||||||
{
|
{
|
||||||
return archivaUser.getActivePrincipal();
|
return ArchivaXworkUser.getActivePrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getObservableRepos()
|
private List<String> getObservableRepos()
|
||||||
|
@ -19,6 +19,10 @@
|
|||||||
* under the License.
|
* 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.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||||
@ -31,15 +35,11 @@
|
|||||||
import org.apache.maven.archiva.indexer.search.SearchResults;
|
import org.apache.maven.archiva.indexer.search.SearchResults;
|
||||||
import org.apache.maven.archiva.security.AccessDeniedException;
|
import org.apache.maven.archiva.security.AccessDeniedException;
|
||||||
import org.apache.maven.archiva.security.ArchivaSecurityException;
|
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.PrincipalNotFoundException;
|
||||||
import org.apache.maven.archiva.security.UserRepositories;
|
import org.apache.maven.archiva.security.UserRepositories;
|
||||||
|
import org.apache.maven.archiva.web.util.ArchivaXworkUser;
|
||||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
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.
|
* Search all indexed fields by the given criteria.
|
||||||
*
|
*
|
||||||
@ -73,11 +73,6 @@ public class SearchAction
|
|||||||
*/
|
*/
|
||||||
private UserRepositories userRepositories;
|
private UserRepositories userRepositories;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="xwork"
|
|
||||||
*/
|
|
||||||
private ArchivaUser archivaUser;
|
|
||||||
|
|
||||||
private static final String RESULTS = "results";
|
private static final String RESULTS = "results";
|
||||||
|
|
||||||
private static final String ARTIFACT = "artifact";
|
private static final String ARTIFACT = "artifact";
|
||||||
@ -160,7 +155,7 @@ public String doInput()
|
|||||||
|
|
||||||
private String getPrincipal()
|
private String getPrincipal()
|
||||||
{
|
{
|
||||||
return archivaUser.getActivePrincipal();
|
return ArchivaXworkUser.getActivePrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getObservableRepos()
|
private List<String> getObservableRepos()
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
* under the License.
|
* 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.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||||
@ -28,13 +29,12 @@
|
|||||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
import org.apache.maven.archiva.security.AccessDeniedException;
|
import org.apache.maven.archiva.security.AccessDeniedException;
|
||||||
import org.apache.maven.archiva.security.ArchivaSecurityException;
|
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.PrincipalNotFoundException;
|
||||||
import org.apache.maven.archiva.security.UserRepositories;
|
import org.apache.maven.archiva.security.UserRepositories;
|
||||||
|
import org.apache.maven.archiva.web.util.ArchivaXworkUser;
|
||||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
||||||
|
|
||||||
import java.util.Collections;
|
import com.opensymphony.xwork.Validateable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse the repository.
|
* Browse the repository.
|
||||||
@ -58,11 +58,6 @@ public class ShowArtifactAction
|
|||||||
*/
|
*/
|
||||||
private UserRepositories userRepositories;
|
private UserRepositories userRepositories;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="xwork"
|
|
||||||
*/
|
|
||||||
private ArchivaUser archivaUser;
|
|
||||||
|
|
||||||
/* .\ Input Parameters \.________________________________________ */
|
/* .\ Input Parameters \.________________________________________ */
|
||||||
|
|
||||||
private String groupId;
|
private String groupId;
|
||||||
@ -178,7 +173,7 @@ public String dependencyTree()
|
|||||||
|
|
||||||
private String getPrincipal()
|
private String getPrincipal()
|
||||||
{
|
{
|
||||||
return archivaUser.getActivePrincipal();
|
return ArchivaXworkUser.getActivePrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String> getObservableRepos()
|
private List<String> getObservableRepos()
|
||||||
|
@ -19,7 +19,15 @@
|
|||||||
* under the License.
|
* 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.Checksums;
|
||||||
import org.apache.maven.archiva.common.utils.VersionComparator;
|
import org.apache.maven.archiva.common.utils.VersionComparator;
|
||||||
import org.apache.maven.archiva.common.utils.VersionUtil;
|
import org.apache.maven.archiva.common.utils.VersionUtil;
|
||||||
@ -38,23 +46,16 @@
|
|||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
|
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataWriter;
|
||||||
import org.apache.maven.archiva.repository.project.ProjectModelException;
|
import org.apache.maven.archiva.repository.project.ProjectModelException;
|
||||||
import org.apache.maven.archiva.repository.project.ProjectModelWriter;
|
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.ArchivaSecurityException;
|
||||||
import org.apache.maven.archiva.security.ArchivaUser;
|
|
||||||
import org.apache.maven.archiva.security.PrincipalNotFoundException;
|
import org.apache.maven.archiva.security.PrincipalNotFoundException;
|
||||||
import org.apache.maven.archiva.security.UserRepositories;
|
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.Preparable;
|
||||||
import com.opensymphony.xwork.Validateable;
|
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
|
* 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.
|
* will also be updated if one exists, otherwise it would be created.
|
||||||
@ -122,11 +123,6 @@ public class UploadAction
|
|||||||
*/
|
*/
|
||||||
private List<String> managedRepoIdList;
|
private List<String> managedRepoIdList;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="xwork"
|
|
||||||
*/
|
|
||||||
private ArchivaUser archivaUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement
|
* @plexus.requirement
|
||||||
*/
|
*/
|
||||||
@ -142,10 +138,7 @@ public class UploadAction
|
|||||||
*/
|
*/
|
||||||
private RepositoryContentFactory repositoryFactory;
|
private RepositoryContentFactory repositoryFactory;
|
||||||
|
|
||||||
/**
|
private ProjectModelWriter pomWriter = new ProjectModel400Writer();
|
||||||
* @plexus.requirement role-hint="model400"
|
|
||||||
*/
|
|
||||||
private ProjectModelWriter pomWriter;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @plexus.requirement
|
* @plexus.requirement
|
||||||
@ -334,7 +327,7 @@ public String doUpload()
|
|||||||
|
|
||||||
private String getPrincipal()
|
private String getPrincipal()
|
||||||
{
|
{
|
||||||
return archivaUser.getActivePrincipal();
|
return ArchivaXworkUser.getActivePrincipal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void copyFile( File targetPath, String artifactFilename )
|
private void copyFile( File targetPath, String artifactFilename )
|
||||||
|
@ -19,6 +19,18 @@
|
|||||||
* under the License.
|
* 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.common.utils.PathUtil;
|
||||||
import org.apache.maven.archiva.model.ArtifactReference;
|
import org.apache.maven.archiva.model.ArtifactReference;
|
||||||
import org.apache.maven.archiva.model.ProjectReference;
|
import org.apache.maven.archiva.model.ProjectReference;
|
||||||
@ -36,7 +48,7 @@
|
|||||||
import org.apache.maven.archiva.repository.layout.LayoutException;
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
||||||
import org.apache.maven.archiva.repository.metadata.RepositoryMetadataException;
|
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.AbstractDavServerComponent;
|
||||||
import org.apache.maven.archiva.webdav.DavServerComponent;
|
import org.apache.maven.archiva.webdav.DavServerComponent;
|
||||||
import org.apache.maven.archiva.webdav.DavServerException;
|
import org.apache.maven.archiva.webdav.DavServerException;
|
||||||
@ -49,17 +61,6 @@
|
|||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
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
|
* ProxiedDavServer
|
||||||
*
|
*
|
||||||
@ -102,11 +103,6 @@ public class ProxiedDavServer
|
|||||||
*/
|
*/
|
||||||
private MetadataTools metadataTools;
|
private MetadataTools metadataTools;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="xwork"
|
|
||||||
*/
|
|
||||||
private ArchivaUser archivaUser;
|
|
||||||
|
|
||||||
private ManagedRepositoryContent managedRepository;
|
private ManagedRepositoryContent managedRepository;
|
||||||
|
|
||||||
public String getPrefix()
|
public String getPrefix()
|
||||||
@ -576,7 +572,7 @@ private void triggerAuditEvent( String user, String remoteIP, String resource, S
|
|||||||
|
|
||||||
private void triggerAuditEvent( DavServerRequest request, String resource, String action )
|
private void triggerAuditEvent( DavServerRequest request, String resource, String action )
|
||||||
{
|
{
|
||||||
triggerAuditEvent( archivaUser.getActivePrincipal(), getRemoteIP( request ), resource,
|
triggerAuditEvent( ArchivaXworkUser.getActivePrincipal(), getRemoteIP( request ), resource,
|
||||||
action );
|
action );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public void contextInitialized(ServletContextEvent arg0) {
|
|||||||
ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class));
|
ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class));
|
||||||
TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update"));
|
TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update"));
|
||||||
TaskQueueExecutor repositoryScanningQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning"));
|
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
|
try
|
||||||
{
|
{
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component
|
|
||||||
* role="org.apache.maven.archiva.web.startup.Banner"
|
|
||||||
* role-hint="default"
|
|
||||||
*/
|
*/
|
||||||
public class Banner
|
public class Banner
|
||||||
{
|
{
|
||||||
|
@ -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 <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
|
||||||
* @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( "<a href=\"#\" onclick=\"Effect.toggle('repoPom" );
|
|
||||||
prefix.append( repo.getId() ).append( "','slide'); return false;\">Show POM Snippet</a><br/>" );
|
|
||||||
prefix.append( "<pre class=\"pom\" style=\"display: none;\" id=\"repoPom" ).append( repo.getId() );
|
|
||||||
prefix.append( "\"><code>" );
|
|
||||||
|
|
||||||
suffix.append( "</code></pre>" );
|
|
||||||
}
|
|
||||||
else if ( PRE.equals( wrapper ) )
|
|
||||||
{
|
|
||||||
prefix.append( "<pre>" );
|
|
||||||
suffix.append( "</pre>" );
|
|
||||||
}
|
|
||||||
|
|
||||||
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( "<project>\n" );
|
|
||||||
snippet.append( " ...\n" );
|
|
||||||
snippet.append( " <distributionManagement>\n" );
|
|
||||||
|
|
||||||
String distRepoName = "repository";
|
|
||||||
if ( repo.isSnapshots() )
|
|
||||||
{
|
|
||||||
distRepoName = "snapshotRepository";
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet.append( " <" ).append( distRepoName ).append( ">\n" );
|
|
||||||
snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
|
|
||||||
snippet.append( " <url>dav:" ).append( ContextUtils.getBaseURL( pageContext, "repository" ) );
|
|
||||||
snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "</url>\n" );
|
|
||||||
|
|
||||||
if ( !"default".equals( repo.getLayout() ) )
|
|
||||||
{
|
|
||||||
snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>" );
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet.append( " </" ).append( distRepoName ).append( ">\n" );
|
|
||||||
snippet.append( " </distributionManagement>\n" );
|
|
||||||
snippet.append( "\n" );
|
|
||||||
|
|
||||||
snippet.append( " <repositories>\n" );
|
|
||||||
snippet.append( " <repository>\n" );
|
|
||||||
snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
|
|
||||||
snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" );
|
|
||||||
|
|
||||||
snippet.append( " <url>" );
|
|
||||||
snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) );
|
|
||||||
snippet.append( "/" ).append( repo.getId() ).append( "/" );
|
|
||||||
|
|
||||||
snippet.append( "</url>\n" );
|
|
||||||
|
|
||||||
if ( !"default".equals( repo.getLayout() ) )
|
|
||||||
{
|
|
||||||
snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>\n" );
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet.append( " <releases>\n" );
|
|
||||||
snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isReleases() ) ).append( "</enabled>\n" );
|
|
||||||
snippet.append( " </releases>\n" );
|
|
||||||
snippet.append( " <snapshots>\n" );
|
|
||||||
snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isSnapshots() ) ).append( "</enabled>\n" );
|
|
||||||
snippet.append( " </snapshots>\n" );
|
|
||||||
snippet.append( " </repository>\n" );
|
|
||||||
snippet.append( " </repositories>\n" );
|
|
||||||
|
|
||||||
snippet.append( " ...\n" );
|
|
||||||
snippet.append( "</project>\n" );
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,11 +19,19 @@
|
|||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import javax.servlet.jsp.JspException;
|
import javax.servlet.jsp.JspException;
|
||||||
|
import javax.servlet.jsp.JspWriter;
|
||||||
|
import javax.servlet.jsp.PageContext;
|
||||||
import javax.servlet.jsp.tagext.TagSupport;
|
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
|
* CopyPasteSnippetTag
|
||||||
*
|
*
|
||||||
@ -33,10 +41,16 @@
|
|||||||
public class CopyPasteSnippetTag
|
public class CopyPasteSnippetTag
|
||||||
extends TagSupport
|
extends TagSupport
|
||||||
{
|
{
|
||||||
|
private Logger log = LoggerFactory.getLogger( CopyPasteSnippetTag.class );
|
||||||
|
|
||||||
private Object object;
|
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()
|
public void release()
|
||||||
{
|
{
|
||||||
object = null;
|
object = null;
|
||||||
@ -46,23 +60,56 @@ public void release()
|
|||||||
public int doEndTag()
|
public int doEndTag()
|
||||||
throws JspException
|
throws JspException
|
||||||
{
|
{
|
||||||
CopyPasteSnippet snippet;
|
StringBuffer prefix = new StringBuffer();
|
||||||
|
StringBuffer buf = new StringBuffer();
|
||||||
|
StringBuffer suffix = new StringBuffer();
|
||||||
|
|
||||||
|
if ( object == null )
|
||||||
|
{
|
||||||
|
buf.append( "Error generating snippet." );
|
||||||
|
log.error( "Unable to generate snippet for null object." );
|
||||||
|
}
|
||||||
|
else if ( object instanceof ManagedRepositoryConfiguration )
|
||||||
|
{
|
||||||
|
ManagedRepositoryConfiguration repo = (ManagedRepositoryConfiguration) object;
|
||||||
|
|
||||||
|
if ( TOGGLE.equals( wrapper ) )
|
||||||
|
{
|
||||||
|
prefix.append( "<a href=\"#\" onclick=\"Effect.toggle('repoPom" );
|
||||||
|
prefix.append( repo.getId() ).append( "','slide'); return false;\">Show POM Snippet</a><br/>" );
|
||||||
|
prefix.append( "<pre class=\"pom\" style=\"display: none;\" id=\"repoPom" ).append( repo.getId() );
|
||||||
|
prefix.append( "\"><code>" );
|
||||||
|
|
||||||
|
suffix.append( "</code></pre>" );
|
||||||
|
}
|
||||||
|
else if ( PRE.equals( wrapper ) )
|
||||||
|
{
|
||||||
|
prefix.append( "<pre>" );
|
||||||
|
suffix.append( "</pre>" );
|
||||||
|
}
|
||||||
|
|
||||||
|
createSnippet( buf, repo, pageContext );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf.append( "Unable to generate snippet for object " ).append( object.getClass().getName() );
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
snippet = (CopyPasteSnippet) PlexusTagUtil.lookup( pageContext, CopyPasteSnippet.class.getName() );
|
JspWriter out = pageContext.getOut();
|
||||||
|
|
||||||
|
out.write( prefix.toString() );
|
||||||
|
out.write( StringEscapeUtils.escapeXml( buf.toString() ) );
|
||||||
|
out.write( suffix.toString() );
|
||||||
|
|
||||||
|
out.flush();
|
||||||
}
|
}
|
||||||
catch ( ComponentLookupException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new JspException( "Unable to lookup CopyPasteSnippet: " + e.getMessage(), e );
|
throw new JspException( "Unable to write snippet to output: " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( snippet == null )
|
|
||||||
{
|
|
||||||
throw new JspException( "Unable to process snippet. Component not found." );
|
|
||||||
}
|
|
||||||
|
|
||||||
snippet.write( wrapper, object, pageContext );
|
|
||||||
|
|
||||||
return super.doEndTag();
|
return super.doEndTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,4 +122,59 @@ public void setWrapper( String wrapper )
|
|||||||
{
|
{
|
||||||
this.wrapper = wrapper;
|
this.wrapper = wrapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createSnippet( StringBuffer snippet, ManagedRepositoryConfiguration repo, PageContext pageContext )
|
||||||
|
{
|
||||||
|
snippet.append( "<project>\n" );
|
||||||
|
snippet.append( " ...\n" );
|
||||||
|
snippet.append( " <distributionManagement>\n" );
|
||||||
|
|
||||||
|
String distRepoName = "repository";
|
||||||
|
if ( repo.isSnapshots() )
|
||||||
|
{
|
||||||
|
distRepoName = "snapshotRepository";
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet.append( " <" ).append( distRepoName ).append( ">\n" );
|
||||||
|
snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
|
||||||
|
snippet.append( " <url>dav:" ).append( ContextUtils.getBaseURL( pageContext, "repository" ) );
|
||||||
|
snippet.append( "/" ).append( repo.getId() ).append( "/" ).append( "</url>\n" );
|
||||||
|
|
||||||
|
if ( !"default".equals( repo.getLayout() ) )
|
||||||
|
{
|
||||||
|
snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>" );
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet.append( " </" ).append( distRepoName ).append( ">\n" );
|
||||||
|
snippet.append( " </distributionManagement>\n" );
|
||||||
|
snippet.append( "\n" );
|
||||||
|
|
||||||
|
snippet.append( " <repositories>\n" );
|
||||||
|
snippet.append( " <repository>\n" );
|
||||||
|
snippet.append( " <id>" ).append( repo.getId() ).append( "</id>\n" );
|
||||||
|
snippet.append( " <name>" ).append( repo.getName() ).append( "</name>\n" );
|
||||||
|
|
||||||
|
snippet.append( " <url>" );
|
||||||
|
snippet.append( ContextUtils.getBaseURL( pageContext, "repository" ) );
|
||||||
|
snippet.append( "/" ).append( repo.getId() ).append( "/" );
|
||||||
|
|
||||||
|
snippet.append( "</url>\n" );
|
||||||
|
|
||||||
|
if ( !"default".equals( repo.getLayout() ) )
|
||||||
|
{
|
||||||
|
snippet.append( " <layout>" ).append( repo.getLayout() ).append( "</layout>\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
snippet.append( " <releases>\n" );
|
||||||
|
snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isReleases() ) ).append( "</enabled>\n" );
|
||||||
|
snippet.append( " </releases>\n" );
|
||||||
|
snippet.append( " <snapshots>\n" );
|
||||||
|
snippet.append( " <enabled>" ).append( Boolean.valueOf( repo.isSnapshots() ) ).append( "</enabled>\n" );
|
||||||
|
snippet.append( " </snapshots>\n" );
|
||||||
|
snippet.append( " </repository>\n" );
|
||||||
|
snippet.append( " </repositories>\n" );
|
||||||
|
|
||||||
|
snippet.append( " ...\n" );
|
||||||
|
snippet.append( "</project>\n" );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,30 +19,25 @@
|
|||||||
* under the License.
|
* 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.ArchivaRoleConstants;
|
||||||
import org.apache.maven.archiva.security.ArchivaUser;
|
|
||||||
import org.codehaus.plexus.redback.system.SecuritySession;
|
import org.codehaus.plexus.redback.system.SecuritySession;
|
||||||
import org.codehaus.plexus.redback.system.SecuritySystemConstants;
|
import org.codehaus.plexus.redback.system.SecuritySystemConstants;
|
||||||
import org.codehaus.plexus.redback.users.User;
|
import org.codehaus.plexus.redback.users.User;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import com.opensymphony.xwork.ActionContext;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArchivaXworkUser
|
* ArchivaXworkUser
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*
|
|
||||||
* @plexus.component role="org.apache.maven.archiva.security.ArchivaUser"
|
|
||||||
* role-hint="xwork"
|
|
||||||
*/
|
*/
|
||||||
public class ArchivaXworkUser
|
public class ArchivaXworkUser
|
||||||
implements ArchivaUser
|
|
||||||
{
|
{
|
||||||
private Map<String, Object> getContextSession()
|
private static Map<String, Object> getContextSession()
|
||||||
{
|
{
|
||||||
ActionContext context = ActionContext.getContext();
|
ActionContext context = ActionContext.getContext();
|
||||||
Map<String, Object> sessionMap = context.getSession();
|
Map<String, Object> sessionMap = context.getSession();
|
||||||
@ -54,7 +49,7 @@ private Map<String, Object> getContextSession()
|
|||||||
return sessionMap;
|
return sessionMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SecuritySession getSecuritySession()
|
private static SecuritySession getSecuritySession()
|
||||||
{
|
{
|
||||||
SecuritySession securitySession =
|
SecuritySession securitySession =
|
||||||
(SecuritySession) getContextSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
|
(SecuritySession) getContextSession().get( SecuritySystemConstants.SECURITY_SESSION_KEY );
|
||||||
@ -67,7 +62,7 @@ private SecuritySession getSecuritySession()
|
|||||||
return securitySession;
|
return securitySession;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getActivePrincipal()
|
public static String getActivePrincipal()
|
||||||
{
|
{
|
||||||
SecuritySession securitySession = getSecuritySession();
|
SecuritySession securitySession = getSecuritySession();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user