001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.bpel.model.xam;
042:
043: import java.util.HashSet;
044: import java.util.Set;
045:
046: import javax.xml.namespace.QName;
047:
048: import org.netbeans.modules.bpel.model.api.BpelEntity;
049: import org.netbeans.modules.bpel.model.api.ServiceRef;
050:
051: /**
052: * @author ads
053: */
054: public enum BpelElements {
055: PROCESS("process"), // NOI18N
056: ASSIGN("assign"), // NOI18N
057: REPLY("reply"), // NOI18N
058: CATCH_ALL("catchAll"), // NOI18N
059: CATCH("catch"), // NOI18N
060: COMPENSATE("compensate"), // NOI18N
061: COMPENSATION_HANDLER("compensationHandler"), // NOI18N
062: COPY("copy"), // NOI18N
063: CORRELATIONS("correlations"), // NOI18N
064: CORRELATION("correlation"), // NOI18N
065: CORRELATION_SETS("correlationSets"), // NOI18N
066: CORRELATION_SET("correlationSet"), // NOI18N
067: EMPTY("empty"), // NOI18N
068: EVENT_HANDLERS("eventHandlers"), // NOI18N
069: FAULT_HANDLERS("faultHandlers"), // NOI18N
070: FLOW("flow"), // NOI18N
071: FROM("from"), // NOI18N
072: INVOKE("invoke"), // NOI18N
073: LINKS("links"), // NOI18N
074: LINK("link"), // NOI18N
075: ON_MESSAGE("onMessage"), // NOI18N
076: PARTNERLINKS("partnerLinks"), // NOI18N
077: PARTNER_LINK("partnerLink"), // NOI18N
078: CORRELATIONS_WITH_PATTERN("correlations"), // NOI18N
079: CORRELATION_WITH_PATTERN("correlation"), // NOI18N
080: PICK("pick"), // NOI18N
081: RECEIVE("receive"), // NOI18N
082: SCOPE("scope"), // NOI18N
083: SEQUENCE("sequence"), // NOI18N
084: SOURCES("sources"), // NOI18N
085: TARGETS("targets"), // NOI18N
086: SOURCE("source"), // NOI18N
087: TARGET("target"), // NOI18N
088: THROW("throw"), // NOI18N
089: TO("to"), // NOI18N
090: VARIABLES("variables"), // NOI18N
091: VARIABLE("variable"), // NOI18N
092: WAIT("wait"), // NOI18N
093: WHILE("while"), // NOI18N
094: ELSE("else"), // NOI18N
095: THEN("then"), // NOI18N
096: ON_EVENT("onEvent"), // NOI18N
097: ON_ALARM_EVENT("onAlarm"), // NOI18N
098: EXTENSIBLE_ASSIGN("extensibleAssign"), // NOI18N
099: ON_ALARM_PICK("onAlarm"), // NOI18N
100: TERMINATION_HANDLER("terminationHandler"), // NOI18N
101: CONDITION("condition"), // NOI18N
102: FOR("for"), // NOI18N
103: UNTIL("until"), // NOI18N
104: FOR_EACH("forEach"), // NOI18N
105: IF("if"), // NOI18N
106: REPEAT_UNTIL("repeatUntil"), // NOI18N
107: RETHROW("rethrow"), // NOI18N
108: EXIT("exit"), // NOI18N
109: VALIDATE("validate"), // NOI18N
110: DOCUMENTATION("documentation"), // NOI18N
111: EXTENSIONS("extensions"), // NOI18N
112: IMPORT("import"), // NOI18N
113: EXTENSION("extension"), // NOI18N
114: REPEAT_EVERY("repeatEvery"), // NOI18N
115: TRANSITION_CONDITION("transitionCondition"), // NOI18N
116: JOIN_CONDITION("joinCondition"), // NOI18N
117: FROM_PART("fromPart"), // NOI18N
118: FROM_PARTS("fromParts"), // NOI18N
119: TO_PART("toPart"), // NOI18N
120: TO_PARTS("toParts"), // NOI18N
121: LITERAL("literal"), // NOI18N
122: ELSE_IF("elseif"), // NOI18N
123: COMPLETION_CONDITION("completionCondition"), // NOI18N
124: BRANCHES("branches"), // NOI18N
125: START_COUNTER_VALUE("startCounterValue"), // NOI18N
126: FINAL_COUNTER_VALUE("finalCounterValue"), // NOI18N
127: MESSAGE_EXCHAGES("messageExchanges"), // NOI18N
128: MESSAGE_EXCHAGE("messageExchange"), // NOI18N
129: SERVICE_REF("service-ref", // NOI18N
130: ServiceRef.SERVICE_REF_NS), COMPENSATE_SCOPE(
131: "compensateScope"), // NOI18N
132: QUERY("query"), // NOI18N
133: ;
134:
135: BpelElements(String name) {
136: this (name, null);
137: }
138:
139: BpelElements(String name, String nsUri) {
140: myTag = name;
141: myNS = nsUri;
142: }
143:
144: /**
145: * @return Name of tag.
146: */
147: public String getName() {
148: return myTag;
149: }
150:
151: /**
152: * @return namespace if any
153: */
154: public String getNamespace() {
155: return myNS;
156: }
157:
158: /**
159: * @return QName of tag.
160: */
161: public QName getQName() {
162: if (getNamespace() == null) {
163: return new QName(BpelEntity.BUSINESS_PROCESS_NS_URI,
164: getName());
165: } else {
166: return new QName(getNamespace(), getName());
167: }
168: }
169:
170: /**
171: * @return All set of qnames in BPEL.
172: */
173: public static Set<QName> allQNames() {
174: return QNAMES;
175: }
176:
177: private final String myTag;
178:
179: private final String myNS;
180:
181: private static final Set<QName> QNAMES = new HashSet<QName>();
182:
183: static {
184: for (BpelElements v : values()) {
185: QNAMES.add(v.getQName());
186: }
187: }
188: }
|