01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter;
06:
07: import com.sun.portal.rewriter.util.ConfigManager;
08: import com.sun.portal.rewriter.util.StringHelper;
09:
10: /**
11: * Provides helper method which are required for implementing JSFunctionSpec interface.
12: */
13: public abstract class AbstractJSFunctionSpec implements JSFunctionSpec {
14: public static final String INSERT_EXPRESSION_FUNCTION_NAME_PATTERN = "$CONVERT_EXPRESSION$";
15: public static final String INSERT_SYSTEM_FUNCTION_NAME_PATTERN = "$CONVERT_SYSTEM$";
16:
17: public static final String INSERT_PAGE_NETWORK_URI_PATTERN = "$INSERT_PAGE_NETWORK_URI$";
18: public static final String INSERT_PAGE_BASE_URI_PATTERN = "$INSERT_PAGE_BASE_URI$";
19:
20: protected static final String CONVERT_EXPRESSION_FUNCTION_NAME = ConfigManager
21: .getModulePrefixID()
22: + "_convert_expression";
23:
24: protected static String CONVERT_SYSTEM_FUNCTION_NAME = ConfigManager
25: .getModulePrefixID()
26: + "_convert_system";
27:
28: protected final String expressionFunctionDefinition;
29: protected final String systemFunctionDefinition;
30: protected final String allFunctionsDefinition;
31:
32: protected AbstractJSFunctionSpec(final String aJSUtilsDef,
33: final String aExpressionDef, final String aSystemDef) {
34: String jsUtilsDefinition = aJSUtilsDef;
35: String expressionDefinition = StringHelper.searchAndReplace(
36: aExpressionDef,
37: INSERT_EXPRESSION_FUNCTION_NAME_PATTERN,
38: CONVERT_EXPRESSION_FUNCTION_NAME);
39:
40: String systemDefinition = StringHelper.searchAndReplace(
41: aSystemDef, INSERT_SYSTEM_FUNCTION_NAME_PATTERN,
42: CONVERT_SYSTEM_FUNCTION_NAME);
43:
44: expressionFunctionDefinition = jsUtilsDefinition + "\n\n"
45: + expressionDefinition;
46:
47: systemFunctionDefinition = jsUtilsDefinition + "\n\n"
48: + systemDefinition;
49:
50: allFunctionsDefinition = expressionFunctionDefinition + "\n\n"
51: + systemDefinition;
52: }//constructor
53:
54: public String getExpressionFunctionName() {
55: return CONVERT_EXPRESSION_FUNCTION_NAME;
56: }//getExpressionFunctionDefination()
57:
58: public String getSystemFunctionName() {
59: //BugNo:4770669
60: return CONVERT_SYSTEM_FUNCTION_NAME;
61: }//getSystemFunctionName()
62:
63: }//class AbstractJSFunctionSpec
|