]> source.dussan.org Git - archiva.git/commitdiff
- added the ArchivaTaskScheduler in AdministrationServiceImpl
authorMaria Odea B. Ching <oching@apache.org>
Thu, 16 Oct 2008 10:38:50 +0000 (10:38 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Thu, 16 Oct 2008 10:38:50 +0000 (10:38 +0000)
- uncommented methods for executing db and repo scanners

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches@705202 13f79535-47bb-0310-9956-ffa450edef68

MRM-124/archiva-modules/archiva-web/archiva-webapp/src/main/webapp/WEB-INF/applicationContext.xml
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-api/src/main/java/org/apache/archiva/web/xmlrpc/api/AdministrationService.java
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/main/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImpl.java
MRM-124/archiva-modules/archiva-web/archiva-xmlrpc/archiva-xmlrpc-services/src/test/java/org/apache/archiva/web/xmlrpc/services/AdministrationServiceImplTest.java

index 5b1b38131f3c242b00639e6beefa88cc11d201ce..d8604065c52817bdaf336f4efad7b30cccc4cf77 100644 (file)
     <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"/>        
+    <constructor-arg ref="databaseCleanupConsumer#not-present-remove-db-project"/> 
+    <constructor-arg ref="archivaTaskScheduler"/>       
   </bean> 
 
   <bean name="xmlrpcServicesList" lazy-init="true" scope="singleton" class="java.util.ArrayList">
-    <constructor-arg> 
-      <ref bean="administrationService"/>
-    </constructor-arg>
+    <constructor-arg ref="administrationService"/>
   </bean>
     
   <bean name="xmlRpcAuthenticator" class="org.apache.archiva.web.xmlrpc.security.XmlRpcAuthenticator">
index 45c83fb1d4fa508aae1a0f5c3e77e076f157ae07..8149334464b298987136f5aec09f6c24bca4ba8b 100644 (file)
@@ -69,7 +69,16 @@ public interface AdministrationService
      */
     public List<String> getAllRepositoryConsumers();
     
-    // TODO should we already implement config of consumers per repository?
+ // TODO should we already implement config of consumers per repository?
+    /**
+     * Configures (enable or disable) repository consumer.
+     * 
+     * @param repoId
+     * @param consumerId
+     * @param enable
+     * @return
+     * @throws Exception
+     */    
     public Boolean configureRepositoryConsumer( String repoId, String consumerId, boolean enable ) throws Exception;
 
     /**
index ca3c1a7eaa342a620535366a5620d71c287d2e6f..7bb2882b246595fe98401eeffd3f09ead5a8b481 100644 (file)
@@ -69,9 +69,7 @@ public class AdministrationServiceImpl
     private RepositoryContentConsumers repoConsumersUtil;
         
     private DatabaseConsumers dbConsumersUtil;
-        
-    //private ArchivaTaskScheduler taskScheduler;
-        
+            
     private RepositoryContentFactory repoFactory;
     
     private ArtifactDAO artifactDAO;
@@ -80,10 +78,12 @@ public class AdministrationServiceImpl
    
     private DatabaseCleanupConsumer cleanupProjects;
     
+    private ArchivaTaskScheduler taskScheduler;
+    
     public AdministrationServiceImpl( ArchivaConfiguration archivaConfig, RepositoryContentConsumers repoConsumersUtil,
                                       DatabaseConsumers dbConsumersUtil, RepositoryContentFactory repoFactory,
                                       ArtifactDAO artifactDAO, DatabaseCleanupConsumer cleanupArtifacts,
-                                      DatabaseCleanupConsumer cleanupProjects )
+                                      DatabaseCleanupConsumer cleanupProjects, ArchivaTaskScheduler taskScheduler )
     {   
         this.archivaConfiguration = archivaConfig;
         this.repoConsumersUtil = repoConsumersUtil;
@@ -92,6 +92,7 @@ public class AdministrationServiceImpl
         this.artifactDAO = artifactDAO;
         this.cleanupArtifacts = cleanupArtifacts;
         this.cleanupProjects = cleanupProjects;             
+        this.taskScheduler = taskScheduler;
     }
         
     /**
@@ -288,7 +289,7 @@ public class AdministrationServiceImpl
      */
     public Boolean executeDatabaseScanner() throws Exception
     {
-        /*if ( taskScheduler.isProcessingDatabaseTask() )
+        if ( taskScheduler.isProcessingDatabaseTask() )
         {
             return false;
         }
@@ -297,7 +298,7 @@ public class AdministrationServiceImpl
         task.setName( DefaultArchivaTaskScheduler.DATABASE_JOB + ":user-requested-via-web-service" );
         task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
         
-        taskScheduler.queueDatabaseTask( task );      */      
+        taskScheduler.queueDatabaseTask( task );           
         
         return new Boolean( true );
     }
@@ -307,7 +308,7 @@ public class AdministrationServiceImpl
      */
     public Boolean executeRepositoryScanner( String repoId ) throws Exception
     {
-       /* Configuration config = archivaConfiguration.getConfiguration();
+        Configuration config = archivaConfiguration.getConfiguration();
         if( config.findManagedRepositoryById( repoId ) == null )
         {
             throw new Exception( "Repository does not exist." );
@@ -326,7 +327,7 @@ public class AdministrationServiceImpl
         task.setName( DefaultArchivaTaskScheduler.REPOSITORY_JOB + ":" + repoId );
         task.setQueuePolicy( ArchivaTask.QUEUE_POLICY_WAIT );
 
-        taskScheduler.queueRepositoryTask( task );      */      
+        taskScheduler.queueRepositoryTask( task );          
         
         return new Boolean( true );
     }
@@ -396,8 +397,6 @@ public class AdministrationServiceImpl
             managedRepos.add( repo );
         }
         
-        System.out.println( "\n++++++MANAGED REPOS --> " + managedRepos );
-        
         return managedRepos;
     }
 
index 770acbc5febca629954c88a13e2437b47c4c45c1..2c544577d9be0b440f9bee80207b3c32cc50d0c3 100644 (file)
@@ -172,7 +172,7 @@ public class AdministrationServiceImplTest
         cleanupConsumer = ( DatabaseCleanupConsumer ) cleanupControl.getMock();
          
         service = new AdministrationServiceImpl( archivaConfig, repoConsumersUtil, dbConsumersUtil, 
-                         repositoryFactory, artifactDao, cleanupConsumer, cleanupConsumer );
+                         repositoryFactory, artifactDao, cleanupConsumer, cleanupConsumer, taskScheduler );
     }
   
 /* Tests for database consumers  */