1 17 18 package org.pentaho.core.system; 19 20 import java.io.File ; 21 import java.util.*; 22 23 public class StandaloneApplicationContext implements IApplicationContext { 24 25 private String solutionRootPath; 26 27 private String baseUrl; 28 29 private String applicationPath; 30 31 private Properties properties = new Properties(); 32 33 private List entryPointsList = new ArrayList(); 34 private List exitPointsList = new ArrayList(); 35 36 37 public StandaloneApplicationContext(String solutionRootPath, String applicationPath) { 38 this.solutionRootPath = solutionRootPath; 39 this.applicationPath = applicationPath; 40 baseUrl = null; 41 } 42 43 public void setBaseUrl(String baseUrl) { 44 this.baseUrl = baseUrl; 45 } 46 47 public String getFileOutputPath(String path) { 48 return solutionRootPath + File.separator + path; 49 } 50 51 public String getSolutionPath(String path) { 52 return solutionRootPath + File.separator + path; 53 } 54 55 60 public String getPentahoServerName() { 61 return ""; } 63 64 69 public int getServerPort() { 70 return 0; 72 } 73 74 public String getBaseUrl() { 75 return baseUrl; 76 } 77 78 public String getApplicationPath(String path) { 79 return applicationPath + File.separator + path; 80 } 81 82 public String getProperty(String key) { 83 return properties.getProperty(key); 84 } 85 86 public String getProperty(String key, String defaultValue) { 87 return properties.getProperty(key, defaultValue); 88 } 89 90 protected void setProperties(Properties props) { 91 properties = props; 92 } 93 94 public void addEntryPointHandler(IPentahoSystemEntryPoint entryPoint) { 95 entryPointsList.add(entryPoint); 96 } 97 98 public void removeEntryPointHandler(IPentahoSystemEntryPoint entryPoint) { 99 entryPointsList.remove(entryPoint); 100 } 101 102 public void addExitPointHandler(IPentahoSystemExitPoint exitPoint) { 103 exitPointsList.add(exitPoint); 104 } 105 106 public void removeExitPointHandler(IPentahoSystemExitPoint exitPoint) { 107 exitPointsList.remove(exitPoint); 108 } 109 110 public void invokeEntryPoints() { 111 for (int i=0; i<entryPointsList.size(); i++) { 112 ((IPentahoSystemEntryPoint)entryPointsList.get(i)).systemEntryPoint(); 113 } 114 } 115 116 public void invokeExitPoints() { 117 for (int i=0; i<exitPointsList.size(); i++) { 118 ((IPentahoSystemExitPoint)entryPointsList.get(i)).systemExitPoint(); 119 } 120 } 121 122 123 } 124 | Popular Tags |