View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.plugins.ear;
20  
21  import java.io.File;
22  import java.util.List;
23  
24  /**
25   * A context for the {@link ApplicationXmlWriter}.
26   *
27   * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
28   */
29  class ApplicationXmlWriterContext {
30  
31      private String applicationId;
32  
33      private final File destinationFile;
34  
35      private final List<EarModule> earModules;
36  
37      private final List<SecurityRole> securityRoles;
38  
39      private final List<EnvEntry> envEntries;
40  
41      private final List<EjbRef> ejbEntries;
42  
43      private final List<ResourceRef> resourceRefs;
44  
45      private final String displayName;
46  
47      private final String description;
48  
49      private final String libraryDirectory;
50  
51      private final String applicationName;
52  
53      private final Boolean initializeInOrder;
54  
55      ApplicationXmlWriterContext(
56              File destinationFile,
57              List<EarModule> earModules,
58              List<SecurityRole> securityRoles,
59              List<EnvEntry> envEntries,
60              List<EjbRef> ejbEntries,
61              List<ResourceRef> resourceRefs,
62              String displayName,
63              String description,
64              String libraryDirectory,
65              String applicationName,
66              Boolean initializeInOrder) {
67          this.destinationFile = destinationFile;
68          this.earModules = earModules;
69          this.securityRoles = securityRoles;
70          this.envEntries = envEntries;
71          this.ejbEntries = ejbEntries;
72          this.resourceRefs = resourceRefs;
73          this.displayName = displayName;
74          this.description = description;
75          this.libraryDirectory = libraryDirectory;
76          this.applicationName = applicationName;
77          this.initializeInOrder = initializeInOrder;
78      }
79  
80      public final ApplicationXmlWriterContext setApplicationId(String applicationId) {
81          this.applicationId = applicationId;
82          return this;
83      }
84  
85      public final String getApplicationId() {
86          return applicationId;
87      }
88  
89      /**
90       * Returns the name of the file to use to write application.xml to.
91       *
92       * @return the output file
93       */
94      public File getDestinationFile() {
95          return destinationFile;
96      }
97  
98      /**
99       * Returns the list of {@link EarModule} instances.
100      *
101      * @return the ear modules
102      */
103     public List<EarModule> getEarModules() {
104         return earModules;
105     }
106 
107     /**
108      * Returns the list of {@link SecurityRole} instances.
109      *
110      * @return the security roles
111      */
112     public List<SecurityRole> getSecurityRoles() {
113         return securityRoles;
114     }
115 
116     /**
117      * Returns the list of {@link EnvEntry} instances (as per JavaEE 6).
118      *
119      * @return the env-entry elements
120      */
121     public List<EnvEntry> getEnvEntries() {
122         return envEntries;
123     }
124 
125     /**
126      * Returns the list of {@link EjbRef}.
127      *
128      * @return the env-ref elements
129      */
130     public List<EjbRef> getEjbEntries() {
131         return ejbEntries;
132     }
133 
134     /**
135      * Returns the list of {@link ResourceRef}.
136      *
137      * @return the resource-ref elements.
138      */
139     public List<ResourceRef> getResourceRefs() {
140         return resourceRefs;
141     }
142 
143     /**
144      * Returns the display name.
145      *
146      * @return the display name
147      */
148     public String getDisplayName() {
149         return displayName;
150     }
151 
152     /**
153      * Returns the description.
154      *
155      * @return the description
156      */
157     public String getDescription() {
158         return description;
159     }
160 
161     /**
162      * Returns the library directory (as per JavaEE 5).
163      *
164      * @return the library directory
165      */
166     public String getLibraryDirectory() {
167         return libraryDirectory;
168     }
169 
170     /**
171      * Returns the application name (as per JavaEE 6).
172      *
173      * @return the application name
174      */
175     public String getApplicationName() {
176         return applicationName;
177     }
178 
179     /**
180      * Returns the value of the initialize in order parameter (as per JavaEE 6).
181      *
182      * @return the initialize in order value
183      */
184     public Boolean getInitializeInOrder() {
185         return initializeInOrder;
186     }
187 }