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 ear module interface.
30 *
31 * @author <a href="snicoll@apache.org">Stephane Nicoll</a>
32 * @version $Id: EarModule.java 1645331 2014-12-13 17:31:09Z khmarbaise $
33 */
34 public interface EarModule
35 {
36
37 /**
38 * Returns the {@link Artifact} representing this module.
39 * <p/>
40 * Note that this might return <tt>null</tt> till the module has been resolved.
41 *
42 * @return the artifact
43 * @see #resolveArtifact(java.util.Set)
44 */
45 Artifact getArtifact();
46
47 /**
48 * Returns the <tt>URI</tt> for this module.
49 *
50 * @return the <tt>URI</tt>
51 */
52 String getUri();
53
54 /**
55 * Returns the type associated to the module.
56 *
57 * @return the artifact's type of the module
58 */
59 String getType();
60
61 /**
62 * Specify whether this module should be excluded or not.
63 *
64 * @return true if this module should be skipped, false otherwise
65 */
66 boolean isExcluded();
67
68 /**
69 * Specify whether this module should be unpacked in the EAR archive or not.
70 * <p/>
71 * Returns null if no configuration was specified so that defaulting may apply.
72 *
73 * @return true if this module should be bundled unpacked, false otherwise
74 */
75 Boolean shouldUnpack();
76
77 /**
78 * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a
79 * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to
80 * the application's root directory.
81 *
82 * @return the alternative deployment descriptor for this module
83 * @since JavaEE 5
84 */
85 String getAltDeploymentDescriptor();
86
87 /**
88 * Appends the <tt>XML</tt> representation of this module.
89 *
90 * @param writer the writer to use
91 * @param version the version of the <tt>application.xml</tt> file
92 * @param generateId whether an id should be generated
93 */
94 void appendModule( XMLWriter writer, String version, Boolean generateId );
95
96 /**
97 * Resolves the {@link Artifact} represented by the module. Note that the {@link EarExecutionContext} might be used
98 * to customize further the resolution.
99 *
100 * @param artifacts the project's artifacts
101 * @throws EarPluginException if the artifact could not be resolved
102 * @throws MojoFailureException if an unexpected error occurred
103 */
104 void resolveArtifact( Set<Artifact> artifacts )
105 throws EarPluginException, MojoFailureException;
106
107 /**
108 * @param earExecutionContext The execution context.
109 */
110 void setEarExecutionContext( EarExecutionContext earExecutionContext );
111
112 /**
113 * @return the state if manifest classpath will be changed or not.
114 */
115 boolean changeManifestClasspath();
116
117 /**
118 * @return The libDir.
119 */
120 String getLibDir();
121
122 }