Source Code Cross Referenced for BPELNode.java in  » IDE-Netbeans » bpel » org » netbeans » modules » bpel » debugger » ui » breakpoint » 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 » IDE Netbeans » bpel » org.netbeans.modules.bpel.debugger.ui.breakpoint 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.modules.bpel.debugger.ui.breakpoint;
021:
022:        import java.util.ArrayList;
023:        import java.util.HashMap;
024:        import java.util.List;
025:
026:        /**
027:         * An abstract Node corresponding to each XML node when
028:         * a BPEL file is parsed. It includes the line number and XPath
029:         * information as well as the references to parent node and children node
030:         *
031:         * @author Sun Microsystems
032:         *
033:         */
034:        public class BPELNode {
035:
036:            /** "receive" element tag */
037:            public static final String RECEIVE = "receive";
038:
039:            /** "reply" element tag */
040:            public static final String REPLY = "reply";
041:
042:            /** "invoke" element tag */
043:            public static final String INVOKE = "invoke";
044:
045:            /** "assign" element tag */
046:            public static final String ASSIGN = "assign";
047:
048:            /** "throw" element tag */
049:            public static final String THROW = "throw";
050:
051:            /** "exit" element tag */
052:            public static final String TERMINATE = "exit";
053:
054:            /** "wait" element tag */
055:            public static final String WAIT = "wait";
056:
057:            /** "empty" element tag */
058:            public static final String EMPTY = "empty";
059:
060:            /** "sequence" element tag */
061:            public static final String SEQUENCE = "sequence";
062:
063:            /** "switch" element tag */
064:            public static final String SWITCH = "switch";
065:
066:            /** "if" element tag */
067:            public static final String IF = "if";
068:
069:            /** "while" element tag */
070:            public static final String WHILE = "while";
071:
072:            /** "repeatUntil element tag */
073:            public static final String REPEAT_UNTIL = "repeatUntil";
074:
075:            /** "repeatUntil element tag */
076:            public static final String FOREACH = "forEach";
077:
078:            /** "pick" element tag */
079:            public static final String PICK = "pick";
080:
081:            /** "flow" element tag */
082:            public static final String FLOW = "flow";
083:
084:            /** "scope" element tag */
085:            public static final String SCOPE = "scope";
086:
087:            /** "compensate" element tag */
088:            public static final String COMPENSATE = "compensate";
089:
090:            /** "compensateScope" element tag */
091:            public static final String COMPENSATE_SCOPE = "compensateScope";
092:
093:            /** "rethrow" element tag */
094:            public static final String RETHROW = "rethrow";
095:
096:            /** "validate" element tag */
097:            public static final String VALIDATE = "validate";
098:
099:            private static HashMap ALL_ACTIVITIES_MAP;
100:
101:            /**
102:             * NodeType class to ensure type safe comparison,
103:             * so that no equalsTo is required to indentify
104:             * what type the BPELNode is.
105:             *
106:             */
107:            static public final class BPELNodeType {
108:
109:                private String mName;
110:                //Not an activity type
111:                private static final String NONE_ACTIVITY = "NoneActivity";
112:
113:                /**
114:                 * Private constructor to avoid creating an instance.
115:                 * All instances are precreated.
116:                 * 
117:                 * @param nodeType The nodeType
118:                 * 
119:                 */
120:                private BPELNodeType(String nodeType) {
121:                    mName = nodeType;
122:                }
123:
124:                /**
125:                 * The 'receive' activity
126:                 */
127:                public static final BPELNodeType RECEIVE_TYPE = new BPELNodeType(
128:                        RECEIVE);
129:
130:                /**
131:                 * The 'reply' activity
132:                 */
133:                public static final BPELNodeType REPLY_TYPE = new BPELNodeType(
134:                        REPLY);
135:
136:                /**
137:                 * The 'invoke' activity
138:                 */
139:                public static final BPELNodeType INVOKE_TYPE = new BPELNodeType(
140:                        INVOKE);
141:
142:                /**
143:                 * The 'assign' activity
144:                 */
145:                public static final BPELNodeType ASSIGN_TYPE = new BPELNodeType(
146:                        ASSIGN);
147:
148:                /**
149:                 * The 'throw' activity
150:                 */
151:                public static final BPELNodeType THROW_TYPE = new BPELNodeType(
152:                        THROW);
153:
154:                /**
155:                 * The 'terminate' activity
156:                 */
157:                public static final BPELNodeType TERMINATE_TYPE = new BPELNodeType(
158:                        TERMINATE);
159:
160:                /**
161:                 * The 'wait' activity
162:                 */
163:                public static final BPELNodeType WAIT_TYPE = new BPELNodeType(
164:                        WAIT);
165:
166:                /**
167:                 * The 'empty' activity
168:                 */
169:                public static final BPELNodeType EMPTY_TYPE = new BPELNodeType(
170:                        EMPTY);
171:
172:                /**
173:                 * The 'sequence' activity
174:                 */
175:                public static final BPELNodeType SEQUENCE_TYPE = new BPELNodeType(
176:                        SEQUENCE);
177:
178:                /**
179:                 * The 'if' activity
180:                 */
181:                public static final BPELNodeType IF_TYPE = new BPELNodeType(IF);
182:
183:                /**
184:                 * The 'switch' activity
185:                 */
186:                public static final BPELNodeType SWITCH_TYPE = new BPELNodeType(
187:                        SWITCH);
188:
189:                /**
190:                 * The 'repeatUntil' activity
191:                 */
192:                public static final BPELNodeType REPEAT_UNTIL_TYPE = new BPELNodeType(
193:                        REPEAT_UNTIL);
194:
195:                /**
196:                 * The 'while' activity
197:                 */
198:                public static final BPELNodeType WHILE_TYPE = new BPELNodeType(
199:                        WHILE);
200:
201:                /**
202:                 * The 'forEach' activity
203:                 */
204:                public static final BPELNodeType FOREACH_TYPE = new BPELNodeType(
205:                        FOREACH);
206:
207:                /**
208:                 * The 'pick' activity
209:                 */
210:                public static final BPELNodeType PICK_TYPE = new BPELNodeType(
211:                        PICK);
212:
213:                /**
214:                 * The 'flow' activity
215:                 */
216:                public static final BPELNodeType FLOW_TYPE = new BPELNodeType(
217:                        FLOW);
218:
219:                /**
220:                 * The 'scope' activity
221:                 */
222:                public static final BPELNodeType SCOPE_TYPE = new BPELNodeType(
223:                        SCOPE);
224:
225:                /**
226:                 * The 'compensateScope' activity
227:                 */
228:                public static final BPELNodeType COMPENSATE_SCOPE_TYPE = new BPELNodeType(
229:                        COMPENSATE_SCOPE);
230:
231:                /**
232:                 * The 'rethrow' activity
233:                 */
234:                public static final BPELNodeType RETHROW_TYPE = new BPELNodeType(
235:                        RETHROW);
236:                /**
237:                 * The 'validate' activity
238:                 */
239:                public static final BPELNodeType VALIDATE_TYPE = new BPELNodeType(
240:                        VALIDATE);
241:                /**
242:                 * The 'compensate' activity
243:                 */
244:                public static final BPELNodeType COMPENSATE_TYPE = new BPELNodeType(
245:                        COMPENSATE);
246:
247:                /**
248:                 * Any node that is not the above mentioned types
249:                 *
250:                 */
251:                public static final BPELNodeType NONE_ACTIVITY_TYPE = new BPELNodeType(
252:                        NONE_ACTIVITY);
253:
254:                public boolean equals(Object obj) {
255:                    // TODO Auto-generated method stub
256:                    if (obj instanceof  BPELNodeType)
257:                        return false;
258:                    return ((BPELNodeType) obj).mName.equals(mName);
259:                }
260:
261:                public int hashCode() {
262:                    // TODO Auto-generated method stub
263:                    return mName.hashCode();
264:                }
265:
266:                public String toString() {
267:                    // TODO Auto-generated method stub
268:                    return "Type:" + mName;
269:                }
270:
271:            }
272:
273:            static {
274:                ALL_ACTIVITIES_MAP = new HashMap();
275:                ALL_ACTIVITIES_MAP.put(RECEIVE, BPELNodeType.RECEIVE_TYPE);
276:                ALL_ACTIVITIES_MAP.put(REPLY, BPELNodeType.REPLY_TYPE);
277:                ALL_ACTIVITIES_MAP.put(INVOKE, BPELNodeType.INVOKE_TYPE);
278:                ALL_ACTIVITIES_MAP.put(ASSIGN, BPELNodeType.ASSIGN_TYPE);
279:                ALL_ACTIVITIES_MAP.put(THROW, BPELNodeType.THROW_TYPE);
280:                ALL_ACTIVITIES_MAP.put(TERMINATE, BPELNodeType.TERMINATE_TYPE);
281:                ALL_ACTIVITIES_MAP.put(WAIT, BPELNodeType.WAIT_TYPE);
282:                ALL_ACTIVITIES_MAP.put(EMPTY, BPELNodeType.EMPTY_TYPE);
283:                ALL_ACTIVITIES_MAP.put(SEQUENCE, BPELNodeType.SEQUENCE_TYPE);
284:                ALL_ACTIVITIES_MAP.put(IF, BPELNodeType.IF_TYPE);
285:                ALL_ACTIVITIES_MAP.put(REPEAT_UNTIL,
286:                        BPELNodeType.REPEAT_UNTIL_TYPE);
287:                ALL_ACTIVITIES_MAP.put(FOREACH, BPELNodeType.FOREACH_TYPE);
288:                ALL_ACTIVITIES_MAP.put(SWITCH, BPELNodeType.SWITCH_TYPE);
289:                ALL_ACTIVITIES_MAP.put(WHILE, BPELNodeType.WHILE_TYPE);
290:                ALL_ACTIVITIES_MAP.put(PICK, BPELNodeType.PICK_TYPE);
291:                ALL_ACTIVITIES_MAP.put(FLOW, BPELNodeType.FLOW_TYPE);
292:                ALL_ACTIVITIES_MAP.put(SCOPE, BPELNodeType.SCOPE_TYPE);
293:                ALL_ACTIVITIES_MAP
294:                        .put(COMPENSATE, BPELNodeType.COMPENSATE_TYPE);
295:                ALL_ACTIVITIES_MAP.put(COMPENSATE_SCOPE,
296:                        BPELNodeType.COMPENSATE_SCOPE_TYPE);
297:                ALL_ACTIVITIES_MAP.put(RETHROW, BPELNodeType.RETHROW_TYPE);
298:                ALL_ACTIVITIES_MAP.put(VALIDATE, BPELNodeType.VALIDATE_TYPE);
299:            }
300:
301:            public static BPELNodeType getNodeType(String nodeName) {
302:                return ALL_ACTIVITIES_MAP.get(nodeName) != null ? ((BPELNodeType) ALL_ACTIVITIES_MAP
303:                        .get(nodeName))
304:                        : BPELNodeType.NONE_ACTIVITY_TYPE;
305:            }
306:
307:            private final int mLineNo;
308:            private final String mName;
309:            private final String mXpath;
310:            private final BPELNodeType mType;
311:            private final boolean mActivityFlag;
312:            private final String mTargetNameSpace;
313:            private int mClosingNo;
314:
315:            private List mChildren = new ArrayList();
316:            private BPELNode mParent;
317:
318:            public BPELNode(final String name, final int lineNumber,
319:                    final String targetNamespace, final BPELNodeType type,
320:                    final BPELNode parent) {
321:                mName = name;
322:                mLineNo = lineNumber;
323:                mTargetNameSpace = targetNamespace;
324:                mType = type;
325:                mActivityFlag = (getNodeType(name) != BPELNodeType.NONE_ACTIVITY_TYPE);
326:                mParent = parent;
327:                mXpath = constructXpath();
328:            }
329:
330:            /**
331:             * Returns whether he BPEL Node is an Activity type
332:             * of node
333:             * @return true if it is 
334:             */
335:            public boolean isActivity() {
336:                return mActivityFlag;
337:            }
338:
339:            private String constructXpath() {
340:                // TODO Auto-generated method stub
341:                String result = "/";
342:                if (mParent == null) {
343:                    return result + mName;
344:                }
345:                String xpath = mParent.getXpath();
346:                List sibings = mParent.getChildren();
347:
348:                int index = 1;
349:                for (int i = 0; i < sibings.size(); i++) {
350:                    BPELNode sibling = (BPELNode) sibings.get(i);
351:                    if (sibling.getType() == mType) {
352:                        index++;
353:                    }
354:                }
355:                return xpath + "/" + mName + "[" + index + "]";
356:            }
357:
358:            public String getName() {
359:                return mName;
360:            }
361:
362:            /**
363:             * Returns the type of this node
364:             * @return
365:             */
366:            public BPELNodeType getType() {
367:                // TODO Auto-generated method stub
368:                return mType;
369:            }
370:
371:            /**
372:             * Returns the children of this node
373:             * @return
374:             */
375:            public List getChildren() {
376:                // TODO Auto-generated method stub
377:                return mChildren;
378:            }
379:
380:            /**
381:             * Add a child
382:             * @param child
383:             */
384:            public void addChild(BPELNode child) {
385:                mChildren.add(child);
386:            }
387:
388:            /**
389:             * Returns the xpath of this node
390:             * @return
391:             */
392:            public String getXpath() {
393:                // TODO Auto-generated method stub
394:                return mXpath;
395:            }
396:
397:            /**
398:             * Returns the lineNo of this node
399:             * @return
400:             */
401:            public int getLineNumber() {
402:                return mLineNo;
403:            }
404:
405:            public BPELNode getParent() {
406:                return mParent;
407:            }
408:
409:            /**
410:             * Returns the target name space 
411:             */
412:            public String getTargetNameSpace() {
413:                return mTargetNameSpace;
414:            }
415:
416:            /**
417:             * Sets the closing number
418:             * @param lineNo the line no. for the closing tag line
419:             */
420:
421:            public void setClosingNumber(int lineNumber) {
422:                mClosingNo = lineNumber;
423:            }
424:
425:            /**
426:             * Gets the closing number
427:             * @return the line no. for the closing tag line
428:             */
429:            public int getClosingNumber() {
430:                return mClosingNo;
431:            }
432:
433:            @Override
434:            public boolean equals(Object obj) {
435:                // TODO Auto-generated method stub
436:                if (!(obj instanceof  BPELNode)) {
437:                    return false;
438:                }
439:                return ((BPELNode) obj).mTargetNameSpace
440:                        .equals(mTargetNameSpace)
441:                        && ((BPELNode) obj).mXpath.equals(mXpath);
442:            }
443:
444:            @Override
445:            public int hashCode() {
446:                // TODO Auto-generated method stub
447:                return (mXpath.hashCode() + mTargetNameSpace.hashCode()) * 37;
448:            }
449:
450:            @Override
451:            public String toString() {
452:                // TODO Auto-generated method stub
453:                return "targetNameSpace:" + mTargetNameSpace + "   name:"
454:                        + mName + "   lineNo:" + mLineNo + "   xPath:" + mXpath;
455:            }
456:        }
w__w__w_.__ja_v_a___2s._c_o__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.