* 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
This commit is contained in:
Joakim Erdfelt 2007-04-24 05:41:27 +00:00
parent c5839cb7f1
commit b4d57ec324
4 changed files with 120 additions and 8 deletions

View 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 )
@ -99,6 +114,16 @@ public class ConfigurationNames
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 )

View File

@ -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;
}
}

View File

@ -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();
}

View 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,14 +43,15 @@ 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;
}