Source Code Cross Referenced for WebPageTagMacroHelper.java in  » Workflow-Engines » JFolder » org » jfolder » common » files » 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.files 
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.files;
009:
010:        //base classes
011:        import java.util.ArrayList;
012:        import java.util.StringTokenizer;
013:
014:        //project specific classes
015:        import org.jfolder.common.utils.misc.CommonSeparators;
016:
017:        //other classes
018:
019:        public class WebPageTagMacroHelper {
020:
021:            public final static String getMacroDisplayName(String inWebPage,
022:                    WebPageTagMacro inWptm) {
023:                //
024:                StringBuffer outValue = new StringBuffer();
025:
026:                outValue.append(inWptm.getResultType());
027:                outValue.append(" ");
028:                outValue.append(inWptm.getName());
029:                outValue.append("(");
030:                for (int i = 0; i < inWptm.getParameterCount(); i++) {
031:                    if (i > 0) {
032:                        outValue.append(", ");
033:                    }
034:                    outValue.append(inWptm.getParameterType(i));
035:                    outValue.append(" ");
036:                    outValue.append(inWptm.getParameterName(i));
037:                }
038:                outValue.append(")");
039:                //
040:                //
041:                //
042:                outValue.append("   (");
043:                outValue.append(inWebPage);
044:                outValue.append(")");
045:
046:                return outValue.toString();
047:            }
048:
049:            public final static String getMacroHandle(String inWebPage,
050:                    WebPageTagMacro inWptm) {
051:                //
052:                StringBuffer outValue = new StringBuffer();
053:
054:                outValue.append(CommonSeparators.BRANCH_SEPARATOR);
055:                outValue.append(inWebPage);
056:                outValue.append(CommonSeparators.BRANCH_SEPARATOR);
057:                outValue.append(representMacroAsString(inWptm));
058:
059:                return outValue.toString();
060:            }
061:
062:            public final static SimpleWebPageTagMacroSet getMacroSet(
063:                    VirtualFileSystemHolder inVfsh, String inProp) {
064:                //
065:                SimpleWebPageTagMacroSet outValue = SimpleWebPageTagMacroSet
066:                        .newInstance();
067:
068:                //
069:                getMacroSet(VirtualFileSystemHolder.DIRECTORY_SEPARATOR,
070:                        inVfsh, outValue, inProp);
071:
072:                return outValue;
073:            }
074:
075:            //
076:            private final static void getMacroSet(String inWebDir,
077:                    VirtualFileSystemHolder inVfsh,
078:                    SimpleWebPageTagMacroSet inSwptms, String inProp) {
079:                //
080:
081:                //
082:                ArrayList localDirs = inVfsh.getLocalDirectories();
083:                for (int i = 0; i < localDirs.size(); i++) {
084:                    VirtualFileSystemDirectory nextVfsd = ((VirtualFileSystemDirectory) localDirs
085:                            .get(i));
086:                    String subWebDir = inWebDir + nextVfsd.getName()
087:                            + VirtualFileSystemHolder.DIRECTORY_SEPARATOR;
088:                    getMacroSet(subWebDir, nextVfsd, inSwptms, inProp);
089:                }
090:
091:                //
092:                ArrayList localFiles = inVfsh.getLocalFiles();
093:                for (int i = 0; i < localFiles.size(); i++) {
094:                    VirtualFileSystemFile nextVfsf = ((VirtualFileSystemFile) localFiles
095:                            .get(i));
096:                    String subWebFile = inWebDir + nextVfsf.getName();
097:                    //
098:                    SimpleVirtualFileSystemProperties nextVfsp = SimpleVirtualFileSystemProperties
099:                            .newInstance(nextVfsf.getContent());
100:                    //
101:
102:                    if (nextVfsp.isPropertyPresent(inProp)) {
103:                        String nextMacroToken = nextVfsp
104:                                .getPropertyValue(inProp);
105:                        //
106:                        getMacroSet(inSwptms, nextMacroToken, subWebFile);
107:                    }
108:                }
109:            }
110:
111:            private final static void getMacroSet(
112:                    SimpleWebPageTagMacroSet inSwptms, String inToken,
113:                    String inWebPage) {
114:                //
115:                StringTokenizer st = new StringTokenizer(inToken,
116:                        CommonSeparators.HANDLE_SEPARATOR);
117:
118:                while (st.hasMoreTokens()) {
119:                    String nextToken = st.nextToken();
120:                    WebPageTagMacro nextWptm = getMacroFromString(nextToken);
121:                    inSwptms.addMacro(inWebPage, nextWptm);
122:                }
123:            }
124:
125:            //
126:            //
127:            //
128:            public final static String getWebPageFromMacroHandle(String inHandle) {
129:
130:                String outValue = null;
131:
132:                String webPage[] = new String[1];
133:                String macroHandle[] = new String[1];
134:                parseMacroHandleWithWebPage(inHandle, webPage, macroHandle);
135:
136:                outValue = webPage[0];
137:
138:                return outValue;
139:            }
140:
141:            public final static WebPageTagMacro getMacroFromMacroHandle(
142:                    String inHandle) {
143:                //
144:
145:                WebPageTagMacro outValue = null;
146:
147:                String webPage[] = new String[1];
148:                String macroHandle[] = new String[1];
149:                parseMacroHandleWithWebPage(inHandle, webPage, macroHandle);
150:
151:                outValue = getMacroFromString(macroHandle[0]);
152:
153:                return outValue;
154:            }
155:
156:            private final static void parseMacroHandleWithWebPage(
157:                    String inFullHandle, String inWebPage[],
158:                    String inMacroHandle[]) {
159:                //
160:                int delimiterLength = CommonSeparators.BRANCH_SEPARATOR
161:                        .length();
162:                int firstDelimiter = inFullHandle
163:                        .indexOf(CommonSeparators.BRANCH_SEPARATOR);
164:                int secondDelimiter = inFullHandle.indexOf(
165:                        CommonSeparators.BRANCH_SEPARATOR, firstDelimiter
166:                                + delimiterLength);
167:                //
168:                inWebPage[0] = inFullHandle.substring(firstDelimiter
169:                        + delimiterLength, secondDelimiter);
170:                //
171:                inMacroHandle[0] = inFullHandle.substring(secondDelimiter
172:                        + delimiterLength);
173:            }
174:
175:            //
176:            public final static String representMacroGroupAsString(
177:                    WebPageTagMacroGroup inWptmg) {
178:                //
179:                StringBuffer outValue = new StringBuffer();
180:
181:                int icount = inWptmg.getValidAndInvalidSignatureLength();
182:                for (int i = 0; i < icount; i++) {
183:                    if (inWptmg.isSignatureValid(i)) {
184:                        //
185:                        WebPageTagMacro nextMacro = inWptmg.getMacro(i);
186:                        //
187:                        outValue.append(CommonSeparators.HANDLE_SEPARATOR);
188:                        outValue.append(representMacroAsString(nextMacro));
189:                        outValue.append(CommonSeparators.HANDLE_SEPARATOR);
190:                        //
191:                        //
192:                        //
193:                    }
194:                }
195:
196:                return outValue.toString();
197:            }
198:
199:            public final static String representMacroAsString(
200:                    WebPageTagMacro inWptm) {
201:                //
202:                StringBuffer outValue = new StringBuffer();
203:                //
204:                getValueAsToken(outValue, inWptm.getResultType());
205:                getValueAsToken(outValue, inWptm.getName());
206:                for (int j = 0; j < inWptm.getParameterCount(); j++) {
207:                    getValueAsToken(outValue, inWptm.getParameterName(j));
208:                    getValueAsToken(outValue, inWptm.getParameterType(j));
209:                }
210:                //
211:                return outValue.toString();
212:            }
213:
214:            private final static void getValueAsToken(StringBuffer inSb,
215:                    String inValue) {
216:                //
217:                inSb.append(CommonSeparators.BRANCH_SEPARATOR);
218:                inSb.append(inValue);
219:                inSb.append(CommonSeparators.BRANCH_SEPARATOR);
220:            }
221:
222:            //
223:            public final static WebPageTagMacro getMacroFromString(
224:                    String inValue) {
225:
226:                SimpleWebPageTagMacro outValue = null;
227:
228:                ArrayList parts = new ArrayList();
229:
230:                StringTokenizer st = new StringTokenizer(inValue,
231:                        CommonSeparators.BRANCH_SEPARATOR);
232:                while (st.hasMoreTokens()) {
233:                    String nextToken = st.nextToken();
234:                    if (nextToken.length() > 0) {
235:                        parts.add(nextToken);
236:                    }
237:                }
238:
239:                //
240:                String resultType = ((String) parts.get(0));
241:                String macroName = ((String) parts.get(1));
242:
243:                ArrayList paramNames = new ArrayList();
244:                ArrayList paramTypes = new ArrayList();
245:                for (int i = 2; i < parts.size(); i = i + 2) {
246:                    String nextParamName = ((String) parts.get(i));
247:                    String nextParamType = ((String) parts.get(i + 1));
248:                    //
249:                    paramNames.add(nextParamName);
250:                    paramTypes.add(nextParamType);
251:                }
252:
253:                outValue = SimpleWebPageTagMacro.newInstance(macroName,
254:                        resultType, paramNames, paramTypes);
255:
256:                return outValue;
257:            }
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.