diff options
Diffstat (limited to 'archiva-webapp')
21 files changed, 330 insertions, 463 deletions
diff --git a/archiva-webapp/pom.xml b/archiva-webapp/pom.xml index b6353ed0f..c9d02499a 100644 --- a/archiva-webapp/pom.xml +++ b/archiva-webapp/pom.xml @@ -67,11 +67,16 @@ </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> - <artifactId>plexus-log4j-logging</artifactId> - <version>1.1-alpha-2</version> + <artifactId>plexus-slf4j-logging</artifactId> + <version>1.1-alpha-1-SNAPSHOT</version> <scope>runtime</scope> </dependency> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + <version>1.2</version> + </dependency> + <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> <version>1.0.4</version> @@ -112,23 +117,15 @@ </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> - <artifactId>archiva-indexer</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven.archiva</groupId> - <artifactId>archiva-discoverer</artifactId> - </dependency> - <dependency> - <groupId>org.apache.maven.archiva</groupId> - <artifactId>archiva-configuration</artifactId> + <artifactId>archiva-proxy</artifactId> </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> - <artifactId>archiva-proxy</artifactId> + <artifactId>archiva-core</artifactId> </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> - <artifactId>archiva-core</artifactId> + <artifactId>archiva-common</artifactId> </dependency> <dependency> <groupId>org.apache.maven.archiva</groupId> @@ -178,6 +175,7 @@ <dependency> <groupId>org.apache.derby</groupId> <artifactId>derby</artifactId> + <version>10.1.3.1</version> <scope>provided</scope> </dependency> <dependency> diff --git a/archiva-webapp/src/jetty-env.xml b/archiva-webapp/src/jetty-env.xml index 7e260ebfe..bd1d76c14 100644 --- a/archiva-webapp/src/jetty-env.xml +++ b/archiva-webapp/src/jetty-env.xml @@ -21,37 +21,62 @@ <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure class="org.mortbay.jetty.webapp.WebAppContext"> -<New id="validation_mail" class="org.mortbay.jetty.plus.naming.Resource"> - <Arg>mail/Session</Arg> - <Arg> - <New class="org.mortbay.naming.factories.MailSessionReference"> - <Set name="user"></Set> - <Set name="password"></Set> - <Set name="properties"> - <New class="java.util.Properties"> - <Put name="mail.smtp.host">localhost</Put> - <Put name="mail.smtp.port">25</Put> <!-- TODO: shouldn't this default? --> - </New> - </Set> - </New> - </Arg> -</New> + <New id="validation_mail" class="org.mortbay.jetty.plus.naming.Resource"> + <Arg>mail/Session</Arg> + <Arg> + <New class="org.mortbay.naming.factories.MailSessionReference"> + <Set name="user"></Set> + <Set name="password"></Set> + <Set name="properties"> + <New class="java.util.Properties"> + <Put name="mail.smtp.host">localhost</Put> + <Put name="mail.smtp.port">25</Put> <!-- TODO: shouldn't this default? --> + </New> + </Set> + </New> + </Arg> + </New> + <!-- Archiva database --> + <New id="archiva" class="org.mortbay.jetty.plus.naming.Resource"> + <Arg>jdbc/archiva</Arg> + <Arg> + <New class="org.apache.derby.jdbc.EmbeddedDataSource"> + <Set name="DatabaseName">target/databases/archiva</Set> + <Set name="user">sa</Set> + <Set name="createDatabase">create</Set> + </New> + </Arg> + </New> + + <New id="archivaShutdown" class="org.mortbay.jetty.plus.naming.Resource"> + <Arg>jdbc/archivaShutdown</Arg> + <Arg> + <New class="org.apache.derby.jdbc.EmbeddedDataSource"> + <Set name="DatabaseName">target/databases/archiva</Set> + <Set name="user">sa</Set> + <Set name="shutdownDatabase">shutdown</Set> + </New> + </Arg> + </New> + + <!-- Users / Security Database --> <New id="users" class="org.mortbay.jetty.plus.naming.Resource"> <Arg>jdbc/users</Arg> <Arg> <New class="org.apache.derby.jdbc.EmbeddedDataSource"> - <Set name="DatabaseName">target/database</Set> + <Set name="DatabaseName">target/databases/users</Set> <Set name="user">sa</Set> <Set name="createDatabase">create</Set> </New> </Arg> </New> - <New id="shutdown" class="org.mortbay.jetty.plus.naming.Resource"> - <Arg>jdbc/shutdown</Arg> + + <New id="usersShutdown" class="org.mortbay.jetty.plus.naming.Resource"> + <Arg>jdbc/usersShutdown</Arg> <Arg> <New class="org.apache.derby.jdbc.EmbeddedDataSource"> - <Set name="DatabaseName">target/database</Set> + <Set name="DatabaseName">target/databases/users</Set> <Set name="user">sa</Set> <Set name="shutdownDatabase">shutdown</Set> </New> diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java index de64abe26..952cc674c 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java @@ -19,31 +19,15 @@ package org.apache.maven.archiva.web.action; * under the License. */ -import com.opensymphony.xwork.Preparable; -import org.apache.maven.archiva.configuration.ArchivaConfiguration; -import org.apache.maven.archiva.configuration.Configuration; -import org.apache.maven.archiva.configuration.ConfiguredRepositoryFactory; -import org.apache.maven.archiva.configuration.RepositoryConfiguration; -import org.apache.maven.archiva.discoverer.DiscovererException; -import org.apache.maven.archiva.discoverer.filter.AcceptAllArtifactFilter; -import org.apache.maven.archiva.discoverer.filter.SnapshotArtifactFilter; import org.apache.maven.archiva.reporting.database.ReportingDatabase; -import org.apache.maven.archiva.reporting.executor.ReportExecutor; -import org.apache.maven.archiva.reporting.group.ReportGroup; -import org.apache.maven.archiva.reporting.store.ReportingStoreException; import org.apache.maven.archiva.security.ArchivaRoleConstants; -import org.apache.maven.artifact.repository.ArtifactRepository; -import org.apache.maven.artifact.resolver.filter.ArtifactFilter; import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; -import java.util.Map; /** * Repository reporting. @@ -53,185 +37,23 @@ import java.util.Map; */ public class ReportsAction extends PlexusActionSupport - implements Preparable, SecureAction + implements SecureAction { /** * @plexus.requirement */ - private ArchivaConfiguration archivaConfiguration; + private ReportingDatabase database; - /** - * @plexus.requirement - */ - private ConfiguredRepositoryFactory factory; - - private List databases; - - private String repositoryId; - - /** - * @plexus.requirement - */ - private ReportExecutor executor; - - private Configuration configuration; - - /** - * @plexus.requirement role="org.apache.maven.archiva.reporting.group.ReportGroup" - */ - private Map reports; - - private String reportGroup = DEFAULT_REPORT_GROUP; - - private static final String DEFAULT_REPORT_GROUP = "health"; - - private String filter; + private List reports; public String execute() throws Exception { - ReportGroup reportGroup = (ReportGroup) reports.get( this.reportGroup ); - - databases = new ArrayList(); - - if ( repositoryId != null && !repositoryId.equals( "-" ) ) - { - RepositoryConfiguration repositoryConfiguration = configuration.getRepositoryById( repositoryId ); - getReport( repositoryConfiguration, reportGroup ); - } - else - { - for ( Iterator i = configuration.getRepositories().iterator(); i.hasNext(); ) - { - RepositoryConfiguration repositoryConfiguration = (RepositoryConfiguration) i.next(); - - getReport( repositoryConfiguration, reportGroup ); - } - } - return SUCCESS; - } - - private void getReport( RepositoryConfiguration repositoryConfiguration, ReportGroup reportGroup ) - throws ReportingStoreException - { - ArtifactRepository repository = factory.createRepository( repositoryConfiguration ); - - ReportingDatabase database = executor.getReportDatabase( repository, reportGroup ); - - if ( filter != null && !filter.equals( "-" ) ) - { - database = database.getFilteredDatabase( filter ); - } - - databases.add( database ); - } - - public String runReport() - throws Exception - { - ReportGroup reportGroup = (ReportGroup) reports.get( this.reportGroup ); - - RepositoryConfiguration repositoryConfiguration = configuration.getRepositoryById( repositoryId ); - ArtifactRepository repository = factory.createRepository( repositoryConfiguration ); - - ReportingDatabase database = executor.getReportDatabase( repository, reportGroup ); - if ( database.isInProgress() ) - { - return SUCCESS; - } - - generateReport( database, repositoryConfiguration, reportGroup, repository ); - + reports = database.getArtifactDatabase().getAllArtifactResults(); + return SUCCESS; } - private void generateReport( ReportingDatabase database, RepositoryConfiguration repositoryConfiguration, - ReportGroup reportGroup, ArtifactRepository repository ) - throws DiscovererException, ReportingStoreException - { - database.setInProgress( true ); - - List blacklistedPatterns = new ArrayList(); - if ( repositoryConfiguration.getBlackListPatterns() != null ) - { - blacklistedPatterns.addAll( repositoryConfiguration.getBlackListPatterns() ); - } - if ( configuration.getGlobalBlackListPatterns() != null ) - { - blacklistedPatterns.addAll( configuration.getGlobalBlackListPatterns() ); - } - - ArtifactFilter filter; - if ( repositoryConfiguration.isIncludeSnapshots() ) - { - filter = new AcceptAllArtifactFilter(); - } - else - { - filter = new SnapshotArtifactFilter(); - } - - try - { - executor.runReports( reportGroup, repository, blacklistedPatterns, filter ); - } - finally - { - database.setInProgress( false ); - } - } - - public void setReportGroup( String reportGroup ) - { - this.reportGroup = reportGroup; - } - - public String getReportGroup() - { - return reportGroup; - } - - public String getRepositoryId() - { - return repositoryId; - } - - public void setRepositoryId( String repositoryId ) - { - this.repositoryId = repositoryId; - } - - public List getDatabases() - { - return databases; - } - - public void prepare() - throws Exception - { - configuration = archivaConfiguration.getConfiguration(); - } - - public Configuration getConfiguration() - { - return configuration; - } - - public Map getReports() - { - return reports; - } - - public String getFilter() - { - return filter; - } - - public void setFilter( String filter ) - { - this.filter = filter; - } - public SecureActionBundle getSecureActionBundle() throws SecureActionException { @@ -242,4 +64,9 @@ public class ReportsAction return bundle; } + + public List getReports() + { + return reports; + } } diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index f8f8ca318..ecc109a86 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -32,6 +32,7 @@ import org.apache.maven.archiva.indexer.RepositoryIndexSearchException; import org.apache.maven.archiva.indexer.lucene.LuceneQuery; import org.apache.maven.archiva.indexer.record.StandardArtifactIndexRecord; import org.apache.maven.archiva.proxy.ProxyException; +import org.apache.maven.archiva.reporting.database.ArtifactResultsDatabase; import org.apache.maven.archiva.web.util.VersionMerger; import org.apache.maven.artifact.Artifact; import org.apache.maven.artifact.factory.ArtifactFactory; @@ -111,6 +112,11 @@ public class ShowArtifactAction * @plexus.requirement */ private DependencyTreeBuilder dependencyTreeBuilder; + + /** + * @plexus.requirement + */ + ArtifactResultsDatabase artifactsDatabase; private String groupId; @@ -131,6 +137,8 @@ public class ShowArtifactAction private String artifactPath; private List mailingLists; + + private List reports; public String artifact() throws IOException, XmlPullParserException, ProjectBuildingException, ResourceDoesNotExistException, @@ -182,6 +190,21 @@ public class ShowArtifactAction return SUCCESS; } + + public String reports() + throws IOException, XmlPullParserException, ProjectBuildingException + { + if ( !checkParameters() ) + { + return ERROR; + } + + System.out.println("#### In reports."); + this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, version ); + System.out.println("#### Found " + reports.size() + " reports."); + + return SUCCESS; + } public String dependees() throws IOException, XmlPullParserException, ProjectBuildingException, RepositoryIndexException, @@ -518,4 +541,9 @@ public class ShowArtifactAction { return repositoryUrlName; } + + public List getReports() + { + return reports; + } } diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java index 34e3a981a..a2cdcffb4 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/ConfigureAction.java @@ -22,12 +22,13 @@ package org.apache.maven.archiva.web.action.admin; import com.opensymphony.xwork.ModelDriven; import com.opensymphony.xwork.Preparable; import com.opensymphony.xwork.Validateable; + import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; import org.apache.maven.archiva.configuration.InvalidConfigurationException; import org.apache.maven.archiva.indexer.RepositoryIndexException; import org.apache.maven.archiva.indexer.RepositoryIndexSearchException; -import org.apache.maven.archiva.scheduler.executors.IndexerTaskExecutor; +import org.apache.maven.archiva.repositories.ActiveManagedRepositories; import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.codehaus.plexus.registry.RegistryException; import org.codehaus.plexus.scheduler.CronExpressionValidator; @@ -56,15 +57,15 @@ public class ConfigureAction private ArchivaConfiguration archivaConfiguration; /** - * @plexus.requirement role="org.codehaus.plexus.taskqueue.execution.TaskExecutor" role-hint="indexer" + * @plexus.requirement */ - private IndexerTaskExecutor indexer; + private ActiveManagedRepositories activeRepositories; /** * The configuration. */ private Configuration configuration; - + private CronExpressionValidator cronValidator; private String second = "0"; @@ -100,7 +101,7 @@ public class ConfigureAction { // TODO: if this didn't come from the form, go to configure.action instead of going through with re-saving what was just loaded // TODO: if this is changed, do we move the index or recreate it? - configuration.setIndexerCronExpression( getCronExpression() ); + configuration.setDataRefreshCronExpression( getCronExpression() ); // Normalize the path File file = new File( configuration.getIndexPath() ); @@ -125,7 +126,7 @@ public class ConfigureAction public String input() { - String[] cronEx = configuration.getIndexerCronExpression().split( " " ); + String[] cronEx = configuration.getDataRefreshCronExpression().split( " " ); int i = 0; while ( i < cronEx.length ) @@ -157,9 +158,9 @@ public class ConfigureAction i++; } - if ( indexer.getLastIndexingTime() != 0 ) + if ( activeRepositories.getLastDataRefreshTime() != 0 ) { - lastIndexingTime = new Date( indexer.getLastIndexingTime() ).toString(); + lastIndexingTime = new Date( activeRepositories.getLastDataRefreshTime() ).toString(); } else { diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java index c0fa12f82..06daf24a9 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/RunRepositoryTaskAction.java @@ -20,12 +20,12 @@ package org.apache.maven.archiva.web.action.admin; */ import org.apache.maven.archiva.scheduler.RepositoryTaskScheduler; -import org.apache.maven.archiva.scheduler.TaskExecutionException; import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionBundle; import org.codehaus.plexus.security.ui.web.interceptor.SecureActionException; +import org.codehaus.plexus.taskqueue.execution.TaskExecutionException; import org.codehaus.plexus.xwork.action.PlexusActionSupport; /** @@ -42,10 +42,10 @@ public class RunRepositoryTaskAction */ private RepositoryTaskScheduler taskScheduler; - public String runIndexer() + public String runRefresh() throws TaskExecutionException { - taskScheduler.runIndexer(); + taskScheduler.runDataRefresh(); return SUCCESS; } diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/AuditLog.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/AuditLog.java index 93568a2ae..6ae6b8a49 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/AuditLog.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/AuditLog.java @@ -35,7 +35,7 @@ import java.util.Date; /** * AuditLog - Audit Log. * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ * * @plexus.component role="org.apache.maven.archiva.web.repository.AuditLog" diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java index 77e45ebfd..db43e54b7 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/ProxiedDavServer.java @@ -49,7 +49,7 @@ import java.util.List; /** * ProxiedDavServer * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ * @plexus.component role="org.codehaus.plexus.webdav.DavServerComponent" * role-hint="proxied" diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java index 687dae1f2..cb3184443 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/repository/RepositoryServlet.java @@ -52,7 +52,7 @@ import java.util.List; /** * RepositoryServlet * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class RepositoryServlet diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java index 226f27c38..79c4b95b6 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifact.java @@ -25,7 +25,7 @@ import com.opensymphony.xwork.util.OgnlValueStack; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; -import org.apache.maven.archiva.artifact.ManagedArtifact; +import org.apache.maven.archiva.common.artifact.managed.ManagedArtifact; import org.apache.maven.archiva.configuration.RepositoryConfiguration; import org.apache.maven.archiva.repositories.ActiveManagedRepositories; import org.apache.maven.project.ProjectBuildingException; @@ -44,7 +44,7 @@ import javax.servlet.jsp.PageContext; /** * DownloadArtifact * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ * * @plexus.component role="com.opensymphony.webwork.components.Component" role-hint="download-artifact" diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java index 7127acad9..21aaa982f 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java @@ -27,7 +27,7 @@ import javax.servlet.jsp.tagext.TagSupport; /** * DownloadArtifactTag * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class DownloadArtifactTag diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ExpressionTool.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ExpressionTool.java index 8efab8a18..b59c5636f 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ExpressionTool.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/ExpressionTool.java @@ -29,7 +29,7 @@ import javax.servlet.jsp.tagext.Tag; /** * ExpressionTool * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class ExpressionTool diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java index 9d2e5d6f8..75b3b8081 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java @@ -33,7 +33,7 @@ import javax.servlet.http.HttpServletResponse; /** * GroupIdLink * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class GroupIdLink diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLinkTag.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLinkTag.java index 462d6ae6f..ec42b8bbe 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLinkTag.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLinkTag.java @@ -29,7 +29,7 @@ import javax.servlet.jsp.tagext.TagSupport; /** * GroupIdLink * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class GroupIdLinkTag diff --git a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java index 2b730c6bb..a56068a30 100644 --- a/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java +++ b/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java @@ -29,7 +29,7 @@ import javax.servlet.jsp.PageContext; /** * PlexusTagUtil * - * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a> + * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a> * @version $Id$ */ public class PlexusTagUtil diff --git a/archiva-webapp/src/main/resources/META-INF/plexus/application.xml b/archiva-webapp/src/main/resources/META-INF/plexus/application.xml index 62b65f63e..9b0d313bf 100644 --- a/archiva-webapp/src/main/resources/META-INF/plexus/application.xml +++ b/archiva-webapp/src/main/resources/META-INF/plexus/application.xml @@ -73,6 +73,60 @@ <component> <role>org.codehaus.plexus.jdo.JdoFactory</role> + <role-hint>archiva</role-hint> + <implementation>org.codehaus.plexus.jdo.DataSourceConfigurableJdoFactory</implementation> + <configuration> + + <connectionFactoryName>java:comp/env/jdbc/archiva</connectionFactoryName> + <shutdownConnectionFactoryName>java:comp/env/jdbc/archivaShutdown</shutdownConnectionFactoryName> + + <!-- JPOX and JDO configuration --> + <persistenceManagerFactoryClass>org.jpox.PersistenceManagerFactoryImpl</persistenceManagerFactoryClass> + <otherProperties> + <property> + <name>org.jpox.autoCreateSchema</name> + <value>true</value> + </property> + <property> + <name>org.jpox.validateTables</name> + <value>false</value> + </property> + <property> + <name>org.jpox.validateConstraints</name> + <value>false</value> + </property> + <property> + <name>org.jpox.validateColumns</name> + <value>false</value> + </property> + <property> + <name>org.jpox.autoStartMechanism</name> + <value>None</value> + </property> + <property> + <name>org.jpox.transactionIsolation</name> + <value>READ_UNCOMMITTED</value> + </property> + <property> + <name>org.jpox.poid.transactionIsolation</name> + <value>READ_UNCOMMITTED</value> + </property> + <property> + <name>org.jpox.rdbms.dateTimezone</name> + <value>JDK_DEFAULT_TIMEZONE</value> + </property> + <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations. + <property> + <name>org.jpox.identifier.case</name> + <value>PreserveCase</value> + </property> + --> + </otherProperties> + </configuration> + </component> + + <component> + <role>org.codehaus.plexus.jdo.JdoFactory</role> <role-hint>users</role-hint> <implementation>org.codehaus.plexus.jdo.DataSourceConfigurableJdoFactory</implementation> <configuration> @@ -115,12 +169,12 @@ <name>org.jpox.rdbms.dateTimezone</name> <value>JDK_DEFAULT_TIMEZONE</value> </property> -<!-- + <!-- NEEDED FOR POSTGRES, But causes problems in other JDBC implementations. <property> <name>org.jpox.identifier.case</name> <value>PreserveCase</value> </property> ---> + --> </otherProperties> </configuration> </component> @@ -130,101 +184,9 @@ --> <component> <role>org.codehaus.plexus.logging.LoggerManager</role> - <implementation>org.codehaus.plexus.logging.log4j.Log4JLoggerManager</implementation> + <implementation>org.codehaus.plexus.logging.slf4j.Slf4jLoggerManager</implementation> <lifecycle-handler>basic</lifecycle-handler> - - <configuration> - <threshold>WARN</threshold> - <default-appender>console,rolling</default-appender> - - <appenders> - <appender> - <id>console</id> - <threshold>DEBUG</threshold> - <type>org.apache.log4j.ConsoleAppender</type> - <conversion-pattern>%d [%t] %-5p %-30c{1} - %m%n</conversion-pattern> - </appender> - - <appender> - <id>rolling</id> - <threshold>DEBUG</threshold> - <type>org.apache.log4j.DailyRollingFileAppender</type> - <conversion-pattern>%-4r [%t] %-5p %c %x - %m%n</conversion-pattern> - - <properties> - <property> - <name>file</name> - <value>${appserver.base}/logs/archiva.log</value> - </property> - <property> - <name>append</name> - <value>true</value> - </property> - <property> - <name>datePattern</name> - <value>'.'yyyy-MM-dd</value> - </property> - </properties> - </appender> - </appenders> - - <levels> - <!-- Help identify bugs during testing --> - <level> - <hierarchy>org.apache.maven</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>org.codehaus.plexus.security</hierarchy> - <level>INFO</level> - </level> - <!-- squelch noisy objects (for now) --> - <level> - <hierarchy>org.codehaus.plexus.mailsender.MailSender</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>org.quartz</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>org.apache.jasper</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>com.opensymphony.xwork</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>com.opensymphony.webwork</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>org.codehaus.plexus.PlexusContainer</hierarchy> - <level>INFO</level> - </level> - <level> - <hierarchy>JPOX</hierarchy> - <level>WARN</level> - </level> - <level> - <hierarchy>JPOX.MetaData</hierarchy> - <level>ERROR</level> - </level> - <!-- - <level> - <hierarchy>JPOX.RDBMS.SQL</hierarchy> - <level>DEBUG</level> - </level> - --> - <level> - <hierarchy>freemarker</hierarchy> - <level>WARN</level> - </level> - </levels> - </configuration> </component> - </components> <load-on-start> @@ -233,7 +195,7 @@ </component> <component> <role>org.codehaus.plexus.taskqueue.execution.TaskQueueExecutor</role> - <role-hint>indexer</role-hint> + <role-hint>data-refresh</role-hint> </component> </load-on-start> diff --git a/archiva-webapp/src/main/resources/log4j.xml b/archiva-webapp/src/main/resources/log4j.xml new file mode 100644 index 000000000..9875c602e --- /dev/null +++ b/archiva-webapp/src/main/resources/log4j.xml @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> + + <appender name="rolling" class="org.apache.log4j.DailyRollingFileAppender"> + <param name="file" value="${appserver.base}/logs/archiva.log" /> + <param name="append" value="true" /> + <param name="datePattern" value="'.'yyyy-MM-dd" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-4r [%t] %-5p %c %x - %m%n"/> + </layout> + </appender> + + <appender name="console" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.out"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d [%t] %-5p %-30c{1} - %m%n"/> + </layout> + </appender> + + <!-- Help identify bugs during testing --> + <logger name="org.apache.maven"> + <level value="info"/> + </logger> + + <logger name="org.codehaus.plexus.security"> + <level value="info"/> + </logger> + + <!-- squelch noisy objects (for now) --> + <logger name="org.codehaus.plexus.mailsender.MailSender"> + <level value="info"/> + </logger> + + <logger name="org.quartz"> + <level value="info"/> + </logger> + + <logger name="org.apache.jasper"> + <level value="info"/> + </logger> + + <logger name="com.opensymphony.xwork"> + <level value="info"/> + </logger> + + <logger name="com.opensymphony.webwork"> + <level value="info"/> + </logger> + + <logger name="org.codehaus.plexus.PlexusContainer"> + <level value="info"/> + </logger> + + <logger name="JPOX"> + <level value="warn"/> + </logger> + + <logger name="JPOX.MetaData"> + <level value="error"/> + </logger> + +<!-- + <logger name="JPOX.RDBMS.SQL"> + <level value="debug"/> + </logger> + --> + + <logger name="freemarker"> + <level value="warn"/> + </logger> + + <root> + <priority value ="warn" /> + <appender-ref ref="console" /> + <appender-ref ref="rolling" /> + </root> + +</log4j:configuration> diff --git a/archiva-webapp/src/main/resources/xwork.xml b/archiva-webapp/src/main/resources/xwork.xml index f89edbe4b..703e922fc 100644 --- a/archiva-webapp/src/main/resources/xwork.xml +++ b/archiva-webapp/src/main/resources/xwork.xml @@ -92,6 +92,10 @@ <param name="actionName">login</param> <param name="namespace">/security</param> </result> + <result name="requires-authorization" type="redirect-action"> + <param name="actionName">login</param> + <param name="namespace">/security</param> + </result> <result name="security-register-success" type="redirect-action"> <param name="actionName">login</param> <param name="namespace">/security</param> @@ -177,6 +181,10 @@ <result>/WEB-INF/jsp/showArtifact.jsp</result> </action> + <action name="showArtifactReports" class="showArtifactAction" method="reports"> + <result>/WEB-INF/jsp/showArtifact.jsp</result> + </action> + <action name="showArtifactDependencies" class="showArtifactAction" method="dependencies"> <result>/WEB-INF/jsp/showArtifact.jsp</result> </action> diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactReports.jspf b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactReports.jspf new file mode 100644 index 000000000..1a9d41638 --- /dev/null +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/include/artifactReports.jspf @@ -0,0 +1,38 @@ +<%-- + ~ 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. + --%> + +<%@ taglib prefix="ww" uri="/webwork" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> + +<c:forEach items="${reports}" var="report"> + <h3> + ${report.groupId} : ${report.artifactId} : ${report.version} : ${report.classifier} : ${report.type} + </h3> + <ul> + <c:forEach items="${repor.results}" var="result"> + <li> + <b>${result.reason}</b> + </li> + </c:forEach> + </ul> +</c:forEach> +<c:if test="${empty(reports)}"> + <strong>No reports for this artifact.</strong> +</c:if> diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp index 5d73c0cd7..33d342ae0 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/reports/reports.jsp @@ -26,9 +26,7 @@ <html> <head> - <ww:set name="reports" value="reports"/> - <ww:set name="reportGroup" value="reportGroup"/> - <title>Report: ${reports[reportGroup].name}</title> + <title>Reports</title> <ww:head/> </head> @@ -38,135 +36,22 @@ <div id="contentArea"> -<pss:ifAnyAuthorized permissions="archiva-access-reports"> - <ww:form action="reports" namespace="/admin"> - <ww:select list="reports" label="Report" name="reportGroup" onchange="document.reports.submit();"/> - <ww:select list="configuration.repositories" listKey="id" listValue="name" label="Repository" headerKey="-" - headerValue="(All repositories)" name="repositoryId" onchange="document.reports.submit();"/> - <ww:select list="reports[reportGroup].reports" label="Filter" headerKey="-" headerValue="(All Problems)" - name="filter" onchange="document.reports.submit();"/> - <ww:submit value="Get Report"/> - </ww:form> -</pss:ifAnyAuthorized> - -<ww:set name="databases" value="databases"/> -<c:forEach items="${databases}" var="database"> -<div> -<div style="float: right"> - <%-- TODO! - <a href="#">Repair all</a> - | - --%> - <c:choose> - <c:when test="${!database.inProgress}"> - <pss:ifAuthorized permission="archiva-access-reports"> - <ww:url id="regenerateReportUrl" action="runReport" namespace="/admin"> - <ww:param name="repositoryId">${database.repository.id}</ww:param> - <ww:param name="reportGroup" value="reportGroup"/> - </ww:url> - <ww:a href="%{regenerateReportUrl}">Regenerate Report</ww:a> - </pss:ifAuthorized> - </c:when> - <c:otherwise> - <!-- TODO: would be good to have a generic task/job mechanism that tracked progress and ability to run - concurrently --> - <span style="color: gray;">Report in progress</span> - </c:otherwise> - </c:choose> -</div> -<h2>Repository: ${database.repository.name}</h2> - -<p> - <c:choose> - <c:when test="${!empty(database.reporting.lastModified)}"> - Status: - <img src="<c:url value="/images/icon_error_sml.gif"/>" width="15" height="15" alt=""/> - ${database.numFailures} - <img src="<c:url value="/images/icon_warning_sml.gif"/>" width="15" height="15" alt=""/> - ${database.numWarnings} - <img src="<c:url value="/images/icon_info_sml.gif"/>" width="15" height="15" alt=""/> - ${database.numNotices} - - <span style="font-size: x-small"> - <jsp:useBean id="date" class="java.util.Date"/> - <c:set target="${date}" property="time" value="${database.reporting.lastModified}"/> - Last updated: <fmt:formatDate type="both" value="${date}"/>, - execution time: <fmt:formatNumber maxFractionDigits="0" value="${database.reporting.executionTime / 60000}"/> minutes - <fmt:formatNumber maxFractionDigits="0" value="${(database.reporting.executionTime / 1000) % 60}"/> seconds - </span> - </c:when> - <c:otherwise> - <b> - This report has not yet been generated. <a href="${url}">Generate Report</a> - </b> - </c:otherwise> - </c:choose> -</p> - - <%-- TODO need to protect iterations against concurrent modification exceptions by cloning the lists synchronously --%> - <%-- TODO! paginate (displaytag?) --%> -<c:if test="${!empty(database.reporting.artifacts)}"> - <h3>Artifacts</h3> - <c:forEach items="${database.reporting.artifacts}" var="artifact" begin="0" end="2"> - <ul> - <c:forEach items="${artifact.failures}" var="result"> - <li class="errorBullet">${result.reason}</li> - </c:forEach> - <c:forEach items="${artifact.warnings}" var="result"> - <li class="warningBullet">${result.reason}</li> - </c:forEach> - <c:forEach items="${artifact.notices}" var="result"> - <li class="infoBullet">${result.reason}</li> - </c:forEach> - </ul> - <p style="text-indent: 3em;"> - <my:showArtifactLink groupId="${artifact.groupId}" artifactId="${artifact.artifactId}" - version="${artifact.version}" classifier="${artifact.classifier}"/> - </p> - <%-- TODO! - <td> - <a href="#">Repair</a> - </td> - --%> - </c:forEach> - <c:if test="${fn:length(database.reporting.artifacts) gt 3}"> - <p> - <b>... more ...</b> - </p> - </c:if> -</c:if> -<c:if test="${!empty(database.metadataWithProblems)}"> - <h3>Metadata</h3> - <c:forEach items="${database.metadataWithProblems}" var="metadata" begin="0" end="2"> - <ul> - <c:forEach items="${metadata.failures}" var="result"> - <li class="errorBullet">${result.reason}</li> - </c:forEach> - <c:forEach items="${metadata.warnings}" var="result"> - <li class="warningBullet">${result.reason}</li> - </c:forEach> - <c:forEach items="${metadata.notices}" var="result"> - <li class="infoBullet">${result.reason}</li> - </c:forEach> - </ul> - <p style="text-indent: 3em;"> - <my:showArtifactLink groupId="${metadata.groupId}" artifactId="${metadata.artifactId}" - version="${metadata.version}"/> - </p> - <%-- TODO! - <td> - <a href="#">Repair</a> - </td> - --%> - </c:forEach> - <c:if test="${fn:length(database.metadataWithProblems) gt 3}"> - <p> - <b>... more ...</b> - </p> - </c:if> -</c:if> -</div> +<c:forEach items="${reports}" var="report"> + <h3> + ${report.groupId} : ${report.artifactId} : ${report.version} : ${report.classifier} : ${report.type} + </h3> + <ul> + <c:forEach items="${repor.results}" var="result"> + <li> + <b>${result.reason}</b> + </li> + </c:forEach> + </ul> </c:forEach> +<c:if test="${empty(reports)}"> + <strong>No reports for any artifact.</strong> +</c:if> + </div> </body> diff --git a/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp b/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp index 60299d7d3..0ba14bb84 100644 --- a/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp +++ b/archiva-webapp/src/main/webapp/WEB-INF/jsp/showArtifact.jsp @@ -21,6 +21,7 @@ <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="my" tagdir="/WEB-INF/tags" %> <%@ taglib prefix="archiva" uri="http://maven.apache.org/archiva" %> +<%@ taglib prefix="pss" uri="/plexusSecuritySystem" %> <html> <head> @@ -115,6 +116,17 @@ </ww:url> </c:set> <my:currentWWUrl url="${url}">Mailing Lists</my:currentWWUrl> + <pss:ifAnyAuthorized permissions="archiva-access-reports"> + <c:set var="url"> + <ww:url action="showArtifactReports"> + <ww:param name="groupId" value="%{groupId}"/> + <ww:param name="artifactId" value="%{artifactId}"/> + <ww:param name="version" value="%{version}"/> + </ww:url> + </c:set> + <my:currentWWUrl url="${url}">Reports</my:currentWWUrl> + </pss:ifAnyAuthorized> + </span> </div> @@ -135,6 +147,9 @@ <c:when test="${mailingLists != null}"> <%@ include file="/WEB-INF/jsp/include/mailingLists.jspf" %> </c:when> + <c:when test="${reports != null}"> + <%@ include file="/WEB-INF/jsp/include/artifactReports.jspf" %> + </c:when> <c:otherwise> <%@ include file="/WEB-INF/jsp/include/artifactInfo.jspf" %> </c:otherwise> |