Source Code Cross Referenced for ListPortalsBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » fabric » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » Open Portal » com.sun.portal.admin.console.fabric 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: ListPortalsBean.java,v 1.8 2005/09/23 04:05:54 pd109850 Exp $
003:         * Copyright 2005 Sun Microsystems, Inc. All
004:         * rights reserved. Use of this product is subject
005:         * to license terms. Federal Acquisitions:
006:         * Commercial Software -- Government Users
007:         * Subject to Standard License Terms and
008:         * Conditions.
009:         *
010:         * Sun, Sun Microsystems, the Sun logo, and Sun ONE
011:         * are trademarks or registered trademarks of Sun Microsystems,
012:         * Inc. in the United States and other countries.
013:         */package com.sun.portal.admin.console.fabric;
014:
015:        import java.util.List;
016:        import java.util.logging.Level;
017:        import java.util.ArrayList;
018:        import java.util.Set;
019:        import java.util.Iterator;
020:        import java.io.IOException;
021:        import java.text.MessageFormat;
022:
023:        import javax.faces.event.ActionEvent;
024:        import javax.faces.context.FacesContext;
025:        import javax.servlet.http.HttpServletRequest;
026:
027:        import com.sun.data.provider.DataProvider;
028:        import com.sun.data.provider.impl.ObjectListDataProvider;
029:        import com.sun.web.ui.model.Option;
030:        import com.sun.web.ui.component.RadioButton;
031:
032:        import com.sun.portal.admin.common.util.AdminClientUtil;
033:        import com.sun.portal.admin.common.PortalAttributes;
034:
035:        import javax.management.ObjectName;
036:
037:        public class ListPortalsBean extends FabricBaseBean {
038:            private DataProvider portals = null;
039:            private List portalsList = null;
040:            private List names = null;
041:
042:            public String currentPortal = null;
043:
044:            /** Creates a new instance of ListPortalsBean*/
045:            public ListPortalsBean() {
046:                buildPortalList();
047:            }
048:
049:            private void buildPortalList() {
050:                portalsList = new ArrayList();
051:                names = getPortalNames();
052:                Iterator iter = names.iterator();
053:                while (iter.hasNext()) {
054:                    String name = (String) iter.next();
055:                    int nInstances = 0;
056:                    try {
057:                        nInstances = getInstanceObjectNames(name).size();
058:                    } catch (Exception e) {
059:                        log(
060:                                Level.INFO,
061:                                "ListPortalsBean.ListPortalsBean(): "
062:                                        + "Failed to get number of instances for portal "
063:                                        + name, e);
064:                    }
065:                    portalsList.add(new PortalBean(name, getPortalAttribute(
066:                            name, PortalAttributes.PORTAL_URI), nInstances));
067:                }
068:                portals = new ObjectListDataProvider(portalsList);
069:            }
070:
071:            public DataProvider getPortals() {
072:                return portals;
073:            }
074:
075:            public void setPortals(DataProvider portals) {
076:                this .portals = portals;
077:            }
078:
079:            public Option[] getPortalOptions() {
080:                Option[] pOptions = new Option[names.size()];
081:                Iterator iter = names.iterator();
082:                int i = 0;
083:                while (iter.hasNext()) {
084:                    String portalName = (String) iter.next();
085:                    Option portal = new Option(portalName, portalName);
086:                    pOptions[i] = portal;
087:                    i++;
088:                }
089:                return pOptions;
090:            }
091:
092:            public String getCurrentPortal() {
093:                currentPortal = (String) getSessionAttribute(ATTR_SELECTED_PORTAL);
094:                if (currentPortal == null) {
095:                    if (names != null && !names.isEmpty()) {
096:                        currentPortal = (String) names.get(0);
097:                    }
098:                }
099:                return currentPortal;
100:            }
101:
102:            public void setCurrentPortal(String portalId) {
103:                setSessionAttribute(ATTR_SELECTED_PORTAL, portalId);
104:                currentPortal = portalId;
105:            }
106:
107:            private List getPortalNames() {
108:                List pNames = new ArrayList();
109:                try {
110:                    ObjectName portalPat = AdminClientUtil
111:                            .getPortalsPattern(AdminClientUtil.DEFAULT_DOMAIN);
112:                    Set objNames = getMBeanServerConnection().queryNames(
113:                            portalPat, null);
114:                    Iterator iter = objNames.iterator();
115:                    while (iter.hasNext()) {
116:                        pNames
117:                                .add(getAttribute((ObjectName) iter.next(),
118:                                        "ID"));
119:                    }
120:                } catch (IOException ie) {
121:                    log(
122:                            Level.SEVERE,
123:                            "ListPortalsBean.getPortalNames: Exception when trying to get the list of portals",
124:                            ie);
125:                } catch (Exception ex) {
126:                    log(
127:                            Level.SEVERE,
128:                            "ListPortalsBean.getPortalNames: Exception when trying to get the list of portals",
129:                            ex);
130:                }
131:                return pNames;
132:            }
133:
134:            public String gotoDesktopHome() {
135:                HttpServletRequest req = (HttpServletRequest) FacesContext
136:                        .getCurrentInstance().getExternalContext().getRequest();
137:                String portalId = (String) req
138:                        .getParameter(ATTR_SELECTED_PORTAL);
139:                setSessionAttribute(ATTR_SELECTED_PORTAL, portalId);
140:                return "gotoDesktopHome";
141:            }
142:
143:            public String exportPortal() {
144:                return "export";
145:            }
146:
147:            public String importPortal() {
148:                return "import";
149:            }
150:
151:            public String newPortal() {
152:                return "newPortal";
153:            }
154:
155:            public String getSelectedPortal() {
156:                String portalId = (String) RadioButton.getSelected("rb");
157:                return portalId;
158:            }
159:
160:            public String deletePortal() {
161:
162:                // Get the selected portal id
163:                String name = (String) RadioButton.getSelected("rb");
164:
165:                // Set the right params and signature
166:                Object[] params = { name };
167:                String[] signature = { "java.lang.String" };
168:
169:                try {
170:                    // Get the MBean object for the newly created portal
171:                    ObjectName iObjName = AdminClientUtil
172:                            .getPortalDomainMBeanObjectName(AdminClientUtil.DEFAULT_DOMAIN);
173:
174:                    log(Level.FINEST, "Invoking Delete Portal for: " + name);
175:                    // Invoke the delete portal operation
176:                    getMBeanServerConnection().invoke(iObjName, "deletePortal",
177:                            params, signature);
178:
179:                    setAlertType("information");
180:                    setAlertSummary(getFabricI18N("message.deletePortal.success.summary"));
181:                    String ptrn = getFabricI18N("message.deletePortal.success.details");
182:                    MessageFormat mf = new MessageFormat(ptrn);
183:                    setAlertDetail(mf.format(params));
184:                    showAlert();
185:                    buildPortalList();
186:                } catch (Exception e) {
187:                    log(
188:                            Level.SEVERE,
189:                            "ListPortalsBean.deletePortal(): Delete Portal operation failed",
190:                            e);
191:                    setAlertType("error");
192:                    setAlertSummary(getFabricI18N("message.deletePortal.failed.summary"));
193:                    String ptrn = getFabricI18N("message.deletePortal.failed.details");
194:                    MessageFormat mf = new MessageFormat(ptrn);
195:                    setAlertDetail(mf.format(params));
196:                    showAlert();
197:                }
198:                return null;
199:            }
200:
201:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.