mirror of https://github.com/apache/archiva.git
[MRM-346]: Show Artifact results in error 500.
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@539163 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2ae3268ff9
commit
650c56007b
|
@ -34,5 +34,9 @@
|
||||||
<groupId>org.apache.maven.archiva</groupId>
|
<groupId>org.apache.maven.archiva</groupId>
|
||||||
<artifactId>archiva-model</artifactId>
|
<artifactId>archiva-model</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-collections</groupId>
|
||||||
|
<artifactId>commons-collections</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
package org.apache.maven.archiva.consumers.functors;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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 org.apache.commons.collections.Predicate;
|
||||||
|
import org.apache.maven.archiva.consumers.BaseConsumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Selects Consumers that are flaged as 'permanent'.
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class PermanentConsumerPredicate
|
||||||
|
implements Predicate
|
||||||
|
{
|
||||||
|
|
||||||
|
public boolean evaluate( Object object )
|
||||||
|
{
|
||||||
|
boolean satisfies = false;
|
||||||
|
|
||||||
|
if ( object instanceof BaseConsumer )
|
||||||
|
{
|
||||||
|
BaseConsumer consumer = (BaseConsumer) object;
|
||||||
|
satisfies = consumer.isPermanent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return satisfies;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -19,11 +19,25 @@ package org.apache.maven.archiva.consumers.database;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
|
import org.apache.maven.archiva.configuration.RepositoryConfiguration;
|
||||||
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
import org.apache.maven.archiva.consumers.AbstractMonitoredConsumer;
|
||||||
import org.apache.maven.archiva.consumers.ConsumerException;
|
import org.apache.maven.archiva.consumers.ConsumerException;
|
||||||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
|
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
|
||||||
|
import org.apache.maven.archiva.database.ArchivaDAO;
|
||||||
|
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||||
import org.apache.maven.archiva.model.ArchivaArtifact;
|
import org.apache.maven.archiva.model.ArchivaArtifact;
|
||||||
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
|
import org.apache.maven.archiva.model.RepositoryURL;
|
||||||
|
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayout;
|
||||||
|
import org.apache.maven.archiva.repository.layout.BidirectionalRepositoryLayoutFactory;
|
||||||
|
import org.apache.maven.archiva.repository.layout.LayoutException;
|
||||||
|
import org.apache.maven.archiva.repository.project.ProjectModelException;
|
||||||
|
import org.apache.maven.archiva.repository.project.ProjectModelReader;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +64,39 @@ public class ProjectModelToDatabaseConsumer
|
||||||
*/
|
*/
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement role-hint="jdo"
|
||||||
|
*/
|
||||||
|
private ArchivaDAO dao;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement
|
||||||
|
*/
|
||||||
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement
|
||||||
|
*/
|
||||||
|
private BidirectionalRepositoryLayoutFactory layoutFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement role-hint="model400"
|
||||||
|
*/
|
||||||
|
private ProjectModelReader project400Reader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @plexus.requirement role-hint="model300"
|
||||||
|
*/
|
||||||
|
private ProjectModelReader project300Reader;
|
||||||
|
|
||||||
|
private List includes;
|
||||||
|
|
||||||
|
public ProjectModelToDatabaseConsumer()
|
||||||
|
{
|
||||||
|
includes = new ArrayList();
|
||||||
|
includes.add( "pom" );
|
||||||
|
}
|
||||||
|
|
||||||
public void beginScan()
|
public void beginScan()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
|
@ -64,15 +111,65 @@ public class ProjectModelToDatabaseConsumer
|
||||||
|
|
||||||
public List getIncludedTypes()
|
public List getIncludedTypes()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
return includes;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processArchivaArtifact( ArchivaArtifact artifact )
|
public void processArchivaArtifact( ArchivaArtifact artifact )
|
||||||
throws ConsumerException
|
throws ConsumerException
|
||||||
{
|
{
|
||||||
// TODO Auto-generated method stub
|
if ( !StringUtils.equals( "pom", artifact.getType() ) )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
File artifactFile = toFile( artifact );
|
||||||
|
RepositoryConfiguration repo = getRepository( artifact );
|
||||||
|
|
||||||
|
if ( StringUtils.equals( "default", repo.getLayout() ) )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ArchivaProjectModel model = project400Reader.read( artifactFile );
|
||||||
|
dao.getProjectModelDAO().saveProjectModel( model );
|
||||||
|
}
|
||||||
|
catch ( ProjectModelException e )
|
||||||
|
{
|
||||||
|
getLogger().warn( "Unable to read project model " + artifactFile + " : " + e.getMessage(), e );
|
||||||
|
}
|
||||||
|
catch ( ArchivaDatabaseException e )
|
||||||
|
{
|
||||||
|
getLogger().warn(
|
||||||
|
"Unable to save project model " + artifactFile + " to the database : "
|
||||||
|
+ e.getMessage(), e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private RepositoryConfiguration getRepository( ArchivaArtifact artifact )
|
||||||
|
{
|
||||||
|
String repoId = artifact.getModel().getRepositoryId();
|
||||||
|
return archivaConfiguration.getConfiguration().findRepositoryById( repoId );
|
||||||
|
}
|
||||||
|
|
||||||
|
private File toFile( ArchivaArtifact artifact )
|
||||||
|
{
|
||||||
|
RepositoryConfiguration repoConfig = getRepository( artifact );
|
||||||
|
|
||||||
|
BidirectionalRepositoryLayout layout = null;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
layout = layoutFactory.getLayout( artifact );
|
||||||
|
}
|
||||||
|
catch ( LayoutException e )
|
||||||
|
{
|
||||||
|
getLogger().warn( "Unable to determine layout of " + artifact + ": " + e.getMessage(), e );
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = layout.toPath( artifact );
|
||||||
|
RepositoryURL url = new RepositoryURL( repoConfig.getUrl() );
|
||||||
|
return new File( url.getPath(), path );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
public String getDescription()
|
||||||
|
@ -87,7 +184,7 @@ public class ProjectModelToDatabaseConsumer
|
||||||
|
|
||||||
public boolean isPermanent()
|
public boolean isPermanent()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1601,7 +1601,7 @@
|
||||||
<name>classifier</name>
|
<name>classifier</name>
|
||||||
<version>1.0.0+</version>
|
<version>1.0.0+</version>
|
||||||
<type>String</type>
|
<type>String</type>
|
||||||
<required>true</required>
|
<required>false</required>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but
|
The classifier of the dependency. This allows distinguishing two artifacts that belong to the same POM but
|
||||||
were built differently, and is appended to the filename after the version. For example,
|
were built differently, and is appended to the filename after the version. For example,
|
||||||
|
|
|
@ -30,6 +30,10 @@ import java.io.File;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
*
|
||||||
|
* @plexus.component
|
||||||
|
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
||||||
|
* role-hint="model300"
|
||||||
*/
|
*/
|
||||||
public class ProjectModel300Reader implements ProjectModelReader
|
public class ProjectModel300Reader implements ProjectModelReader
|
||||||
{
|
{
|
||||||
|
|
|
@ -52,6 +52,10 @@ import java.util.Properties;
|
||||||
*
|
*
|
||||||
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
*
|
||||||
|
* @plexus.component
|
||||||
|
* role="org.apache.maven.archiva.repository.project.ProjectModelReader"
|
||||||
|
* role-hint="model400"
|
||||||
*/
|
*/
|
||||||
public class ProjectModel400Reader
|
public class ProjectModel400Reader
|
||||||
implements ProjectModelReader
|
implements ProjectModelReader
|
||||||
|
|
|
@ -23,11 +23,13 @@ import org.apache.commons.collections.Closure;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
import org.apache.commons.collections.functors.IfClosure;
|
import org.apache.commons.collections.functors.IfClosure;
|
||||||
|
import org.apache.commons.collections.functors.OrPredicate;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
import org.apache.maven.archiva.configuration.RepositoryScanningConfiguration;
|
||||||
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
import org.apache.maven.archiva.consumers.InvalidRepositoryContentConsumer;
|
||||||
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
import org.apache.maven.archiva.consumers.KnownRepositoryContentConsumer;
|
||||||
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
import org.apache.maven.archiva.consumers.RepositoryContentConsumer;
|
||||||
|
import org.apache.maven.archiva.consumers.functors.PermanentConsumerPredicate;
|
||||||
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
import org.codehaus.plexus.logging.AbstractLogEnabled;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||||
|
@ -64,9 +66,9 @@ public class RepositoryContentConsumers
|
||||||
*/
|
*/
|
||||||
private List availableInvalidConsumers;
|
private List availableInvalidConsumers;
|
||||||
|
|
||||||
private SelectedKnownRepoConsumersPredicate selectedKnownPredicate;
|
private Predicate selectedKnownPredicate;
|
||||||
|
|
||||||
private SelectedInvalidRepoConsumersPredicate selectedInvalidPredicate;
|
private Predicate selectedInvalidPredicate;
|
||||||
|
|
||||||
class SelectedKnownRepoConsumersPredicate
|
class SelectedKnownRepoConsumersPredicate
|
||||||
implements Predicate
|
implements Predicate
|
||||||
|
@ -131,8 +133,11 @@ public class RepositoryContentConsumers
|
||||||
public void initialize()
|
public void initialize()
|
||||||
throws InitializationException
|
throws InitializationException
|
||||||
{
|
{
|
||||||
this.selectedKnownPredicate = new SelectedKnownRepoConsumersPredicate();
|
Predicate permanentConsumers = new PermanentConsumerPredicate();
|
||||||
this.selectedInvalidPredicate = new SelectedInvalidRepoConsumersPredicate();
|
|
||||||
|
this.selectedKnownPredicate = new OrPredicate( permanentConsumers, new SelectedKnownRepoConsumersPredicate() );
|
||||||
|
this.selectedInvalidPredicate = new OrPredicate( permanentConsumers,
|
||||||
|
new SelectedInvalidRepoConsumersPredicate() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getSelectedKnownConsumerIds()
|
public List getSelectedKnownConsumerIds()
|
||||||
|
|
|
@ -21,10 +21,12 @@ package org.apache.maven.archiva.database.updater;
|
||||||
|
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.collections.Predicate;
|
import org.apache.commons.collections.Predicate;
|
||||||
|
import org.apache.commons.collections.functors.OrPredicate;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
||||||
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
|
import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration;
|
||||||
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
|
import org.apache.maven.archiva.consumers.DatabaseCleanupConsumer;
|
||||||
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
|
import org.apache.maven.archiva.consumers.DatabaseUnprocessedArtifactConsumer;
|
||||||
|
import org.apache.maven.archiva.consumers.functors.PermanentConsumerPredicate;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
||||||
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
import org.codehaus.plexus.personality.plexus.lifecycle.phase.InitializationException;
|
||||||
|
|
||||||
|
@ -58,9 +60,9 @@ public class DatabaseConsumers
|
||||||
*/
|
*/
|
||||||
private List availableCleanupConsumers;
|
private List availableCleanupConsumers;
|
||||||
|
|
||||||
private SelectedCleanupConsumersPredicate selectedCleanupConsumers;
|
private Predicate selectedCleanupConsumers;
|
||||||
|
|
||||||
private SelectedUnprocessedConsumersPredicate selectedUnprocessedConsumers;
|
private Predicate selectedUnprocessedConsumers;
|
||||||
|
|
||||||
class SelectedUnprocessedConsumersPredicate
|
class SelectedUnprocessedConsumersPredicate
|
||||||
implements Predicate
|
implements Predicate
|
||||||
|
@ -103,8 +105,10 @@ public class DatabaseConsumers
|
||||||
public void initialize()
|
public void initialize()
|
||||||
throws InitializationException
|
throws InitializationException
|
||||||
{
|
{
|
||||||
selectedCleanupConsumers = new SelectedCleanupConsumersPredicate();
|
Predicate permanentConsumers = new PermanentConsumerPredicate();
|
||||||
selectedUnprocessedConsumers = new SelectedUnprocessedConsumersPredicate();
|
|
||||||
|
selectedCleanupConsumers = new OrPredicate( permanentConsumers, new SelectedCleanupConsumersPredicate() );
|
||||||
|
selectedUnprocessedConsumers = new OrPredicate( permanentConsumers, new SelectedUnprocessedConsumersPredicate() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -19,27 +19,17 @@ package org.apache.maven.archiva.web.action;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import com.opensymphony.xwork.Validateable;
|
||||||
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.maven.archiva.configuration.ArchivaConfiguration;
|
|
||||||
import org.apache.maven.archiva.configuration.Configuration;
|
|
||||||
import org.apache.maven.archiva.database.ArchivaDAO;
|
|
||||||
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
import org.apache.maven.archiva.database.ArchivaDatabaseException;
|
||||||
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
import org.apache.maven.archiva.database.ObjectNotFoundException;
|
||||||
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
import org.apache.maven.archiva.database.browsing.RepositoryBrowsing;
|
||||||
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
import org.apache.maven.archiva.model.ArchivaProjectModel;
|
||||||
import org.apache.maven.archiva.web.util.VersionMerger;
|
|
||||||
import org.apache.maven.wagon.ResourceDoesNotExistException;
|
|
||||||
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
import org.codehaus.plexus.xwork.action.PlexusActionSupport;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse the repository.
|
* Browse the repository.
|
||||||
|
@ -49,6 +39,7 @@ import java.util.Set;
|
||||||
*/
|
*/
|
||||||
public class ShowArtifactAction
|
public class ShowArtifactAction
|
||||||
extends PlexusActionSupport
|
extends PlexusActionSupport
|
||||||
|
implements Validateable
|
||||||
{
|
{
|
||||||
/* .\ Not Exposed \._____________________________________________ */
|
/* .\ Not Exposed \._____________________________________________ */
|
||||||
|
|
||||||
|
@ -90,12 +81,7 @@ public class ShowArtifactAction
|
||||||
public String artifact()
|
public String artifact()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
this.model = repoBrowsing.selectVersion( groupId, artifactId, version );
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model = readProject();
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -106,12 +92,7 @@ public class ShowArtifactAction
|
||||||
public String dependencies()
|
public String dependencies()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
this.model = repoBrowsing.selectVersion( groupId, artifactId, version );
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model = readProject();
|
|
||||||
|
|
||||||
// TODO: should this be the whole set of artifacts, and be more like the maven dependencies report?
|
// TODO: should this be the whole set of artifacts, and be more like the maven dependencies report?
|
||||||
// this.dependencies = VersionMerger.wrap( project.getModel().getDependencies() );
|
// this.dependencies = VersionMerger.wrap( project.getModel().getDependencies() );
|
||||||
|
@ -125,12 +106,7 @@ public class ShowArtifactAction
|
||||||
public String mailingLists()
|
public String mailingLists()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
this.model = repoBrowsing.selectVersion( groupId, artifactId, version );
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model = readProject();
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -141,11 +117,6 @@ public class ShowArtifactAction
|
||||||
public String reports()
|
public String reports()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("#### In reports.");
|
System.out.println("#### In reports.");
|
||||||
// TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, version );
|
// TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, version );
|
||||||
System.out.println("#### Found " + reports.size() + " reports.");
|
System.out.println("#### Found " + reports.size() + " reports.");
|
||||||
|
@ -159,12 +130,7 @@ public class ShowArtifactAction
|
||||||
public String dependees()
|
public String dependees()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
this.model = repoBrowsing.selectVersion( groupId, artifactId, version );
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model = readProject();
|
|
||||||
|
|
||||||
// TODO: create depends on collector.
|
// TODO: create depends on collector.
|
||||||
this.dependees = Collections.EMPTY_LIST;
|
this.dependees = Collections.EMPTY_LIST;
|
||||||
|
@ -178,47 +144,27 @@ public class ShowArtifactAction
|
||||||
public String dependencyTree()
|
public String dependencyTree()
|
||||||
throws ObjectNotFoundException, ArchivaDatabaseException
|
throws ObjectNotFoundException, ArchivaDatabaseException
|
||||||
{
|
{
|
||||||
if ( !checkParameters() )
|
this.model = repoBrowsing.selectVersion( groupId, artifactId, version );
|
||||||
{
|
|
||||||
return ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.model = readProject();
|
|
||||||
|
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private ArchivaProjectModel readProject()
|
public void validate()
|
||||||
throws ArchivaDatabaseException
|
|
||||||
{
|
{
|
||||||
return repoBrowsing.selectVersion( groupId, artifactId, version );
|
if ( StringUtils.isBlank( groupId ) )
|
||||||
}
|
|
||||||
|
|
||||||
private boolean checkParameters()
|
|
||||||
{
|
{
|
||||||
boolean result = true;
|
|
||||||
|
|
||||||
if ( StringUtils.isEmpty( groupId ) )
|
|
||||||
{
|
|
||||||
// TODO: i18n
|
|
||||||
addActionError( "You must specify a group ID to browse" );
|
addActionError( "You must specify a group ID to browse" );
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( StringUtils.isEmpty( artifactId ) )
|
if ( StringUtils.isBlank( artifactId ) )
|
||||||
{
|
{
|
||||||
// TODO: i18n
|
|
||||||
addActionError( "You must specify a artifact ID to browse" );
|
addActionError( "You must specify a artifact ID to browse" );
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( StringUtils.isEmpty( version ) )
|
if ( StringUtils.isBlank( version ) )
|
||||||
{
|
{
|
||||||
// TODO: i18n
|
|
||||||
addActionError( "You must specify a version to browse" );
|
addActionError( "You must specify a version to browse" );
|
||||||
result = false;
|
|
||||||
}
|
}
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArchivaProjectModel getModel()
|
public ArchivaProjectModel getModel()
|
||||||
|
|
Loading…
Reference in New Issue