01: /**
02: * $Id: ConsumerBaseBean.java,v 1.3 2005/08/16 23:43:34 yue Exp $
03: * Copyright 2005 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.admin.console.wsrp.consumer;
14:
15: import java.util.LinkedList;
16: import java.util.List;
17: import java.util.ResourceBundle;
18:
19: import javax.faces.context.FacesContext;
20: import javax.faces.el.ValueBinding;
21: import javax.servlet.http.HttpServletRequest;
22:
23: import com.sun.data.provider.RowKey;
24: import com.sun.portal.admin.common.util.AdminUtil;
25: import com.sun.portal.admin.console.common.PSBaseBean;
26:
27: public class ConsumerBaseBean extends PSBaseBean {
28: public static final String INFORMATION = "information";
29: public static final String WARNING = "warning";
30: public static final String ERROR = "error";
31: public static final String COMPONENT = "consumer";
32: public static final String CONSUMER = "Consumer";
33: public static final String CONFIGURED_PRODUCER = "ConfiguredProducer";
34:
35: public static final String CONSUMER_TYPE = AdminUtil.PORTAL_MBEAN_TYPE
36: + "." + CONSUMER;
37:
38: public static final String CONFIGURED_PRODUCER_TYPE = CONSUMER_TYPE
39: + "." + CONFIGURED_PRODUCER;
40:
41: protected ResourceBundle rb = null;
42: protected String portalID = null;
43:
44: public ConsumerBaseBean() {
45: rb = getRBundle(COMPONENT);
46: portalID = (String) getSessionAttribute(ATTR_SELECTED_PORTAL);
47: }
48:
49: protected HttpServletRequest getRequest() {
50: return (HttpServletRequest) FacesContext.getCurrentInstance()
51: .getExternalContext().getRequest();
52: }
53:
54: protected void setRequestAttributeInSession(String attrName) {
55: setSessionAttribute(attrName, getRequest().getParameter(
56: attrName));
57: }
58:
59: protected List getConsumerPath() {
60: LinkedList path = new LinkedList();
61: path.addFirst(getDomain());
62: path.addFirst(getSessionAttribute(ATTR_SELECTED_PORTAL));
63: path.addFirst(CONSUMER);
64: return path;
65: }
66:
67: protected List getConfiguredProducerPath() {
68: LinkedList path = new LinkedList();
69: path.addFirst(getDomain());
70: path.addFirst(getSessionAttribute(ATTR_SELECTED_PORTAL));
71: path.addFirst(CONSUMER);
72: path
73: .addFirst(getSessionAttribute(ATTR_SELECTED_CONFIGURED_PRODUCER));
74: return path;
75: }
76:
77: protected RowKey getTableRow(String row) {
78: FacesContext context = FacesContext.getCurrentInstance();
79: ValueBinding vb = context.getApplication().createValueBinding(
80: row);
81: return (RowKey) vb.getValue(context);
82: }
83: }
|