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;
006:
007: import java.util.Properties;
008:
009: import com.sun.portal.rewriter.RewriterModule;
010: import com.sun.portal.rewriter.services.DataService;
011: import com.sun.portal.rewriter.services.DataServiceHelper;
012: import com.sun.portal.rewriter.util.ConfigManager;
013: import com.sun.portal.rewriter.util.Constants;
014: import com.sun.portal.rewriter.util.StringHelper;
015: import com.sun.portal.rewriter.util.crypto.CryptoHelper;
016: import com.sun.portal.rproxy.rewriter.services.SRAPProcessedProfile;
017: import com.sun.portal.rproxy.rewriter.services.file.SRAPFileContext;
018: import com.sun.portal.rproxy.rewriter.services.idsame.SRAPIDSAMEContext;
019:
020: public class SRAPRewriterModule {
021: public static final String RESOURCE_CONVERT_EXPRESSTION_FUNCTION_LOCATION = RewriterModule.RESOURCE_HOME
022: + "/SRAPConvertExpression.js";
023:
024: public static final String RESOURCE_CONVERT_SYSTEM_FUNCTION_LOCATION = RewriterModule.RESOURCE_HOME
025: + "/SRAPConvertSystem.js";
026:
027: public static final String RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION = RewriterModule.RESOURCE_HOME
028: + "/SRAPRewriterModule.properties";
029:
030: public static final String RESOURCE_DEFAULT_GATEWAY_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
031: + "/DefaultGatewayRuleSet.xml";
032:
033: public static final String DEFAULT_GATEWAY_RULESET_ID = "default_gateway_ruleset";
034:
035: public static final String RESOURCE_I_NOTES_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
036: + "/iNotesRuleSet.xml";
037:
038: public static final String I_NOTES_RULESET_ID = "inotes_ruleset";
039:
040: // Bug#4830343
041: public static final String RESOURCE_IPLANET_MAIL_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
042: + "/IPlanetMailExpressRuleset.xml";
043:
044: public static final String IPLANET_MAIL_RULESET_ID = "iplanet_mail_ruleset";
045:
046: public static final String RESOURCE_OWA_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
047: + "/OWASP3RuleSet.xml";
048:
049: public static final String RESOURCE_OWA_2003_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
050: + "/OWA2003RuleSet.xml";
051:
052: public static final String RESOURCE_SAP_PORTAL_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
053: + "/SAPPortalRuleSet.xml";
054:
055: public static final String OWA_RULESET_ID = "exchange_2000sp3_owa_ruleset";
056:
057: public static final String OWA_2003_RULESET_ID = "exchange_2003_owa_ruleset";
058:
059: public static final String SAP_PORTAL_RULESET_ID = "sap_portal_ruleset";
060:
061: public static final String RESOURCE_WML_RULESET_LOCATION = RewriterModule.RESOURCE_HOME
062: + "/WMLRuleSet.xml";
063:
064: public static final String WML_RULESET_ID = "wml_ruleset";
065:
066: public static final String[][] SRAP_RULESET_SPEC = {
067: { RESOURCE_DEFAULT_GATEWAY_RULESET_LOCATION,
068: DEFAULT_GATEWAY_RULESET_ID },
069: { RESOURCE_I_NOTES_RULESET_LOCATION, I_NOTES_RULESET_ID },
070: { RESOURCE_OWA_RULESET_LOCATION, OWA_RULESET_ID },
071: { RESOURCE_OWA_2003_RULESET_LOCATION, OWA_2003_RULESET_ID },
072: { RESOURCE_SAP_PORTAL_RULESET_LOCATION,
073: SAP_PORTAL_RULESET_ID },
074: { RESOURCE_IPLANET_MAIL_RULESET_LOCATION,
075: IPLANET_MAIL_RULESET_ID }, // BugNo:4830343
076: { RESOURCE_WML_RULESET_LOCATION, WML_RULESET_ID } };
077:
078: private static Properties getSRAPIDSAMEProps() {
079: Properties rewriterProps = new Properties();
080: rewriterProps.setProperty(Constants.PROPERTY_DATA_SOURCE_TYPE,
081: DataService.CUSTOM);
082: rewriterProps
083: .setProperty(
084: DataService.PROPERTY_CUSTOM_DATA_SERVICE_IMPLEMENTOR,
085: "com.sun.portal.rproxy.rewriter.services.idsame.IDSAMEDataServiceStub");
086: return rewriterProps;
087: }// getSRAPRewriterProps()
088:
089: public static Properties getConfigProps() {
090: // need to give unique instance name to each debug file
091: Properties p = ConfigManager
092: .readProps(RESOURCE_REWRITER_MODULE_PROPERTIES_LOCATION);
093: String s = p.getProperty(Constants.PROPERTY_MODULE_ID);
094: String[] l = StringHelper.tokenize(s, "|", true, 2);
095: p.setProperty(Constants.PROPERTY_MODULE_ID, l[0] + "|"
096: + SRAPProcessedProfile.getInstanceName());
097: p.setProperty(CryptoHelper.PROPERTY_SECRET_KEY,
098: SRAPProcessedProfile.getObfuscatorSeed());
099: return p;
100: }// getConfigProps()
101:
102: public static synchronized void initIDSAME() // BugNo:4895102
103: {
104: SRAPProcessedProfile.init(SRAPIDSAMEContext.defaultContext);
105: // initialize the Rewriter component, so that Debug is available to
106: // during Yahoo intialization
107: RewriterModule.init(getSRAPIDSAMEProps(), getConfigProps(),
108: null);
109: // intitialize yahoo in IDAMSE Context
110: // BugNo:4889146
111: // YahooConfigManager.init();
112: }// initIDSAME()
113:
114: public static void initFile() {
115: SRAPProcessedProfile.init(SRAPFileContext.defaultContext);
116: RewriterModule.init(DataServiceHelper.getDefaultFileProps(),
117: getConfigProps(), null);
118: }// initFile()
119:
120: }// Inteface SRAPRewriterModule
|