mirror of https://github.com/apache/archiva.git
* 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:
parent
c5839cb7f1
commit
b4d57ec324
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue