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: import java.net.URL;
20:
21: import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
22: import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
23: import javax.enterprise.deploy.spi.exceptions.InvalidModuleException;
24: import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
25: import javax.portlet.ActionRequest;
26: import javax.portlet.ActionResponse;
27: import javax.portlet.PortletException;
28: import javax.portlet.RenderRequest;
29: import javax.portlet.RenderResponse;
30:
31: import org.apache.commons.logging.Log;
32: import org.apache.commons.logging.LogFactory;
33: import org.apache.geronimo.console.MultiPageModel;
34:
35: /**
36: * A handler for ...
37: *
38: * @version $Rev: 611338 $ $Date: 2008-01-11 16:42:22 -0800 (Fri, 11 Jan 2008) $
39: */
40: public class DisplayPlanHandler extends AbstractHandler {
41: private static final Log log = LogFactory
42: .getLog(DisplayPlanHandler.class);
43:
44: public DisplayPlanHandler() {
45: super (DISPLAY_PLAN_MODE,
46: "/WEB-INF/view/configcreator/displayPlan.jsp");
47: }
48:
49: public String actionBeforeView(ActionRequest request,
50: ActionResponse response, MultiPageModel model)
51: throws PortletException, IOException {
52: return getMode();
53: }
54:
55: public void renderView(RenderRequest request,
56: RenderResponse response, MultiPageModel model)
57: throws PortletException, IOException {
58: WARConfigData data = getSessionData(request);
59: try {
60: String plan = JSR88_Util.createDeploymentPlan(request,
61: data, new URL(data.getUploadedWarUri()));
62: data.setDeploymentPlan(plan);
63: } catch (DDBeanCreateException e) {
64: log.error(e.getMessage(), e);
65: } catch (InvalidModuleException e) {
66: log.error(e.getMessage(), e);
67: } catch (ConfigurationException e) {
68: log.error(e.getMessage(), e);
69: } catch (DeploymentManagerCreationException e) {
70: log.error(e.getMessage(), e);
71: }
72: request.setAttribute(DATA_PARAMETER, data);
73: }
74:
75: public String actionAfterView(ActionRequest request,
76: ActionResponse response, MultiPageModel model)
77: throws PortletException, IOException {
78: WARConfigData data = getSessionData(request);
79: data.setDeploymentPlan(request
80: .getParameter(DEPLOYMENT_PLAN_PARAMETER));
81: return DEPLOY_STATUS_MODE;
82: }
83: }
|