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 java.util.Arrays;
23 import java.util.HashSet;
24 import java.util.Iterator;
25 import java.util.List;
29 * AbstractMonitoredConsumer
31 * @author <a href="mailto:joakime@apache.org">Joakim Erdfelt</a>
34 public abstract class AbstractMonitoredConsumer
35 implements BaseConsumer
37 private Set<ConsumerMonitor> monitors = new HashSet<ConsumerMonitor>();
40 * Default exclusions from artifact consumers that are using the file types. Note that this is simplistic in the
41 * case of the support files (based on extension) as it is elsewhere - it may be better to match these to actual
42 * artifacts and exclude later during scanning.
44 private static final List<String> DEFAULT_EXCLUSIONS = Arrays.asList( "**/maven-metadata.xml",
45 "**/maven-metadata-*.xml", "**/*.sha1",
46 "**/*.asc", "**/*.md5", "**/*.pgp" );
48 public void addConsumerMonitor( ConsumerMonitor monitor )
50 monitors.add( monitor );
53 public void removeConsumerMonitor( ConsumerMonitor monitor )
55 monitors.remove( monitor );
58 protected void triggerConsumerError( String type, String message )
60 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
62 ConsumerMonitor monitor = itmonitors.next();
65 monitor.consumerError( this, type, message );
74 protected void triggerConsumerWarning( String type, String message )
76 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
78 ConsumerMonitor monitor = itmonitors.next();
81 monitor.consumerWarning( this, type, message );
90 protected void triggerConsumerInfo( String message )
92 for ( Iterator<ConsumerMonitor> itmonitors = monitors.iterator(); itmonitors.hasNext(); )
94 ConsumerMonitor monitor = itmonitors.next();
97 monitor.consumerInfo( this, message );
106 public boolean isProcessUnmodified()
111 protected List<String> getDefaultArtifactExclusions()
113 return DEFAULT_EXCLUSIONS;