Source Code Cross Referenced for SSOConfigurationBean.java in  » Portal » Open-Portal » com » sun » portal » wireless » taglibs » commprefs » 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.wireless.taglibs.commprefs 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002 Sun Microsystems, Inc. All
003:         * rights reserved. Use of this product is subject
004:         * to license terms. Federal Acquisitions:
005:         * Commercial Software -- Government Users
006:         * Subject to Standard License Terms and
007:         * Conditions.
008:         *
009:         * Sun, Sun Microsystems, the Sun logo, and iPlanet
010:         * are trademarks or registered trademarks of Sun Microsystems,
011:         * Inc. in the United States and other countries.
012:         */
013:
014:        package com.sun.portal.wireless.taglibs.commprefs;
015:
016:        import com.sun.portal.log.common.PortalLogger;
017:        import com.sun.ssoadapter.config.Configuration;
018:
019:        import java.util.Arrays;
020:        import java.util.List;
021:        import java.util.ArrayList;
022:        import java.util.Map;
023:        import java.util.Vector;
024:        import java.util.logging.Level;
025:        import java.util.logging.Logger;
026:
027:        public class SSOConfigurationBean extends SaveableBean {
028:
029:            /**
030:             * A SSOConfigurationBean is a named bean backed by an ssoadapter Configuration, that keeps track of whether is has been updated
031:             * since construction.  The name is not stored in the map.
032:             */
033:
034:            private static Logger logger = PortalLogger
035:                    .getLogger(SSOConfigurationBean.class);
036:            protected Configuration configuration = null;
037:            private String name = null;
038:            private String oldName = null; // for rename handling
039:
040:            public SSOConfigurationBean() {
041:                configuration = new Configuration();
042:            }
043:
044:            public SSOConfigurationBean(String name, Configuration configuration) {
045:                this .name = name;
046:                this .configuration = configuration;
047:            }
048:
049:            public Configuration getConfiguration() {
050:                return configuration;
051:            }
052:
053:            public String getName() {
054:                return name;
055:            }
056:
057:            public void setName(String name) {
058:                if (this .name != null)
059:                    setOldName(this .name);
060:                this .name = name;
061:                configuration.setConfigurationName(name);
062:                wasUpdated = true;
063:            }
064:
065:            public String getOldName() {
066:                return oldName;
067:            }
068:
069:            public void setOldName(String oldName) {
070:                this .oldName = oldName;
071:            }
072:
073:            /**
074:             * Returns empty string if absent.
075:             * @param property
076:             * @return
077:             */
078:            public String getProperty(String property) {
079:                String value = "";
080:                if (property != null) {
081:                    value = configuration.getProperty(property, "");
082:                }
083:                return value;
084:            }
085:
086:            /**
087:             * Only set if String value is non-null or empty string, and has changed.
088:             * @param property
089:             * @param value
090:             */
091:            public void setProperty(String property, String value) {
092:                if ((value != null) && (!"".equals(value))
093:                        && (!value.equals(configuration.getProperty(property)))) {
094:                    configuration.setProperty(property, value);
095:                    wasUpdated = true;
096:                }
097:            }
098:
099:            /**
100:             * Get property array as a list.
101:             * @param property
102:             * @return
103:             */
104:            public List getPropertyList(String property) {
105:                List valueList = new ArrayList();
106:                try {
107:                    Object[] values = configuration.getPropertyArray(property);
108:                    if (values != null)
109:                        valueList = Arrays.asList(values);
110:                } catch (Exception e) {
111:                    logger.log(Level.WARNING, "PSMA_CSPWTP0012", property);
112:                }
113:                return valueList;
114:            }
115:
116:            /**
117:             * Add a String value to the values list:
118:             *   '*CLEAR*' or null - clears all values
119:             *   non-null value    - add the value to the list
120:             * @param property
121:             * @param value
122:             */
123:            public void addValueToList(String property, String value) {
124:                if (configuration == null) {
125:                    logger.log(Level.WARNING, "PSMA_CSPWTP0010", this );
126:                    return;
127:                }
128:                String[] valuesArray = new String[0];
129:                try {
130:                    if ((value == null) || (value.equals("*CLEAR*"))) {
131:                        configuration.setPropertyArray(property, valuesArray);
132:                    } else {
133:                        // non-null: add to list
134:                        Vector values = new Vector(getPropertyList(property));
135:                        if (values == null) {
136:                            values = new Vector();
137:                        }
138:                        values.add(value);
139:                        valuesArray = (String[]) values.toArray(new String[0]);
140:                        configuration.setPropertyArray(property, valuesArray);
141:                    }
142:                    wasUpdated = true;
143:                } catch (Exception e) {
144:                    logger.log(Level.WARNING, "PSMA_CSPWTP0011", e);
145:                }
146:            }
147:
148:            /**
149:             * Set property array as a list of non-null Strings.
150:             * @param property
151:             * @param values
152:             */
153:            public void setPropertyList(String property, List values) {
154:                if (values == null)
155:                    return;
156:                String[] valuesArray = (String[]) values.toArray(new String[0]);
157:                configuration.setPropertyArray(property, valuesArray);
158:            }
159:
160:            public Map getProperties() {
161:                return configuration.getHashMap();
162:            }
163:
164:            public boolean isDelete() {
165:                return delete;
166:            }
167:
168:            public void setDelete(boolean delete) {
169:                this .delete = delete;
170:            }
171:
172:            /**
173:             * The configuration has been saved since the last update.
174:             */
175:            public void upToDate() {
176:                super .upToDate();
177:                // just deleted old config after rename, so oldName no longer useful
178:                this.oldName = null;
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.