This project has retired. For details please refer to its Attic page.
Source code
001package org.apache.archiva.converter.artifact;
002
003/*
004 * Licensed to the Apache Software Foundation (ASF) under one
005 * or more contributor license agreements.  See the NOTICE file
006 * distributed with this work for additional information
007 * regarding copyright ownership.  The ASF licenses this file
008 * to you under the Apache License, Version 2.0 (the
009 * "License"); you may not use this file except in compliance
010 * with the License.  You may obtain a copy of the License at
011 *
012 *  http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing,
015 * software distributed under the License is distributed on an
016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017 * KIND, either express or implied.  See the License for the
018 * specific language governing permissions and limitations
019 * under the License.
020 */
021
022import org.apache.archiva.checksum.ChecksumAlgorithm;
023import org.apache.archiva.checksum.ChecksumValidationException;
024import org.apache.archiva.checksum.ChecksummedFile;
025import org.apache.archiva.common.plexusbridge.PlexusSisuBridge;
026import org.apache.archiva.common.plexusbridge.PlexusSisuBridgeException;
027import org.apache.archiva.transaction.FileTransaction;
028import org.apache.archiva.transaction.TransactionException;
029import org.apache.commons.io.FileUtils;
030import org.apache.maven.artifact.Artifact;
031import org.apache.maven.artifact.factory.ArtifactFactory;
032import org.apache.maven.artifact.handler.manager.ArtifactHandlerManager;
033import org.apache.maven.artifact.repository.ArtifactRepository;
034import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
035import org.apache.maven.artifact.repository.metadata.Metadata;
036import org.apache.maven.artifact.repository.metadata.RepositoryMetadata;
037import org.apache.maven.artifact.repository.metadata.Snapshot;
038import org.apache.maven.artifact.repository.metadata.Versioning;
039import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Reader;
040import org.apache.maven.artifact.repository.metadata.io.xpp3.MetadataXpp3Writer;
041import org.apache.maven.model.DistributionManagement;
042import org.apache.maven.model.Model;
043import org.apache.maven.model.Relocation;
044import org.apache.maven.model.converter.ModelConverter;
045import org.apache.maven.model.converter.PomTranslationException;
046import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
047import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
048import org.springframework.stereotype.Service;
049
050import javax.annotation.PostConstruct;
051import javax.inject.Inject;
052import java.io.IOException;
053import java.io.Reader;
054import java.io.StringReader;
055import java.io.StringWriter;
056import java.nio.charset.Charset;
057import java.nio.file.Files;
058import java.nio.file.Path;
059import java.nio.file.Paths;
060import java.util.ArrayList;
061import java.util.Arrays;
062import java.util.HashMap;
063import java.util.List;
064import java.util.Map;
065import java.util.Properties;
066import java.util.regex.Matcher;
067
068/**
069 * LegacyToDefaultConverter
070 */
071@Service("artifactConverter#legacy-to-default")
072public class LegacyToDefaultConverter
073    implements ArtifactConverter
074{
075    /**
076     *
077     */
078    private List<ChecksumAlgorithm> digesters;
079
080    @Inject
081    private PlexusSisuBridge plexusSisuBridge;
082
083    private ModelConverter translator;
084
085    private ArtifactFactory artifactFactory;
086
087    private ArtifactHandlerManager artifactHandlerManager;
088
089    private boolean force;
090
091    private boolean dryrun;
092
093    private Map<Artifact, List<String>> warnings = new HashMap<>();
094
095    @PostConstruct
096    public void initialize()
097        throws PlexusSisuBridgeException
098    {
099        // TODO: Should be configurable!
100        this.digesters = Arrays.asList(ChecksumAlgorithm.SHA256, ChecksumAlgorithm.SHA1, ChecksumAlgorithm.MD5);
101        translator = plexusSisuBridge.lookup( ModelConverter.class );
102        artifactFactory = plexusSisuBridge.lookup( ArtifactFactory.class );
103        artifactHandlerManager = plexusSisuBridge.lookup( ArtifactHandlerManager.class );
104    }
105
106    @Override
107    public void convert( Artifact artifact, ArtifactRepository targetRepository )
108        throws ArtifactConversionException
109    {
110        if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) )
111        {
112            throw new ArtifactConversionException( Messages.getString( "exception.repositories.match" ) ); //$NON-NLS-1$
113        }
114
115        if ( !validateMetadata( artifact ) )
116        {
117            addWarning( artifact, Messages.getString( "unable.to.validate.metadata" ) ); //$NON-NLS-1$
118            return;
119        }
120
121        FileTransaction transaction = new FileTransaction();
122
123        if ( !copyPom( artifact, targetRepository, transaction ) )
124        {
125            addWarning( artifact, Messages.getString( "unable.to.copy.pom" ) ); //$NON-NLS-1$
126            return;
127        }
128
129        if ( !copyArtifact( artifact, targetRepository, transaction ) )
130        {
131            addWarning( artifact, Messages.getString( "unable.to.copy.artifact" ) ); //$NON-NLS-1$
132            return;
133        }
134
135        Metadata metadata = createBaseMetadata( artifact );
136        Versioning versioning = new Versioning();
137        versioning.addVersion( artifact.getBaseVersion() );
138        metadata.setVersioning( versioning );
139        updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
140
141        metadata = createBaseMetadata( artifact );
142        metadata.setVersion( artifact.getBaseVersion() );
143        versioning = new Versioning();
144
145        Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
146        if ( matcher.matches() )
147        {
148            Snapshot snapshot = new Snapshot();
149            snapshot.setBuildNumber( Integer.parseInt( matcher.group( 3 ) ) );
150            snapshot.setTimestamp( matcher.group( 2 ) );
151            versioning.setSnapshot( snapshot );
152        }
153
154        // TODO: merge latest/release/snapshot from source instead
155        metadata.setVersioning( versioning );
156        updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
157
158        if ( !dryrun )
159        {
160            try
161            {
162                transaction.commit();
163            }
164            catch ( TransactionException e )
165            {
166                throw new ArtifactConversionException( Messages.getString( "transaction.failure", e.getMessage() ),
167                                                       e ); //$NON-NLS-1$
168            }
169        }
170    }
171
172    @SuppressWarnings("unchecked")
173    private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
174        throws ArtifactConversionException
175    {
176        Artifact pom = artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
177                                                              artifact.getVersion() );
178        pom.setBaseVersion( artifact.getBaseVersion() );
179        ArtifactRepository repository = artifact.getRepository();
180        Path file = Paths.get( repository.getBasedir(), repository.pathOf( pom ) );
181
182        boolean result = true;
183        if ( Files.exists(file) )
184        {
185            Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( pom ) );
186
187            String contents = null;
188            boolean checksumsValid = false;
189            try
190            {
191                if ( testChecksums( artifact, file ) )
192                {
193                    checksumsValid = true;
194                }
195
196                // Even if the checksums for the POM are invalid we should still convert the POM
197                contents = org.apache.archiva.common.utils.FileUtils.readFileToString( file, Charset.defaultCharset() );
198            }
199            catch ( IOException e )
200            {
201                throw new ArtifactConversionException(
202                    Messages.getString( "unable.to.read.source.pom", e.getMessage() ), e ); //$NON-NLS-1$
203            }
204
205            if ( checksumsValid && contents.indexOf( "modelVersion" ) >= 0 ) //$NON-NLS-1$
206            {
207                // v4 POM
208                boolean matching = false;
209                if ( !force && Files.exists( targetFile ) )
210                {
211                    String targetContents = org.apache.archiva.common.utils.FileUtils.readFileToString( targetFile, Charset.defaultCharset( ) );
212                    matching = targetContents.equals( contents );
213                }
214                if ( force || !matching )
215                {
216                    transaction.createFile( contents, targetFile, digesters );
217                }
218            }
219            else
220            {
221                // v3 POM
222                try (StringReader stringReader = new StringReader( contents ))
223                {
224
225                    try (StringWriter writer = new StringWriter())
226                    {
227                        org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader v3Reader =
228                            new org.apache.maven.model.v3_0_0.io.xpp3.MavenXpp3Reader();
229                        org.apache.maven.model.v3_0_0.Model v3Model = v3Reader.read( stringReader );
230
231                        if ( doRelocation( artifact, v3Model, targetRepository, transaction ) )
232                        {
233                            Artifact relocatedPom =
234                                artifactFactory.createProjectArtifact( artifact.getGroupId(), artifact.getArtifactId(),
235                                                                       artifact.getVersion() );
236                            targetFile =
237                                Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( relocatedPom ) );
238                        }
239
240                        Model v4Model = translator.translate( v3Model );
241
242                        translator.validateV4Basics( v4Model, v3Model.getGroupId(), v3Model.getArtifactId(),
243                                                     v3Model.getVersion(), v3Model.getPackage() );
244
245                        MavenXpp3Writer xpp3Writer = new MavenXpp3Writer();
246                        xpp3Writer.write( writer, v4Model );
247
248                        transaction.createFile( writer.toString(), targetFile, digesters );
249
250                        List<String> warnings = translator.getWarnings();
251
252                        for ( String message : warnings )
253                        {
254                            addWarning( artifact, message );
255                        }
256                    }
257                    catch ( XmlPullParserException e )
258                    {
259                        addWarning( artifact,
260                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
261                        result = false;
262                    }
263                    catch ( IOException e )
264                    {
265                        throw new ArtifactConversionException( Messages.getString( "unable.to.write.converted.pom" ),
266                                                               e ); //$NON-NLS-1$
267                    }
268                    catch ( PomTranslationException e )
269                    {
270                        addWarning( artifact,
271                                    Messages.getString( "invalid.source.pom", e.getMessage() ) ); //$NON-NLS-1$
272                        result = false;
273                    }
274                }
275            }
276        }
277        else
278        {
279            addWarning( artifact, Messages.getString( "warning.missing.pom" ) ); //$NON-NLS-1$
280        }
281        return result;
282    }
283
284    private boolean testChecksums( Artifact artifact, Path file )
285        throws IOException
286    {
287        boolean result = true;
288        for ( ChecksumAlgorithm digester : digesters )
289        {
290            result &= verifyChecksum( file, file.getFileName() + "." + getDigesterFileExtension( digester ), digester,
291                                      //$NON-NLS-1$
292                                      artifact,
293                                      "failure.incorrect." + getDigesterFileExtension( digester ) ); //$NON-NLS-1$
294        }
295        return result;
296    }
297
298    private boolean verifyChecksum( Path file, String fileName, ChecksumAlgorithm digester, Artifact artifact, String key )
299        throws IOException
300    {
301        boolean result;
302        Path checksumFile = file.resolveSibling( fileName );
303        // We ignore the check, if the checksum file does not exist
304        if (!Files.exists(checksumFile)) {
305            return true;
306        }
307        ChecksummedFile csFile = new ChecksummedFile( file );
308        try
309        {
310            result = csFile.isValidChecksum( digester, true );
311        } catch (ChecksumValidationException e ) {
312            addWarning( artifact, Messages.getString( key ) );
313            result = false;
314        }
315        return result;
316    }
317
318    /**
319     * File extension for checksums
320     * TODO should be moved to plexus-digester ?
321     */
322    private String getDigesterFileExtension( ChecksumAlgorithm checksumAlgorithm )
323    {
324        return checksumAlgorithm.getExt().get(0);
325    }
326
327    private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, FileTransaction transaction )
328        throws ArtifactConversionException
329    {
330        Path sourceFile = artifact.getFile().toPath();
331
332        if ( sourceFile.toAbsolutePath().toString().indexOf( "/plugins/" ) > -1 ) //$NON-NLS-1$
333        {
334            artifact.setArtifactHandler( artifactHandlerManager.getArtifactHandler( "maven-plugin" ) ); //$NON-NLS-1$
335        }
336
337        Path targetFile = Paths.get( targetRepository.getBasedir(), targetRepository.pathOf( artifact ) );
338
339        boolean result = true;
340        try
341        {
342            boolean matching = false;
343            if ( !force && Files.exists(targetFile) )
344            {
345                matching = FileUtils.contentEquals( sourceFile.toFile(), targetFile.toFile() );
346                if ( !matching )
347                {
348                    addWarning( artifact, Messages.getString( "failure.target.already.exists" ) ); //$NON-NLS-1$
349                    result = false;
350                }
351            }
352            if ( result )
353            {
354                if ( force || !matching )
355                {
356                    if ( testChecksums( artifact, sourceFile ) )
357                    {
358                        transaction.copyFile( sourceFile, targetFile, digesters );
359                    }
360                    else
361                    {
362                        result = false;
363                    }
364                }
365            }
366        }
367        catch ( IOException e )
368        {
369            throw new ArtifactConversionException( Messages.getString( "error.copying.artifact" ), e ); //$NON-NLS-1$
370        }
371        return result;
372    }
373
374    private Metadata createBaseMetadata( Artifact artifact )
375    {
376        Metadata metadata = new Metadata();
377        metadata.setArtifactId( artifact.getArtifactId() );
378        metadata.setGroupId( artifact.getGroupId() );
379        return metadata;
380    }
381
382    private Metadata readMetadata( Path file )
383        throws ArtifactConversionException
384    {
385        MetadataXpp3Reader reader = new MetadataXpp3Reader();
386
387        try (Reader fileReader = Files.newBufferedReader( file, Charset.defaultCharset() ))
388        {
389            return reader.read( fileReader );
390        }
391        catch ( IOException | XmlPullParserException e )
392        {
393            throw new ArtifactConversionException( Messages.getString( "error.reading.target.metadata" ),
394                                                   e ); //$NON-NLS-1$
395        }
396    }
397
398    private boolean validateMetadata( Artifact artifact )
399        throws ArtifactConversionException
400    {
401        ArtifactRepository repository = artifact.getRepository();
402
403        boolean result = true;
404
405        RepositoryMetadata repositoryMetadata = new ArtifactRepositoryMetadata( artifact );
406        Path file = Paths.get( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
407        if ( Files.exists(file) )
408        {
409            Metadata metadata = readMetadata( file );
410            result = validateMetadata( metadata, repositoryMetadata, artifact );
411        }
412
413        repositoryMetadata = new SnapshotArtifactRepositoryMetadata( artifact );
414        file = Paths.get( repository.getBasedir(), repository.pathOfRemoteRepositoryMetadata( repositoryMetadata ) );
415        if ( Files.exists(file) )
416        {
417            Metadata metadata = readMetadata( file );
418            result = result && validateMetadata( metadata, repositoryMetadata, artifact );
419        }
420
421        return result;
422    }
423
424    @SuppressWarnings("unchecked")
425    private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact )
426    {
427        String groupIdKey;
428        String artifactIdKey = null;
429        String snapshotKey = null;
430        String versionKey = null;
431        String versionsKey = null;
432
433        if ( repositoryMetadata.storedInGroupDirectory() )
434        {
435            groupIdKey = "failure.incorrect.groupMetadata.groupId"; //$NON-NLS-1$
436        }
437        else if ( repositoryMetadata.storedInArtifactVersionDirectory() )
438        {
439            groupIdKey = "failure.incorrect.snapshotMetadata.groupId"; //$NON-NLS-1$
440            artifactIdKey = "failure.incorrect.snapshotMetadata.artifactId"; //$NON-NLS-1$
441            versionKey = "failure.incorrect.snapshotMetadata.version"; //$NON-NLS-1$
442            snapshotKey = "failure.incorrect.snapshotMetadata.snapshot"; //$NON-NLS-1$
443        }
444        else
445        {
446            groupIdKey = "failure.incorrect.artifactMetadata.groupId"; //$NON-NLS-1$
447            artifactIdKey = "failure.incorrect.artifactMetadata.artifactId"; //$NON-NLS-1$
448            versionsKey = "failure.incorrect.artifactMetadata.versions"; //$NON-NLS-1$
449        }
450
451        boolean result = true;
452
453        if ( metadata.getGroupId() == null || !metadata.getGroupId().equals( artifact.getGroupId() ) )
454        {
455            addWarning( artifact, Messages.getString( groupIdKey ) );
456            result = false;
457        }
458        if ( !repositoryMetadata.storedInGroupDirectory() )
459        {
460            if ( metadata.getGroupId() == null || !metadata.getArtifactId().equals( artifact.getArtifactId() ) )
461            {
462                addWarning( artifact, Messages.getString( artifactIdKey ) );
463                result = false;
464            }
465            if ( !repositoryMetadata.storedInArtifactVersionDirectory() )
466            {
467                // artifact metadata
468
469                boolean foundVersion = false;
470                if ( metadata.getVersioning() != null )
471                {
472                    for ( String version : (List<String>) metadata.getVersioning().getVersions() )
473                    {
474                        if ( version.equals( artifact.getBaseVersion() ) )
475                        {
476                            foundVersion = true;
477                            break;
478                        }
479                    }
480                }
481
482                if ( !foundVersion )
483                {
484                    addWarning( artifact, Messages.getString( versionsKey ) );
485                    result = false;
486                }
487            }
488            else
489            {
490                // snapshot metadata
491                if ( !artifact.getBaseVersion().equals( metadata.getVersion() ) )
492                {
493                    addWarning( artifact, Messages.getString( versionKey ) );
494                    result = false;
495                }
496
497                if ( artifact.isSnapshot() )
498                {
499                    Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
500                    if ( matcher.matches() )
501                    {
502                        boolean correct = false;
503                        if ( metadata.getVersioning() != null && metadata.getVersioning().getSnapshot() != null )
504                        {
505                            Snapshot snapshot = metadata.getVersioning().getSnapshot();
506                            int build = Integer.parseInt( matcher.group( 3 ) );
507                            String ts = matcher.group( 2 );
508                            if ( build == snapshot.getBuildNumber() && ts.equals( snapshot.getTimestamp() ) )
509                            {
510                                correct = true;
511                            }
512                        }
513
514                        if ( !correct )
515                        {
516                            addWarning( artifact, Messages.getString( snapshotKey ) );
517                            result = false;
518                        }
519                    }
520                }
521            }
522        }
523        return result;
524    }
525
526    private void updateMetadata( RepositoryMetadata artifactMetadata, ArtifactRepository targetRepository,
527                                 Metadata newMetadata, FileTransaction transaction )
528        throws ArtifactConversionException
529    {
530        Path file = Paths.get( targetRepository.getBasedir(),
531                              targetRepository.pathOfRemoteRepositoryMetadata( artifactMetadata ) );
532
533        Metadata metadata;
534        boolean changed;
535
536        if ( Files.exists(file) )
537        {
538            metadata = readMetadata( file );
539            changed = metadata.merge( newMetadata );
540        }
541        else
542        {
543            changed = true;
544            metadata = newMetadata;
545        }
546
547        if ( changed )
548        {
549
550            try (StringWriter writer = new StringWriter())
551            {
552                MetadataXpp3Writer mappingWriter = new MetadataXpp3Writer();
553
554                mappingWriter.write( writer, metadata );
555
556                transaction.createFile( writer.toString(), file, digesters );
557            }
558            catch ( IOException e )
559            {
560                throw new ArtifactConversionException( Messages.getString( "error.writing.target.metadata" ),
561                                                       e ); //$NON-NLS-1$
562            }
563        }
564    }
565
566    private boolean doRelocation( Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model,
567                                  ArtifactRepository repository, FileTransaction transaction )
568        throws IOException
569    {
570        Properties properties = v3Model.getProperties();
571        if ( properties.containsKey( "relocated.groupId" ) || properties.containsKey( "relocated.artifactId" )
572            //$NON-NLS-1$ //$NON-NLS-2$
573            || properties.containsKey( "relocated.version" ) ) //$NON-NLS-1$
574        {
575            String newGroupId = properties.getProperty( "relocated.groupId", v3Model.getGroupId() ); //$NON-NLS-1$
576            properties.remove( "relocated.groupId" ); //$NON-NLS-1$
577
578            String newArtifactId =
579                properties.getProperty( "relocated.artifactId", v3Model.getArtifactId() ); //$NON-NLS-1$
580            properties.remove( "relocated.artifactId" ); //$NON-NLS-1$
581
582            String newVersion = properties.getProperty( "relocated.version", v3Model.getVersion() ); //$NON-NLS-1$
583            properties.remove( "relocated.version" ); //$NON-NLS-1$
584
585            String message = properties.getProperty( "relocated.message", "" ); //$NON-NLS-1$ //$NON-NLS-2$
586            properties.remove( "relocated.message" ); //$NON-NLS-1$
587
588            if ( properties.isEmpty() )
589            {
590                v3Model.setProperties( null );
591            }
592
593            writeRelocationPom( v3Model.getGroupId(), v3Model.getArtifactId(), v3Model.getVersion(), newGroupId,
594                                newArtifactId, newVersion, message, repository, transaction );
595
596            v3Model.setGroupId( newGroupId );
597            v3Model.setArtifactId( newArtifactId );
598            v3Model.setVersion( newVersion );
599
600            artifact.setGroupId( newGroupId );
601            artifact.setArtifactId( newArtifactId );
602            artifact.setVersion( newVersion );
603
604            return true;
605        }
606        else
607        {
608            return false;
609        }
610    }
611
612    private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
613                                     String newArtifactId, String newVersion, String message,
614                                     ArtifactRepository repository, FileTransaction transaction )
615        throws IOException
616    {
617        Model pom = new Model();
618        pom.setGroupId( groupId );
619        pom.setArtifactId( artifactId );
620        pom.setVersion( version );
621
622        DistributionManagement dMngt = new DistributionManagement();
623
624        Relocation relocation = new Relocation();
625        relocation.setGroupId( newGroupId );
626        relocation.setArtifactId( newArtifactId );
627        relocation.setVersion( newVersion );
628        if ( message != null && message.length() > 0 )
629        {
630            relocation.setMessage( message );
631        }
632
633        dMngt.setRelocation( relocation );
634
635        pom.setDistributionManagement( dMngt );
636
637        Artifact artifact = artifactFactory.createBuildArtifact( groupId, artifactId, version, "pom" ); //$NON-NLS-1$
638        Path pomFile = Paths.get( repository.getBasedir(), repository.pathOf( artifact ) );
639
640        StringWriter strWriter = new StringWriter();
641        MavenXpp3Writer pomWriter = new MavenXpp3Writer();
642        pomWriter.write( strWriter, pom );
643
644        transaction.createFile( strWriter.toString(), pomFile, digesters );
645    }
646
647    private void addWarning( Artifact artifact, String message )
648    {
649        List<String> messages = warnings.get( artifact );
650        if ( messages == null )
651        {
652            messages = new ArrayList<>( 1 );
653        }
654        messages.add( message );
655        warnings.put( artifact, messages );
656    }
657
658    @Override
659    public void clearWarnings()
660    {
661        warnings.clear();
662    }
663
664    @Override
665    public Map<Artifact, List<String>> getWarnings()
666    {
667        return warnings;
668    }
669
670
671    public List<ChecksumAlgorithm> getDigesters()
672    {
673        return digesters;
674    }
675
676    public void setDigesters( List<ChecksumAlgorithm> digesters )
677    {
678        this.digesters = digesters;
679    }
680
681    public ModelConverter getTranslator()
682    {
683        return translator;
684    }
685
686    public void setTranslator( ModelConverter translator )
687    {
688        this.translator = translator;
689    }
690
691    public ArtifactFactory getArtifactFactory()
692    {
693        return artifactFactory;
694    }
695
696    public void setArtifactFactory( ArtifactFactory artifactFactory )
697    {
698        this.artifactFactory = artifactFactory;
699    }
700
701    public ArtifactHandlerManager getArtifactHandlerManager()
702    {
703        return artifactHandlerManager;
704    }
705
706    public void setArtifactHandlerManager( ArtifactHandlerManager artifactHandlerManager )
707    {
708        this.artifactHandlerManager = artifactHandlerManager;
709    }
710
711    public boolean isForce()
712    {
713        return force;
714    }
715
716    public void setForce( boolean force )
717    {
718        this.force = force;
719    }
720
721    public boolean isDryrun()
722    {
723        return dryrun;
724    }
725
726    public void setDryrun( boolean dryrun )
727    {
728        this.dryrun = dryrun;
729    }
730}