You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2010/12/29 07:14:07 UTC
svn commit: r1053542 [3/7] - in /archiva/trunk/archiva-modules:
archiva-base/archiva-consumers/archiva-core-consumers/
archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/
archiva-base/...
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/MergeAction.java Wed Dec 29 06:14:04 2010
@@ -19,30 +19,30 @@ package org.apache.maven.archiva.web.act
* under the License.
*/
-import com.opensymphony.xwork2.Validateable;
import com.opensymphony.xwork2.Preparable;
-import org.apache.archiva.audit.Auditable;
+import com.opensymphony.xwork2.Validateable;
import org.apache.archiva.audit.AuditEvent;
-import org.apache.archiva.stagerepository.merge.Maven2RepositoryMerger;
+import org.apache.archiva.audit.Auditable;
import org.apache.archiva.metadata.model.ArtifactMetadata;
+import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.filter.Filter;
import org.apache.archiva.metadata.repository.filter.IncludesFilter;
-import org.apache.archiva.metadata.repository.MetadataRepository;
-import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
-import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.archiva.stagerepository.merge.Maven2RepositoryMerger;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
+import org.apache.maven.archiva.configuration.Configuration;
+import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
import org.apache.maven.archiva.web.action.admin.SchedulerAction;
-import java.util.List;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
/**
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="mergeAction" instantiation-strategy="per-lookup"
*/
-public class
- MergeAction
+public class MergeAction
extends PlexusActionSupport
implements Validateable, Preparable, Auditable
@@ -58,11 +58,6 @@ public class
protected ArchivaConfiguration archivaConfiguration;
/**
- * @plexus.requirement role-hint="default"
- */
- private MetadataRepository metadataRepository;
-
- /**
* @plexus.requirement role="com.opensymphony.xwork2.Action" role-hint="schedulerAction"
*/
private SchedulerAction scheduler;
@@ -101,17 +96,19 @@ public class
public String doMerge()
throws Exception
{
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
+ MetadataRepository metadataRepository = repositorySession.getRepository();
List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepoId );
if ( repository.isReleases() && !repository.isSnapshots() )
{
- mergeWithOutSnapshots( sourceArtifacts, sourceRepoId, repoid );
+ mergeWithOutSnapshots( metadataRepository, sourceArtifacts, sourceRepoId, repoid );
}
else
{
- repositoryMerger.merge( sourceRepoId, repoid );
+ repositoryMerger.merge( metadataRepository, sourceRepoId, repoid );
for ( ArtifactMetadata metadata : sourceArtifacts )
{
@@ -130,25 +127,31 @@ public class
addActionError( "Error occurred while merging the repositories." );
return ERROR;
}
+ finally
+ {
+ repositorySession.close();
+ }
}
public String mergeBySkippingConflicts()
{
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
+ MetadataRepository metadataRepository = repositorySession.getRepository();
List<ArtifactMetadata> sourceArtifacts = metadataRepository.getArtifacts( sourceRepoId );
sourceArtifacts.removeAll( conflictSourceArtifacts );
if ( repository.isReleases() && !repository.isSnapshots() )
{
- mergeWithOutSnapshots( sourceArtifacts, sourceRepoId, repoid );
+ mergeWithOutSnapshots( metadataRepository, sourceArtifacts, sourceRepoId, repoid );
}
else
{
- Filter<ArtifactMetadata> artifactsWithOutConflicts =
- new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
- repositoryMerger.merge( sourceRepoId, repoid, artifactsWithOutConflicts );
+ Filter<ArtifactMetadata> artifactsWithOutConflicts = new IncludesFilter<ArtifactMetadata>(
+ sourceArtifacts );
+ repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactsWithOutConflicts );
for ( ArtifactMetadata metadata : sourceArtifacts )
{
triggerAuditEvent( repoid, metadata.getId(), AuditEvent.MERGING_REPOSITORIES );
@@ -165,22 +168,31 @@ public class
addActionError( "Error occurred while merging the repositories." );
return ERROR;
}
+ finally
+ {
+ repositorySession.close();
+ }
}
- public String mergeWithOutConlficts()
+ public String mergeWithOutConlficts()
{
-
sourceRepoId = repoid + "-stage";
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
- conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( sourceRepoId, repoid );
+ conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(),
+ sourceRepoId, repoid );
}
catch ( Exception e )
{
addActionError( "Error occurred while merging the repositories." );
return ERROR;
}
+ finally
+ {
+ repositorySession.close();
+ }
addActionMessage( "Repository '" + sourceRepoId + "' successfully merged to '" + repoid + "'." );
@@ -201,9 +213,18 @@ public class
throws Exception
{
sourceRepoId = repoid + "-stage";
- conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( sourceRepoId, repoid );
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ conflictSourceArtifacts = repositoryMerger.getConflictingArtifacts( repositorySession.getRepository(),
+ sourceRepoId, repoid );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
this.scheduler.setRepoid( repoid );
-
+
Configuration config = archivaConfiguration.getConfiguration();
this.repository = config.findManagedRepositoryById( repoid );
setConflictSourceArtifactsToBeDisplayed( conflictSourceArtifacts );
@@ -263,7 +284,8 @@ public class
}
}
- private void mergeWithOutSnapshots( List<ArtifactMetadata> sourceArtifacts, String sourceRepoId, String repoid )
+ private void mergeWithOutSnapshots( MetadataRepository metadataRepository, List<ArtifactMetadata> sourceArtifacts,
+ String sourceRepoId, String repoid )
throws Exception
{
List<ArtifactMetadata> artifactsWithOutSnapshots = new ArrayList<ArtifactMetadata>();
@@ -283,7 +305,7 @@ public class
sourceArtifacts.removeAll( artifactsWithOutSnapshots );
Filter<ArtifactMetadata> artifactListWithOutSnapShots = new IncludesFilter<ArtifactMetadata>( sourceArtifacts );
- repositoryMerger.merge( sourceRepoId, repoid, artifactListWithOutSnapShots );
+ repositoryMerger.merge( metadataRepository, sourceRepoId, repoid, artifactListWithOutSnapShots );
}
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java Wed Dec 29 06:14:04 2010
@@ -24,6 +24,7 @@ import com.opensymphony.xwork2.ActionSup
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.audit.AuditListener;
import org.apache.archiva.audit.Auditable;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.maven.archiva.security.ArchivaXworkUser;
import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.SessionAware;
@@ -51,9 +52,14 @@ public abstract class PlexusActionSuppor
*/
private List<AuditListener> auditListeners = new ArrayList<AuditListener>();
+ /**
+ * @plexus.requirement
+ */
+ protected RepositorySessionFactory repositorySessionFactory;
+
private String principal;
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public void setSession( Map map )
{
this.session = map;
@@ -78,7 +84,7 @@ public abstract class PlexusActionSuppor
{
AuditEvent event = new AuditEvent( repositoryId, getPrincipal(), resource, action );
event.setRemoteIP( getRemoteAddr() );
-
+
for ( AuditListener listener : auditListeners )
{
listener.auditEvent( event );
@@ -89,7 +95,7 @@ public abstract class PlexusActionSuppor
{
AuditEvent event = new AuditEvent( null, getPrincipal(), resource, action );
event.setRemoteIP( getRemoteAddr() );
-
+
for ( AuditListener listener : auditListeners )
{
listener.auditEvent( event );
@@ -100,7 +106,7 @@ public abstract class PlexusActionSuppor
{
AuditEvent event = new AuditEvent( null, getPrincipal(), null, action );
event.setRemoteIP( getRemoteAddr() );
-
+
for ( AuditListener listener : auditListeners )
{
listener.auditEvent( event );
@@ -122,7 +128,7 @@ public abstract class PlexusActionSuppor
}
return ArchivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );
}
-
+
void setPrincipal( String principal )
{
this.principal = principal;
@@ -132,4 +138,9 @@ public abstract class PlexusActionSuppor
{
this.auditListeners = auditListeners;
}
+
+ public void setRepositorySessionFactory( RepositorySessionFactory repositorySessionFactory )
+ {
+ this.repositorySessionFactory = repositorySessionFactory;
+ }
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/SearchAction.java Wed Dec 29 06:14:04 2010
@@ -1,5 +1,5 @@
package org.apache.maven.archiva.web.action;
-
+
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,12 +19,6 @@ package org.apache.maven.archiva.web.act
* under the License.
*/
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
import com.opensymphony.xwork2.Preparable;
import org.apache.archiva.indexer.search.RepositorySearch;
import org.apache.archiva.indexer.search.RepositorySearchException;
@@ -34,6 +28,7 @@ import org.apache.archiva.indexer.search
import org.apache.archiva.indexer.search.SearchResults;
import org.apache.archiva.metadata.model.ArtifactMetadata;
import org.apache.archiva.metadata.repository.MetadataRepository;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.common.utils.VersionUtil;
@@ -43,12 +38,18 @@ import org.apache.struts2.ServletActionC
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
/**
* Search all indexed fields by the given criteria.
*
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="searchAction" instantiation-strategy="per-lookup"
*/
-public class SearchAction
+public class SearchAction
extends AbstractRepositoryBasedAction
implements Preparable
{
@@ -70,15 +71,15 @@ public class SearchAction
private static final String ARTIFACT = "artifact";
private List<ArtifactMetadata> databaseResults;
-
+
private int currentPage = 0;
-
+
private int totalPages;
-
+
private boolean searchResultsOnly;
-
+
private String completeQueryString;
-
+
private static final String COMPLETE_QUERY_STRING_SEPARATOR = ";";
private List<String> managedRepositoryList;
@@ -102,16 +103,11 @@ public class SearchAction
private boolean fromResultsPage;
private RepositorySearch nexusSearch;
-
+
private Map<String, String> searchFields;
private String infoMessage;
- /**
- * @plexus.requirement
- */
- private MetadataRepository metadataRepository;
-
public boolean isFromResultsPage()
{
return fromResultsPage;
@@ -141,25 +137,25 @@ public class SearchAction
{
managedRepositoryList.add( "all" );
}
-
+
searchFields = new LinkedHashMap<String, String>();
searchFields.put( "groupId", "Group ID" );
searchFields.put( "artifactId", "Artifact ID" );
searchFields.put( "version", "Version" );
- searchFields.put( "className", "Class/Package Name" );
+ searchFields.put( "className", "Class/Package Name" );
searchFields.put( "rowCount", "Row Count" );
-
- super.clearErrorsAndMessages();
+
+ super.clearErrorsAndMessages();
clearSearchFields();
}
-
+
private void clearSearchFields()
{
repositoryId = "";
artifactId = "";
groupId = "";
version = "";
- className = "";
+ className = "";
rowCount = 30;
currentPage = 0;
}
@@ -167,44 +163,42 @@ public class SearchAction
// advanced search MRM-90 -- filtered search
public String filteredSearch()
throws MalformedURLException
- {
- if ( ( groupId == null || "".equals( groupId ) ) &&
- ( artifactId == null || "".equals( artifactId ) ) && ( className == null || "".equals( className ) ) &&
- ( version == null || "".equals( version ) ) )
- {
+ {
+ if ( ( groupId == null || "".equals( groupId ) ) && ( artifactId == null || "".equals( artifactId ) ) &&
+ ( className == null || "".equals( className ) ) && ( version == null || "".equals( version ) ) )
+ {
addActionError( "Advanced Search - At least one search criteria must be provided." );
return INPUT;
}
-
+
fromFilterSearch = true;
-
+
if ( CollectionUtils.isEmpty( managedRepositoryList ) )
- {
+ {
return GlobalResults.ACCESS_TO_NO_REPOS;
}
SearchResultLimits limits = new SearchResultLimits( currentPage );
limits.setPageSize( rowCount );
List<String> selectedRepos = new ArrayList<String>();
-
- if ( repositoryId == null || StringUtils.isBlank( repositoryId ) ||
- "all".equals( StringUtils.stripToEmpty( repositoryId ) ) )
+
+ if ( repositoryId == null || StringUtils.isBlank( repositoryId ) || "all".equals( StringUtils.stripToEmpty(
+ repositoryId ) ) )
{
selectedRepos = getObservableRepos();
}
else
{
selectedRepos.add( repositoryId );
- }
+ }
if ( CollectionUtils.isEmpty( selectedRepos ) )
- {
+ {
return GlobalResults.ACCESS_TO_NO_REPOS;
}
- SearchFields searchFields =
- new SearchFields( groupId, artifactId, version, null, className, selectedRepos );
-
+ SearchFields searchFields = new SearchFields( groupId, artifactId, version, null, className, selectedRepos );
+
// TODO: add packaging in the list of fields for advanced search (UI)?
try
{
@@ -215,7 +209,7 @@ public class SearchAction
addActionError( e.getMessage() );
return ERROR;
}
-
+
if ( results.isEmpty() )
{
addActionError( "No results found" );
@@ -229,19 +223,19 @@ public class SearchAction
totalPages = totalPages + 1;
}
- for (SearchResultHit hit : results.getHits())
+ for ( SearchResultHit hit : results.getHits() )
{
final String version = hit.getVersion();
- if (version != null)
+ if ( version != null )
{
- hit.setVersion(VersionUtil.getBaseVersion(version));
+ hit.setVersion( VersionUtil.getBaseVersion( version ) );
}
}
return SUCCESS;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public String quickSearch()
throws MalformedURLException
{
@@ -265,14 +259,15 @@ public class SearchAction
try
{
- if( searchResultsOnly && !completeQueryString.equals( "" ) )
- {
- results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString() );
+ if ( searchResultsOnly && !completeQueryString.equals( "" ) )
+ {
+ results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits,
+ parseCompleteQueryString() );
}
else
{
- completeQueryString = "";
- results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, null );
+ completeQueryString = "";
+ results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, null );
}
}
catch ( RepositorySearchException e )
@@ -289,16 +284,16 @@ public class SearchAction
totalPages = results.getTotalHits() / limits.getPageSize();
- if( (results.getTotalHits() % limits.getPageSize()) != 0 )
+ if ( ( results.getTotalHits() % limits.getPageSize() ) != 0 )
{
totalPages = totalPages + 1;
}
- if( !isEqualToPreviousSearchTerm( q ) )
+ if ( !isEqualToPreviousSearchTerm( q ) )
{
buildCompleteQueryString( q );
}
-
+
return SUCCESS;
}
@@ -314,9 +309,18 @@ public class SearchAction
}
databaseResults = new ArrayList<ArtifactMetadata>();
- for ( String repoId : getObservableRepos() )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ for ( String repoId : getObservableRepos() )
+ {
+ databaseResults.addAll( metadataRepository.getArtifactsByChecksum( repoId, q ) );
+ }
+ }
+ finally
{
- databaseResults.addAll( metadataRepository.getArtifactsByChecksum( repoId, q ) );
+ repositorySession.close();
}
if ( databaseResults.isEmpty() )
@@ -333,7 +337,7 @@ public class SearchAction
return RESULTS;
}
-
+
public String doInput()
{
return INPUT;
@@ -541,11 +545,11 @@ public class SearchAction
public RepositorySearch getNexusSearch()
{
// no need to do this when wiring is already in spring
- if( nexusSearch == null )
+ if ( nexusSearch == null )
{
- WebApplicationContext wac =
- WebApplicationContextUtils.getRequiredWebApplicationContext( ServletActionContext.getServletContext() );
- nexusSearch = ( RepositorySearch ) wac.getBean( "nexusSearch" );
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(
+ ServletActionContext.getServletContext() );
+ nexusSearch = (RepositorySearch) wac.getBean( "nexusSearch" );
}
return nexusSearch;
}
@@ -564,7 +568,7 @@ public class SearchAction
{
this.searchFields = searchFields;
}
-
+
public String getInfoMessage()
{
return infoMessage;
@@ -574,9 +578,4 @@ public class SearchAction
{
this.infoMessage = infoMessage;
}
-
- public void setMetadataRepository( MetadataRepository metadataRepository )
- {
- this.metadataRepository = metadataRepository;
- }
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java Wed Dec 29 06:14:04 2010
@@ -30,6 +30,7 @@ import org.apache.archiva.metadata.repos
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
import org.apache.archiva.metadata.repository.MetadataResolutionException;
import org.apache.archiva.metadata.repository.MetadataResolver;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.storage.maven2.MavenArtifactFacet;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.model.ArtifactReference;
@@ -66,18 +67,8 @@ public class ShowArtifactAction
/**
* @plexus.requirement
*/
- private MetadataResolver metadataResolver;
-
- /**
- * @plexus.requirement
- */
private RepositoryContentFactory repositoryFactory;
- /**
- * @plexus.requirement
- */
- private MetadataRepository metadataRepository;
-
/* .\ Exposed Output Objects \.__________________________________ */
private String groupId;
@@ -120,15 +111,26 @@ public class ShowArtifactAction
*/
public String artifact()
{
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ return handleArtifact( repositorySession );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
+ }
+ private String handleArtifact( RepositorySession session )
+ {
// In the future, this should be replaced by the repository grouping mechanism, so that we are only making
// simple resource requests here and letting the resolver take care of it
- String errorMsg = null;
- ProjectVersionMetadata versionMetadata = getProjectVersionMetadata();
+ ProjectVersionMetadata versionMetadata = getProjectVersionMetadata( session );
if ( versionMetadata == null )
{
- addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
+ addActionError( "Artifact not found" );
return ERROR;
}
@@ -142,13 +144,14 @@ public class ShowArtifactAction
return SUCCESS;
}
- private ProjectVersionMetadata getProjectVersionMetadata()
+ private ProjectVersionMetadata getProjectVersionMetadata( RepositorySession session )
{
ProjectVersionMetadata versionMetadata = null;
artifacts = new LinkedHashMap<String, List<ArtifactDownloadInfo>>();
List<String> repos = getObservableRepos();
+ MetadataResolver metadataResolver = session.getResolver();
for ( String repoId : repos )
{
if ( versionMetadata == null )
@@ -157,7 +160,8 @@ public class ShowArtifactAction
// "just-in-time" nature of picking up the metadata (if appropriate for the repository type) is used
try
{
- versionMetadata = metadataResolver.resolveProjectVersion( repoId, groupId, artifactId, version );
+ versionMetadata = metadataResolver.resolveProjectVersion( session, repoId, groupId, artifactId,
+ version );
}
catch ( MetadataResolutionException e )
{
@@ -174,7 +178,8 @@ public class ShowArtifactAction
List<ArtifactMetadata> artifacts;
try
{
- artifacts = new ArrayList<ArtifactMetadata>( metadataResolver.resolveArtifacts( repoId, groupId,
+ artifacts = new ArrayList<ArtifactMetadata>( metadataResolver.resolveArtifacts( session, repoId,
+ groupId,
artifactId,
version ) );
}
@@ -262,10 +267,20 @@ public class ShowArtifactAction
{
List<ProjectVersionReference> references = new ArrayList<ProjectVersionReference>();
// TODO: what if we get duplicates across repositories?
- for ( String repoId : getObservableRepos() )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- // TODO: what about if we want to see this irrespective of version?
- references.addAll( metadataResolver.resolveProjectReferences( repoId, groupId, artifactId, version ) );
+ MetadataResolver metadataResolver = repositorySession.getResolver();
+ for ( String repoId : getObservableRepos() )
+ {
+ // TODO: what about if we want to see this irrespective of version?
+ references.addAll( metadataResolver.resolveProjectReferences( repositorySession, repoId, groupId,
+ artifactId, version ) );
+ }
+ }
+ finally
+ {
+ repositorySession.close();
}
this.dependees = references;
@@ -314,47 +329,57 @@ public class ShowArtifactAction
public String addMetadataProperty()
{
- String errorMsg = null;
-
- ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
- if ( projectMetadata == null )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ ProjectVersionMetadata projectMetadata;
+ try
{
- addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
- return ERROR;
- }
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ projectMetadata = getProjectVersionMetadata( repositorySession );
+ if ( projectMetadata == null )
+ {
+ addActionError( "Artifact not found" );
+ return ERROR;
+ }
- if ( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) == null )
- {
- genericMetadata = new HashMap<String, String>();
- }
- else
- {
- genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
- }
+ if ( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) == null )
+ {
+ genericMetadata = new HashMap<String, String>();
+ }
+ else
+ {
+ genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
+ }
- if ( propertyName == null || "".equals( propertyName.trim() ) || propertyValue == null || "".equals(
- propertyValue.trim() ) )
- {
- model = projectMetadata;
- addActionError( errorMsg != null ? errorMsg : "Property Name and Property Value are required." );
- return INPUT;
- }
+ if ( propertyName == null || "".equals( propertyName.trim() ) || propertyValue == null || "".equals(
+ propertyValue.trim() ) )
+ {
+ model = projectMetadata;
+ addActionError( "Property Name and Property Value are required." );
+ return INPUT;
+ }
- genericMetadata.put( propertyName, propertyValue );
+ genericMetadata.put( propertyName, propertyValue );
- try
- {
- updateProjectMetadata( projectMetadata );
+ try
+ {
+ updateProjectMetadata( projectMetadata, metadataRepository );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to persist modified project metadata after adding entry: " + e.getMessage(), e );
+ addActionError(
+ "Unable to add metadata item to underlying content storage - consult application logs." );
+ return ERROR;
+ }
+
+ // TODO: why re-retrieve?
+ projectMetadata = getProjectVersionMetadata( repositorySession );
}
- catch ( MetadataRepositoryException e )
+ finally
{
- log.warn( "Unable to persist modified project metadata after adding entry: " + e.getMessage(), e );
- addActionError( "Unable to add metadata item to underlying content storage - consult application logs." );
- return ERROR;
+ repositorySession.close();
}
- projectMetadata = getProjectVersionMetadata();
-
genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
model = projectMetadata;
@@ -367,57 +392,66 @@ public class ShowArtifactAction
public String deleteMetadataEntry()
{
- ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
- String errorMsg = null;
-
- if ( projectMetadata == null )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- addActionError( "Artifact not found" );
- return ERROR;
- }
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ ProjectVersionMetadata projectMetadata = getProjectVersionMetadata( repositorySession );
- if ( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) != null )
- {
- genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
+ if ( projectMetadata == null )
+ {
+ addActionError( "Artifact not found" );
+ return ERROR;
+ }
- if ( !StringUtils.isEmpty( deleteItem ) )
+ if ( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) != null )
{
- genericMetadata.remove( deleteItem );
+ genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
- try
- {
- updateProjectMetadata( projectMetadata );
- }
- catch ( MetadataRepositoryException e )
+ if ( !StringUtils.isEmpty( deleteItem ) )
{
- log.warn( "Unable to persist modified project metadata after removing entry: " + e.getMessage(),
- e );
- addActionError(
- "Unable to remove metadata item to underlying content storage - consult application logs." );
- return ERROR;
- }
+ genericMetadata.remove( deleteItem );
- projectMetadata = getProjectVersionMetadata();
+ try
+ {
+ updateProjectMetadata( projectMetadata, metadataRepository );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to persist modified project metadata after removing entry: " + e.getMessage(),
+ e );
+ addActionError(
+ "Unable to remove metadata item to underlying content storage - consult application logs." );
+ return ERROR;
+ }
- genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
+ // TODO: why re-retrieve?
+ projectMetadata = getProjectVersionMetadata( repositorySession );
- model = projectMetadata;
+ genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
- addActionMessage( "Property successfully deleted." );
- }
+ model = projectMetadata;
+
+ addActionMessage( "Property successfully deleted." );
+ }
- deleteItem = "";
+ deleteItem = "";
+ }
+ else
+ {
+ addActionError( "No generic metadata facet for this artifact." );
+ return ERROR;
+ }
}
- else
+ finally
{
- addActionError( "No generic metadata facet for this artifact." );
- return ERROR;
+ repositorySession.close();
}
return SUCCESS;
}
- private void updateProjectMetadata( ProjectVersionMetadata projectMetadata )
+ private void updateProjectMetadata( ProjectVersionMetadata projectMetadata, MetadataRepository metadataRepository )
throws MetadataRepositoryException
{
GenericMetadataFacet genericMetadataFacet = new GenericMetadataFacet();
@@ -507,11 +541,6 @@ public class ShowArtifactAction
this.repositoryId = repositoryId;
}
- public MetadataResolver getMetadataResolver()
- {
- return metadataResolver;
- }
-
public Map<String, List<ArtifactDownloadInfo>> getArtifacts()
{
return artifacts;
@@ -567,11 +596,6 @@ public class ShowArtifactAction
this.repositoryFactory = repositoryFactory;
}
- public void setMetadataRepository( MetadataRepository metadataRepository )
- {
- this.metadataRepository = metadataRepository;
- }
-
// TODO: move this into the artifact metadata itself via facets where necessary
public class ArtifactDownloadInfo
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/DeleteManagedRepositoryAction.java Wed Dec 29 06:14:04 2010
@@ -23,6 +23,7 @@ import com.opensymphony.xwork2.Preparabl
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
@@ -55,11 +56,6 @@ public class DeleteManagedRepositoryActi
*/
private RepositoryStatisticsManager repositoryStatisticsManager;
- /**
- * @plexus.requirement
- */
- private MetadataRepository metadataRepository;
-
public void prepare()
{
if ( StringUtils.isNotBlank( repoid ) )
@@ -103,17 +99,18 @@ public class DeleteManagedRepositoryActi
String result;
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
Configuration configuration = archivaConfiguration.getConfiguration();
if ( attachedStagingRepo != null )
{
- cleanupRepositoryData( attachedStagingRepo );
+ cleanupRepositoryData( attachedStagingRepo, repositorySession );
removeRepository( repoid + "-stage", configuration );
triggerAuditEvent( repoid + "-stage", null, AuditEvent.DELETE_MANAGED_REPO );
}
- cleanupRepositoryData( existingRepository );
+ cleanupRepositoryData( existingRepository, repositorySession );
removeRepository( repoid, configuration );
triggerAuditEvent( repoid, null, AuditEvent.DELETE_MANAGED_REPO );
result = saveConfiguration( configuration );
@@ -148,17 +145,24 @@ public class DeleteManagedRepositoryActi
"Unable to delete repository, content may already be partially removed: " + e.getMessage() );
result = ERROR;
}
+ finally
+ {
+ repositorySession.close();
+ }
return result;
}
- private void cleanupRepositoryData( ManagedRepositoryConfiguration cleanupRepository )
+ private void cleanupRepositoryData( ManagedRepositoryConfiguration cleanupRepository,
+ RepositorySession repositorySession )
throws RoleManagerException, MetadataRepositoryException
{
removeRepositoryRoles( cleanupRepository );
- cleanupDatabase( cleanupRepository.getId() );
- repositoryStatisticsManager.deleteStatistics( cleanupRepository.getId() );
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ cleanupDatabase( metadataRepository, cleanupRepository.getId() );
+ repositoryStatisticsManager.deleteStatistics( metadataRepository, cleanupRepository.getId() );
// TODO: delete all content for a repository from the content API?
+ repositorySession.save();
List<ProxyConnectorConfiguration> proxyConnectors = getProxyConnectors();
for ( ProxyConnectorConfiguration proxyConnector : proxyConnectors )
@@ -184,7 +188,7 @@ public class DeleteManagedRepositoryActi
}
}
- private void cleanupDatabase( String repoId )
+ private void cleanupDatabase( MetadataRepository metadataRepository, String repoId )
throws MetadataRepositoryException
{
metadataRepository.removeRepository( repoId );
@@ -214,9 +218,4 @@ public class DeleteManagedRepositoryActi
{
this.repositoryStatisticsManager = repositoryStatisticsManager;
}
-
- public void setMetadataRepository( MetadataRepository metadataRepository )
- {
- this.metadataRepository = metadataRepository;
- }
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/EditManagedRepositoryAction.java Wed Dec 29 06:14:04 2010
@@ -23,6 +23,7 @@ import com.opensymphony.xwork2.Preparabl
import com.opensymphony.xwork2.Validateable;
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.Configuration;
@@ -127,6 +128,7 @@ public class EditManagedRepositoryAction
// Save the repository configuration.
String result;
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
try
{
addRepository( repository, configuration );
@@ -154,7 +156,8 @@ public class EditManagedRepositoryAction
result = saveConfiguration( configuration );
if ( resetStats )
{
- resetStatistics();
+ repositoryStatisticsManager.deleteStatistics( repositorySession.getRepository(), repository.getId() );
+ repositorySession.save();
}
}
catch ( IOException e )
@@ -172,6 +175,10 @@ public class EditManagedRepositoryAction
addActionError( "Metadata Exception: " + e.getMessage() );
result = ERROR;
}
+ finally
+ {
+ repositorySession.close();
+ }
return result;
}
@@ -225,12 +232,6 @@ public class EditManagedRepositoryAction
}
}
- private void resetStatistics()
- throws MetadataRepositoryException
- {
- repositoryStatisticsManager.deleteStatistics( repository.getId() );
- }
-
public String getRepoid()
{
return repoid;
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoriesAction.java Wed Dec 29 06:14:04 2010
@@ -20,7 +20,9 @@ package org.apache.maven.archiva.web.act
*/
import com.opensymphony.xwork2.Preparable;
+import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
@@ -107,24 +109,33 @@ public class RepositoriesAction
Collections.sort( remoteRepositories, new RepositoryConfigurationComparator() );
repositoryStatistics = new HashMap<String, RepositoryStatistics>();
- for ( ManagedRepositoryConfiguration repo : managedRepositories )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- RepositoryStatistics stats = null;
- try
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ for ( ManagedRepositoryConfiguration repo : managedRepositories )
{
- stats = repositoryStatisticsManager.getLastStatistics( repo.getId() );
- }
- catch ( MetadataRepositoryException e )
- {
- addActionError(
- "Error retrieving statistics for repository " + repo.getId() + " - consult application logs" );
- log.warn( "Error retrieving repository statistics: " + e.getMessage(), e );
- }
- if ( stats != null )
- {
- repositoryStatistics.put( repo.getId(), stats );
+ RepositoryStatistics stats = null;
+ try
+ {
+ stats = repositoryStatisticsManager.getLastStatistics( metadataRepository, repo.getId() );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ addActionError(
+ "Error retrieving statistics for repository " + repo.getId() + " - consult application logs" );
+ log.warn( "Error retrieving repository statistics: " + e.getMessage(), e );
+ }
+ if ( stats != null )
+ {
+ repositoryStatistics.put( repo.getId(), stats );
+ }
}
}
+ finally
+ {
+ repositorySession.close();
+ }
}
public List<ManagedRepositoryConfiguration> getManagedRepositories()
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/GenerateReportAction.java Wed Dec 29 06:14:04 2010
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.act
import com.opensymphony.xwork2.Preparable;
import org.apache.archiva.metadata.repository.MetadataRepository;
import org.apache.archiva.metadata.repository.MetadataRepositoryException;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.archiva.metadata.repository.stats.RepositoryStatistics;
import org.apache.archiva.metadata.repository.stats.RepositoryStatisticsManager;
import org.apache.archiva.reports.RepositoryProblemFacet;
@@ -110,11 +111,6 @@ public class GenerateReportAction
private boolean lastPage;
- /**
- * @plexus.requirement
- */
- private MetadataRepository metadataRepository;
-
@SuppressWarnings( "unchecked" )
public void prepare()
{
@@ -163,112 +159,123 @@ public class GenerateReportAction
Date startDateInDF;
Date endDateInDF;
- if ( selectedRepositories.size() > 1 )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- numPages = 1;
-
- try
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ if ( selectedRepositories.size() > 1 )
{
- startDateInDF = getStartDateInDateFormat();
- endDateInDF = getEndDateInDateFormat();
- }
- catch ( ParseException e )
- {
- addActionError( "Error parsing date(s)." );
- return ERROR;
- }
+ numPages = 1;
- if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
- {
- addFieldError( "startDate", "Start Date must be earlier than the End Date" );
- return INPUT;
- }
-
- // multiple repos
- for ( String repo : selectedRepositories )
- {
- List<RepositoryStatistics> stats = null;
try
{
- stats = repositoryStatisticsManager.getStatisticsInRange( repo, startDateInDF, endDateInDF );
- }
- catch ( MetadataRepositoryException e )
- {
- log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ startDateInDF = getStartDateInDateFormat();
+ endDateInDF = getEndDateInDateFormat();
}
- if ( stats == null || stats.isEmpty() )
+ catch ( ParseException e )
{
- log.info( "No statistics available for repository '" + repo + "'." );
- // TODO set repo's stats to 0
- continue;
+ addActionError( "Error parsing date(s)." );
+ return ERROR;
}
- repositoryStatistics.add( stats.get( 0 ) );
- }
- }
- else if ( selectedRepositories.size() == 1 )
- {
- repositoryId = selectedRepositories.get( 0 );
- try
- {
- startDateInDF = getStartDateInDateFormat();
- endDateInDF = getEndDateInDateFormat();
-
if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
{
addFieldError( "startDate", "Start Date must be earlier than the End Date" );
return INPUT;
}
- List<RepositoryStatistics> stats = null;
- try
+ // multiple repos
+ for ( String repo : selectedRepositories )
{
- stats = repositoryStatisticsManager.getStatisticsInRange( repositoryId, startDateInDF,
- endDateInDF );
- }
- catch ( MetadataRepositoryException e )
- {
- log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ List<RepositoryStatistics> stats = null;
+ try
+ {
+ stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo,
+ startDateInDF, endDateInDF );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ }
+ if ( stats == null || stats.isEmpty() )
+ {
+ log.info( "No statistics available for repository '" + repo + "'." );
+ // TODO set repo's stats to 0
+ continue;
+ }
+
+ repositoryStatistics.add( stats.get( 0 ) );
}
- if ( stats == null || stats.isEmpty() )
+ }
+ else if ( selectedRepositories.size() == 1 )
+ {
+ repositoryId = selectedRepositories.get( 0 );
+ try
{
- addActionError( "No statistics available for repository. Repository might not have been scanned." );
- return ERROR;
- }
+ startDateInDF = getStartDateInDateFormat();
+ endDateInDF = getEndDateInDateFormat();
- int rowCount = getRowCount();
- int extraPage = ( stats.size() % rowCount ) != 0 ? 1 : 0;
- int totalPages = ( stats.size() / rowCount ) + extraPage;
- numPages = totalPages;
+ if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
+ {
+ addFieldError( "startDate", "Start Date must be earlier than the End Date" );
+ return INPUT;
+ }
+
+ List<RepositoryStatistics> stats = null;
+ try
+ {
+ stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repositoryId,
+ startDateInDF, endDateInDF );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ }
+ if ( stats == null || stats.isEmpty() )
+ {
+ addActionError(
+ "No statistics available for repository. Repository might not have been scanned." );
+ return ERROR;
+ }
+
+ int rowCount = getRowCount();
+ int extraPage = ( stats.size() % rowCount ) != 0 ? 1 : 0;
+ int totalPages = ( stats.size() / rowCount ) + extraPage;
+ numPages = totalPages;
+
+ int currentPage = getPage();
+ if ( currentPage > totalPages )
+ {
+ addActionError(
+ "Error encountered while generating report :: The requested page exceeds the total number of pages." );
+ return ERROR;
+ }
+
+ int start = rowCount * ( currentPage - 1 );
+ int end = ( start + rowCount ) - 1;
+
+ if ( end > stats.size() )
+ {
+ end = stats.size() - 1;
+ }
- int currentPage = getPage();
- if ( currentPage > totalPages )
- {
- addActionError(
- "Error encountered while generating report :: The requested page exceeds the total number of pages." );
- return ERROR;
+ repositoryStatistics = stats.subList( start, end + 1 );
}
-
- int start = rowCount * ( currentPage - 1 );
- int end = ( start + rowCount ) - 1;
-
- if ( end > stats.size() )
+ catch ( ParseException pe )
{
- end = stats.size() - 1;
+ addActionError( pe.getMessage() );
+ return ERROR;
}
-
- repositoryStatistics = stats.subList( start, end + 1 );
}
- catch ( ParseException pe )
+ else
{
- addActionError( pe.getMessage() );
- return ERROR;
+ addFieldError( "availableRepositories", "Please select a repository (or repositories) from the list." );
+ return INPUT;
}
}
- else
+ finally
{
- addFieldError( "availableRepositories", "Please select a repository (or repositories) from the list." );
- return INPUT;
+ repositorySession.close();
}
if ( repositoryStatistics.isEmpty() )
@@ -293,102 +300,58 @@ public class GenerateReportAction
List<RepositoryStatistics> repositoryStatistics = new ArrayList<RepositoryStatistics>();
StringBuffer input;
- if ( selectedRepositories.size() > 1 )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- try
- {
- startDateInDF = getStartDateInDateFormat();
- endDateInDF = getEndDateInDateFormat();
- }
- catch ( ParseException e )
- {
- addActionError( "Error parsing date(s)." );
- return ERROR;
- }
-
- if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
- {
- addFieldError( "startDate", "Start Date must be earlier than the End Date" );
- return INPUT;
- }
-
- input = new StringBuffer(
- "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes," +
- "Jars,Wars\n" );
-
- // multiple repos
- for ( String repo : selectedRepositories )
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ if ( selectedRepositories.size() > 1 )
{
- List<RepositoryStatistics> stats = null;
try
{
- stats = repositoryStatisticsManager.getStatisticsInRange( repo, startDateInDF, endDateInDF );
+ startDateInDF = getStartDateInDateFormat();
+ endDateInDF = getEndDateInDateFormat();
}
- catch ( MetadataRepositoryException e )
+ catch ( ParseException e )
{
- log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
- }
- if ( stats == null || stats.isEmpty() )
- {
- log.info( "No statistics available for repository '" + repo + "'." );
- // TODO set repo's stats to 0
- continue;
+ addActionError( "Error parsing date(s)." );
+ return ERROR;
}
- // only the first one
- RepositoryStatistics repositoryStats = stats.get( 0 );
- repositoryStatistics.add( repositoryStats );
-
- input.append( repo ).append( "," );
- input.append( repositoryStats.getTotalFileCount() ).append( "," );
- input.append( repositoryStats.getTotalArtifactFileSize() ).append( "," );
- input.append( repositoryStats.getTotalArtifactCount() ).append( "," );
- input.append( repositoryStats.getTotalGroupCount() ).append( "," );
- input.append( repositoryStats.getTotalProjectCount() ).append( "," );
- input.append( repositoryStats.getTotalCountForType( "maven-plugin" ) ).append( "," );
- input.append( repositoryStats.getTotalCountForType( "maven-archetype" ) ).append( "," );
- input.append( repositoryStats.getTotalCountForType( "jar" ) ).append( "," );
- input.append( repositoryStats.getTotalCountForType( "war" ) );
- input.append( "\n" );
- }
- }
- else if ( selectedRepositories.size() == 1 )
- {
- repositoryId = selectedRepositories.get( 0 );
- try
- {
- startDateInDF = getStartDateInDateFormat();
- endDateInDF = getEndDateInDateFormat();
-
if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
{
addFieldError( "startDate", "Start Date must be earlier than the End Date" );
return INPUT;
}
- List<RepositoryStatistics> stats = null;
- try
- {
- stats = repositoryStatisticsManager.getStatisticsInRange( repositoryId, startDateInDF,
- endDateInDF );
- }
- catch ( MetadataRepositoryException e )
- {
- log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
- }
- if ( stats == null || stats.isEmpty() )
- {
- addActionError( "No statistics available for repository. Repository might not have been scanned." );
- return ERROR;
- }
-
input = new StringBuffer(
- "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins," +
- "Archetypes,Jars,Wars\n" );
+ "Repository,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins,Archetypes," +
+ "Jars,Wars\n" );
- for ( RepositoryStatistics repositoryStats : stats )
+ // multiple repos
+ for ( String repo : selectedRepositories )
{
- input.append( repositoryStats.getScanStartTime() ).append( "," );
+ List<RepositoryStatistics> stats = null;
+ try
+ {
+ stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repo,
+ startDateInDF, endDateInDF );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ }
+ if ( stats == null || stats.isEmpty() )
+ {
+ log.info( "No statistics available for repository '" + repo + "'." );
+ // TODO set repo's stats to 0
+ continue;
+ }
+
+ // only the first one
+ RepositoryStatistics repositoryStats = stats.get( 0 );
+ repositoryStatistics.add( repositoryStats );
+
+ input.append( repo ).append( "," );
input.append( repositoryStats.getTotalFileCount() ).append( "," );
input.append( repositoryStats.getTotalArtifactFileSize() ).append( "," );
input.append( repositoryStats.getTotalArtifactCount() ).append( "," );
@@ -400,19 +363,74 @@ public class GenerateReportAction
input.append( repositoryStats.getTotalCountForType( "war" ) );
input.append( "\n" );
}
+ }
+ else if ( selectedRepositories.size() == 1 )
+ {
+ repositoryId = selectedRepositories.get( 0 );
+ try
+ {
+ startDateInDF = getStartDateInDateFormat();
+ endDateInDF = getEndDateInDateFormat();
- repositoryStatistics = stats;
+ if ( startDateInDF != null && endDateInDF != null && startDateInDF.after( endDateInDF ) )
+ {
+ addFieldError( "startDate", "Start Date must be earlier than the End Date" );
+ return INPUT;
+ }
+
+ List<RepositoryStatistics> stats = null;
+ try
+ {
+ stats = repositoryStatisticsManager.getStatisticsInRange( metadataRepository, repositoryId,
+ startDateInDF, endDateInDF );
+ }
+ catch ( MetadataRepositoryException e )
+ {
+ log.warn( "Unable to retrieve stats, assuming is empty: " + e.getMessage(), e );
+ }
+ if ( stats == null || stats.isEmpty() )
+ {
+ addActionError(
+ "No statistics available for repository. Repository might not have been scanned." );
+ return ERROR;
+ }
+
+ input = new StringBuffer(
+ "Date of Scan,Total File Count,Total Size,Artifact Count,Group Count,Project Count,Plugins," +
+ "Archetypes,Jars,Wars\n" );
+
+ for ( RepositoryStatistics repositoryStats : stats )
+ {
+ input.append( repositoryStats.getScanStartTime() ).append( "," );
+ input.append( repositoryStats.getTotalFileCount() ).append( "," );
+ input.append( repositoryStats.getTotalArtifactFileSize() ).append( "," );
+ input.append( repositoryStats.getTotalArtifactCount() ).append( "," );
+ input.append( repositoryStats.getTotalGroupCount() ).append( "," );
+ input.append( repositoryStats.getTotalProjectCount() ).append( "," );
+ input.append( repositoryStats.getTotalCountForType( "maven-plugin" ) ).append( "," );
+ input.append( repositoryStats.getTotalCountForType( "maven-archetype" ) ).append( "," );
+ input.append( repositoryStats.getTotalCountForType( "jar" ) ).append( "," );
+ input.append( repositoryStats.getTotalCountForType( "war" ) );
+ input.append( "\n" );
+ }
+
+ repositoryStatistics = stats;
+ }
+ catch ( ParseException pe )
+ {
+ addActionError( pe.getMessage() );
+ return ERROR;
+ }
}
- catch ( ParseException pe )
+ else
{
- addActionError( pe.getMessage() );
- return ERROR;
+ addFieldError( "availableRepositories", "Please select a repository (or repositories) from the list." );
+ return INPUT;
}
}
- else
+ finally
{
- addFieldError( "availableRepositories", "Please select a repository (or repositories) from the list." );
- return INPUT;
+ repositorySession.close();
}
if ( repositoryStatistics.isEmpty() )
@@ -528,20 +546,29 @@ public class GenerateReportAction
}
List<RepositoryProblemFacet> problemArtifacts = new ArrayList<RepositoryProblemFacet>();
- for ( String repoId : repoIds )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
{
- // TODO: improve performance by navigating into a group subtree. Currently group is property, not part of name of item
- for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
+ MetadataRepository metadataRepository = repositorySession.getRepository();
+ for ( String repoId : repoIds )
{
- RepositoryProblemFacet metadataFacet = (RepositoryProblemFacet) metadataRepository.getMetadataFacet(
- repoId, RepositoryProblemFacet.FACET_ID, name );
-
- if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
+ // TODO: improve performance by navigating into a group subtree. Currently group is property, not part of name of item
+ for ( String name : metadataRepository.getMetadataFacets( repoId, RepositoryProblemFacet.FACET_ID ) )
{
- problemArtifacts.add( metadataFacet );
+ RepositoryProblemFacet metadataFacet = (RepositoryProblemFacet) metadataRepository.getMetadataFacet(
+ repoId, RepositoryProblemFacet.FACET_ID, name );
+
+ if ( StringUtils.isEmpty( groupId ) || groupId.equals( metadataFacet.getNamespace() ) )
+ {
+ problemArtifacts.add( metadataFacet );
+ }
}
}
}
+ finally
+ {
+ repositorySession.close();
+ }
// TODO: getting range only after reading is not efficient for a large number of artifacts
int lowerBound = ( page - 1 ) * rowCount;
@@ -727,9 +754,4 @@ public class GenerateReportAction
{
this.repositoryStatisticsManager = repositoryStatisticsManager;
}
-
- public void setMetadataRepository( MetadataRepository metadataRepository )
- {
- this.metadataRepository = metadataRepository;
- }
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/reports/ViewAuditLogReportAction.java Wed Dec 29 06:14:04 2010
@@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.act
import com.opensymphony.xwork2.Preparable;
import org.apache.archiva.audit.AuditEvent;
import org.apache.archiva.audit.AuditManager;
+import org.apache.archiva.metadata.repository.RepositorySession;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;
import org.apache.maven.archiva.security.AccessDeniedException;
@@ -119,7 +120,7 @@ public class ViewAuditLogReportAction
this.request = request;
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings( "unchecked" )
public void prepare()
throws Exception
{
@@ -142,7 +143,15 @@ public class ViewAuditLogReportAction
headerName = HEADER_RESULTS;
}
- auditLogs = auditManager.getMostRecentAuditEvents( repos );
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ auditLogs = auditManager.getMostRecentAuditEvents( repositorySession.getRepository(), repos );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
}
public String execute()
@@ -205,7 +214,16 @@ public class ViewAuditLogReportAction
}
}
- auditLogs = auditManager.getAuditEventsInRange( repos, resource, startDateInDF, endDateInDF );
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ auditLogs = auditManager.getAuditEventsInRange( repositorySession.getRepository(), repos, resource,
+ startDateInDF, endDateInDF );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
if ( auditLogs.isEmpty() )
{
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java Wed Dec 29 06:14:04 2010
@@ -19,20 +19,11 @@ package org.apache.maven.archiva.web.rss
* under the License.
*/
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import com.sun.syndication.feed.synd.SyndFeed;
import com.sun.syndication.io.FeedException;
import com.sun.syndication.io.SyndFeedOutput;
+import org.apache.archiva.metadata.repository.RepositorySession;
+import org.apache.archiva.metadata.repository.RepositorySessionFactory;
import org.apache.archiva.rss.processor.RssFeedProcessor;
import org.apache.commons.codec.Decoder;
import org.apache.commons.codec.DecoderException;
@@ -60,10 +51,19 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
/**
* Servlet for handling rss feed requests.
- *
- * @version
*/
public class RssFeedServlet
extends HttpServlet
@@ -87,18 +87,23 @@ public class RssFeedServlet
private ServletAuthenticator servletAuth;
private HttpAuthenticator httpAuth;
-
+
+ private RepositorySessionFactory repositorySessionFactory;
+
public void init( javax.servlet.ServletConfig servletConfig )
throws ServletException
{
super.init( servletConfig );
wac = WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() );
- userRepositories =
- (UserRepositories) wac.getBean( PlexusToSpringUtils.buildSpringId( UserRepositories.class.getName() ) );
- servletAuth =
- (ServletAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( ServletAuthenticator.class.getName() ) );
- httpAuth =
- (HttpAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE, "basic" ) );
+ userRepositories = (UserRepositories) wac.getBean( PlexusToSpringUtils.buildSpringId(
+ UserRepositories.class.getName() ) );
+ servletAuth = (ServletAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId(
+ ServletAuthenticator.class.getName() ) );
+ httpAuth = (HttpAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE,
+ "basic" ) );
+ // TODO: what if there are other types?
+ repositorySessionFactory = (RepositorySessionFactory) wac.getBean( PlexusToSpringUtils.buildSpringId(
+ RepositorySessionFactory.class.getName() ) );
}
public void doGet( HttpServletRequest req, HttpServletResponse res )
@@ -107,15 +112,15 @@ public class RssFeedServlet
String repoId = null;
String groupId = null;
String artifactId = null;
-
- String url = StringUtils.removeEnd( req.getRequestURL().toString(), "/" );
- if( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) > 0 )
+
+ String url = StringUtils.removeEnd( req.getRequestURL().toString(), "/" );
+ if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) > 0 )
{
artifactId = StringUtils.substringAfterLast( url, "/" );
- groupId = StringUtils.substringBeforeLast( StringUtils.substringAfter( url, "feeds/" ), "/");
+ groupId = StringUtils.substringBeforeLast( StringUtils.substringAfter( url, "feeds/" ), "/" );
groupId = StringUtils.replaceChars( groupId, '/', '.' );
}
- else if( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) == 0 )
+ else if ( StringUtils.countMatches( StringUtils.substringAfter( url, "feeds/" ), "/" ) == 0 )
{
repoId = StringUtils.substringAfterLast( url, "/" );
}
@@ -123,32 +128,28 @@ public class RssFeedServlet
{
res.sendError( HttpServletResponse.SC_BAD_REQUEST, "Invalid request url." );
return;
- }
-
+ }
+
try
{
Map<String, String> map = new HashMap<String, String>();
SyndFeed feed = null;
-
+
if ( isAllowed( req, repoId, groupId, artifactId ) )
{
if ( repoId != null )
{
// new artifacts in repo feed request
- processor =
- (RssFeedProcessor) wac.getBean( PlexusToSpringUtils.buildSpringId(
- RssFeedProcessor.class.getName(),
- "new-artifacts" ) );
+ processor = (RssFeedProcessor) wac.getBean( PlexusToSpringUtils.buildSpringId(
+ RssFeedProcessor.class.getName(), "new-artifacts" ) );
map.put( RssFeedProcessor.KEY_REPO_ID, repoId );
}
else if ( ( groupId != null ) && ( artifactId != null ) )
{
// TODO: this only works for guest - we could pass in the list of repos
// new versions of artifact feed request
- processor =
- (RssFeedProcessor) wac.getBean( PlexusToSpringUtils.buildSpringId(
- RssFeedProcessor.class.getName(),
- "new-versions" ) );
+ processor = (RssFeedProcessor) wac.getBean( PlexusToSpringUtils.buildSpringId(
+ RssFeedProcessor.class.getName(), "new-versions" ) );
map.put( RssFeedProcessor.KEY_GROUP_ID, groupId );
map.put( RssFeedProcessor.KEY_ARTIFACT_ID, artifactId );
}
@@ -159,22 +160,30 @@ public class RssFeedServlet
return;
}
- feed = processor.process( map );
- if( feed == null )
+ RepositorySession repositorySession = repositorySessionFactory.createSession();
+ try
+ {
+ feed = processor.process( map, repositorySession.getRepository() );
+ }
+ finally
+ {
+ repositorySession.close();
+ }
+ if ( feed == null )
{
res.sendError( HttpServletResponse.SC_NO_CONTENT, "No information available." );
return;
}
-
+
res.setContentType( MIME_TYPE );
-
+
if ( repoId != null )
- {
+ {
feed.setLink( req.getRequestURL().toString() );
}
else if ( ( groupId != null ) && ( artifactId != null ) )
{
- feed.setLink( req.getRequestURL().toString() );
+ feed.setLink( req.getRequestURL().toString() );
}
SyndFeedOutput output = new SyndFeedOutput();
@@ -186,11 +195,11 @@ public class RssFeedServlet
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
}
catch ( AccountLockedException acce )
- {
+ {
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
}
catch ( AuthenticationException authe )
- {
+ {
log.debug( COULD_NOT_AUTHENTICATE_USER, authe );
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
}
@@ -200,7 +209,7 @@ public class RssFeedServlet
res.sendError( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, COULD_NOT_GENERATE_FEED_ERROR );
}
catch ( MustChangePasswordException e )
- {
+ {
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, COULD_NOT_AUTHENTICATE_USER );
}
catch ( UnauthorizedException e )
@@ -208,24 +217,25 @@ public class RssFeedServlet
log.debug( e.getMessage() );
if ( repoId != null )
{
- res.setHeader("WWW-Authenticate", "Basic realm=\"Repository Archiva Managed " + repoId + " Repository" );
+ res.setHeader( "WWW-Authenticate",
+ "Basic realm=\"Repository Archiva Managed " + repoId + " Repository" );
}
else
{
- res.setHeader("WWW-Authenticate", "Basic realm=\"Artifact " + groupId + ":" + artifactId );
+ res.setHeader( "WWW-Authenticate", "Basic realm=\"Artifact " + groupId + ":" + artifactId );
}
-
+
res.sendError( HttpServletResponse.SC_UNAUTHORIZED, USER_NOT_AUTHORIZED );
}
}
/**
* Basic authentication.
- *
+ *
* @param req
* @param repositoryId TODO
- * @param groupId TODO
- * @param artifactId TODO
+ * @param groupId TODO
+ * @param artifactId TODO
* @return
*/
private boolean isAllowed( HttpServletRequest req, String repositoryId, String groupId, String artifactId )
@@ -287,20 +297,20 @@ public class RssFeedServlet
AuthenticationResult result = httpAuth.getAuthenticationResult( req, null );
SecuritySession securitySession = httpAuth.getSecuritySession( req.getSession( true ) );
- if ( servletAuth.isAuthenticated( req, result )
- && servletAuth.isAuthorized( req, securitySession, repoId,
- ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) )
+ if ( servletAuth.isAuthenticated( req, result ) && servletAuth.isAuthorized( req, securitySession,
+ repoId,
+ ArchivaRoleConstants.OPERATION_REPOSITORY_ACCESS ) )
{
return true;
}
}
catch ( AuthorizationException e )
{
-
+
}
catch ( UnauthorizedException e )
{
-
+
}
}
Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml?rev=1053542&r1=1053541&r2=1053542&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml Wed Dec 29 06:14:04 2010
@@ -7,6 +7,8 @@
<bean id="loggerManager" class="org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager"
init-method="initialize"/>
+ <alias name="repositorySessionFactory#file" alias="repositorySessionFactory"/>
+
<bean name="wagon#http" class="org.apache.maven.wagon.providers.http.LightweightHttpWagon" scope="prototype">
<property name="httpHeaders">
<map>
@@ -40,8 +42,7 @@
<bean name="searchService" lazy-init="true" scope="singleton"
class="org.apache.archiva.web.xmlrpc.services.SearchServiceImpl">
<constructor-arg ref="xmlRpcUserRepositories"/>
- <constructor-arg ref="metadataResolver"/>
- <constructor-arg ref="metadataRepository"/>
+ <constructor-arg ref="repositorySessionFactory"/>
<constructor-arg ref="nexusSearch"/>
</bean>
@@ -51,7 +52,7 @@
<constructor-arg ref="archivaConfiguration"/>
<constructor-arg ref="repositoryContentConsumers"/>
<constructor-arg ref="repositoryContentFactory"/>
- <constructor-arg ref="metadataRepository"/>
+ <constructor-arg ref="repositorySessionFactory"/>
<constructor-arg ref="archivaTaskScheduler#repository"/>
<constructor-arg>
<bean class="org.apache.archiva.web.spring.RepositoryListenerFactoryBean"/>