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.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 */
33 public interface EarModule
34 {
35
36 /**
37 * Returns the {@link Artifact} representing this module.
38 *
39 * Note that this might return {@code null} till the module has been resolved.
40 *
41 * @return the artifact
42 * @see #resolveArtifact(java.util.Set)
43 */
44 Artifact getArtifact();
45
46 /**
47 * Returns the {@code URI} for this module.
48 *
49 * @return the {@code URI}
50 */
51 String getUri();
52
53 /**
54 * Returns the type associated to the module.
55 *
56 * @return the artifact's type of the module
57 */
58 String getType();
59
60 /**
61 * Specify whether this module should be excluded or not.
62 *
63 * @return true if this module should be skipped, false otherwise
64 */
65 boolean isExcluded();
66
67 /**
68 * Specify whether this module should be unpacked in the EAR archive or not.
69 *
70 * Returns null if no configuration was specified so that defaulting may apply.
71 *
72 * @return true if this module should be bundled unpacked, false otherwise
73 */
74 Boolean shouldUnpack();
75
76 /**
77 * The alt-dd element specifies an optional URI to the post-assembly version of the deployment descriptor file for a
78 * particular Java EE module. The URI must specify the full pathname of the deployment descriptor file relative to
79 * the application's root directory.
80 *
81 * @return the alternative deployment descriptor for this module
82 * @since JavaEE 5
83 */
84 String getAltDeploymentDescriptor();
85
86 /**
87 * Appends the {@code XML} representation of this module.
88 *
89 * @param writer the writer to use
90 * @param version the version of the {@code application.xml} file
91 * @param generateId whether an id should be generated
92 */
93 void appendModule( XMLWriter writer, String version, Boolean generateId );
94
95 /**
96 * Resolves the {@link Artifact} represented by the module. Note that the {@link EarExecutionContext} might be used
97 * to customize further the resolution.
98 *
99 * @param artifacts the project's artifacts
100 * @throws EarPluginException if the artifact could not be resolved
101 * @throws MojoFailureException if an unexpected error occurred
102 */
103 void resolveArtifact( Set<Artifact> artifacts )
104 throws EarPluginException, MojoFailureException;
105
106 /**
107 * @param earExecutionContext The execution context.
108 */
109 void setEarExecutionContext( EarExecutionContext earExecutionContext );
110
111 /**
112 * @return the state if manifest classpath will be changed or not.
113 */
114 boolean changeManifestClasspath();
115
116 /**
117 * @return The directory of the module which contains the JAR libraries packaged within the module.
118 * Can be {@code null}, which means that module doesn't contain any packaged libraries.
119 */
120 String getLibDir();
121
122 /**
123 * Returns the bundle file name. If {@code null}, the artifact's file name is returned.
124 *
125 * @return the bundle file name
126 */
127 String getBundleFileName();
128
129 /**
130 * If module should be included into the Class-Path entry of MANIFEST.mf. Doesn't impact Class-Path entry of
131 * MANIFEST.mf of modules which contain all of their dependencies unless skinnyWars / skinnyModules is turned on.
132 *
133 * @return {@code }True} if module should be included into the Class-Path entry of MANIFEST.mf
134 */
135 boolean isClassPathItem();
136
137 }