Source Code Cross Referenced for ReactorManager.java in  » Build » maven » org » apache » maven » execution » 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.execution 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.apache.maven.execution;
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.artifact.ArtifactUtils;
023:        import org.apache.maven.plugin.descriptor.PluginDescriptor;
024:        import org.apache.maven.project.DuplicateProjectException;
025:        import org.apache.maven.project.MavenProject;
026:        import org.apache.maven.project.ProjectSorter;
027:        import org.codehaus.plexus.util.dag.CycleDetectedException;
028:
029:        import java.util.ArrayList;
030:        import java.util.HashMap;
031:        import java.util.Iterator;
032:        import java.util.List;
033:        import java.util.Map;
034:
035:        public class ReactorManager {
036:            public static final String FAIL_FAST = "fail-fast";
037:
038:            public static final String FAIL_AT_END = "fail-at-end";
039:
040:            public static final String FAIL_NEVER = "fail-never";
041:
042:            private List blackList = new ArrayList();
043:
044:            private Map buildFailuresByProject = new HashMap();
045:
046:            private Map pluginContextsByProjectAndPluginKey = new HashMap();
047:
048:            private String failureBehavior = FAIL_FAST;
049:
050:            private final ProjectSorter sorter;
051:
052:            private Map buildSuccessesByProject = new HashMap();
053:
054:            public ReactorManager(List projects, String failureBehavior)
055:                    throws CycleDetectedException, DuplicateProjectException {
056:                this .sorter = new ProjectSorter(projects);
057:
058:                if (failureBehavior == null) {
059:                    this .failureBehavior = FAIL_FAST;
060:                } else {
061:                    this .failureBehavior = failureBehavior;
062:                }
063:            }
064:
065:            public Map getPluginContext(PluginDescriptor plugin,
066:                    MavenProject project) {
067:                Map pluginContextsByKey = (Map) pluginContextsByProjectAndPluginKey
068:                        .get(project.getId());
069:
070:                if (pluginContextsByKey == null) {
071:                    pluginContextsByKey = new HashMap();
072:
073:                    pluginContextsByProjectAndPluginKey.put(project.getId(),
074:                            pluginContextsByKey);
075:                }
076:
077:                Map pluginContext = (Map) pluginContextsByKey.get(plugin
078:                        .getPluginLookupKey());
079:
080:                if (pluginContext == null) {
081:                    pluginContext = new HashMap();
082:                    pluginContextsByKey.put(plugin.getPluginLookupKey(),
083:                            pluginContext);
084:                }
085:
086:                return pluginContext;
087:            }
088:
089:            public String getFailureBehavior() {
090:                return failureBehavior;
091:            }
092:
093:            public void blackList(MavenProject project) {
094:                blackList(getProjectKey(project));
095:            }
096:
097:            private void blackList(String id) {
098:                if (!blackList.contains(id)) {
099:                    blackList.add(id);
100:
101:                    List dependents = sorter.getDependents(id);
102:
103:                    if (dependents != null && !dependents.isEmpty()) {
104:                        for (Iterator it = dependents.iterator(); it.hasNext();) {
105:                            String dependentId = (String) it.next();
106:
107:                            if (!buildSuccessesByProject
108:                                    .containsKey(dependentId)
109:                                    && !buildFailuresByProject
110:                                            .containsKey(dependentId)) {
111:                                blackList(dependentId);
112:                            }
113:                        }
114:                    }
115:                }
116:            }
117:
118:            public boolean isBlackListed(MavenProject project) {
119:                return blackList.contains(getProjectKey(project));
120:            }
121:
122:            private static String getProjectKey(MavenProject project) {
123:                return ArtifactUtils.versionlessKey(project.getGroupId(),
124:                        project.getArtifactId());
125:            }
126:
127:            public void registerBuildFailure(MavenProject project,
128:                    Exception error, String task, long time) {
129:                buildFailuresByProject.put(getProjectKey(project),
130:                        new BuildFailure(error, task, time));
131:            }
132:
133:            public boolean hasBuildFailures() {
134:                return !buildFailuresByProject.isEmpty();
135:            }
136:
137:            public boolean hasBuildFailure(MavenProject project) {
138:                return buildFailuresByProject
139:                        .containsKey(getProjectKey(project));
140:            }
141:
142:            public boolean hasMultipleProjects() {
143:                return sorter.hasMultipleProjects();
144:            }
145:
146:            public List getSortedProjects() {
147:                return sorter.getSortedProjects();
148:            }
149:
150:            public MavenProject getTopLevelProject() {
151:                return sorter.getTopLevelProject();
152:            }
153:
154:            public boolean hasBuildSuccess(MavenProject project) {
155:                return buildSuccessesByProject
156:                        .containsKey(getProjectKey(project));
157:            }
158:
159:            public void registerBuildSuccess(MavenProject project, long time) {
160:                buildSuccessesByProject.put(getProjectKey(project),
161:                        new BuildSuccess(project, time));
162:            }
163:
164:            public BuildFailure getBuildFailure(MavenProject project) {
165:                return (BuildFailure) buildFailuresByProject
166:                        .get(getProjectKey(project));
167:            }
168:
169:            public BuildSuccess getBuildSuccess(MavenProject project) {
170:                return (BuildSuccess) buildSuccessesByProject
171:                        .get(getProjectKey(project));
172:            }
173:
174:            public boolean executedMultipleProjects() {
175:                return buildFailuresByProject.size()
176:                        + buildSuccessesByProject.size() > 1;
177:            }
178:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.