Source Code Cross Referenced for MojoDescriptor.java in  » Build » maven » org » apache » maven » plugin » descriptor » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Build » maven » org.apache.maven.plugin.descriptor 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.maven.plugin.descriptor;
002:
003:        /*
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:
022:        import org.apache.maven.plugin.Mojo;
023:        import org.codehaus.plexus.component.repository.ComponentDescriptor;
024:        import org.codehaus.plexus.configuration.PlexusConfiguration;
025:        import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
026:
027:        import java.util.HashMap;
028:        import java.util.Iterator;
029:        import java.util.LinkedList;
030:        import java.util.List;
031:        import java.util.Map;
032:
033:        /**
034:         * The bean containing the mojo descriptor.
035:         *
036:         * @todo is there a need for the delegation of MavenMojoDescriptor to this? Why not just extend ComponentDescriptor here?
037:         */
038:        public class MojoDescriptor extends ComponentDescriptor implements 
039:                Cloneable {
040:            public static String MAVEN_PLUGIN = "maven-plugin";
041:
042:            public static final String SINGLE_PASS_EXEC_STRATEGY = "once-per-session";
043:
044:            public static final String MULTI_PASS_EXEC_STRATEGY = "always";
045:
046:            private static final String DEFAULT_INSTANTIATION_STRATEGY = "per-lookup";
047:
048:            private static final String DEFAULT_LANGUAGE = "java";
049:
050:            private List parameters;
051:
052:            private Map parameterMap;
053:
054:            private String executionStrategy = SINGLE_PASS_EXEC_STRATEGY;
055:
056:            private String goal;
057:
058:            private String phase;
059:
060:            private String since;
061:
062:            private String executePhase;
063:
064:            private String executeGoal;
065:
066:            private String executeLifecycle;
067:
068:            private String deprecated;
069:
070:            private boolean aggregator = false;
071:
072:            // ----------------------------------------------------------------------
073:            //
074:            // ----------------------------------------------------------------------
075:
076:            private String dependencyResolutionRequired = null;
077:
078:            private boolean projectRequired = true;
079:
080:            private boolean onlineRequired = false;
081:
082:            private PlexusConfiguration mojoConfiguration;
083:
084:            private PluginDescriptor pluginDescriptor;
085:
086:            private boolean inheritedByDefault = true;
087:
088:            private boolean directInvocationOnly = false;
089:
090:            private boolean requiresReports = false;
091:
092:            public MojoDescriptor() {
093:                setInstantiationStrategy(DEFAULT_INSTANTIATION_STRATEGY);
094:                setComponentFactory(DEFAULT_LANGUAGE);
095:            }
096:
097:            // ----------------------------------------------------------------------
098:            //
099:            // ----------------------------------------------------------------------
100:
101:            public String getLanguage() {
102:                return getComponentFactory();
103:            }
104:
105:            public void setLanguage(String language) {
106:                setComponentFactory(language);
107:            }
108:
109:            public String getDeprecated() {
110:                return deprecated;
111:            }
112:
113:            public void setDeprecated(String deprecated) {
114:                this .deprecated = deprecated;
115:            }
116:
117:            public List getParameters() {
118:                return parameters;
119:            }
120:
121:            public void setParameters(List parameters)
122:                    throws DuplicateParameterException {
123:                for (Iterator it = parameters.iterator(); it.hasNext();) {
124:                    Parameter parameter = (Parameter) it.next();
125:                    addParameter(parameter);
126:                }
127:            }
128:
129:            public void addParameter(Parameter parameter)
130:                    throws DuplicateParameterException {
131:                if (parameters != null && parameters.contains(parameter)) {
132:                    throw new DuplicateParameterException(
133:                            parameter.getName()
134:                                    + " has been declared multiple times in mojo with goal: "
135:                                    + getGoal() + " (implementation: "
136:                                    + getImplementation() + ")");
137:                } else {
138:                    if (parameters == null) {
139:                        parameters = new LinkedList();
140:                    }
141:
142:                    parameters.add(parameter);
143:                }
144:            }
145:
146:            public Map getParameterMap() {
147:                if (parameterMap == null) {
148:                    parameterMap = new HashMap();
149:
150:                    if (parameters != null) {
151:                        for (Iterator iterator = parameters.iterator(); iterator
152:                                .hasNext();) {
153:                            Parameter pd = (Parameter) iterator.next();
154:
155:                            parameterMap.put(pd.getName(), pd);
156:                        }
157:                    }
158:                }
159:
160:                return parameterMap;
161:            }
162:
163:            // ----------------------------------------------------------------------
164:            // Dependency requirement
165:            // ----------------------------------------------------------------------
166:
167:            public void setDependencyResolutionRequired(
168:                    String requiresDependencyResolution) {
169:                this .dependencyResolutionRequired = requiresDependencyResolution;
170:            }
171:
172:            public String isDependencyResolutionRequired() {
173:                return dependencyResolutionRequired;
174:            }
175:
176:            // ----------------------------------------------------------------------
177:            // Project requirement
178:            // ----------------------------------------------------------------------
179:
180:            public void setProjectRequired(boolean requiresProject) {
181:                this .projectRequired = requiresProject;
182:            }
183:
184:            public boolean isProjectRequired() {
185:                return projectRequired;
186:            }
187:
188:            // ----------------------------------------------------------------------
189:            // Online vs. Offline requirement
190:            // ----------------------------------------------------------------------
191:
192:            public void setOnlineRequired(boolean requiresOnline) {
193:                this .onlineRequired = requiresOnline;
194:            }
195:
196:            // blech! this isn't even intelligible as a method name. provided for
197:            // consistency...
198:            public boolean isOnlineRequired() {
199:                return onlineRequired;
200:            }
201:
202:            // more english-friendly method...keep the code clean! :)
203:            public boolean requiresOnline() {
204:                return onlineRequired;
205:            }
206:
207:            public String getPhase() {
208:                return phase;
209:            }
210:
211:            public void setPhase(String phase) {
212:                this .phase = phase;
213:            }
214:
215:            public String getSince() {
216:                return since;
217:            }
218:
219:            public void setSince(String since) {
220:                this .since = since;
221:            }
222:
223:            public String getGoal() {
224:                return goal;
225:            }
226:
227:            public void setGoal(String goal) {
228:                this .goal = goal;
229:            }
230:
231:            public String getExecutePhase() {
232:                return executePhase;
233:            }
234:
235:            public void setExecutePhase(String executePhase) {
236:                this .executePhase = executePhase;
237:            }
238:
239:            public boolean alwaysExecute() {
240:                return MULTI_PASS_EXEC_STRATEGY.equals(executionStrategy);
241:            }
242:
243:            public String getExecutionStrategy() {
244:                return executionStrategy;
245:            }
246:
247:            public void setExecutionStrategy(String executionStrategy) {
248:                this .executionStrategy = executionStrategy;
249:            }
250:
251:            public PlexusConfiguration getMojoConfiguration() {
252:                if (mojoConfiguration == null) {
253:                    mojoConfiguration = new XmlPlexusConfiguration(
254:                            "configuration");
255:                }
256:                return mojoConfiguration;
257:            }
258:
259:            public void setMojoConfiguration(
260:                    PlexusConfiguration mojoConfiguration) {
261:                this .mojoConfiguration = mojoConfiguration;
262:            }
263:
264:            public String getRole() {
265:                return Mojo.ROLE;
266:            }
267:
268:            public String getRoleHint() {
269:                return getId();
270:            }
271:
272:            public String getId() {
273:                return getPluginDescriptor().getId() + ":" + getGoal();
274:            }
275:
276:            public String getFullGoalName() {
277:                return getPluginDescriptor().getGoalPrefix() + ":" + getGoal();
278:            }
279:
280:            public String getComponentType() {
281:                return MAVEN_PLUGIN;
282:            }
283:
284:            public PluginDescriptor getPluginDescriptor() {
285:                return pluginDescriptor;
286:            }
287:
288:            public void setPluginDescriptor(PluginDescriptor pluginDescriptor) {
289:                this .pluginDescriptor = pluginDescriptor;
290:            }
291:
292:            public boolean isInheritedByDefault() {
293:                return inheritedByDefault;
294:            }
295:
296:            public void setInheritedByDefault(boolean inheritedByDefault) {
297:                this .inheritedByDefault = inheritedByDefault;
298:            }
299:
300:            public boolean equals(Object object) {
301:                if (this  == object) {
302:                    return true;
303:                }
304:
305:                if (object instanceof  MojoDescriptor) {
306:                    MojoDescriptor other = (MojoDescriptor) object;
307:
308:                    if (!compareObjects(getPluginDescriptor(), other
309:                            .getPluginDescriptor())) {
310:                        return false;
311:                    }
312:
313:                    if (!compareObjects(getGoal(), other.getGoal())) {
314:                        return false;
315:                    }
316:
317:                    return true;
318:                }
319:
320:                return false;
321:            }
322:
323:            private boolean compareObjects(Object first, Object second) {
324:                if ((first == null && second != null)
325:                        || (first != null && second == null)) {
326:                    return false;
327:                }
328:
329:                if (!first.equals(second)) {
330:                    return false;
331:                }
332:
333:                return true;
334:            }
335:
336:            public int hashCode() {
337:                int result = 1;
338:
339:                String goal = getGoal();
340:
341:                if (goal != null) {
342:                    result += goal.hashCode();
343:                }
344:
345:                PluginDescriptor pd = getPluginDescriptor();
346:
347:                if (pd != null) {
348:                    result -= pd.hashCode();
349:                }
350:
351:                return result;
352:            }
353:
354:            public String getExecuteLifecycle() {
355:                return executeLifecycle;
356:            }
357:
358:            public void setExecuteLifecycle(String executeLifecycle) {
359:                this .executeLifecycle = executeLifecycle;
360:            }
361:
362:            public void setAggregator(boolean aggregator) {
363:                this .aggregator = aggregator;
364:            }
365:
366:            public boolean isAggregator() {
367:                return aggregator;
368:            }
369:
370:            public boolean isDirectInvocationOnly() {
371:                return directInvocationOnly;
372:            }
373:
374:            public void setDirectInvocationOnly(boolean directInvocationOnly) {
375:                this .directInvocationOnly = directInvocationOnly;
376:            }
377:
378:            public boolean isRequiresReports() {
379:                return requiresReports;
380:            }
381:
382:            public void setRequiresReports(boolean requiresReports) {
383:                this .requiresReports = requiresReports;
384:            }
385:
386:            public void setExecuteGoal(String executeGoal) {
387:                this .executeGoal = executeGoal;
388:            }
389:
390:            public String getExecuteGoal() {
391:                return executeGoal;
392:            }
393:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.