01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.geronimo.console.configcreator;
17:
18: import java.io.IOException;
19:
20: import javax.portlet.ActionRequest;
21: import javax.portlet.ActionResponse;
22: import javax.portlet.PortletException;
23: import javax.portlet.RenderRequest;
24: import javax.portlet.RenderResponse;
25:
26: import org.apache.commons.logging.Log;
27: import org.apache.commons.logging.LogFactory;
28: import org.apache.geronimo.console.MultiPageModel;
29:
30: /**
31: * A handler for ...
32: *
33: * @version $Rev: 595692 $ $Date: 2007-11-16 07:13:23 -0800 (Fri, 16 Nov 2007) $
34: */
35: public class EnvironmentHandler extends AbstractHandler {
36: private static final Log log = LogFactory
37: .getLog(EnvironmentHandler.class);
38:
39: public EnvironmentHandler() {
40: super (ENVIRONMENT_MODE,
41: "/WEB-INF/view/configcreator/environment.jsp");
42: }
43:
44: public String actionBeforeView(ActionRequest request,
45: ActionResponse response, MultiPageModel model)
46: throws PortletException, IOException {
47: return getMode();
48: }
49:
50: public void renderView(RenderRequest request,
51: RenderResponse response, MultiPageModel model)
52: throws PortletException, IOException {
53: WARConfigData data = getSessionData(request);
54: request.setAttribute(DATA_PARAMETER, data);
55: }
56:
57: public String actionAfterView(ActionRequest request,
58: ActionResponse response, MultiPageModel model)
59: throws PortletException, IOException {
60: WARConfigData data = getSessionData(request);
61: data.readEnvironmentData(request);
62: if (data.getEjbRefs().size() > 0
63: || data.getEjbLocalRefs().size() > 0
64: || data.getJdbcPoolRefs().size() > 0
65: || data.getJavaMailSessionRefs().size() > 0
66: || data.getJmsConnectionFactoryRefs().size() > 0
67: || data.getJmsDestinationRefs().size() > 0
68: || data.getWebServiceRefs().size() > 0) {
69: return REFERENCES_MODE + "-before";
70: }
71: if (data.getSecurity() != null) {
72: return SECURITY_MODE + "-before";
73: }
74: return DEPENDENCIES_MODE + "-before";
75: }
76: }
|