Coverage Report - org.apache.maven.plugin.ear.JarModule
 
Classes in this File Line Coverage Branch Coverage Complexity
JarModule
0%
0/23
0%
0/6
1,429
 
 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.artifact.Artifact;
 23  
 import org.apache.maven.plugin.MojoFailureException;
 24  
 import org.codehaus.plexus.util.xml.XMLWriter;
 25  
 
 26  
 import java.util.Set;
 27  
 
 28  
 /**
 29  
  * The {@link EarModule} implementation for a non J2EE module such as
 30  
  * third party libraries.
 31  
  * <p/>
 32  
  * Such module is not incorporated in the generated <tt>application.xml<tt>
 33  
  * but some application servers support it. To include it in the generated
 34  
  * deployment descriptor anyway, set the <tt>includeInApplicationXml</tt>
 35  
  * boolean flag.
 36  
  * <p/>
 37  
  * This class deprecates {@link org.apache.maven.plugin.ear.JavaModule}.
 38  
  *
 39  
  * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
 40  
  * @version $Id: JarModule.java 1228837 2012-01-08 13:19:38Z rfscholte $
 41  
  */
 42  
 public class JarModule
 43  
     extends AbstractEarModule
 44  
 {
 45  0
     private Boolean includeInApplicationXml = Boolean.FALSE;
 46  
 
 47  
     public JarModule()
 48  
     {
 49  0
         super();
 50  0
     }
 51  
 
 52  
     public JarModule( Artifact a, String defaultLibBundleDir, Boolean includeInApplicationXml )
 53  
     {
 54  0
         super( a );
 55  0
         setLibBundleDir( defaultLibBundleDir );
 56  0
         this.includeInApplicationXml = includeInApplicationXml;
 57  
 
 58  0
     }
 59  
 
 60  
     public void appendModule( XMLWriter writer, String version, Boolean generateId )
 61  
     {
 62  
         // Generates an entry in the application.xml only if
 63  
         // includeInApplicationXml is set
 64  0
         if ( includeInApplicationXml.booleanValue() )
 65  
         {
 66  0
             startModuleElement( writer, generateId );
 67  0
             writer.startElement( JAVA_MODULE );
 68  0
             writer.writeText( getUri() );
 69  0
             writer.endElement();
 70  
 
 71  0
             writeAltDeploymentDescriptor( writer, version );
 72  
 
 73  0
             writer.endElement();
 74  
         }
 75  0
     }
 76  
 
 77  
     public void resolveArtifact( Set<Artifact> artifacts )
 78  
         throws EarPluginException, MojoFailureException
 79  
     {
 80  
         // Let's resolve the artifact
 81  0
         super.resolveArtifact( artifacts );
 82  
 
 83  
         // If the defaultLibBundleDir is set and no bundle dir is
 84  
         // set, set the default as bundle dir
 85  0
         setLibBundleDir( earExecutionContext.getDefaultLibBundleDir() );
 86  0
     }
 87  
 
 88  
     public String getType()
 89  
     {
 90  0
         return "jar";
 91  
     }
 92  
 
 93  
     private void setLibBundleDir( String defaultLibBundleDir )
 94  
     {
 95  0
         if ( defaultLibBundleDir != null && bundleDir == null )
 96  
         {
 97  0
             this.bundleDir = defaultLibBundleDir;
 98  
         }
 99  0
     }
 100  
 
 101  
     public boolean changeManifestClasspath()
 102  
     {
 103  0
         return false;
 104  
     }
 105  
 }