1package org.apache.archiva.repository.scanner.functors;
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.consumers.ConsumerException;
23import org.apache.archiva.consumers.RepositoryContentConsumer;
24import org.apache.archiva.repository.ManagedRepository;
25import org.apache.commons.collections4.Closure;
26import org.slf4j.Logger;
27import org.slf4j.LoggerFactory;
2829import java.util.Date;
3031/**32 * TriggerBeginScanClosure33 */34publicclassTriggerBeginScanClosure35implements Closure<RepositoryContentConsumer>
36 {
37private Logger log = LoggerFactory.getLogger( TriggerBeginScanClosure.class );
3839private ManagedRepository repository;
4041private Date whenGathered;
4243privateboolean executeOnEntireRepo = true;
4445publicTriggerBeginScanClosure( ManagedRepository repository )
46 {
47this.repository = repository;
48 }
4950publicTriggerBeginScanClosure( ManagedRepository repository, Date whenGathered )
51 {
52this( repository );
53this.whenGathered = whenGathered;
54 }
5556publicTriggerBeginScanClosure( ManagedRepository repository, Date whenGathered, boolean executeOnEntireRepo )
57 {
58this( repository, whenGathered );
59this.executeOnEntireRepo = executeOnEntireRepo;
60 }
6162 @Override
63publicvoid execute( RepositoryContentConsumer input )
64 {
65 RepositoryContentConsumer consumer = (RepositoryContentConsumer) input;
6667try68 {
69 consumer.beginScan( repository, whenGathered, executeOnEntireRepo );
70 }
71catch ( ConsumerException e )
72 {
73 log.warn( "Consumer [{}] cannot begin: {}", consumer.getId( ), e.getMessage( ), e );
74 }
75 }
76 }