1 64 65 package com.jcorporate.expresso.services.controller; 66 67 import com.jcorporate.expresso.core.controller.ControllerException; 68 import com.jcorporate.expresso.core.controller.ControllerRequest; 69 import com.jcorporate.expresso.core.controller.ControllerResponse; 70 import com.jcorporate.expresso.core.controller.Input; 71 import com.jcorporate.expresso.core.controller.SecureIfSetController; 72 import com.jcorporate.expresso.core.controller.State; 73 import com.jcorporate.expresso.core.controller.Transition; 74 import com.jcorporate.expresso.kernel.DefaultContainerImpl; 75 import com.jcorporate.expresso.kernel.RootContainer; 76 import com.jcorporate.expresso.kernel.SystemFactory; 77 import com.jcorporate.expresso.kernel.digester.ComponentMetadataConfig; 78 import com.jcorporate.expresso.kernel.digester.ExpressoServicesConfig; 79 import com.jcorporate.expresso.services.controller.configuration.ShowComponent; 80 import com.jcorporate.expresso.services.controller.configuration.ShowContainerTree; 81 82 83 89 90 public class Configuration extends SecureIfSetController { 91 92 95 public static final String CURRENT_RUNTIME_KEY = Configuration.class.getName() 96 + ".curRuntimeKey"; 97 98 99 public static final String STATE_SHOW_FILE = "showConfigurationFile"; 100 public static final String STATE_SWITCH_RUNTIME = "switchRuntime"; 101 public static final String STATE_SHOW_STATUS = "showContainerStatus"; 102 public static final String STATE_SHOW_RUNTIME = "showRuntime"; 103 public static final String STATE_SHOW_COMPONENT = "showComponent"; 104 public static final String STATE_PROMPT_CREATE_RUNTIME = "promptCreateRuntime"; 105 public static final String STATE_PROCESS_CREATE_RUNTIME = "processCreateRuntime"; 106 107 110 public Configuration() { 111 super(); 112 this.setSchema(com.jcorporate.expresso.core.ExpressoSchema.class); 113 114 State s = new State(STATE_SHOW_FILE, "Show Configuration File"); 115 this.addState(s); 116 117 s = new State(STATE_SWITCH_RUNTIME, "Switch Runtimes"); 118 s.addRequiredParameter("runtimeName"); 119 120 s = new State(STATE_SHOW_STATUS, "Show Container Status State"); 121 this.addState(s); 122 123 s = new ShowContainerTree(); 124 this.addState(s); 125 126 s = new State(STATE_SHOW_RUNTIME, "Show Runtime Information"); 127 this.addState(s); 128 129 s = new ShowComponent(); 132 this.addState(s); 133 134 s = new State("promptCreateRuntime", "Prompt Create Runtime"); 135 this.addState(s); 136 137 s = new State("processCreateRuntime", "Create Runtime"); 138 this.addState(s); 139 140 s = new State("summary", "Configuration Start Page"); 141 this.addState(s); 142 143 this.setInitialState("summary"); 144 } 145 146 147 151 public void runShowConfigurationFileState(ControllerRequest request, 152 ControllerResponse response) { 153 154 } 155 156 163 public void showContainerStatusState(ControllerRequest request, 164 ControllerResponse response) { 165 166 } 167 168 169 173 public void runSwitchRuntimeState(ControllerRequest request, 174 ControllerResponse response) { 175 176 } 177 178 179 183 public void runShowContainerStatusState(ControllerRequest request, 184 ControllerResponse response) { 185 186 187 } 188 189 193 public void runShowComponentState(ControllerRequest request, 194 ControllerResponse response) { 195 196 } 197 198 199 203 public void runSummaryState(ControllerRequest request, 204 ControllerResponse response) { 205 response.setTitle("Expresso Runtime Configuration"); 206 207 } 208 209 214 public void runPromptCreateRuntime(ControllerRequest request, 215 ControllerResponse response) throws ControllerException { 216 response.setTitle("Create New Runtime"); 217 Input i = new Input("runtimeName", "Runtime Name(Leave Blank For Default)"); 218 Transition t = new Transition(STATE_PROCESS_CREATE_RUNTIME, this); 219 response.add(i); 220 response.add(t); 221 222 } 223 224 231 public void runProcessCreateRuntime(ControllerRequest request, 232 ControllerResponse response) throws ControllerException { 233 RootContainer rc = new RootContainer(); 234 rc.setContainerImplementation(new DefaultContainerImpl()); 235 rc.setExpressoServicesConfig(new ExpressoServicesConfig()); 236 238 SystemFactory.getInstance(); 240 rc.getMetadataLocation(); 241 new ComponentMetadataConfig(); 242 } 243 244 } | Popular Tags |