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: package org.netbeans.modules.bpel.model.xam;
020:
021: import java.util.List;
022:
023: import javax.xml.namespace.QName;
024:
025: import org.netbeans.modules.bpel.model.api.Assign;
026: import org.netbeans.modules.bpel.model.api.BaseScope;
027: import org.netbeans.modules.bpel.model.api.Branches;
028: import org.netbeans.modules.bpel.model.api.Catch;
029: import org.netbeans.modules.bpel.model.api.CompensateScope;
030: import org.netbeans.modules.bpel.model.api.CompensationHandlerHolder;
031: import org.netbeans.modules.bpel.model.api.ContentElement;
032: import org.netbeans.modules.bpel.model.api.Copy;
033: import org.netbeans.modules.bpel.model.api.Correlation;
034: import org.netbeans.modules.bpel.model.api.CorrelationSet;
035: import org.netbeans.modules.bpel.model.api.CreateInstanceActivity;
036: import org.netbeans.modules.bpel.model.api.Documentation;
037: import org.netbeans.modules.bpel.model.api.Extension;
038: import org.netbeans.modules.bpel.model.api.FaultNameReference;
039: import org.netbeans.modules.bpel.model.api.ForEach;
040: import org.netbeans.modules.bpel.model.api.From;
041: import org.netbeans.modules.bpel.model.api.FromPart;
042: import org.netbeans.modules.bpel.model.api.Import;
043: import org.netbeans.modules.bpel.model.api.Invoke;
044: import org.netbeans.modules.bpel.model.api.JoinFailureSuppressor;
045: import org.netbeans.modules.bpel.model.api.Link;
046: import org.netbeans.modules.bpel.model.api.MessageExchange;
047: import org.netbeans.modules.bpel.model.api.MessageExchangeReference;
048: import org.netbeans.modules.bpel.model.api.MessageTypeReference;
049: import org.netbeans.modules.bpel.model.api.NamedElement;
050: import org.netbeans.modules.bpel.model.api.OnEvent;
051: import org.netbeans.modules.bpel.model.api.OperationReference;
052: import org.netbeans.modules.bpel.model.api.PartReference;
053: import org.netbeans.modules.bpel.model.api.PartnerLink;
054: import org.netbeans.modules.bpel.model.api.PartnerLinkReference;
055: import org.netbeans.modules.bpel.model.api.PatternedCorrelation;
056: import org.netbeans.modules.bpel.model.api.PortTypeReference;
057: import org.netbeans.modules.bpel.model.api.Process;
058: import org.netbeans.modules.bpel.model.api.PropertyReference;
059: import org.netbeans.modules.bpel.model.api.QueryLanguageSpec;
060: import org.netbeans.modules.bpel.model.api.Scope;
061: import org.netbeans.modules.bpel.model.api.ServiceRef;
062: import org.netbeans.modules.bpel.model.api.Target;
063: import org.netbeans.modules.bpel.model.api.Throw;
064: import org.netbeans.modules.bpel.model.api.ToPart;
065: import org.netbeans.modules.bpel.model.api.Validate;
066: import org.netbeans.modules.bpel.model.api.Variable;
067: import org.netbeans.modules.bpel.model.api.VariableDeclaration;
068: import org.netbeans.modules.bpel.model.api.VariableReference;
069: import org.netbeans.modules.bpel.model.api.support.Initiate;
070: import org.netbeans.modules.bpel.model.api.support.Pattern;
071: import org.netbeans.modules.bpel.model.api.support.Roles;
072: import org.netbeans.modules.bpel.model.api.support.TBoolean;
073: import org.netbeans.modules.xml.schema.model.GlobalElement;
074: import org.netbeans.modules.xml.schema.model.GlobalType;
075: import org.netbeans.modules.xml.wsdl.model.Message;
076: import org.netbeans.modules.xml.wsdl.model.Operation;
077: import org.netbeans.modules.xml.wsdl.model.Part;
078: import org.netbeans.modules.xml.wsdl.model.PortType;
079: import org.netbeans.modules.xml.wsdl.model.ReferenceableWSDLComponent;
080: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.CorrelationProperty;
081: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.PartnerLinkType;
082: import org.netbeans.modules.xml.wsdl.model.extensions.bpel.Role;
083: import org.netbeans.modules.xml.xam.dom.Attribute;
084:
085: /**
086: * @author ads
087: */
088: public enum BpelAttributes implements Attribute {
089: EXIT_ON_STANDART_FAULT(BaseScope.EXIT_ON_STANDART_FAULT,
090: TBoolean.class), NAME(NamedElement.NAME, String.class,
091: AttrType.NCNAME), SUPPRESS_JOIN_FAILURE(
092: JoinFailureSuppressor.SUPPRESS_JOIN_FAILURE, TBoolean.class), EXPRESSION_LANGUAGE(
093: Process.EXPRESSION_LANGUAGE, String.class, AttrType.URI), QUERY_LANGUAGE(
094: QueryLanguageSpec.QUERY_LANGUAGE, String.class,
095: AttrType.URI), TARGET_NAMESPACE(Process.TARGET_NAMESPACE,
096: String.class, AttrType.URI), VALIDATE(Assign.VALIDATE,
097: TBoolean.class), CREATE_INSTANCE(
098: CreateInstanceActivity.CREATE_INSTANCE, TBoolean.class), ISOLATED(
099: Scope.ISOLATED, TBoolean.class), SOURCE(
100: Documentation.SOURCE, String.class, AttrType.URI), LOCATION(
101: Import.LOCATION, String.class, AttrType.URI), IMPORT_TYPE(
102: Import.IMPORT_TYPE, String.class, AttrType.URI), NAMESPACE(
103: Import.NAMESPACE, String.class, AttrType.URI), MUST_UNDERSTAND(
104: Extension.MUST_UNDERSTAND, TBoolean.class), INITIATE(
105: Correlation.INITIATE, Initiate.class), PATTERN(
106: PatternedCorrelation.PATTERN, Pattern.class), OPAQUE(
107: From.OPAQUE, TBoolean.class), ENDPOINT_REFERENCE(
108: From.ENDPOINT_REFERENCE, Roles.class), COUNTER_NAME(
109: ForEach.COUNTER_NAME, String.class, AttrType.VARIABLE), PARALLEL(
110: ForEach.PARALLEL, TBoolean.class), COUNT_COMPLETED_BRANCHES_ONLY(
111: Branches.COUNT_COMPLETED_BRANCHES_ONLY, TBoolean.class), INITIALIZE_PARTNER_ROLE(
112: PartnerLink.INITIALIZE_PARTNER_ROLE, TBoolean.class), FAULT_VARIABLE(
113: Catch.FAULT_VARIABLE, String.class, AttrType.VARIABLE), FAULT_VARIABLE_REF(
114: Throw.FAULT_VARIABLE, VariableDeclaration.class), LANGUAGE(
115: Documentation.LANGUAGE, String.class, AttrType.STRING), VARIABLE(
116: OnEvent.VARIABLE, String.class, AttrType.VARIABLE), VARIABLE_REF(
117: VariableReference.VARIABLE, VariableDeclaration.class), FAULT_MESSAGE_TYPE(
118: Catch.FAULT_MESSAGE_TYPE, ReferenceableWSDLComponent.class), FAULT_ELEMENT(
119: Catch.FAULT_ELEMENT, GlobalElement.class), SET(
120: Correlation.SET, CorrelationSet.class), TARGET(
121: CompensateScope.TARGET, CompensationHandlerHolder.class), LINK_NAME(
122: Target.LINK_NAME, Link.class), PARTNER_LINK(
123: PartnerLinkReference.PARTNER_LINK, PartnerLink.class), PORT_TYPE(
124: PortTypeReference.PORT_TYPE, PortType.class), OPERATION(
125: OperationReference.OPERATION, Operation.class), INPUT_VARIABLE(
126: Invoke.INPUT_VARIABLE, VariableDeclaration.class), OUTPUT_VARIABLE(
127: Invoke.OUTPUT_VARIABLE, VariableDeclaration.class), MESSAGE_TYPE(
128: MessageTypeReference.MESSAGE_TYPE, Message.class), ELEMENT(
129: Variable.ELEMENT, GlobalElement.class), PART(
130: PartReference.PART, Part.class), PROPERTY(
131: PropertyReference.PROPERTY, CorrelationProperty.class), TYPE(
132: Variable.TYPE, GlobalType.class), FROM_VARIABLE(
133: ToPart.FROM_VARIABLE, VariableDeclaration.class), MY_ROLE(
134: PartnerLink.MY_ROLE, Role.class), PARTNER_LINK_TYPE(
135: PartnerLink.PARTNER_LINK_TYPE, PartnerLinkType.class), PARTNER_ROLE(
136: PartnerLink.PARTNER_ROLE, Role.class), TO_VARIABLE(
137: FromPart.TO_VARIABLE, VariableDeclaration.class), MESSAGE_EXCHANGE(
138: MessageExchangeReference.MESSAGE_EXCHANGE,
139: MessageExchange.class), PROPERTIES(
140: CorrelationSet.PROPERTIES, List.class,
141: CorrelationProperty.class), VARIABLES(Validate.VARIABLES,
142: List.class, VariableDeclaration.class), CONTENT(
143: ContentElement.CONTENT_PROPERTY, String.class,
144: AttrType.STRING), // this is pseudo attribute.
145: FAULT_NAME(FaultNameReference.FAULT_NAME, QName.class), KEEP_SRC_ELEMENT_NAME(
146: Copy.KEEP_SRC_ELEMENT_NAME, TBoolean.class), REFERENCE_SCHEME(
147: ServiceRef.REFERENCE_SCHEME, String.class, AttrType.URI), IGNORE_MISSING_FROM_DATA(
148: Copy.IGNORE_MISSING_FROM_DATA, TBoolean.class), ;
149:
150: public static enum AttrType {
151: STRING, NCNAME, URI, VARIABLE
152: }
153:
154: BpelAttributes(String name, Class type) {
155: this (name, type, (Class) null);
156: }
157:
158: BpelAttributes(String name, Class type, AttrType attrType) {
159: this (name, type, (Class) null);
160: myType = attrType;
161: }
162:
163: BpelAttributes(String name, Class type, Class subtype) {
164: myAttributeName = name;
165: myAttributeType = type;
166: myAttributeTypeInContainer = subtype;
167: }
168:
169: /* (non-Javadoc)
170: * @see java.lang.Object#toString()
171: */
172: /** {@inheritDoc} */
173: public String toString() {
174: return myAttributeName;
175: }
176:
177: /* (non-Javadoc)
178: * @see org.netbeans.modules.xml.xam.dom.Attribute#getType()
179: */
180: /** {@inheritDoc} */
181: public Class getType() {
182: return myAttributeType;
183: }
184:
185: /* (non-Javadoc)
186: * @see org.netbeans.modules.xml.xam.dom.Attribute#getName()
187: */
188: /** {@inheritDoc} */
189: public String getName() {
190: return myAttributeName;
191: }
192:
193: /* (non-Javadoc)
194: * @see org.netbeans.modules.xml.xam.dom.Attribute#getMemberType()
195: */
196: /** {@inheritDoc} */
197: public Class getMemberType() {
198: return myAttributeTypeInContainer;
199: }
200:
201: /**
202: * @return type of attribute value
203: */
204: public AttrType getAttributeType() {
205: return myType;
206: }
207:
208: /**
209: * @param name String representation of enum.
210: * @return Enum that have <code>name</code> representaion.
211: */
212: public static Attribute forName(String name) {
213: for (BpelAttributes attr : values()) {
214: if (attr.getName().equals(name)
215: && attr.getType().equals(String.class)) {
216: return attr;
217: }
218: }
219: return null;
220: }
221:
222: private String myAttributeName;
223:
224: private Class myAttributeType;
225:
226: private Class myAttributeTypeInContainer;
227:
228: private AttrType myType;
229: }
|