mirror of https://github.com/apache/archiva.git
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 @@ 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: ";
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -46,8 +46,6 @@ import java.util.List;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.dependency.DependencyGraphFactory"
|
||||
*/
|
||||
public class DependencyGraphFactory
|
||||
{
|
||||
|
|
|
@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -32,11 +32,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -29,11 +29,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkBreadthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -42,11 +42,6 @@ import java.util.Map.Entry;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -34,11 +34,6 @@ import org.apache.maven.archiva.model.VersionedReference;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -30,11 +30,6 @@ import org.apache.maven.archiva.dependency.graph.walk.WalkDepthFirstSearch;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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
|
||||
|
|
|
@ -30,10 +30,6 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component
|
||||
* role="org.apache.commons.collections.Predicate"
|
||||
* role-hint="index-exists"
|
||||
*/
|
||||
public class IndexExistsPredicate
|
||||
implements Predicate
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -29,8 +29,6 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.repository.content.PathParser" role-hint="default"
|
||||
*/
|
||||
public class DefaultPathParser implements PathParser
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.util.Set;
|
|||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
|
|
|
@ -42,6 +42,8 @@ import java.util.Set;
|
|||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
|
|
|
@ -31,6 +31,8 @@ import org.apache.maven.archiva.repository.layout.LayoutException;
|
|||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
|
|
|
@ -34,25 +34,14 @@ import org.apache.maven.archiva.repository.metadata.MetadataTools;
|
|||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @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"
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -47,10 +47,6 @@ import java.util.Properties;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component
|
||||
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
||||
* role-hint="model300"
|
||||
*/
|
||||
public class ProjectModel300Reader
|
||||
implements ProjectModelReader
|
||||
|
|
|
@ -51,10 +51,6 @@ import java.util.Properties;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component
|
||||
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
||||
* role-hint="model400"
|
||||
*/
|
||||
public class ProjectModel400Reader
|
||||
implements ProjectModelReader
|
||||
|
|
|
@ -35,8 +35,6 @@ import java.util.List;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.repository.project.resolvers.ProjectModelResolverStack"
|
||||
*/
|
||||
public class ProjectModelResolverStack
|
||||
{
|
||||
|
|
|
@ -58,10 +58,6 @@ import java.util.List;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component
|
||||
* role="org.apache.maven.archiva.repository.project.ProjectModelWriter"
|
||||
* role-hint="model400"
|
||||
*/
|
||||
public class ProjectModel400Writer
|
||||
implements ProjectModelWriter
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ProjectModel400WriterTest
|
|||
{
|
||||
super.setUp();
|
||||
|
||||
modelWriter = (ProjectModelWriter) lookup( ProjectModelWriter.class, "model400" );
|
||||
modelWriter = new ProjectModel400Writer();
|
||||
}
|
||||
|
||||
public void testSimpleWrite()
|
||||
|
|
|
@ -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" );
|
||||
|
||||
|
|
|
@ -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 @@ 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<String> getObservableRepos()
|
||||
|
|
|
@ -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<String> getObservableRepos()
|
||||
|
|
|
@ -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<String> getObservableRepos()
|
||||
|
|
|
@ -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<String> 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 )
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -31,10 +31,6 @@ import org.slf4j.LoggerFactory;
|
|||
*
|
||||
* @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component
|
||||
* role="org.apache.maven.archiva.web.startup.Banner"
|
||||
* role-hint="default"
|
||||
*/
|
||||
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 @@ 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,23 +60,56 @@ public class CopyPasteSnippetTag
|
|||
public int doEndTag()
|
||||
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
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
@ -75,4 +122,59 @@ public class CopyPasteSnippetTag
|
|||
{
|
||||
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 @@ 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 <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
|
||||
* @version $Id$
|
||||
*
|
||||
* @plexus.component role="org.apache.maven.archiva.security.ArchivaUser"
|
||||
* role-hint="xwork"
|
||||
*/
|
||||
public class ArchivaXworkUser
|
||||
implements ArchivaUser
|
||||
{
|
||||
private Map<String, Object> getContextSession()
|
||||
private static Map<String, Object> getContextSession()
|
||||
{
|
||||
ActionContext context = ActionContext.getContext();
|
||||
Map<String, Object> 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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue