]> source.dussan.org Git - archiva.git/commitdiff
* Using ReportingManager in webapp.
authorJoakim Erdfelt <joakime@apache.org>
Tue, 24 Apr 2007 05:41:27 +0000 (05:41 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Tue, 24 Apr 2007 05:41:27 +0000 (05:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/branches/archiva-jpox-database-refactor@531749 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/ConfigurationNames.java
archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/DefaultReportingManager.java [new file with mode: 0644]
archiva-reporting/archiva-report-manager/src/main/java/org/apache/maven/archiva/reporting/ReportingManager.java [new file with mode: 0644]
archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ReportsAction.java

index 7fb925217cef18bd66b55d59c4a895fd00c55524..589a511f52b85cead57bb2e617c1b6f0737e5f36 100644 (file)
@@ -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 (file)
index 0000000..d4cbdef
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @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 (file)
index 0000000..499190b
--- /dev/null
@@ -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 <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
+ * @version $Id$
+ */
+public interface ReportingManager
+{
+    public DynamicReportSource getReport( String id );
+
+    public Map /*<String,DynamicReportSource>*/getAvailableReports();
+}
index 952cc674ccf6344800d7293c55aa87ee2eba2a50..59d1ab35b2ecfb87f5e20972d3562a2f057fbcaa 100644 (file)
@@ -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;
     }