Source Code Cross Referenced for CommonFunctionLangCallTag.java in  » Workflow-Engines » JFolder » org » jfolder » common » function » v1 » 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 » Workflow Engines » JFolder » org.jfolder.common.function.v1 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * JFolder, Copyright 2001-2006 Gary Steinmetz
003:         *
004:         * Distributable under LGPL license.
005:         * See terms of license at gnu.org.
006:         */
007:
008:        package org.jfolder.common.function.v1;
009:
010:        //base classes
011:        import java.lang.reflect.InvocationTargetException;
012:        import java.lang.reflect.Method;
013:
014:        //project specific classes
015:        import org.jfolder.common.SelfArgumentlessConstructor;
016:        import org.jfolder.common.StandardDataTypes;
017:        import org.jfolder.common.function.BaseCommonFunctionCompatibilityTag;
018:        import org.jfolder.common.function.WebPageTagInstanceViewContext;
019:        import org.jfolder.common.function.WebPageTagInstanceViewContextInfo;
020:        import org.jfolder.common.tagging.AppraiseConceptTagContext;
021:        import org.jfolder.common.tagging.ConceptTagCharacteristic;
022:        import org.jfolder.common.tagging.ConceptTagConstraint;
023:        import org.jfolder.common.tagging.ConceptTagConstraintHolder;
024:        import org.jfolder.common.tagging.ConceptTagFlagsHelper;
025:        import org.jfolder.common.tagging.ConceptTagHelper;
026:        import org.jfolder.common.tagging.DetermineClassConceptTagContext;
027:        import org.jfolder.common.tagging.DetermineClassConceptTagException;
028:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
029:        import org.jfolder.common.tagging.DetermineValueAndClassConceptTagException;
030:        import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
031:        import org.jfolder.common.tagging.InitializeConceptTagContext;
032:        import org.jfolder.common.tagging.ReturnableConceptTag;
033:        import org.jfolder.common.tagging.SelectionCriteriaForReturnableConceptTag;
034:        import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
035:        import org.jfolder.common.tagging.StudioConceptTagCreParInfoContext;
036:        import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
037:        import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
038:        import org.jfolder.common.tagging.ValueAndClassForConceptTag;
039:
040:        //other classes
041:
042:        public class CommonFunctionLangCallTag extends
043:                BaseCommonFunctionCompatibilityTag implements 
044:                SelfArgumentlessConstructor {
045:
046:            //characteristics
047:            private ConceptTagCharacteristic callerCtchar = null;
048:            private ConceptTagCharacteristic methodCtchar = null;
049:            private ConceptTagCharacteristic parameterCtchar = null;
050:
051:            //caller details
052:            private final static String CALLER_CTCON = "caller";
053:            private final static String CALLER_TITLE = "Caller";
054:            private final static String CALLER_SHORT_DESCRIPTION = "Object calling the method";
055:
056:            //method details
057:            private final static String METHOD_CTCON = "method";
058:            private final static String METHOD_TITLE = "Method";
059:            private final static String METHOD_SHORT_DESCRIPTION = "Method to be called";
060:
061:            //parameter details
062:            private final static String PARAMETER_CTCON = "parameter";
063:            private final static String PARAMETER_TITLE = "Parameters";
064:            private final static String PARAMETER_SHORT_DESCRIPTION = "Parameters to be passed to the method";
065:
066:            public void initialize(InitializeConceptTagContext inIctc) {
067:
068:                //
069:                ConceptTagConstraintHolder rootCtconh = ConceptTagConstraintHolder
070:                        .newInstance(inIctc);
071:
072:                //constrain "caller"
073:                ConceptTagConstraint callerCtcon = ConceptTagConstraint
074:                        .newInstance(CALLER_CTCON, rootCtconh);
075:                callerCtcon.setTitle(CALLER_TITLE);
076:                callerCtcon.setShortDescription(CALLER_SHORT_DESCRIPTION);
077:                //dtc1.setClassRestrictions(ReturnableConceptTag.class);
078:                //
079:                //
080:                DynamicConceptTagConstraintContext callerDctcc = DynamicConceptTagConstraintContext
081:                        .newInstance(callerCtcon);
082:                callerDctcc.getValidator().filterDirectChildOfRootAndHtml();
083:                //
084:                //callerDctcc.addDefaultValue(
085:                //    GetApplicationAttributeWorkflowTemplateTag.class);
086:
087:                //constrain "method"
088:                ConceptTagConstraint methodCtcon = ConceptTagConstraint
089:                        .newInstance(METHOD_CTCON, rootCtconh);
090:                methodCtcon.setTitle(METHOD_TITLE);
091:                methodCtcon.setShortDescription(METHOD_SHORT_DESCRIPTION);
092:                //
093:                StaticConceptTagConstraintContext methodSctcc = StaticConceptTagConstraintContext
094:                        .newInstance(methodCtcon);
095:                methodSctcc.setRegularExpression("([a-zA-Z][a-zA-Z_0-9]+)");
096:                //
097:                methodSctcc.addDefaultValue("MethodNameHere");
098:                //stc1.setReturnClassExclusions(Void.TYPE);
099:                //TO DO: check if method name goes with object
100:
101:                //constrain "parameter"
102:                ConceptTagConstraint parameterCtcon = ConceptTagConstraint
103:                        .newInstance(PARAMETER_CTCON, rootCtconh);
104:                parameterCtcon.setMinimumLength(0);
105:                parameterCtcon.setLengthUnbounded(true);
106:                parameterCtcon.setTitle(PARAMETER_TITLE);
107:                parameterCtcon.setShortDescription(PARAMETER_SHORT_DESCRIPTION);
108:                //
109:                DynamicConceptTagConstraintContext parameterDctcc = DynamicConceptTagConstraintContext
110:                        .newInstance(parameterCtcon);
111:                parameterDctcc.getValidator()
112:                        .allowReturnOfAnythingExceptNothing();
113:                parameterDctcc.getValidator().filterDirectChildOfRootAndHtml();
114:
115:                //TO DO: check correctness of parameters with method, caller
116:
117:                //
118:                ConceptTagFlagsHelper
119:                        .pushNonIterativeCommonFunctionDepth(inIctc);
120:                inIctc.initialize();
121:                ConceptTagFlagsHelper
122:                        .popNonIterativeCommonFunctionDepth(inIctc);
123:
124:                //initialize characteristic
125:                this .callerCtchar = callerCtcon.getCharacteristic();
126:                this .methodCtchar = methodCtcon.getCharacteristic();
127:                this .parameterCtchar = parameterCtcon.getCharacteristic();
128:
129:            }
130:
131:            public void appraise(AppraiseConceptTagContext inActc) {
132:
133:                if (inActc instanceof  StudioConceptTagInstanceInfoContext) {
134:
135:                    StudioConceptTagInstanceInfoContext sctiic = (StudioConceptTagInstanceInfoContext) inActc;
136:
137:                    sctiic.setInstanceTitle("Call");
138:                    sctiic.setInstanceDescription("Calls a funtion");
139:                } else if (inActc instanceof  StudioConceptTagTypeInfoContext) {
140:
141:                    StudioConceptTagTypeInfoContext scttic = (StudioConceptTagTypeInfoContext) inActc;
142:
143:                    scttic.setTypeTitle("Call");
144:                    scttic.setTypeDescription("Calls a function");
145:                } else if (inActc instanceof  WebPageTagInstanceViewContext) {
146:
147:                    WebPageTagInstanceViewContext wptivc = (WebPageTagInstanceViewContext) inActc;
148:
149:                    WebPageTagInstanceViewContextInfo info = wptivc
150:                            .getInfoAsNonHtml();
151:                    info.setNonHtmlContent("Call - Not Impl");
152:                    //wptivc.getInfo().setStartContent("");
153:                    //wptivc.getInfo().setEndContent("");
154:                } else if (inActc instanceof  SelectionCriteriaForReturnableConceptTag) {
155:
156:                    SelectionCriteriaForReturnableConceptTag scfrct = (SelectionCriteriaForReturnableConceptTag) inActc;
157:
158:                    scfrct.canReturnAnythingIncludingNothing();
159:                    scfrct.declareFormatAsPlain();
160:                } else if (inActc instanceof  StudioConceptTagCreParInfoContext) {
161:
162:                    StudioConceptTagCreParInfoContext scpc = (StudioConceptTagCreParInfoContext) inActc;
163:                }
164:            }
165:
166:            public void determineValueAndClass(
167:                    DetermineValueAndClassConceptTagContext inDvacctc) {
168:
169:                try {
170:
171:                    ValueAndClassForConceptTag vacfct = null;
172:
173:                    //initialize variables
174:                    ValueAndClassForConceptTag objectVac = this .callerCtchar
175:                            .getDetermineValueAndClass(0, inDvacctc);
176:                    Class rClass = objectVac.getValueClass();
177:                    Object rValue = objectVac.getValue();
178:                    String methodName = this .methodCtchar.getValueAsString(0,
179:                            inDvacctc);
180:                    Class pClasses[] = new Class[this .parameterCtchar
181:                            .getValueLength()];
182:                    Object pValues[] = new Object[this .parameterCtchar
183:                            .getValueLength()];
184:                    for (int i = 0; i < this .parameterCtchar.getValueLength(); i++) {
185:                        ValueAndClassForConceptTag nextVac = this .parameterCtchar
186:                                .getDetermineValueAndClass(i, inDvacctc);
187:                        pClasses[i] = nextVac.getValueClass();
188:                        pValues[i] = nextVac.getValue();
189:                    }
190:
191:                    //create method
192:                    Method method = rClass.getMethod(methodName, pClasses);
193:
194:                    //execute method
195:                    Class vacClass = method.getReturnType();
196:                    Object vacObject = method.invoke(rValue, pValues);
197:                    vacfct = ValueAndClassForConceptTag.newInstance(vacObject,
198:                            vacClass);
199:
200:                    inDvacctc.setDetermineValueAndClass(vacfct);
201:                } catch (DetermineValueAndClassConceptTagException dvaccte) {
202:                    inDvacctc.setDetermineException(dvaccte);
203:                } catch (NoSuchMethodException nsme) {
204:                    inDvacctc.setDetermineException(nsme);
205:                } catch (IllegalAccessException iae) {
206:                    inDvacctc.setDetermineException(iae);
207:                } catch (InvocationTargetException ite) {
208:                    inDvacctc.setDetermineException(ite);
209:                }
210:            }
211:
212:            public void determineClass(DetermineClassConceptTagContext inDcctc) {
213:
214:                try {
215:                    //initialize variables
216:                    Class rClass = this .callerCtchar.getDetermineClass(0,
217:                            inDcctc);
218:                    String methodName = this .methodCtchar.getValueAsString(0,
219:                            inDcctc);
220:                    Class pClasses[] = new Class[this .parameterCtchar
221:                            .getValueLength()];
222:                    for (int i = 0; i < this .parameterCtchar.getValueLength(); i++) {
223:                        pClasses[i] = this .parameterCtchar.getDetermineClass(i,
224:                                inDcctc);
225:                    }
226:
227:                    //create method
228:                    Method method = rClass.getMethod(methodName, pClasses);
229:
230:                    //execute method
231:                    inDcctc.setDetermineClass(method.getReturnType());
232:                } catch (DetermineClassConceptTagException dccte) {
233:                    inDcctc.setDetermineException(dccte);
234:                } catch (NoSuchMethodException nsme) {
235:                    inDcctc.setDetermineException(nsme);
236:                }
237:
238:            }
239:
240:            public Object createUninitializedSelf() {
241:                return new CommonFunctionLangCallTag();
242:            }
243:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.