1 package org.apache.maven.plugins.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.plugins.ear.util.ArtifactRepository;
23 import org.apache.maven.plugins.ear.util.ArtifactTypeMappingService;
24 import org.apache.maven.project.MavenProject;
25
26 /**
27 * Contains various runtime parameters used to customize the generated EAR file.
28 *
29 * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
30 */
31 public class EarExecutionContext
32 {
33 private String defaultLibBundleDir;
34
35 private JbossConfiguration jbossConfiguration;
36
37 private String outputFileNameMapping;
38
39 private ArtifactRepository artifactRepository;
40
41 /**
42 * @param project {@link MavenProject}
43 * @param mainArtifactId The artifactId.
44 * @param defaultLibBundleDir The defaultLibBundleDir.
45 * @param jbossConfiguration {@link JbossConfiguration}
46 * @param fileNameMappingName file name mapping.
47 * @param typeMappingService {@link ArtifactTypeMappingService}
48 */
49 public EarExecutionContext( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
50 JbossConfiguration jbossConfiguration, String fileNameMappingName,
51 ArtifactTypeMappingService typeMappingService )
52 {
53 initialize( project, mainArtifactId, defaultLibBundleDir, jbossConfiguration, fileNameMappingName,
54 typeMappingService );
55
56 }
57
58 /**
59 * @return {@link #defaultLibBundleDir}
60 */
61 public String getDefaultLibBundleDir()
62 {
63 return defaultLibBundleDir;
64 }
65
66 /**
67 * @return {@link #jbossConfiguration}
68 */
69 public boolean isJbossConfigured()
70 {
71 return jbossConfiguration != null;
72 }
73
74 /**
75 * @return {@link #outputFileNameMapping}
76 */
77 public String getOutputFileNameMapping()
78 {
79 return outputFileNameMapping;
80 }
81
82 /**
83 * @return {@link #artifactRepository}
84 */
85 public ArtifactRepository getArtifactRepository()
86 {
87 return artifactRepository;
88 }
89
90 private void initialize( MavenProject project, String mainArtifactId, String defaultLibBundleDir,
91 JbossConfiguration jbossConfiguration, String outputFileNameMapping,
92 ArtifactTypeMappingService typeMappingService )
93 {
94 this.artifactRepository = new ArtifactRepository( project.getArtifacts(), mainArtifactId, typeMappingService );
95 this.defaultLibBundleDir = defaultLibBundleDir;
96 this.jbossConfiguration = jbossConfiguration;
97 this.outputFileNameMapping = outputFileNameMapping;
98 }
99 }