Source Code Cross Referenced for ListConfigurationsByDnBean.java in  » Portal » Open-Portal » com » sun » portal » admin » console » ssoa » 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.ssoa 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * $Id: ListConfigurationsByDnBean.java,v 1.6 2005/09/21 15:29:57 fo160993 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.ssoa;
014:
015:        import java.util.*;
016:        import java.util.logging.Level;
017:        import javax.faces.context.FacesContext;
018:        import javax.management.MBeanServerConnection;
019:        import javax.servlet.http.HttpServletRequest;
020:
021:        import com.sun.data.provider.DataProvider;
022:        import com.sun.data.provider.impl.ObjectListDataProvider;
023:
024:        import com.sun.portal.admin.common.util.AdminClientUtil;
025:
026:        // Session-based bean because the dn selector toolbar doesn't always update
027:        // the session before the bean is updated
028:        public class ListConfigurationsByDnBean extends ListConfigurationsBean {
029:
030:            protected String GLOBAL_DN_LABEL = null;
031:            private String locationDN = null;
032:            private boolean hasService = false;
033:
034:            public ListConfigurationsByDnBean() {
035:                log(Level.FINEST, "Start ListConfigurationsByDnBean()");
036:                resetConfigurations();
037:                //locationDN = (String)getCurrentDN();
038:                //checkSSOAService();
039:            }
040:
041:            private boolean isDNChanged() {
042:                log(Level.FINEST, "Start isDNChanged");
043:                return !locationDN.equals((String) getCurrentDN());
044:            }
045:
046:            public void resetConfigurations() {
047:                log(Level.FINEST, "Start resetConfigurations");
048:                locationDN = (String) getCurrentDN();
049:                hasService = hasSSOAService(locationDN);
050:                if (hasService) {
051:                    Map configs = null;
052:                    //		String templateName = (String) getSessionAttribute(ATTR_SELECTED_TEMPLATE);
053:                    //String dn = (String) getSessionAttribute(ATTR_CURRENT_LOCATION_DN);
054:                    //		String dn = (String) getCurrentDN();
055:                    // SSOA templates names are returned by SSOAdapter MBean method resetConfigurationNames
056:                    log(Level.FINEST, "Getting configurations for "
057:                            + locationDN);
058:                    MBeanServerConnection conn = getMBeanServerConnection();
059:                    try {
060:                        // This can throw AttributeNotFoundException, MBeanException, InstanceNotFoundException
061:                        // ReflectionException, RuntimeOperationsException, or IOException
062:                        String[] signature = { String.class.getName() };
063:                        Object[] params = { locationDN };
064:                        MBeanServerConnection connection = getMBeanServerConnection();
065:                        // This can throw AttributeNotFoundException, MBeanException, InstanceNotFoundException
066:                        // ReflectionException, RuntimeOperationsException, or IOException
067:                        configs = (Map) connection.invoke(objectName,
068:                                "getConfigurationNamesByDn", params, signature);
069:                    } catch (Exception ex) {
070:                        log(
071:                                Level.SEVERE,
072:                                "ListConfigurationsByDnBean.resetConfigurations(): Exception when trying to get the list of configurations",
073:                                ex);
074:                        configs = new HashMap();
075:                    }
076:                    ArrayList configList = new ArrayList(configs.size());
077:                    Set names = configs.keySet();
078:                    Iterator iter = names.iterator();
079:                    while (iter.hasNext()) {
080:                        String name = (String) iter.next();
081:                        String basis = (String) configs.get(name);
082:                        ConfigurationBean cb = new ConfigurationBean(
083:                                locationDN, name, basis);
084:                        // Cheesy workaround for global DNs
085:                        if (GLOBAL_LOCATION_DN.equals(locationDN)) {
086:                            if (GLOBAL_DN_LABEL == null) {
087:                                GLOBAL_DN_LABEL = (String) rbMap
088:                                        .get("ssoa.global.dn.label");
089:                            }
090:                            cb.setLabel(GLOBAL_DN_LABEL);
091:                        }
092:                        configList.add(cb);
093:                    }
094:                    Collections.sort(configList);
095:                    configurations = new ObjectListDataProvider(configList);
096:                } else {
097:                    configurations = null;
098:                }
099:            }
100:
101:            public DataProvider getConfigurations() {
102:                log(Level.FINEST, "Start getConfigurations");
103:                if (getSessionAttribute("resetSSOA") != null) {
104:                    log(Level.FINEST, "resetSSOA is non-null");
105:                    resetConfigurations();
106:                    removeFromSession("resetSSOA");
107:                }
108:                if (isDNChanged()) {
109:                    log(Level.FINEST, "DN has changed");
110:                    resetConfigurations();
111:                }
112:                return configurations;
113:            }
114:
115:            public String gotoConfigurationHome() {
116:                HttpServletRequest req = (HttpServletRequest) FacesContext
117:                        .getCurrentInstance().getExternalContext().getRequest();
118:                String configName = (String) req
119:                        .getParameter(ATTR_SELECTED_CONFIG);
120:                String configDn = (String) req
121:                        .getParameter(ATTR_CURRENT_LOCATION_DN);
122:                setSessionAttribute(ATTR_SELECTED_CONFIG, configName);
123:                setSessionAttribute(ATTR_CURRENT_LOCATION_DN, configDn);
124:                log(Level.FINEST,
125:                        "ListConfigurationsBean.gotoConfigurationHome: go to "
126:                                + configName + " at " + configDn);
127:                return "gotoConfigurationHome";
128:            }
129:
130:            public String gotoTemplateHome() {
131:                HttpServletRequest req = (HttpServletRequest) FacesContext
132:                        .getCurrentInstance().getExternalContext().getRequest();
133:                String templateId = (String) req
134:                        .getParameter(ATTR_SELECTED_TEMPLATE);
135:                setSessionAttribute(ATTR_SELECTED_TEMPLATE, templateId);
136:                log(Level.FINEST,
137:                        "ListConfigurationsBean.gotoTemplateHome: Go to "
138:                                + templateId);
139:                return "gotoTemplateHome";
140:            }
141:
142:            public String gotoCreateConfiguration() {
143:                return "gotoCreateConfiguration";
144:            }
145:
146:            public String back() {
147:                return "back";
148:            }
149:
150:            public String getCurrentDnLabel() {
151:                if (GLOBAL_LOCATION_DN.equals(getCurrentDN())) {
152:                    return GLOBAL_DN_LABEL;
153:                }
154:                return (String) getCurrentDN();
155:            }
156:
157:            // Return true if the current dn has the SSOAdapter service
158:            public boolean getHasService() {
159:                //		log(Level.FINEST, "ListConfigurationsByDnBean.getHasService: Returning "+hasService);
160:                return hasService;
161:            }
162:
163:            // This method will check the current dn for whether the SSOAdapter service
164:            // has been assigned.  If not, it will set the error message.  Looking for
165:            // a better way to show the error to the user.
166:            public boolean hasSSOAService(Object dn) {
167:                // Make sure the dn has the ssoadapter service template
168:                log(Level.FINEST,
169:                        "ListConfigurationsByDnBean.hasSSOAService: Start check for dn "
170:                                + dn);
171:                boolean available = false;
172:                try {
173:                    String[] signature = { String.class.getName() };
174:                    Object[] params = { dn };
175:                    MBeanServerConnection connection = getMBeanServerConnection();
176:                    // This can throw AttributeNotFoundException, MBeanException, InstanceNotFoundException
177:                    // ReflectionException, RuntimeOperationsException, or IOException
178:                    Boolean hasServiceBool = (Boolean) connection.invoke(
179:                            objectName, "hasSSOAdapterService", params,
180:                            signature);
181:                    available = hasServiceBool.booleanValue();
182:                    if (!available) {
183:                        log(
184:                                Level.SEVERE,
185:                                "ListConfigurationsByDnBean.checkSSOAService: dn "
186:                                        + dn
187:                                        + " does not have the SSOAdapter service registered.");
188:                    }
189:                } catch (Exception ex) {
190:                    log(
191:                            Level.SEVERE,
192:                            "ListConfigurationsByDnBean.checkSSOAService: Exception when attempting to check ssoadapter service for dn "
193:                                    + dn, ex);
194:                    available = false;
195:                }
196:                return available;
197:            }
198:
199:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.