1 package org.apache.maven.archiva.consumers;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.codehaus.plexus.logging.AbstractLogEnabled;
24 import java.util.Arrays;
25 import java.util.HashSet;
26 import java.util.Iterator;
27 import java.util.List;
31 * AbstractMonitoredConsumer
33 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
36 public abstract class AbstractMonitoredConsumer
37 extends AbstractLogEnabled
38 implements BaseConsumer
40 private Set<ConsumerMonitor> monitors = new HashSet<ConsumerMonitor>();
43 * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
44 * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
45 * artifacts and exclude later during scanning.
47 private static final List<String> DEFAULT_EXCLUSIONS = Arrays.asList( "**/maven-metadata.xml",
48 "**/maven-metadata-*.xml", "**/*.sha1",
49 "**/*.asc", "**/*.md5", "**/*.pgp" );
51 public void addConsumerMonitor( ConsumerMonitor monitor )
53 monitors.add( monitor );
56 public void removeConsumerMonitor( ConsumerMonitor monitor )
58 monitors.remove( monitor );
61 protected void triggerConsumerError( String type, String message )
63 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
65 ConsumerMonitor monitor = itmonitors.next();
68 monitor.consumerError( this, type, message );
77 protected void triggerConsumerWarning( String type, String message )
79 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
81 ConsumerMonitor monitor = itmonitors.next();
84 monitor.consumerWarning( this, type, message );
93 protected void triggerConsumerInfo( String message )
95 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
97 ConsumerMonitor monitor = itmonitors.next();
100 monitor.consumerInfo( this, message );
102 catch ( Throwable t )
109 public boolean isProcessUnmodified()
114 protected List<String> getDefaultArtifactExclusions()
116 return DEFAULT_EXCLUSIONS;