001: /*
002: * To change this template, choose Tools | Templates
003: * and open the template in the editor.
004: */
005: package org.netbeans.modules.bpel.model.api.support;
006:
007: import java.util.ArrayList;
008: import java.util.List;
009: import javax.swing.Icon;
010: import javax.xml.namespace.QName;
011: import org.netbeans.modules.bpel.model.api.BpelEntity;
012: import org.netbeans.modules.xml.xpath.ext.XPathOperationOrFuntion;
013: import org.netbeans.modules.xml.xpath.ext.metadata.AbstractArgument;
014: import org.netbeans.modules.xml.xpath.ext.metadata.ArgumentDescriptor;
015: import org.netbeans.modules.xml.xpath.ext.metadata.ArgumentGroup;
016: import org.netbeans.modules.xml.xpath.ext.metadata.ExtFunctionMetadata;
017: import org.netbeans.modules.xml.xpath.ext.metadata.ResultTypeCalculator;
018: import org.netbeans.modules.xml.xpath.ext.metadata.XPathType;
019: import org.netbeans.modules.xml.xpath.ext.metadata.impl.images.IconLoader;
020: import org.openide.util.NbBundle;
021:
022: /**
023: * Contains Metadata constants for Extended XPath functions for BPEL
024: *
025: * @author nk160297
026: */
027: public interface BpelXPathExtFunctionMetadata {
028:
029: String IMAGE_FOLDER_NAME = "org/netbeans/modules/bpel/model/api/support/"; // NOI18N
030:
031: String SUN_EXT_FUNC_NS = "http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/XPathFunctions"; // NOI18N
032:
033: ExtFunctionMetadata DO_XSL_TRANSFORM_METADATA = new ExtFunctionMetadata() {
034:
035: private List<AbstractArgument> mArguments;
036:
037: public boolean isContextItemRequired(
038: XPathOperationOrFuntion func) {
039: return false;
040: }
041:
042: public QName getName() {
043: return new QName(BpelEntity.BUSINESS_PROCESS_NS_URI,
044: "doXslTransform"); // NOI18N
045: }
046:
047: public Icon getIcon() {
048: return IconLoader.getIcon("doXslTransform",
049: IMAGE_FOLDER_NAME); // NOI18N
050: }
051:
052: public String getDisplayName() {
053: return NbBundle.getMessage(
054: BpelXPathExtFunctionMetadata.class,
055: "DN_DoXSLTransform"); // NOI18N
056: }
057:
058: public String getShortDescription() {
059: return "";
060: }
061:
062: public String getLongDescription() {
063: return "";
064: }
065:
066: public FunctionType getFunctionType() {
067: return FunctionType.EXT_FUNCTION;
068: }
069:
070: public synchronized List<AbstractArgument> getArguments() {
071: if (mArguments == null) {
072: mArguments = new ArrayList<AbstractArgument>();
073: initArguments();
074: }
075: return mArguments;
076: }
077:
078: public XPathType getResultType() {
079: return XPathType.NODE_TYPE;
080: }
081:
082: public ResultTypeCalculator getResultTypeCalculator() {
083: return null;
084: }
085:
086: private void initArguments() {
087: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
088: mArguments
089: .add(ArgumentDescriptor.Predefined.SIMPLE_NODE_SET);
090: //
091: String nameValuePairsGroupName = "Pairs Name&Value"; // TODO: take from resources
092: mArguments.add(new ArgumentGroup(0, Integer.MAX_VALUE,
093: nameValuePairsGroupName,
094: ArgumentDescriptor.Predefined.SIMPLE_STRING,
095: ArgumentDescriptor.Predefined.ANY_TYPE));
096: }
097:
098: public String toStrign() {
099: return getName().toString();
100: }
101:
102: };
103:
104: ExtFunctionMetadata GET_VARIABLE_PROPERTY_METADATA = new ExtFunctionMetadata() {
105:
106: private List<AbstractArgument> mArguments;
107:
108: public boolean isContextItemRequired(
109: XPathOperationOrFuntion func) {
110: return false;
111: }
112:
113: public QName getName() {
114: return new QName(BpelEntity.BUSINESS_PROCESS_NS_URI,
115: "getVariableProperty"); // NOI18N
116: }
117:
118: public Icon getIcon() {
119: return IconLoader.getIcon("getVariableProperty",
120: IMAGE_FOLDER_NAME); // NOI18N
121: }
122:
123: public String getDisplayName() {
124: return NbBundle.getMessage(
125: BpelXPathExtFunctionMetadata.class,
126: "DN_GetVariableProperty"); // NOI18N
127: }
128:
129: public String getShortDescription() {
130: return "";
131: }
132:
133: public String getLongDescription() {
134: return "";
135: }
136:
137: public FunctionType getFunctionType() {
138: return FunctionType.EXT_FUNCTION;
139: }
140:
141: public synchronized List<AbstractArgument> getArguments() {
142: if (mArguments == null) {
143: mArguments = new ArrayList<AbstractArgument>();
144: initArguments();
145: }
146: return mArguments;
147: }
148:
149: public XPathType getResultType() {
150: return XPathType.ANY_TYPE;
151: }
152:
153: public ResultTypeCalculator getResultTypeCalculator() {
154: return null;
155: }
156:
157: private void initArguments() {
158: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
159: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
160: }
161:
162: public String toStrign() {
163: return getName().toString();
164: }
165:
166: };
167:
168: ExtFunctionMetadata CURRENT_TIME_METADATA = new ExtFunctionMetadata() {
169:
170: public boolean isContextItemRequired(
171: XPathOperationOrFuntion func) {
172: return false;
173: }
174:
175: public QName getName() {
176: return new QName(SUN_EXT_FUNC_NS, "current-time"); // NOI18N
177: }
178:
179: public Icon getIcon() {
180: return IconLoader.getIcon(getName().getLocalPart(),
181: IMAGE_FOLDER_NAME);
182: }
183:
184: public String getDisplayName() {
185: return NbBundle.getMessage(
186: BpelXPathExtFunctionMetadata.class,
187: "DN_CurrentTime"); // NOI18N
188: }
189:
190: public String getShortDescription() {
191: return "";
192: }
193:
194: public String getLongDescription() {
195: return "";
196: }
197:
198: public FunctionType getFunctionType() {
199: return FunctionType.EXT_FUNCTION;
200: }
201:
202: public synchronized List<AbstractArgument> getArguments() {
203: return null;
204: }
205:
206: public XPathType getResultType() {
207: return XPathType.ANY_TYPE;
208: }
209:
210: public ResultTypeCalculator getResultTypeCalculator() {
211: return null;
212: }
213:
214: public String toStrign() {
215: return getName().toString();
216: }
217:
218: };
219:
220: ExtFunctionMetadata CURRENT_DATE_METADATA = new ExtFunctionMetadata() {
221:
222: public boolean isContextItemRequired(
223: XPathOperationOrFuntion func) {
224: return false;
225: }
226:
227: public QName getName() {
228: return new QName(SUN_EXT_FUNC_NS, "current-date"); // NOI18N
229: }
230:
231: public Icon getIcon() {
232: return IconLoader.getIcon(getName().getLocalPart(),
233: IMAGE_FOLDER_NAME);
234: }
235:
236: public String getDisplayName() {
237: return NbBundle.getMessage(
238: BpelXPathExtFunctionMetadata.class,
239: "DN_CurrentDate"); // NOI18N
240: }
241:
242: public String getShortDescription() {
243: return "";
244: }
245:
246: public String getLongDescription() {
247: return "";
248: }
249:
250: public FunctionType getFunctionType() {
251: return FunctionType.EXT_FUNCTION;
252: }
253:
254: public synchronized List<AbstractArgument> getArguments() {
255: return null;
256: }
257:
258: public XPathType getResultType() {
259: return XPathType.ANY_TYPE;
260: }
261:
262: public ResultTypeCalculator getResultTypeCalculator() {
263: return null;
264: }
265:
266: public String toStrign() {
267: return getName().toString();
268: }
269:
270: };
271:
272: ExtFunctionMetadata CURRENT_DATE_TIME_METADATA = new ExtFunctionMetadata() {
273:
274: public boolean isContextItemRequired(
275: XPathOperationOrFuntion func) {
276: return false;
277: }
278:
279: public QName getName() {
280: return new QName(SUN_EXT_FUNC_NS, "current-dateTime"); // NOI18N
281: }
282:
283: public Icon getIcon() {
284: return IconLoader.getIcon(getName().getLocalPart(),
285: IMAGE_FOLDER_NAME);
286: }
287:
288: public String getDisplayName() {
289: return NbBundle.getMessage(
290: BpelXPathExtFunctionMetadata.class,
291: "DN_CurrentDateAndTime"); // NOI18N
292: }
293:
294: public String getShortDescription() {
295: return "";
296: }
297:
298: public String getLongDescription() {
299: return "";
300: }
301:
302: public FunctionType getFunctionType() {
303: return FunctionType.EXT_FUNCTION;
304: }
305:
306: public synchronized List<AbstractArgument> getArguments() {
307: return null;
308: }
309:
310: public XPathType getResultType() {
311: return XPathType.ANY_TYPE;
312: }
313:
314: public ResultTypeCalculator getResultTypeCalculator() {
315: return null;
316: }
317:
318: public String toStrign() {
319: return getName().toString();
320: }
321:
322: };
323:
324: ExtFunctionMetadata DO_MARSHAL_METADATA = new ExtFunctionMetadata() {
325:
326: private List<AbstractArgument> mArguments;
327:
328: public boolean isContextItemRequired(
329: XPathOperationOrFuntion func) {
330: return false;
331: }
332:
333: public QName getName() {
334: return new QName(SUN_EXT_FUNC_NS, "doMarshal"); // NOI18N
335: }
336:
337: public Icon getIcon() {
338: return IconLoader.getIcon("doMarshal", IMAGE_FOLDER_NAME); // NOI18N
339: }
340:
341: public String getDisplayName() {
342: return NbBundle.getMessage(
343: BpelXPathExtFunctionMetadata.class, "DN_DoMarshal"); // NOI18N
344: }
345:
346: public String getShortDescription() {
347: return "";
348: }
349:
350: public String getLongDescription() {
351: return "";
352: }
353:
354: public FunctionType getFunctionType() {
355: return FunctionType.EXT_FUNCTION;
356: }
357:
358: public synchronized List<AbstractArgument> getArguments() {
359: if (mArguments == null) {
360: mArguments = new ArrayList<AbstractArgument>();
361: initArguments();
362: }
363: return mArguments;
364: }
365:
366: public XPathType getResultType() {
367: return XPathType.STRING_TYPE;
368: }
369:
370: public ResultTypeCalculator getResultTypeCalculator() {
371: return null;
372: }
373:
374: private void initArguments() {
375: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_NODE);
376: }
377:
378: public String toStrign() {
379: return getName().toString();
380: }
381:
382: };
383:
384: ExtFunctionMetadata DO_UNMARSHAL_METADATA = new ExtFunctionMetadata() {
385:
386: private List<AbstractArgument> mArguments;
387:
388: public boolean isContextItemRequired(
389: XPathOperationOrFuntion func) {
390: return false;
391: }
392:
393: public QName getName() {
394: return new QName(SUN_EXT_FUNC_NS, "doUnMarshal"); // NOI18N
395: }
396:
397: public Icon getIcon() {
398: return IconLoader.getIcon("doUnMarshal", IMAGE_FOLDER_NAME); // NOI18N
399: }
400:
401: public String getDisplayName() {
402: return NbBundle.getMessage(
403: BpelXPathExtFunctionMetadata.class,
404: "DN_DoUnmarshal"); // NOI18N
405: }
406:
407: public String getShortDescription() {
408: return "";
409: }
410:
411: public String getLongDescription() {
412: return "";
413: }
414:
415: public FunctionType getFunctionType() {
416: return FunctionType.EXT_FUNCTION;
417: }
418:
419: public synchronized List<AbstractArgument> getArguments() {
420: if (mArguments == null) {
421: mArguments = new ArrayList<AbstractArgument>();
422: initArguments();
423: }
424: return mArguments;
425: }
426:
427: public XPathType getResultType() {
428: return XPathType.NODE_TYPE;
429: }
430:
431: public ResultTypeCalculator getResultTypeCalculator() {
432: return null;
433: }
434:
435: private void initArguments() {
436: mArguments.add(ArgumentDescriptor.Predefined.SIMPLE_STRING);
437: }
438:
439: public String toStrign() {
440: return getName().toString();
441: }
442:
443: };
444:
445: }
|