| 1 | |
package org.apache.maven.plugin.ear; |
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 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 | |
|
| 30 | |
|
| 31 | |
|
| 32 | |
|
| 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, typeMappingService ); |
| 50 | |
|
| 51 | 0 | } |
| 52 | |
|
| 53 | |
public String getDefaultLibBundleDir() |
| 54 | |
{ |
| 55 | 0 | return defaultLibBundleDir; |
| 56 | |
} |
| 57 | |
|
| 58 | |
public boolean isJbossConfigured() |
| 59 | |
{ |
| 60 | 0 | return jbossConfiguration != null; |
| 61 | |
} |
| 62 | |
|
| 63 | |
public FileNameMapping getFileNameMapping() |
| 64 | |
{ |
| 65 | 0 | return fileNameMapping; |
| 66 | |
} |
| 67 | |
|
| 68 | |
public ArtifactRepository getArtifactRepository() |
| 69 | |
{ |
| 70 | 0 | return artifactRepository; |
| 71 | |
} |
| 72 | |
|
| 73 | |
private void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir, JbossConfiguration jbossConfiguration, |
| 74 | |
String fileNameMappingName, ArtifactTypeMappingService typeMappingService ) |
| 75 | |
{ |
| 76 | 0 | this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId, |
| 77 | |
typeMappingService ); |
| 78 | 0 | this.defaultLibBundleDir = defaultLibBundleDir; |
| 79 | 0 | this.jbossConfiguration = jbossConfiguration; |
| 80 | 0 | if ( fileNameMappingName == null || fileNameMappingName.trim().length() == 0 ) |
| 81 | |
{ |
| 82 | 0 | this.fileNameMapping = FileNameMappingFactory.getDefaultFileNameMapping(); |
| 83 | |
} |
| 84 | |
else |
| 85 | |
{ |
| 86 | 0 | this.fileNameMapping = FileNameMappingFactory.getFileNameMapping( fileNameMappingName ); |
| 87 | |
} |
| 88 | 0 | } |
| 89 | |
} |