Source Code Cross Referenced for RuleSet.java in  » Portal » Open-Portal » com » sun » portal » rewriter » rom » 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.rom 
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:        package com.sun.portal.rewriter.rom;
006:
007:        import com.sun.portal.rewriter.rom.html.HTMLRules;
008:        import com.sun.portal.rewriter.rom.js.JSRules;
009:        import com.sun.portal.rewriter.rom.xml.XMLRules;
010:        import com.sun.portal.rewriter.util.Debug;
011:        import com.sun.portal.rewriter.util.StringHelper;
012:        import com.sun.portal.rewriter.util.xml.Node;
013:
014:        /**
015:         * Java representation of RuleSet Tag
016:         *
017:         * @version 1.0 12/15/2001
018:         * @author Raja Nagendra Kumar, Nagendra.Raja@sun.com
019:         */
020:        public final class RuleSet extends RecursiveRuleCollection {
021:            //XPath Definations
022:            private static final String XPATH_SPERATOR = "\\";
023:            private static final String XPATH_ROOT = XPATH_SPERATOR
024:                    + XPATH_SPERATOR;
025:            private static final String RULESET_XPATH = XPATH_ROOT + RULESET;
026:            private static final String HTMLRULES_XPATH = RULESET_XPATH
027:                    + XPATH_SPERATOR + HTMLRULES;
028:            private static final String JSRULES_XPATH = RULESET_XPATH
029:                    + XPATH_SPERATOR + JSRULES;
030:            private static final String XMLRULES_XPATH = RULESET_XPATH
031:                    + XPATH_SPERATOR + XMLRULES;
032:
033:            private String cacheRuleSetXML;
034:
035:            private final String id;
036:            private final String parentRuleSetID;
037:            private final RuleSet parentRuleSet;
038:
039:            public RuleSet(final String aID, final RuleCollection[] aCollection)
040:                    throws InvalidXMLException {
041:                this (aID, null, aCollection);
042:            }//constructor
043:
044:            public RuleSet(final String aID, final String aChildRuleSetID,
045:                    final RuleCollection[] aCollection)
046:                    throws InvalidXMLException {
047:                super (RULESET, aCollection);
048:
049:                id = checkID(aID);
050:                parentRuleSetID = StringHelper.normalize(aChildRuleSetID,
051:                        Rule.NONE);
052:
053:                //in data migration getDefault() would be null as component will not be intialized
054:                if (RuleSetManager.getDefault() != null) {
055:                    parentRuleSet = RuleSetManager.getDefault().fetchRuleSet(
056:                            parentRuleSetID);
057:                } else {
058:                    parentRuleSet = null;
059:                }
060:            }//constructor
061:
062:            protected RuleSet(final Node aNode) throws InvalidXMLException {
063:                this (aNode.getAttributeValue(ID), aNode
064:                        .getAttributeValue(EXTENDS), null);
065:
066:                addRuleCollection(new HTMLRules(aNode
067:                        .selectNode(HTMLRULES_XPATH)));
068:                addRuleCollection(new JSRules(aNode.selectNode(JSRULES_XPATH)));
069:                addRuleCollection(new XMLRules(aNode.selectNode(XMLRULES_XPATH)));
070:            }//constructor
071:
072:            /**
073:             * RuleSet ID should be in small case only. This needs to enforced as the
074:             * sub config key is mapped with the ID. IDSAME does not support the case
075:             * sensitive config key.
076:             */
077:            private String checkID(final String aID) throws InvalidXMLException {
078:                String lResult = StringHelper.normalize(aID);
079:                if (!(lResult.toLowerCase().equals(lResult))) {
080:                    throw new InvalidXMLException("ID of Tag "
081:                            + getCollectionID() + " Should be in Small Case",
082:                            null, aID, InvalidXMLException.INVALID_ID);
083:                }
084:
085:                return lResult;
086:            }//setID()
087:
088:            public String getID() {
089:                return id;
090:            }//getID()
091:
092:            public String getParentRuleSetID() {
093:                return parentRuleSetID;
094:            }//getParentRuleSetID()
095:
096:            public RuleSet getParentRuleSet() {
097:                return parentRuleSet;
098:            }//getParentRuleSet()
099:
100:            private HTMLRules htmlRules;
101:            private JSRules jsRules;
102:            private XMLRules xmlRules;
103:
104:            public HTMLRules getHTMLRules() {
105:                if (htmlRules == null) {
106:                    htmlRules = (HTMLRules) getRuleCollection(HTMLRULES);
107:                }
108:
109:                return htmlRules;
110:            }//getHTMLRules()
111:
112:            public JSRules getJSRules() {
113:                if (jsRules == null) {
114:                    jsRules = (JSRules) getRuleCollection(JSRULES);
115:                }
116:
117:                return jsRules;
118:            }//getJSRules()
119:
120:            public XMLRules getXMLRules() {
121:                if (xmlRules == null) {
122:                    xmlRules = (XMLRules) getRuleCollection(XMLRULES);
123:                }
124:
125:                return xmlRules;
126:            }//getXMLRules()
127:
128:            public DataRuleCollection getDataRuleCollection(
129:                    final String aFirstTag, final String aSecondTag) {
130:                final RecursiveRuleCollection lRecursiveRuleCollection = (RecursiveRuleCollection) getRuleCollection(aFirstTag);
131:                return (DataRuleCollection) (lRecursiveRuleCollection
132:                        .getRuleCollection(aSecondTag));
133:            }//getDataRuleCollection()
134:
135:            public final StringBuffer writeCustomAttributes(StringBuffer aBuffer) {
136:                aBuffer.insert(0, XML_HEADER);
137:
138:                aBuffer.append(" ").append(ID).append("=\"").append(getID())
139:                        .append("\"");
140:
141:                if (!parentRuleSetID.equals(Rule.NONE)) {
142:                    aBuffer.append(" ").append(EXTENDS).append("=\"").append(
143:                            parentRuleSetID).append("\"");
144:                }
145:
146:                return aBuffer;
147:            }//writeCustomAttributes()
148:
149:            public String toString() {
150:                if (cacheRuleSetXML == null) {
151:                    cacheRuleSetXML = toXML();
152:                }
153:
154:                return cacheRuleSetXML;
155:            }//toString()
156:
157:            public static void main(String[] args) {
158:                String xmlString = com.sun.portal.rewriter.test.util.SampleRuleObjects.defaultRuleSet
159:                        .toXML();
160:                Debug.println(xmlString);
161:            }//main()
162:        }//class RuleSet
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.