1package org.apache.archiva.scheduler.repository;
23/*4 * Licensed to the Apache Software Foundation (ASF) under one5 * or more contributor license agreements. See the NOTICE file6 * distributed with this work for additional information7 * regarding copyright ownership. The ASF licenses this file8 * to you under the Apache License, Version 2.0 (the9 * "License"); you may not use this file except in compliance10 * with the License. You may obtain a copy of the License at11 *12 * http://www.apache.org/licenses/LICENSE-2.013 *14 * Unless required by applicable law or agreed to in writing,15 * software distributed under the License is distributed on an16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY17 * KIND, either express or implied. See the License for the18 * specific language governing permissions and limitations19 * under the License.20 */2122import org.apache.archiva.redback.components.scheduler.AbstractJob;
23import org.apache.archiva.redback.components.taskqueue.TaskQueue;
24import org.apache.archiva.redback.components.taskqueue.TaskQueueException;
25import org.apache.archiva.scheduler.repository.model.RepositoryTask;
26import org.quartz.JobDataMap;
27import org.quartz.JobExecutionContext;
28import org.quartz.JobExecutionException;
2930/**31 * This class is the repository job that is executed by the scheduler.32 */33publicclassRepositoryTaskJob34extends AbstractJob
35 {
36/**37 * Execute the discoverer and the indexer.38 * 39 * @param context40 * @throws org.quartz.JobExecutionException41 */42 @Override
43publicvoid execute( JobExecutionContext context )
44throws JobExecutionException
45 {
46 JobDataMap dataMap = context.getJobDetail().getJobDataMap();
47 setJobDataMap( dataMap );
4849 TaskQueue taskQueue = (TaskQueue) dataMap.get( DefaultRepositoryArchivaTaskScheduler.TASK_QUEUE );
5051 String repositoryId = (String) dataMap.get( DefaultRepositoryArchivaTaskScheduler.TASK_REPOSITORY );
52RepositoryTask task = newRepositoryTask();
53 task.setRepositoryId( repositoryId );
5455try56 {
57 taskQueue.put( task );
58 }
59catch ( TaskQueueException e )
60 {
61thrownew JobExecutionException( e );
62 }
63 }
64 }