From b4d57ec3248baba3280ebb4a4378de6a39e59237 Mon Sep 17 00:00:00 2001 From: Joakim Erdfelt Date: Tue, 24 Apr 2007 05:41:27 +0000 Subject: [PATCH] * Using ReportingManager in webapp. git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@531749 13f79535-47bb-0310-9956-ffa450edef68 --- .../configuration/ConfigurationNames.java | 31 ++++++++++-- .../reporting/DefaultReportingManager.java | 50 +++++++++++++++++++ .../archiva/reporting/ReportingManager.java | 35 +++++++++++++ .../archiva/web/action/ReportsAction.java | 12 +++-- 4 files changed, 120 insertions(+), 8 deletions(-) create mode 100644 archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/DefaultReportingManager.java create mode 100644 archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/ReportingManager.java diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java index 7fb925217..589a511f5 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java @@ -36,6 +36,8 @@ public class ConfigurationNames private static final Set repositories = new HashSet(); + private static final Set proxyConnectors = new HashSet(); + static { repositories.add( "repositories" ); @@ -67,6 +69,19 @@ public class ConfigurationNames repositoryScanning.add( "goodConsumer" ); repositoryScanning.add( "badConsumers" ); repositoryScanning.add( "badConsumer" ); + + proxyConnectors.add( "proxyConnectors" ); + proxyConnectors.add( "proxyConnector" ); + proxyConnectors.add( "sourceRepoId" ); + proxyConnectors.add( "targetRepoId" ); + proxyConnectors.add( "proxyId" ); + proxyConnectors.add( "snapshotsPolicy" ); + proxyConnectors.add( "releasePolicy" ); + proxyConnectors.add( "checksumPolicy" ); + proxyConnectors.add( "whiteListPatterns" ); + proxyConnectors.add( "whiteListPattern" ); + proxyConnectors.add( "blackListPatterns" ); + proxyConnectors.add( "blackListPattern" ); } public static boolean isNetworkProxy( String propertyName ) @@ -88,17 +103,27 @@ public class ConfigurationNames return repositoryScanning.contains( propertyName ); } - + public static boolean isRepositories( String propertyName ) { - if( empty(propertyName)) + if ( empty( propertyName ) ) { return false; } - + return repositories.contains( propertyName ); } + public static boolean isProxyConnector( String propertyName ) + { + if ( empty( propertyName ) ) + { + return false; + } + + return proxyConnectors.contains( propertyName ); + } + private static boolean empty( String name ) { if ( name == null ) diff --git a/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/DefaultReportingManager.java b/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/DefaultReportingManager.java new file mode 100644 index 000000000..d4cbdef4a --- /dev/null +++ b/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/DefaultReportingManager.java @@ -0,0 +1,50 @@ +package org.apache.maven.archiva.reporting; + +/* + * 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.codehaus.plexus.logging.AbstractLogEnabled; + +import java.util.Map; + +/** + * DefaultReportingManager + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public class DefaultReportingManager + extends AbstractLogEnabled + implements ReportingManager +{ + /** + * @plexus.requirement role="org.apache.maven.archiva.reporting.DynamicReportSource" + */ + private Map reportSourceMap; + + public DynamicReportSource getReport( String id ) + { + return (DynamicReportSource) reportSourceMap.get( id ); + } + + public Map getAvailableReports() + { + return reportSourceMap; + } +} diff --git a/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/ReportingManager.java b/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/ReportingManager.java new file mode 100644 index 000000000..499190beb --- /dev/null +++ b/archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/ReportingManager.java @@ -0,0 +1,35 @@ +package org.apache.maven.archiva.reporting; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.Map; + +/** + * ReportingManager + * + * @author Joakim Erdfelt + * @version $Id$ + */ +public interface ReportingManager +{ + public DynamicReportSource getReport( String id ); + + public Map /**/getAvailableReports(); +} diff --git a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java index 952cc674c..59d1ab35b 100644 --- a/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java +++ b/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java @@ -19,7 +19,7 @@ package org.apache.maven.archiva.web.action; * under the License. */ -import org.apache.maven.archiva.reporting.database.ReportingDatabase; +import org.apache.maven.archiva.reporting.ReportingManager; import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.codehaus.plexus.security.rbac.Resource; import org.codehaus.plexus.security.ui.web.interceptor.SecureAction; @@ -27,6 +27,7 @@ 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.List; /** @@ -42,15 +43,16 @@ public class ReportsAction /** * @plexus.requirement */ - private ReportingDatabase database; + private ReportingManager reportingManager; - private List reports; + private List reports = new ArrayList(); public String execute() throws Exception { - reports = database.getArtifactDatabase().getAllArtifactResults(); - + reports.clear(); + reports.addAll( reportingManager.getAvailableReports().values() ); + return SUCCESS; }