1 package org.apache.maven.archiva.converter.legacy;
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.apache.maven.archiva.common.consumers.GenericArtifactConsumer;
23 import org.apache.maven.archiva.common.utils.BaseFile;
24 import org.apache.maven.archiva.converter.ConversionListener;
25 import org.apache.maven.archiva.converter.RepositoryConversionException;
26 import org.apache.maven.archiva.converter.RepositoryConverter;
27 import org.apache.maven.artifact.Artifact;
28 import org.apache.maven.artifact.repository.ArtifactRepository;
31 * LegacyConverterArtifactConsumer - convert artifacts as they are found
32 * into the destination repository.
34 * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
37 * @plexus.component role="org.apache.maven.archiva.common.consumers.Consumers"
38 * role-hint="legacy-converter"
39 * instantiation-strategy="per-lookup"
41 public class LegacyConverterArtifactConsumer
42 extends GenericArtifactConsumer
47 private RepositoryConverter repositoryConverter;
49 private ArtifactRepository destinationRepository;
51 public void processArtifact( Artifact artifact, BaseFile file )
55 repositoryConverter.convert( artifact, destinationRepository );
57 catch ( RepositoryConversionException e )
60 "Unable to convert artifact " + artifact + " to destination repository "
61 + destinationRepository, e );
65 public void processFileProblem( BaseFile path, String message )
67 getLogger().error( "Artifact Build Failure on " + path + " : " + message );
68 // TODO: report this to the ConversionListener?
71 public ArtifactRepository getDestinationRepository()
73 return destinationRepository;
76 public void setDestinationRepository( ArtifactRepository destinationRepository )
78 this.destinationRepository = destinationRepository;
81 public String getName()
83 return "Legacy Artifact Converter Consumer";
87 * Add a listener to the conversion process.
89 * @param listener the listener to add.
91 public void addConversionListener( ConversionListener listener )
93 repositoryConverter.addConversionListener( listener );
97 * Remove a listener from the conversion process.
99 * @param listener the listener to remove.
101 public void removeConversionListener( ConversionListener listener )
103 repositoryConverter.removeConversionListener( listener );