Source Code Cross Referenced for SRAPProcessedProfile.java in  » Portal » Open-Portal » com » sun » portal » rproxy » rewriter » services » 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.rproxy.rewriter.services 
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.rproxy.rewriter.services;
006:
007:        import java.util.HashMap;
008:        import java.util.List;
009:        import java.util.Map;
010:
011:        import com.sun.portal.rewriter.engines.LanguageConstants;
012:        import com.sun.portal.rewriter.util.Constants;
013:        import com.sun.portal.rewriter.util.StringHelper;
014:        import com.sun.portal.rewriter.util.collections.ListMap;
015:        import com.sun.portal.rewriter.util.re.Pattern;
016:
017:        public final class SRAPProcessedProfile {
018:            private static SRAPContext srapContext;
019:
020:            private static URI2RuleSetMap uri2RulesetMAP;
021:
022:            private static ListMap mime2ParserMAP;
023:
024:            private static ListMap uri2ParserMAP;
025:
026:            private static Pattern[] not2RewriteURIPatterns = Pattern.EMPTY_PATTERN_ARRAY;
027:
028:            private static Pattern[] not2ObscureURIPatterns = Pattern.EMPTY_PATTERN_ARRAY;
029:
030:            private static String httpsPort;
031:
032:            private static String httpPort;
033:
034:            public static void init(final SRAPContext aSRAPContext) {
035:                srapContext = aSRAPContext;
036:                uri2RulesetMAP = initURI2RuleSetMap(aSRAPContext
037:                        .readURI2RuleSetMappings());
038:                mime2ParserMAP = initMIME2ParserMap(aSRAPContext
039:                        .readMIME2ParserMappings());
040:                uri2ParserMAP = initURI2ParserMap(aSRAPContext
041:                        .readURI2ParserMappings());
042:                not2RewriteURIPatterns = initURIPatterns(aSRAPContext
043:                        .readNot2RewriteURIList());
044:                not2ObscureURIPatterns = initURIPatterns(aSRAPContext
045:                        .readNot2ObscureURIList());
046:
047:                httpPort = (aSRAPContext.getHTTPPort() == 80) ? "" : ":"
048:                        + aSRAPContext.getHTTPPort();
049:
050:                httpsPort = (aSRAPContext.getHTTPSPort() == 443) ? "" : ":"
051:                        + aSRAPContext.getHTTPSPort();
052:            }// init()
053:
054:            public static String getInstanceName() {
055:                return srapContext.getProfileName();
056:            }// getInstanceName()
057:
058:            public static URI2RuleSetMap getURI2RuleSetMap() {
059:                return uri2RulesetMAP;
060:            }// readURI2RuleSetMappings()
061:
062:            public static ListMap getMIME2ParserMap() {
063:                return mime2ParserMAP;
064:            }// readMIME2ParserMappings()
065:
066:            public static boolean isMIMEGuessingEnabled() {
067:                return srapContext.isMIMEGuessingEnabled();
068:            }// isMIMEGuessingEnabled()
069:
070:            public static ListMap getURI2ParserMAP() {
071:                return uri2ParserMAP;
072:            }// getURI2ParserMAP()
073:
074:            public static Pattern[] getNot2RewriteURIPatterns() {
075:                return not2RewriteURIPatterns;
076:            }// getNot2RewriteURIPatterns()
077:
078:            public static boolean isObscureURIs() {
079:                return srapContext.isURLObfuscationEnabled();
080:            }// isObscureURIs()
081:
082:            public static String getObfuscatorSeed() {
083:                return srapContext.readObfuscatorSeed();
084:            }// getObfuscatorSeed()
085:
086:            public static Pattern[] getNot2ObscureURIPatterns() {
087:                return not2ObscureURIPatterns;
088:            }// getNot2ObscureURIPatterns()
089:
090:            public static boolean isUseConsistantProtocol4Gateway() {
091:                return srapContext.isUseConsistantProtocol4Gateway();
092:            }// isUseConsistantProtocol4Gateway()
093:
094:            private static URI2RuleSetMap initURI2RuleSetMap(List aRuleSetMap) {
095:                return new URI2RuleSetMap(aRuleSetMap);
096:            }// initURI2RuleSetMap()
097:
098:            private static ListMap initMIME2ParserMap(List aMappingInfo) {
099:                return parserMapHelper(aMappingInfo, new CustomProcess() {
100:                    public Object processKey(Object aObject) {
101:                        return aObject.toString().toLowerCase();
102:                    }
103:                });
104:            }// initMIME2ParserMap()
105:
106:            private static ListMap initURI2ParserMap(List aMappingInfo) {
107:                return parserMapHelper(aMappingInfo, new CustomProcess() {
108:                    public Object processKey(Object aObject) {
109:                        return new Pattern(aObject.toString(), true);
110:                    }
111:                });
112:            }// initURI2ParserMap()
113:
114:            private static Pattern[] initURIPatterns(List aList) {
115:                return Pattern.convert2Patterns((String[]) aList
116:                        .toArray(Constants.EMPTY_STRING_ARRAY), true);
117:            }// initURIPatterns()
118:
119:            private static ListMap parserMapHelper(List aMappingInfo,
120:                    CustomProcess aCustomProcess) {
121:                final Map supportedContentTypes = new HashMap();
122:                supportedContentTypes.put("html", LanguageConstants.HTML_MIME);
123:                supportedContentTypes.put("javascript",
124:                        LanguageConstants.JS_MIME);
125:                supportedContentTypes.put("java_script",
126:                        LanguageConstants.JS_MIME);
127:                supportedContentTypes.put("xml", LanguageConstants.XML_MIME);
128:                // BugNo:4781754
129:                supportedContentTypes.put("css", LanguageConstants.CSS_MIME);
130:
131:                final ListMap lMap = new ListMap();
132:                for (int j = 0; j < aMappingInfo.size(); j++) {
133:                    String line = StringHelper.normalize(
134:                            (String) aMappingInfo.get(j)).toString();
135:                    String[] splited = StringHelper.tokenize(line, "=");
136:
137:                    // ignore all other lines i.e which does not have length 2
138:                    if (splited.length == 2) {
139:                        String key = splited[0].trim();
140:                        // check if the parser exists for this key by getting the
141:                        // parser MIME
142:                        Object parserMIME = supportedContentTypes.get(key
143:                                .toLowerCase());
144:                        if (parserMIME != null) {
145:                            String[] values = StringHelper.tokenize(splited[1],
146:                                    ";:|");
147:                            for (int i = 0; i < values.length; i++) {
148:                                String value = values[i].trim();
149:                                if (value.length() != 0) {
150:                                    // make value as key and parser mime as value
151:                                    // i need to know the paser mime based on content
152:                                    // MIME
153:                                    lMap.put(aCustomProcess.processKey(value),
154:                                            parserMIME);
155:                                }
156:                            }
157:                        } else {
158:                            System.out.println("No Rewriter Available for key:"
159:                                    + key);
160:                        }
161:                    } else {
162:                        System.out.println("Illegal List Content:" + line);
163:                    }
164:                }// for loop
165:
166:                return lMap;
167:            }// parserMapHelper()
168:
169:            public static String getHTTPPort() {
170:                return httpPort;
171:            }// getHTTPPort()
172:
173:            public static String getHTTPSPort() {
174:                return httpsPort;
175:            }// getHTTPSPort()
176:
177:            private static interface CustomProcess {
178:                Object processKey(Object aObject);
179:
180:                // Object processValue( Object aObject );
181:            }// interface CustomProcess
182:
183:        }// class SRAPProcessedProfile
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.