Source Code Cross Referenced for BaseUIComponent.java in  » Report » pentaho-report » org » pentaho » ui » 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 » Report » pentaho report » org.pentaho.ui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Pentaho Corporation.  All rights reserved. 
003:         * This software was developed by Pentaho Corporation and is provided under the terms 
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use 
005:         * this file except in compliance with the license. If you need a copy of the license, 
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt. The Original Code is the Pentaho 
007:         * BI Platform.  The Initial Developer is Pentaho Corporation.
008:         *
009:         * Software distributed under the Mozilla Public License is distributed on an "AS IS" 
010:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to 
011:         * the license for the specific language governing your rights and limitations.
012:         *
013:         * @created  Jul 22, 2005 
014:         * @author James Dixon
015:         * 
016:         */
017:
018:        package org.pentaho.ui;
019:
020:        import java.io.IOException;
021:        import java.io.OutputStream;
022:        import java.util.HashMap;
023:        import java.util.List;
024:
025:        import org.apache.commons.logging.Log;
026:        import org.pentaho.core.services.IActionRequestHandler;
027:        import org.pentaho.core.session.IPentahoSession;
028:        import org.pentaho.core.solution.HttpRequestParameterProvider;
029:        import org.pentaho.core.solution.HttpSessionParameterProvider;
030:        import org.pentaho.core.solution.IParameterProvider;
031:        import org.pentaho.core.system.PentahoMessenger;
032:        import org.pentaho.core.system.PentahoSystem;
033:        import org.pentaho.core.ui.IPentahoUrlFactory;
034:        import org.pentaho.messages.Messages;
035:        import org.pentaho.messages.util.LocaleHelper;
036:
037:        /**
038:         * @author James Dixon
039:         * 
040:         * TODO To change the template for this generated type comment go to Window -
041:         * Preferences - Java - Code Style - Code Templates
042:         */
043:        public abstract class BaseUIComponent extends PentahoMessenger {
044:
045:            public static final boolean debug = PentahoSystem.debug;
046:
047:            protected HashMap xslProperties;
048:
049:            protected HashMap contentTypes;
050:
051:            private IActionRequestHandler requestHandler;
052:
053:            private IPentahoSession userSession;
054:
055:            public abstract Log getLogger();
056:
057:            private HashMap parameterProviders;
058:
059:            protected IPentahoUrlFactory urlFactory;
060:
061:            private String sourcePath;
062:
063:            public void handleRequest(OutputStream outputStream,
064:                    IActionRequestHandler actionRequestHandler,
065:                    String contentType, HashMap requestParameterProviders)
066:                    throws IOException {
067:
068:                this .parameterProviders = requestParameterProviders;
069:                this .requestHandler = actionRequestHandler;
070:                String content = getContent(contentType);
071:                if (content != null) {
072:                    outputStream.write(content.getBytes(LocaleHelper
073:                            .getSystemEncoding()));
074:                } else {
075:                    error(Messages.getString("BaseUI.ERROR_0001_NO_CONTENT")); //$NON-NLS-1$
076:                }
077:            }
078:
079:            protected void setSourcePath(String sourcePath) {
080:                this .sourcePath = sourcePath;
081:            }
082:
083:            protected String getSourcePath() {
084:                return sourcePath;
085:            }
086:
087:            public void setUrlFactory(IPentahoUrlFactory urlFactory) {
088:                this .urlFactory = urlFactory;
089:            }
090:
091:            public void setRequestHandler(
092:                    IActionRequestHandler actionRequestHandler) {
093:                this .requestHandler = actionRequestHandler;
094:            }
095:
096:            public BaseUIComponent(IPentahoUrlFactory urlFactory,
097:                    List messages, String sourcePath) {
098:                super ();
099:                this .urlFactory = urlFactory;
100:                xslProperties = new HashMap();
101:                contentTypes = new HashMap();
102:                setMessages(messages);
103:                parameterProviders = new HashMap();
104:                this .sourcePath = sourcePath;
105:            }
106:
107:            public void setParameterProvider(String name,
108:                    IParameterProvider parameterProvider) {
109:                if (parameterProviders == null) {
110:                    parameterProviders = new HashMap();
111:                }
112:                parameterProviders.put(name, parameterProvider);
113:            }
114:
115:            public void setParameterProviders(HashMap parameterProviders) {
116:                this .parameterProviders = parameterProviders;
117:            }
118:
119:            protected IPentahoUrlFactory getUrlFactory() {
120:                return urlFactory;
121:            }
122:
123:            protected IActionRequestHandler getRequestHandler() {
124:                return requestHandler;
125:            }
126:
127:            public HashMap getParameterProviders() {
128:                return parameterProviders;
129:            }
130:
131:            public String getParameter(String name, String defaultValue) {
132:                IParameterProvider parameterProvider = (IParameterProvider) parameterProviders
133:                        .get("options"); //$NON-NLS-1$
134:                String value = null;
135:                if (parameterProvider != null) {
136:                    value = parameterProvider.getStringParameter(name, null);
137:                    if (value != null) {
138:                        return value;
139:                    }
140:                }
141:                parameterProvider = (IParameterProvider) parameterProviders
142:                        .get(HttpRequestParameterProvider.SCOPE_REQUEST);
143:                if (parameterProvider != null) {
144:                    value = parameterProvider.getStringParameter(name, null);
145:                    if (value != null) {
146:                        return value;
147:                    }
148:                }
149:                parameterProvider = (IParameterProvider) parameterProviders
150:                        .get(HttpSessionParameterProvider.SCOPE_SESSION);
151:                if (parameterProvider != null) {
152:                    value = parameterProvider.getStringParameter(name, null);
153:                    if (value != null) {
154:                        return value;
155:                    }
156:                }
157:                return defaultValue;
158:            }
159:
160:            public String[] getParameterAsArray(String name) {
161:                IParameterProvider parameterProvider = (IParameterProvider) parameterProviders
162:                        .get("options"); //$NON-NLS-1$
163:                Object value;
164:                if (parameterProvider != null) {
165:                    value = parameterProvider.getParameter(name);
166:                    if (value != null) {
167:                        return toStringArray(value);
168:                    }
169:                }
170:                parameterProvider = (IParameterProvider) parameterProviders
171:                        .get(HttpRequestParameterProvider.SCOPE_REQUEST);
172:                if (parameterProvider != null) {
173:                    value = parameterProvider.getParameter(name);
174:                    if (value != null) {
175:                        return toStringArray(value);
176:                    }
177:                }
178:                parameterProvider = (IParameterProvider) parameterProviders
179:                        .get(HttpSessionParameterProvider.SCOPE_SESSION);
180:                if (parameterProvider != null) {
181:                    value = parameterProvider.getParameter(name);
182:                    if (value != null) {
183:                        return toStringArray(value);
184:                    }
185:                }
186:                return (new String[] {});
187:            }
188:
189:            private String[] toStringArray(Object value) {
190:                if (value == null) {
191:                    return (new String[] {});
192:                }
193:
194:                if (value instanceof  String[]) {
195:                    return ((String[]) value);
196:                }
197:
198:                return (new String[] { value.toString() });
199:            }
200:
201:            protected IPentahoSession getSession() {
202:                return userSession;
203:            }
204:
205:            public void setXsl(String mimeType, String xslName) {
206:                contentTypes.put(mimeType, xslName);
207:            }
208:
209:            public String getXsl(String mimeType) {
210:                return (String) contentTypes.get(mimeType);
211:            }
212:
213:            public abstract boolean validate();
214:
215:            /**
216:             * Set the userSession member, generate a Log Id, set the requestHandler, and validate 
217:             * the component's configuration.
218:             * NOTE: this method has several side effects not related to validation. could
219:             * probably use some refactoring
220:             * 
221:             * @param session
222:             * @param actionRequestHandler
223:             * @return boolean true if component configuration is valid, else false
224:             */
225:            public boolean validate(IPentahoSession session,
226:                    IActionRequestHandler actionRequestHandler) {
227:                this .userSession = session;
228:                this .genLogIdFromSession(session);
229:                this .requestHandler = actionRequestHandler;
230:                return validate();
231:            }
232:
233:            public void setXslProperty(String name, String value) {
234:                xslProperties.put(name, value);
235:            }
236:
237:            public HashMap getXslProperties() {
238:                return xslProperties;
239:            }
240:
241:            public abstract String getContent(String mimeType);
242:
243:            public void done() {
244:
245:            }
246:
247:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.