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


001:        package com.sun.portal.wireless.admin;
002:
003:        import java.util.List;
004:        import java.util.Map;
005:        import java.util.HashMap;
006:
007:        import com.sun.portal.admin.common.PSMBeanException;
008:        import com.sun.portal.admin.common.AttrOptionConstants;
009:        import com.sun.portal.fabric.common.GenericDSAMEAttributeHandler;
010:
011:        /**
012:         * Get/set handler for Mobile Mail service
013:         * 
014:         * @author ashwin.mathew@sun.com
015:         */
016:        public abstract class AbstractMobileGetSetAttributeHandler extends
017:                GenericDSAMEAttributeHandler {
018:
019:            public static final String KEY_OLD_VALUES = "mobileaccess.oldvalues";
020:            public static final String KEY_OVERRIDE_VALUES = "mobileaccess.overridevalues";
021:
022:            private static final String TRUE_VALUE = "true";
023:            private static final String FALSE_VALUE = "false";
024:
025:            /* (non-Javadoc)
026:             * @see com.sun.portal.fabric.common.AttributeHandler#getAttributeName(java.lang.String)
027:             */
028:            public String getAttributeName(String userFriendlyName) {
029:                String attributeName = null;
030:
031:                MobileAppAttributeHandler handler = MobileAppAttributeHandlerRegistry
032:                        .findHandler(userFriendlyName, getComponentName());
033:
034:                if (handler != null) {
035:                    attributeName = handler.getAttributeName();
036:                }
037:
038:                return attributeName;
039:            }
040:
041:            /* (non-Javadoc)
042:             * @see com.sun.portal.fabric.common.AttributeHandler#getComponentName(java.lang.String)
043:             */
044:            public String getComponentName(String userFriendlyName) {
045:                // Always the same, regardless of userFriendlyName, since
046:                // we have one implementation per MA service.
047:                return getComponentName();
048:            }
049:
050:            public abstract String getComponentName();
051:
052:            /* (non-Javadoc)
053:             * @see com.sun.portal.fabric.common.AttributeHandler#validate(java.util.Map)
054:             */
055:            public void validate(List values, Map optionsMap)
056:                    throws PSMBeanException {
057:                String attributeName = ((String) optionsMap
058:                        .get(AttrOptionConstants.OPT_ATTR_NAME));
059:
060:                if (attributeName == null) {
061:                    // We don't have to do anything
062:                    // This will happen for list-attributes
063:                    return;
064:                }
065:
066:                MobileAppAttributeHandler handler = MobileAppAttributeHandlerRegistry
067:                        .findHandler(attributeName, getComponentName());
068:
069:                if (handler == null) {
070:                    // The user has specified an invalid attribute for mail
071:                    throw new PSMBeanException(
072:                            "error.psadmin.invalid.attribute.name");
073:                    //throw new PSMBeanException("Validating attribute: " + attributeName);
074:                }
075:
076:                if (handler.requiresOldValues()) {
077:                    Map getOptionsMap = new HashMap(optionsMap);
078:                    List oldValues = super .getAttribute(getOptionsMap);
079:                    optionsMap.put(KEY_OLD_VALUES, oldValues);
080:                }
081:
082:                handler.validate(values, optionsMap);
083:
084:                // Validate rule format
085:                // Validate that rule exists when mapping to view
086:                // Validate that view exists when mapping to device
087:                // Maybe (maybe!) also validate that device profile name is valid for above
088:
089:                // Set flags - global, etc.
090:                switch (handler.getScope()) {
091:                case MobileAppAttributeHandler.SCOPE_GLOBAL:
092:                    optionsMap.put(AttrOptionConstants.OPT_GLOBAL, TRUE_VALUE);
093:                    break;
094:                case MobileAppAttributeHandler.SCOPE_ORGANIZATION:
095:                    optionsMap.put(AttrOptionConstants.OPT_ORG, TRUE_VALUE);
096:                    break;
097:                case MobileAppAttributeHandler.SCOPE_USER:
098:                    break;
099:                case MobileAppAttributeHandler.SCOPE_DYNAMIC:
100:                    break;
101:                }
102:            }
103:
104:            /* (non-Javadoc)
105:             * @see com.sun.portal.fabric.common.AttributeHandler#getAttribute(java.util.Map)
106:             */
107:            public List getAttribute(Map optionsMap) throws PSMBeanException {
108:                //validate(null, optionsMap);
109:
110:                // If we're dealing with a URL-like value
111:                // i.e., sunConfigurationTemplates,
112:                // extract the value from the list, then extract the requested
113:                // attribute from the URL
114:                String attributeName = ((String) optionsMap
115:                        .get(AttrOptionConstants.OPT_ATTR_NAME));
116:
117:                MobileAppAttributeHandler handler = MobileAppAttributeHandlerRegistry
118:                        .findHandler(attributeName, getComponentName());
119:
120:                if (handler == null) {
121:                    // The user has specified an invalid attribute for mail
122:                    throw new PSMBeanException(
123:                            "error.psadmin.invalid.attribute.name");
124:                    //throw new PSMBeanException("Getting attribute " + attributeName);
125:                }
126:
127:                List values = super .getAttribute(optionsMap);
128:
129:                values = handler.processGetValue(values);
130:
131:                return values;
132:            }
133:
134:            /* (non-Javadoc)
135:             * @see com.sun.portal.fabric.common.AttributeHandler#setAttribute(java.util.List, java.util.Map)
136:             */
137:            public void setAttribute(List values, Map optionsMap)
138:                    throws PSMBeanException {
139:                List overrideValues = (List) optionsMap
140:                        .get(KEY_OVERRIDE_VALUES);
141:                if (overrideValues != null) {
142:                    values = overrideValues;
143:                }
144:
145:                // If we're dealing with a URL-like value
146:                // i.e., sunConfigurationTemplates,
147:                // extract the value from the list, then extract the requested
148:                // attribute from the URL
149:                String attributeName = ((String) optionsMap
150:                        .get(AttrOptionConstants.OPT_ATTR_NAME)).toLowerCase();
151:
152:                MobileAppAttributeHandler handler = MobileAppAttributeHandlerRegistry
153:                        .findHandler(attributeName, getComponentName());
154:
155:                if (handler == null) {
156:                    // The user has specified an invalid attribute for mail
157:                    throw new PSMBeanException(
158:                            "error.psadmin.invalid.attribute.name");
159:                }
160:
161:                values = handler.processSetValue(values);
162:
163:                super .setAttribute(values, optionsMap);
164:            }
165:
166:            /* (non-Javadoc)
167:             * @see com.sun.portal.fabric.common.AttributeHandler#listAttributes(java.util.Map)
168:             */
169:            public Map listAttributes(Map optionsMap) throws PSMBeanException {
170:                return MobileAppAttributeHandlerRegistry
171:                        .listAttributes(getComponentName());
172:            }
173:
174:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.