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.project.MavenProject; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
public class EarExecutionContext |
34 | |
{ |
35 | 0 | private static final EarExecutionContext INSTANCE = new EarExecutionContext(); |
36 | |
|
37 | |
public static EarExecutionContext getInstance() |
38 | |
{ |
39 | 0 | return INSTANCE; |
40 | |
} |
41 | |
|
42 | |
|
43 | |
|
44 | |
private String defaultLibBundleDir; |
45 | |
|
46 | |
private JbossConfiguration jbossConfiguration; |
47 | |
|
48 | |
private FileNameMapping fileNameMapping; |
49 | |
|
50 | |
private ArtifactRepository artifactRepository; |
51 | |
|
52 | |
|
53 | |
private EarExecutionContext() |
54 | 0 | { |
55 | |
|
56 | 0 | } |
57 | |
|
58 | |
public String getDefaultLibBundleDir() |
59 | |
{ |
60 | 0 | return defaultLibBundleDir; |
61 | |
} |
62 | |
|
63 | |
public JbossConfiguration getJbossConfiguration() |
64 | |
{ |
65 | 0 | return jbossConfiguration; |
66 | |
} |
67 | |
|
68 | |
public boolean isJbossConfigured() |
69 | |
{ |
70 | 0 | return jbossConfiguration != null; |
71 | |
} |
72 | |
|
73 | |
public FileNameMapping getFileNameMapping() |
74 | |
{ |
75 | 0 | return fileNameMapping; |
76 | |
} |
77 | |
|
78 | |
public ArtifactRepository getArtifactRepository() |
79 | |
{ |
80 | 0 | return artifactRepository; |
81 | |
} |
82 | |
|
83 | |
protected void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir, JbossConfiguration jbossConfiguration, |
84 | |
String fileNameMappingName ) |
85 | |
{ |
86 | 0 | this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId); |
87 | 0 | this.defaultLibBundleDir = defaultLibBundleDir; |
88 | 0 | this.jbossConfiguration = jbossConfiguration; |
89 | 0 | if ( fileNameMappingName == null || fileNameMappingName.trim().length() == 0 ) |
90 | |
{ |
91 | 0 | this.fileNameMapping = FileNameMappingFactory.INSTANCE.getDefaultFileNameMapping(); |
92 | |
} |
93 | |
else |
94 | |
{ |
95 | 0 | this.fileNameMapping = FileNameMappingFactory.INSTANCE.getFileNameMapping( fileNameMappingName ); |
96 | |
} |
97 | 0 | } |
98 | |
} |