01: package com.bostechcorp.cbesb.common.util.macro;
02:
03: import java.io.InputStream;
04:
05: import com.bostechcorp.cbesb.common.util.EsbPathHelper;
06: import com.bostechcorp.cbesb.common.util.project.ProjectRuntimeUtil;
07:
08: public class BuiltinMacroResolverImpl implements IMacroResolver {
09: private String projectName = null;
10:
11: public BuiltinMacroResolverImpl(String projectName) {
12:
13: this .projectName = projectName;
14: }
15:
16: public boolean addMacro(String name, String value) {
17: return true;
18: }
19:
20: public void loadMacro(InputStream macroFile) {
21:
22: }
23:
24: public String resolveMacro(String macroStr, String originalStr) {
25: if (macroStr.equalsIgnoreCase(MacroUtil.BUILTIN_CBESB_HOME)) {
26: return EsbPathHelper.getCbesbHomeDir();
27: } else if (macroStr
28: .equalsIgnoreCase(MacroUtil.BUILTIN_CBESB_IDEWS)) {
29: return EsbPathHelper.getCbesbUiWorkSpace();
30: } else if (macroStr
31: .equalsIgnoreCase(MacroUtil.BUILTIN_CBESB_JBI_SA_PROJ)) {
32: return this .projectName;
33: } else if (macroStr
34: .equalsIgnoreCase(MacroUtil.BUILTIN_CBESB_ESB_PROJ)) {
35: if (ProjectRuntimeUtil.isESBProj(this .projectName)) {
36: return this .projectName;
37: } else {
38: if (originalStr.contains("::")) {
39: return this .projectName
40: + "::"
41: + ProjectRuntimeUtil
42: .getDependentESBProjName(this .projectName);
43: } else {
44: return ProjectRuntimeUtil
45: .getDependentESBProjName(this .projectName);
46: }
47: }
48: }
49:
50: return null;
51: }
52:
53: /* (non-Javadoc)
54: * @see com.bostechcorp.cbesb.common.util.macro.IMacroResolver#clearMacro()
55: */
56: public void clearMacro() {
57:
58: }
59:
60: }
|