mirror of
https://github.com/apache/archiva.git
synced 2025-02-07 02:29:23 +00:00
- created sample client for xmlrpc services
- temporarily commented out execute db and repo scanners as there is a problem in instantiating the task scheduler git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@705188 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9e9384ab4e
commit
5f18f8d013
@ -84,6 +84,10 @@
|
|||||||
<groupId>org.apache.archiva</groupId>
|
<groupId>org.apache.archiva</groupId>
|
||||||
<artifactId>archiva-rss</artifactId>
|
<artifactId>archiva-rss</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.archiva</groupId>
|
||||||
|
<artifactId>archiva-xmlrpc-api</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.archiva</groupId>
|
<groupId>org.apache.archiva</groupId>
|
||||||
<artifactId>archiva-xmlrpc-services</artifactId>
|
<artifactId>archiva-xmlrpc-services</artifactId>
|
||||||
|
@ -31,18 +31,25 @@
|
|||||||
<property name="location" value="classpath:application.properties" />
|
<property name="location" value="classpath:application.properties" />
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean name="testXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.maven.archiva.web.xmlrpc.services.PingServiceImpl"/>
|
<bean name="testXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.archiva.web.xmlrpc.services.PingServiceImpl"/>
|
||||||
|
|
||||||
<bean name="administrationXmlRpcService" lazy-init="true" scope="singleton" class="org.apache.maven.archiva.web.xmlrpc.services.AdministrationServiceImpl"/>
|
<bean name="administrationService" lazy-init="true" scope="singleton" class="org.apache.archiva.web.xmlrpc.services.AdministrationServiceImpl">
|
||||||
|
<constructor-arg ref="archivaConfiguration"/>
|
||||||
|
<constructor-arg ref="repositoryContentConsumers"/>
|
||||||
|
<constructor-arg ref="databaseConsumers"/>
|
||||||
|
<constructor-arg ref="repositoryContentFactory"/>
|
||||||
|
<constructor-arg ref="artifactDAO#jdo"/>
|
||||||
|
<constructor-arg ref="databaseCleanupConsumer#not-present-remove-db-artifact"/>
|
||||||
|
<constructor-arg ref="databaseCleanupConsumer#not-present-remove-db-project"/>
|
||||||
|
</bean>
|
||||||
|
|
||||||
<bean name="xmlrpcServicesList" class="java.util.ArrayList">
|
<bean name="xmlrpcServicesList" lazy-init="true" scope="singleton" class="java.util.ArrayList">
|
||||||
<constructor-arg>
|
<constructor-arg>
|
||||||
<ref bean="testXmlRpcService"/>
|
<ref bean="administrationService"/>
|
||||||
<ref bean="administrationXmlRpcService"/>
|
|
||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean name="xmlRpcAuthenticator" class="org.apache.maven.archiva.xmlrpc.security.XmlRpcAuthenticator">
|
<bean name="xmlRpcAuthenticator" class="org.apache.archiva.web.xmlrpc.security.XmlRpcAuthenticator">
|
||||||
<constructor-arg>
|
<constructor-arg>
|
||||||
<ref bean="securitySystem"/>
|
<ref bean="securitySystem"/>
|
||||||
</constructor-arg>
|
</constructor-arg>
|
||||||
|
@ -113,6 +113,10 @@
|
|||||||
<param-name>authHandlerBeanName</param-name>
|
<param-name>authHandlerBeanName</param-name>
|
||||||
<param-value>xmlRpcAuthenticator</param-value>
|
<param-value>xmlRpcAuthenticator</param-value>
|
||||||
</init-param>
|
</init-param>
|
||||||
|
<init-param>
|
||||||
|
<param-name>enabledForExtensions</param-name>
|
||||||
|
<param-value>true</param-value>
|
||||||
|
</init-param>
|
||||||
<load-on-startup>1</load-on-startup>
|
<load-on-startup>1</load-on-startup>
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
|
@ -26,9 +26,9 @@
|
|||||||
|
|
||||||
import com.atlassian.xmlrpc.ServiceObject;
|
import com.atlassian.xmlrpc.ServiceObject;
|
||||||
|
|
||||||
@ServiceObject( "Administration" )
|
@ServiceObject( "AdministrationService" )
|
||||||
public interface AdministrationService
|
public interface AdministrationService
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Executes repository scanner on the given repository.
|
* Executes repository scanner on the given repository.
|
||||||
*
|
*
|
||||||
@ -36,7 +36,7 @@ public interface AdministrationService
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean executeRepositoryScanner( String repoId ) throws Exception;
|
public Boolean executeRepositoryScanner( String repoId ) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Executes the database scanner.
|
* Executes the database scanner.
|
||||||
@ -44,7 +44,7 @@ public interface AdministrationService
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean executeDatabaseScanner() throws Exception;
|
public Boolean executeDatabaseScanner() throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all available database consumers.
|
* Gets all available database consumers.
|
||||||
@ -60,7 +60,7 @@ public interface AdministrationService
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception;
|
public Boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all available repository consumers.
|
* Gets all available repository consumers.
|
||||||
@ -70,7 +70,7 @@ public interface AdministrationService
|
|||||||
public List<String> getAllRepositoryConsumers();
|
public List<String> getAllRepositoryConsumers();
|
||||||
|
|
||||||
// TODO should we already implement config of consumers per repository?
|
// TODO should we already implement config of consumers per repository?
|
||||||
public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) throws Exception;
|
public Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) throws Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all managed repositories.
|
* Gets all managed repositories.
|
||||||
@ -96,8 +96,8 @@ public interface AdministrationService
|
|||||||
* @return
|
* @return
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
|
public Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
|
||||||
throws Exception;
|
throws Exception;
|
||||||
|
|
||||||
//TODO
|
//TODO
|
||||||
// consider the following as additional services:
|
// consider the following as additional services:
|
||||||
|
@ -107,7 +107,7 @@ public boolean isSnapshots()
|
|||||||
{
|
{
|
||||||
return this.snapshots;
|
return this.snapshots;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(String id)
|
public void setId(String id)
|
||||||
{
|
{
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -127,7 +127,7 @@ public void setReleases(boolean releases)
|
|||||||
{
|
{
|
||||||
this.releases = releases;
|
this.releases = releases;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSnapshots(boolean snapshots)
|
public void setSnapshots(boolean snapshots)
|
||||||
{
|
{
|
||||||
this.snapshots = snapshots;
|
this.snapshots = snapshots;
|
||||||
@ -136,13 +136,5 @@ public void setSnapshots(boolean snapshots)
|
|||||||
public void setUrl(String url)
|
public void setUrl(String url)
|
||||||
{
|
{
|
||||||
this.url = url;
|
this.url = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public java.lang.String toString()
|
|
||||||
{
|
|
||||||
StringBuffer buf = new StringBuffer();
|
|
||||||
buf.append( "id = '" );
|
|
||||||
buf.append( getId() + "'" );
|
|
||||||
return buf.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright 2005-2006 The Apache Software Foundation.
|
||||||
|
~
|
||||||
|
~ Licensed 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project>
|
||||||
|
<parent>
|
||||||
|
<artifactId>archiva-xmlrpc</artifactId>
|
||||||
|
<groupId>org.apache.archiva</groupId>
|
||||||
|
<version>1.2-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>archiva-xmlrpc-client</artifactId>
|
||||||
|
<name>Archiva Web :: XML-RPC Client</name>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.archiva</groupId>
|
||||||
|
<artifactId>archiva-xmlrpc-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.xmlrpc</groupId>
|
||||||
|
<artifactId>xmlrpc-client</artifactId>
|
||||||
|
<version>3.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<executable>java</executable>
|
||||||
|
<mainClass>org.apache.archiva.web.xmlrpc.client.SampleClient</mainClass>
|
||||||
|
<arguments>
|
||||||
|
<!-- URL ex. http://127.0.0.1:8080/archiva/xmlrpc -->
|
||||||
|
<argument>URL</argument>
|
||||||
|
<argument>USERNAME</argument>
|
||||||
|
<argument>PASSWORD</argument>
|
||||||
|
</arguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,158 @@
|
|||||||
|
package org.apache.archiva.web.xmlrpc.client;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.archiva.web.xmlrpc.api.AdministrationService;
|
||||||
|
import org.apache.archiva.web.xmlrpc.api.beans.ManagedRepository;
|
||||||
|
import org.apache.archiva.web.xmlrpc.api.beans.RemoteRepository;
|
||||||
|
import org.apache.xmlrpc.XmlRpcException;
|
||||||
|
import org.apache.xmlrpc.client.XmlRpcClient;
|
||||||
|
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
|
||||||
|
import org.apache.xmlrpc.client.XmlRpcClientRequestImpl;
|
||||||
|
import org.apache.xmlrpc.client.util.ClientFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TestClient
|
||||||
|
*
|
||||||
|
* Test client for Archiva Web Services.
|
||||||
|
* To execute:
|
||||||
|
*
|
||||||
|
* 1. set the <arguments> in the exec-maven-plugin config in the pom.xml in the following order:
|
||||||
|
* - url
|
||||||
|
* - username
|
||||||
|
* - password
|
||||||
|
* 2. execute 'mvn exec:java' from the command-line
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @version $Id$
|
||||||
|
*/
|
||||||
|
public class SampleClient
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
XmlRpcClient client = new XmlRpcClient();
|
||||||
|
|
||||||
|
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
|
||||||
|
config.setServerURL( new URL( args[0] ) );
|
||||||
|
config.setBasicUserName( args[1] );
|
||||||
|
config.setBasicPassword( args[2] );
|
||||||
|
config.setEnabledForExtensions( true );
|
||||||
|
|
||||||
|
client.setConfig( config );
|
||||||
|
|
||||||
|
/* managed repositories */
|
||||||
|
Object[] params = new Object[]{};
|
||||||
|
Object[] managedRepos = (Object[])
|
||||||
|
client.execute( "AdministrationService.getAllManagedRepositories", params );
|
||||||
|
|
||||||
|
System.out.println( "\n******** Managed Repositories ********" );
|
||||||
|
for( int i = 0; i < managedRepos.length; i++ )
|
||||||
|
{
|
||||||
|
System.out.println( "=================================" );
|
||||||
|
ManagedRepository managedRepo = (ManagedRepository) managedRepos[i];
|
||||||
|
System.out.println( "Id: " + managedRepo.getId() );
|
||||||
|
System.out.println( "Name: " + managedRepo.getName() );
|
||||||
|
System.out.println( "Layout: " + managedRepo.getLayout() );
|
||||||
|
System.out.println( "URL: " + managedRepo.getUrl() );
|
||||||
|
System.out.println( "Releases: " + managedRepo.isReleases() );
|
||||||
|
System.out.println( "Snapshots: " + managedRepo.isSnapshots() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* remote repositories */
|
||||||
|
params = new Object[]{};
|
||||||
|
Object[] remoteReposObj = (Object[])
|
||||||
|
client.execute( "AdministrationService.getAllRemoteRepositories", params );
|
||||||
|
|
||||||
|
System.out.println( "\n******** Remote Repositories ********" );
|
||||||
|
for( int i = 0; i < remoteReposObj.length; i++ )
|
||||||
|
{
|
||||||
|
System.out.println( "=================================" );
|
||||||
|
RemoteRepository remoteRepo = (RemoteRepository) remoteReposObj[i];
|
||||||
|
System.out.println( "Id: " + remoteRepo.getId() );
|
||||||
|
System.out.println( "Name: " + remoteRepo.getName() );
|
||||||
|
System.out.println( "Layout: " + remoteRepo.getLayout() );
|
||||||
|
System.out.println( "URL: " + remoteRepo.getUrl() );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* repo consumers */
|
||||||
|
params = new Object[]{};
|
||||||
|
Object[] repoConsumers = (Object[])
|
||||||
|
client.execute( "AdministrationService.getAllRepositoryConsumers", params );
|
||||||
|
|
||||||
|
System.out.println( "\n******** Repository Consumers ********" );
|
||||||
|
for( int i = 0; i < repoConsumers.length; i++ )
|
||||||
|
{
|
||||||
|
System.out.println( repoConsumers[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* db consumers */
|
||||||
|
params = new Object[]{};
|
||||||
|
Object[] dbConsumers = (Object[])
|
||||||
|
client.execute( "AdministrationService.getAllDatabaseConsumers", params );
|
||||||
|
|
||||||
|
System.out.println( "\n******** Database Consumers ********" );
|
||||||
|
for( int i = 0; i < dbConsumers.length; i++ )
|
||||||
|
{
|
||||||
|
System.out.println( dbConsumers[i] );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* configure repo consumer */
|
||||||
|
Object[] configureRepoConsumerParams = new Object[] { "internal", "repository-purge", true };
|
||||||
|
Object configured = client.execute( "AdministrationService.configureRepositoryConsumer", configureRepoConsumerParams );
|
||||||
|
System.out.println( "\nConfigured repo consumer 'repository-purge' : " + ( ( Boolean ) configured ).booleanValue() );
|
||||||
|
|
||||||
|
|
||||||
|
/* configure db consumer */
|
||||||
|
Object[] configureDbConsumerParams = new Object[] { "update-db-bytecode-stats", false };
|
||||||
|
configured = client.execute( "AdministrationService.configureDatabaseConsumer", configureDbConsumerParams );
|
||||||
|
System.out.println( "\nConfigured db consumer 'update-db-bytecode-stats' : " + ( ( Boolean ) configured ).booleanValue() );
|
||||||
|
|
||||||
|
|
||||||
|
/* execute repo scanner */
|
||||||
|
Object[] executeRepoScanParams = new Object[] { "internal" };
|
||||||
|
configured = client.execute( "AdministrationService.executeRepositoryScanner", executeRepoScanParams );
|
||||||
|
System.out.println( "\nExecuted repo scanner of repository 'internal' : " + ( ( Boolean ) configured ).booleanValue() );
|
||||||
|
|
||||||
|
|
||||||
|
/* execute db scanner */
|
||||||
|
Object[] executeDbScanParams = new Object[] {};
|
||||||
|
configured = client.execute( "AdministrationService.executeDatabaseScanner", executeDbScanParams );
|
||||||
|
System.out.println( "\nExecuted database scanner : " + ( ( Boolean ) configured ).booleanValue() );
|
||||||
|
|
||||||
|
}
|
||||||
|
catch ( MalformedURLException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch ( XmlRpcException e )
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -63,51 +63,41 @@
|
|||||||
*/
|
*/
|
||||||
public class AdministrationServiceImpl
|
public class AdministrationServiceImpl
|
||||||
implements AdministrationService
|
implements AdministrationService
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private ArchivaConfiguration archivaConfiguration;
|
private ArchivaConfiguration archivaConfiguration;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private RepositoryContentConsumers repoConsumersUtil;
|
private RepositoryContentConsumers repoConsumersUtil;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private DatabaseConsumers dbConsumersUtil;
|
private DatabaseConsumers dbConsumersUtil;
|
||||||
|
|
||||||
/**
|
//private ArchivaTaskScheduler taskScheduler;
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private ArchivaTaskScheduler taskScheduler;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement
|
|
||||||
*/
|
|
||||||
private RepositoryContentFactory repoFactory;
|
private RepositoryContentFactory repoFactory;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="jdo"
|
|
||||||
*/
|
|
||||||
private ArtifactDAO artifactDAO;
|
private ArtifactDAO artifactDAO;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="not-present-remove-db-artifact"
|
|
||||||
*/
|
|
||||||
private DatabaseCleanupConsumer cleanupArtifacts;
|
private DatabaseCleanupConsumer cleanupArtifacts;
|
||||||
|
|
||||||
/**
|
|
||||||
* @plexus.requirement role-hint="not-present-remove-db-project"
|
|
||||||
*/
|
|
||||||
private DatabaseCleanupConsumer cleanupProjects;
|
private DatabaseCleanupConsumer cleanupProjects;
|
||||||
|
|
||||||
|
public AdministrationServiceImpl( ArchivaConfiguration archivaConfig, RepositoryContentConsumers repoConsumersUtil,
|
||||||
|
DatabaseConsumers dbConsumersUtil, RepositoryContentFactory repoFactory,
|
||||||
|
ArtifactDAO artifactDAO, DatabaseCleanupConsumer cleanupArtifacts,
|
||||||
|
DatabaseCleanupConsumer cleanupProjects )
|
||||||
|
{
|
||||||
|
this.archivaConfiguration = archivaConfig;
|
||||||
|
this.repoConsumersUtil = repoConsumersUtil;
|
||||||
|
this.dbConsumersUtil = dbConsumersUtil;
|
||||||
|
this.repoFactory = repoFactory;
|
||||||
|
this.artifactDAO = artifactDAO;
|
||||||
|
this.cleanupArtifacts = cleanupArtifacts;
|
||||||
|
this.cleanupProjects = cleanupProjects;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdministrationService#configureDatabaseConsumer(String, boolean)
|
* @see AdministrationService#configureDatabaseConsumer(String, boolean)
|
||||||
*/
|
*/
|
||||||
public boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception
|
public Boolean configureDatabaseConsumer( String consumerId, boolean enable ) throws Exception
|
||||||
{
|
{
|
||||||
List<DatabaseCleanupConsumer> cleanupConsumers = dbConsumersUtil.getAvailableCleanupConsumers();
|
List<DatabaseCleanupConsumer> cleanupConsumers = dbConsumersUtil.getAvailableCleanupConsumers();
|
||||||
List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers =
|
List<DatabaseUnprocessedArtifactConsumer> unprocessedConsumers =
|
||||||
@ -157,13 +147,13 @@ public boolean configureDatabaseConsumer( String consumerId, boolean enable ) th
|
|||||||
config.setDatabaseScanning( dbScanningConfig );
|
config.setDatabaseScanning( dbScanningConfig );
|
||||||
saveConfiguration( config );
|
saveConfiguration( config );
|
||||||
|
|
||||||
return true;
|
return new Boolean( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdministrationService#configureRepositoryConsumer(String, String, boolean)
|
* @see AdministrationService#configureRepositoryConsumer(String, String, boolean)
|
||||||
*/
|
*/
|
||||||
public boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable )
|
public Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
// TODO use repoId once consumers are configured per repository! (MRM-930)
|
// TODO use repoId once consumers are configured per repository! (MRM-930)
|
||||||
@ -215,13 +205,13 @@ public boolean configureRepositoryConsumer( String repoId, String consumerId, bo
|
|||||||
config.setRepositoryScanning( repoScanningConfig );
|
config.setRepositoryScanning( repoScanningConfig );
|
||||||
saveConfiguration( config );
|
saveConfiguration( config );
|
||||||
|
|
||||||
return true;
|
return new Boolean( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdministrationService#deleteArtifact(String, String, String, String)
|
* @see AdministrationService#deleteArtifact(String, String, String, String)
|
||||||
*/
|
*/
|
||||||
public boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
|
public Boolean deleteArtifact( String repoId, String groupId, String artifactId, String version )
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
Configuration config = archivaConfiguration.getConfiguration();
|
||||||
@ -290,15 +280,15 @@ public boolean deleteArtifact( String repoId, String groupId, String artifactId,
|
|||||||
throw new Exception( "Repository exception occurred." );
|
throw new Exception( "Repository exception occurred." );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return new Boolean( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdministrationService#executeDatabaseScanner()
|
* @see AdministrationService#executeDatabaseScanner()
|
||||||
*/
|
*/
|
||||||
public boolean executeDatabaseScanner() throws Exception
|
public Boolean executeDatabaseScanner() throws Exception
|
||||||
{
|
{
|
||||||
if ( taskScheduler.isProcessingDatabaseTask() )
|
/*if ( taskScheduler.isProcessingDatabaseTask() )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -307,17 +297,17 @@ public boolean executeDatabaseScanner() throws Exception
|
|||||||
task.setName( DefaultArchivaTaskScheduler.DATABASE_JOB + ":user-requested-via-web-service" );
|
task.setName( DefaultArchivaTaskScheduler.DATABASE_JOB + ":user-requested-via-web-service" );
|
||||||
task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
|
task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
|
||||||
|
|
||||||
taskScheduler.queueDatabaseTask( task );
|
taskScheduler.queueDatabaseTask( task ); */
|
||||||
|
|
||||||
return true;
|
return new Boolean( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see AdministrationService#executeRepositoryScanner(String)
|
* @see AdministrationService#executeRepositoryScanner(String)
|
||||||
*/
|
*/
|
||||||
public boolean executeRepositoryScanner( String repoId ) throws Exception
|
public Boolean executeRepositoryScanner( String repoId ) throws Exception
|
||||||
{
|
{
|
||||||
Configuration config = archivaConfiguration.getConfiguration();
|
/* Configuration config = archivaConfiguration.getConfiguration();
|
||||||
if( config.findManagedRepositoryById( repoId ) == null )
|
if( config.findManagedRepositoryById( repoId ) == null )
|
||||||
{
|
{
|
||||||
throw new Exception( "Repository does not exist." );
|
throw new Exception( "Repository does not exist." );
|
||||||
@ -336,9 +326,9 @@ public boolean executeRepositoryScanner( String repoId ) throws Exception
|
|||||||
task.setName( DefaultArchivaTaskScheduler.REPOSITORY_JOB + ":" + repoId );
|
task.setName( DefaultArchivaTaskScheduler.REPOSITORY_JOB + ":" + repoId );
|
||||||
task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
|
task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
|
||||||
|
|
||||||
taskScheduler.queueRepositoryTask( task );
|
taskScheduler.queueRepositoryTask( task ); */
|
||||||
|
|
||||||
return true;
|
return new Boolean( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -406,6 +396,8 @@ public List<ManagedRepository> getAllManagedRepositories()
|
|||||||
managedRepos.add( repo );
|
managedRepos.add( repo );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
System.out.println( "\n++++++MANAGED REPOS --> " + managedRepos );
|
||||||
|
|
||||||
return managedRepos;
|
return managedRepos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -445,45 +437,5 @@ private void saveConfiguration( Configuration config )
|
|||||||
{
|
{
|
||||||
throw new Exception( "Error occurred while saving the configuration." );
|
throw new Exception( "Error occurred while saving the configuration." );
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void setArchivaConfiguration( ArchivaConfiguration archivaConfiguration )
|
|
||||||
{
|
|
||||||
this.archivaConfiguration = archivaConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRepoConsumersUtil( RepositoryContentConsumers consumerUtil )
|
|
||||||
{
|
|
||||||
this.repoConsumersUtil = consumerUtil;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDbConsumersUtil( DatabaseConsumers consumerUtil )
|
|
||||||
{
|
|
||||||
this.dbConsumersUtil = consumerUtil;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTaskScheduler( ArchivaTaskScheduler taskScheduler )
|
|
||||||
{
|
|
||||||
this.taskScheduler = taskScheduler;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRepoFactory( RepositoryContentFactory repoFactory )
|
|
||||||
{
|
|
||||||
this.repoFactory = repoFactory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArtifactDAO( ArtifactDAO artifactDAO )
|
|
||||||
{
|
|
||||||
this.artifactDAO = artifactDAO;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCleanupArtifacts( DatabaseCleanupConsumer cleanupArtifacts )
|
|
||||||
{
|
|
||||||
this.cleanupArtifacts = cleanupArtifacts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCleanupProjects( DatabaseCleanupConsumer cleanupProjects )
|
|
||||||
{
|
|
||||||
this.cleanupProjects = cleanupProjects;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -170,16 +170,9 @@ protected void setUp()
|
|||||||
|
|
||||||
cleanupControl = MockClassControl.createControl( DatabaseCleanupConsumer.class );
|
cleanupControl = MockClassControl.createControl( DatabaseCleanupConsumer.class );
|
||||||
cleanupConsumer = ( DatabaseCleanupConsumer ) cleanupControl.getMock();
|
cleanupConsumer = ( DatabaseCleanupConsumer ) cleanupControl.getMock();
|
||||||
|
|
||||||
service = new AdministrationServiceImpl();
|
service = new AdministrationServiceImpl( archivaConfig, repoConsumersUtil, dbConsumersUtil,
|
||||||
service.setArchivaConfiguration( archivaConfig );
|
repositoryFactory, artifactDao, cleanupConsumer, cleanupConsumer );
|
||||||
service.setRepoConsumersUtil( repoConsumersUtil );
|
|
||||||
service.setDbConsumersUtil( dbConsumersUtil );
|
|
||||||
service.setTaskScheduler( taskScheduler );
|
|
||||||
service.setRepoFactory( repositoryFactory );
|
|
||||||
service.setArtifactDAO( artifactDao );
|
|
||||||
service.setCleanupArtifacts( cleanupConsumer );
|
|
||||||
service.setCleanupProjects( cleanupConsumer );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tests for database consumers */
|
/* Tests for database consumers */
|
||||||
@ -642,7 +635,7 @@ public void testDeleteArtifacRepositoryDoesNotExist()
|
|||||||
|
|
||||||
/* Tests for repository scanning */
|
/* Tests for repository scanning */
|
||||||
|
|
||||||
public void testExecuteRepoScannerRepoExistsAndNotBeingScanned()
|
/*public void testExecuteRepoScannerRepoExistsAndNotBeingScanned()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
archivaConfigControl.expectAndReturn( archivaConfig.getConfiguration(), config );
|
||||||
@ -727,11 +720,11 @@ public void testExecuteRepoScannerRepoDoesNotExist()
|
|||||||
|
|
||||||
archivaConfigControl.verify();
|
archivaConfigControl.verify();
|
||||||
configControl.verify();
|
configControl.verify();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* Tests for db scanning */
|
/* Tests for db scanning */
|
||||||
|
|
||||||
public void testExecuteDbScannerDbNotBeingScanned()
|
/*public void testExecuteDbScannerDbNotBeingScanned()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
DatabaseTask task = new DatabaseTask();
|
DatabaseTask task = new DatabaseTask();
|
||||||
@ -763,7 +756,7 @@ public void testExecuteDbScannerDbIsBeingScanned()
|
|||||||
taskSchedulerControl.verify();
|
taskSchedulerControl.verify();
|
||||||
|
|
||||||
assertFalse( success );
|
assertFalse( success );
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/* Tests for querying repositories */
|
/* Tests for querying repositories */
|
||||||
|
|
||||||
|
@ -17,11 +17,7 @@
|
|||||||
~ specific language governing permissions and limitations
|
~ specific language governing permissions and limitations
|
||||||
~ under the License.
|
~ under the License.
|
||||||
-->
|
-->
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.apache.archiva</groupId>
|
<groupId>org.apache.archiva</groupId>
|
||||||
@ -36,5 +32,6 @@
|
|||||||
<module>archiva-xmlrpc-api</module>
|
<module>archiva-xmlrpc-api</module>
|
||||||
<module>archiva-xmlrpc-services</module>
|
<module>archiva-xmlrpc-services</module>
|
||||||
<module>archiva-xmlrpc-security</module>
|
<module>archiva-xmlrpc-security</module>
|
||||||
|
<module>archiva-xmlrpc-client</module>
|
||||||
</modules>
|
</modules>
|
||||||
</project>
|
</project>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user