Source Code Cross Referenced for IDSRuleCollectionBuilder.java in  » Portal » Open-Portal » com » sun » portal » rewriter » services » ids » 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 » Portal » Open Portal » com.sun.portal.rewriter.services.ids 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
003:         * PROPRIETARY/CONFIDENTIAL.  Use of this product is subject to license terms.
004:         */
005:
006:        package com.sun.portal.rewriter.services.ids;
007:
008:        import com.sun.portal.rewriter.rom.DataRule;
009:        import com.sun.portal.rewriter.rom.DataRuleCollection;
010:        import com.sun.portal.rewriter.rom.Rule;
011:        import com.sun.portal.rewriter.rom.common.Attribute;
012:        import com.sun.portal.rewriter.rom.common.AttributeRule;
013:        import com.sun.portal.rewriter.rom.js.Variable;
014:        import com.sun.portal.rewriter.rom.js.VariableRule;
015:
016:        import java.util.ArrayList;
017:        import java.util.Arrays;
018:        import java.util.List;
019:
020:        final class IDSRuleCollectionBuilder {
021:            static DataRuleCollection getHTMLAppletRuleCollection(
022:                    final DataSource aDataSource) {
023:                final String[] appletStrings = aDataSource.getHTMLAppletData();
024:                final ArrayList list = new ArrayList(appletStrings.length);
025:                for (int i = 0; i < appletStrings.length; i++) {
026:                    DataRule applet = IDSRuleBuilder
027:                            .buildAppletRule(appletStrings[i]);
028:                    list.add(applet);
029:                }
030:                final DataRule[] appletRules = (DataRule[]) list
031:                        .toArray(new DataRule[0]);
032:                return new DataRuleCollection(Rule.APPLET, appletRules);
033:            }//createAppletRules()
034:
035:            static DataRuleCollection getHTMLFormRuleCollection(
036:                    final DataSource aDataSource) {
037:                final String[] formStrings = aDataSource.getHTMLFormData();
038:                final ArrayList list = new ArrayList(formStrings.length);
039:                for (int i = 0; i < formStrings.length; i++) {
040:                    DataRule formRule = IDSRuleBuilder
041:                            .buildFormRule(formStrings[i]);
042:                    list.add(formRule);
043:                }
044:                final DataRule[] formRules = (DataRule[]) list
045:                        .toArray(new DataRule[0]);
046:                return new DataRuleCollection(Rule.FORM, formRules);
047:            }//getHTMLFormRuleCollection()
048:
049:            static DataRuleCollection getHTMLAttributeRuleCollection(
050:                    DataSource aDataSource) {
051:
052:                String[] attrStrings = aDataSource.getHTMLAttributeData();
053:
054:                ArrayList list = new ArrayList(attrStrings.length);
055:                for (int i = 0; i < attrStrings.length; i++) {
056:                    DataRule attr = IDSRuleBuilder
057:                            .buildAttributeRule(attrStrings[i]);
058:                    list.add(attr);
059:                }
060:
061:                list.addAll(getHTMLJSTokenRules(aDataSource));
062:                DataRule[] attrRules = (DataRule[]) list
063:                        .toArray(new DataRule[0]);
064:                return new DataRuleCollection(Rule.ATTRIBUTE, attrRules);
065:            }
066:
067:            private static List getHTMLJSTokenRules(final DataSource aDataSource) {
068:                final String[] jsTokens = aDataSource.getHTMLJSTokenData();
069:                final List lList = new ArrayList();
070:                for (int i = 0; i < jsTokens.length; i++) {
071:                    lList.add(new AttributeRule(new Attribute(jsTokens[i],
072:                            null, null, Rule.DJS, null)));
073:                }
074:
075:                return lList;
076:            }//getHTMLJSTokenRules()
077:
078:            //Variables
079:            static DataRuleCollection getJSVariableRuleCollection(
080:                    final DataSource aDataSource) {
081:                final List allVariables = new ArrayList();
082:
083:                {
084:                    final List urlDataRules = Arrays.asList(buildVariables(
085:                            aDataSource.getJSURLVariablesData(), Rule.URL));
086:                    allVariables.addAll(urlDataRules);
087:                }
088:
089:                {
090:                    final List expressionDataRules = Arrays
091:                            .asList(buildVariables(aDataSource
092:                                    .getJSExpressionVariablesData(),
093:                                    Rule.EXPRESSION));
094:                    allVariables.addAll(expressionDataRules);
095:                }
096:
097:                {
098:                    final List dhtmlDataRules = Arrays.asList(buildVariables(
099:                            aDataSource.getJSDHTMLVariablesData(), Rule.DHTML));
100:                    allVariables.addAll(dhtmlDataRules);
101:                }
102:
103:                {
104:                    final List djsDataRules = Arrays.asList(buildVariables(
105:                            aDataSource.getJSDJSVariablesData(), Rule.DJS));
106:                    allVariables.addAll(djsDataRules);
107:                }
108:
109:                {
110:                    final List systemDataRules = Arrays
111:                            .asList(buildVariables(aDataSource
112:                                    .getJSSystemVariablesData(), Rule.SYSTEM));
113:                    allVariables.addAll(systemDataRules);
114:                }
115:
116:                final DataRule[] allRules = (DataRule[]) allVariables
117:                        .toArray(new DataRule[0]);
118:                return new DataRuleCollection(Rule.VARIABLE, allRules);
119:            }//getJSVariableRuleCollection()
120:
121:            //Function
122:            static DataRuleCollection getJSFunctionRuleCollection(
123:                    final DataSource aDataSource) {
124:                final List allFunctions = new ArrayList();
125:
126:                {
127:                    final List urlDataRules = Arrays.asList(buildFunctions(
128:                            aDataSource.getJSURLFunctionData(), Rule.URL));
129:                    allFunctions.addAll(urlDataRules);
130:                }
131:
132:                {
133:                    final List expressionDataRules = Arrays
134:                            .asList(buildFunctions(aDataSource
135:                                    .getJSExpressionFunctionData(),
136:                                    Rule.EXPRESSION));
137:                    allFunctions.addAll(expressionDataRules);
138:
139:                }
140:
141:                {
142:                    final List dhtmlDataRules = Arrays.asList(buildFunctions(
143:                            aDataSource.getJSDHTMLFunctionData(), Rule.DHTML));
144:                    allFunctions.addAll(dhtmlDataRules);
145:                }
146:
147:                {
148:                    final List djsDataRules = Arrays.asList(buildFunctions(
149:                            aDataSource.getJSDJSFunctionData(), Rule.DJS));
150:                    allFunctions.addAll(djsDataRules);
151:                }
152:
153:                final DataRule[] allRules = (DataRule[]) allFunctions
154:                        .toArray(new DataRule[0]);
155:                return new DataRuleCollection(Rule.FUNCTION, allRules);
156:            }//getJSFunctionRuleCollection()
157:
158:            private static DataRule[] buildVariables(final String[] variables,
159:                    final String type) {
160:                final ArrayList list = new ArrayList(variables.length);
161:                for (int i = 0; i < variables.length; i++) {
162:                    DataRule dataRule = new VariableRule(new Variable(
163:                            variables[i], type, null));
164:                    list.add(dataRule);
165:                }
166:                return (DataRule[]) list.toArray(new DataRule[0]);
167:            }//buildVariables()
168:
169:            private static DataRule[] buildFunctions(final String[] variables,
170:                    final String type) {
171:                final ArrayList list = new ArrayList(variables.length);
172:                for (int i = 0; i < variables.length; i++) {
173:                    DataRule dataRule = IDSRuleBuilder.buildFunctionRule(
174:                            variables[i], type);
175:                    list.add(dataRule);
176:                }
177:                return (DataRule[]) list.toArray(new DataRule[0]);
178:            }//buildFunctions()
179:
180:            static DataRuleCollection getXMLAttributeRuleCollection(
181:                    DataSource aDataSource) {
182:                int length = 0;
183:                String[] xmlAttrs = aDataSource.getXMLAttributeData();
184:                if (xmlAttrs != null) {
185:                    length = xmlAttrs.length;
186:                }
187:
188:                List list = new ArrayList(length);
189:                for (int i = 0; i < length; i++) {
190:                    DataRule xAttr = IDSRuleBuilder
191:                            .buildAttributeRule(xmlAttrs[i]);
192:                    list.add(xAttr);
193:                }
194:
195:                DataRule[] dataRules = (DataRule[]) list
196:                        .toArray(new DataRule[0]);
197:                return new DataRuleCollection(Rule.ATTRIBUTE, dataRules);
198:            }//getXMLAttributeRuleCollection()
199:
200:            static DataRuleCollection getXMLTagTextRuleCollection(
201:                    DataSource aDataSource) {
202:                int length = 0;
203:                String[] xmlTS = aDataSource.getXMLTagTextData();
204:
205:                if (xmlTS != null) {
206:                    length = xmlTS.length;
207:                }
208:
209:                List list = new ArrayList(length);
210:                for (int i = 0; i < length; i++) {
211:                    DataRule xTS = IDSRuleBuilder.buildTagTextRule(xmlTS[i]);
212:                    list.add(xTS);
213:                }
214:
215:                DataRule[] dataRules = (DataRule[]) list
216:                        .toArray(new DataRule[0]);
217:                return new DataRuleCollection(Rule.TAGTEXT, dataRules);
218:            }//getXMLTagTextRuleCollection()
219:
220:        }//class IDSRuleCollectionBuilder
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.