Coverage Report - org.apache.maven.plugin.ear.EarExecutionContext
 
Classes in this File Line Coverage Branch Coverage Complexity
EarExecutionContext
0%
0/14
0%
0/6
1.333
 
 1  
 package org.apache.maven.plugin.ear;
 2  
 
 3  
 /*
 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
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 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
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.plugin.ear.output.FileNameMapping;
 23  
 import org.apache.maven.plugin.ear.output.FileNameMappingFactory;
 24  
 import org.apache.maven.plugin.ear.util.ArtifactRepository;
 25  
 import org.apache.maven.plugin.ear.util.ArtifactTypeMappingService;
 26  
 import org.apache.maven.project.MavenProject;
 27  
 
 28  
 /**
 29  
  * Contains various runtime parameters used to customize the generated EAR file.
 30  
  *
 31  
  * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
 32  
  * @version $Id: EarExecutionContext.java 992370 2010-09-03 16:48:59Z snicoll $
 33  
  */
 34  
 public class EarExecutionContext
 35  
 {
 36  
     private String defaultLibBundleDir;
 37  
 
 38  
     private JbossConfiguration jbossConfiguration;
 39  
 
 40  
     private FileNameMapping fileNameMapping;
 41  
 
 42  
     private ArtifactRepository artifactRepository;
 43  
 
 44  
 
 45  
     public EarExecutionContext( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
 46  
                                 JbossConfiguration jbossConfiguration, String fileNameMappingName,
 47  
                                 ArtifactTypeMappingService typeMappingService )
 48  0
     {
 49  0
         initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMappingName,
 50  
                     typeMappingService );
 51  
 
 52  0
     }
 53  
 
 54  
     public String getDefaultLibBundleDir()
 55  
     {
 56  0
         return defaultLibBundleDir;
 57  
     }
 58  
 
 59  
     public boolean isJbossConfigured()
 60  
     {
 61  0
         return jbossConfiguration != null;
 62  
     }
 63  
 
 64  
     public FileNameMapping getFileNameMapping()
 65  
     {
 66  0
         return fileNameMapping;
 67  
     }
 68  
 
 69  
     public ArtifactRepository getArtifactRepository()
 70  
     {
 71  0
         return artifactRepository;
 72  
     }
 73  
 
 74  
     private void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
 75  
                              JbossConfiguration jbossConfiguration, String fileNameMappingName,
 76  
                              ArtifactTypeMappingService typeMappingService )
 77  
     {
 78  0
         this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId, typeMappingService );
 79  0
         this.defaultLibBundleDir = defaultLibBundleDir;
 80  0
         this.jbossConfiguration = jbossConfiguration;
 81  0
         if ( fileNameMappingName == null || fileNameMappingName.trim().length() == 0 )
 82  
         {
 83  0
             this.fileNameMapping = FileNameMappingFactory.getDefaultFileNameMapping();
 84  
         }
 85  
         else
 86  
         {
 87  0
             this.fileNameMapping = FileNameMappingFactory.getFileNameMapping( fileNameMappingName );
 88  
         }
 89  0
     }
 90  
 }