Source Code Cross Referenced for SolutionHelper.java in  » Report » pentaho-report » org » pentaho » core » solution » 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.core.solution 
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 Jan 13, 2006 
014:         * @author James Dixon
015:         */
016:
017:        package org.pentaho.core.solution;
018:
019:        import java.io.ByteArrayOutputStream;
020:        import java.io.OutputStream;
021:        import java.util.ArrayList;
022:        import java.util.HashMap;
023:        import java.util.List;
024:        import java.util.Map;
025:
026:        import org.pentaho.core.runtime.IRuntimeContext;
027:        import org.pentaho.core.session.IPentahoSession;
028:        import org.pentaho.core.session.StandaloneSession;
029:        import org.pentaho.core.system.PentahoSystem;
030:        import org.pentaho.core.ui.IPentahoUrlFactory;
031:        import org.pentaho.core.ui.SimpleUrlFactory;
032:        import org.pentaho.plugin.core.StandardSettings;
033:
034:        // TODO sbarkdull, ton's of opportunity here for some refactoring to get rid of european reuse
035:
036:        public class SolutionHelper {
037:
038:            /**
039:             * 
040:             * 
041:             * Runs an action sequence. This method uses the base URL set by the
042:             * Application Context
043:             * 
044:             * @param description
045:             *            An identifier for this process. This is used for auditing and
046:             *            logging purposes only.
047:             * @param userId
048:             *            The user (or user agent) that is requesting this execution.
049:             *            This is used for auditing and logging and also can be used in
050:             *            action sequences (for example to filter data)
051:             * @param actionSequence
052:             *            Path to the action sequence file
053:             * @param parameters
054:             *            Parameters to be passed to the action sequence
055:             * @param outputStream
056:             *            The output stream for content generated by the action
057:             *            sequence. Can be null.
058:             * @return
059:             */
060:            public static ISolutionEngine execute(String description,
061:                    String userId, String actionSequence, Map parameters,
062:                    OutputStream outputStream) {
063:
064:                PentahoSystem.systemEntryPoint();
065:                ISolutionEngine solutionEngine = null;
066:                try {
067:                    // create a generic session object
068:                    StandaloneSession session = new StandaloneSession(userId);
069:
070:                    solutionEngine = PentahoSystem
071:                            .getSolutionEngineInstance(session);
072:                    solutionEngine.init(session);
073:
074:                    SimpleParameterProvider parameterProvider = new SimpleParameterProvider(
075:                            parameters);
076:
077:                    //Modifications by Ezequiel Cuellar
078:                    //Old code.
079:                    //String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
080:                    //New code. Since the SubActionComponent is being instantiated below to return feedback
081:                    //it is necesary to configure the baseUrl to include the ViewAction.
082:                    String baseUrl = PentahoSystem.getApplicationContext()
083:                            .getBaseUrl();
084:                    Object actionUrlComponent = parameters
085:                            .get(StandardSettings.ACTION_URL_COMPONENT);
086:                    if (actionUrlComponent != null
087:                            && actionUrlComponent.toString().length() > 0) {
088:                        baseUrl += actionUrlComponent.toString();
089:                    } else {
090:                        baseUrl += "ViewAction?";//$NON-NLS-1$ 
091:                    }
092:
093:                    HashMap parameterProviderMap = new HashMap();
094:                    parameterProviderMap.put(
095:                            HttpRequestParameterProvider.SCOPE_REQUEST,
096:                            parameterProvider);
097:
098:                    IPentahoUrlFactory urlFactory = new SimpleUrlFactory(
099:                            baseUrl);
100:
101:                    PentahoSystem.ActionInfo solutionRef = PentahoSystem
102:                            .parseActionString(actionSequence);
103:
104:                    String processName = description;
105:                    boolean persisted = false;
106:                    List messages = new ArrayList();
107:
108:                    if (outputStream == null) {
109:                        outputStream = new ByteArrayOutputStream(0);
110:                    }
111:                    SimpleOutputHandler outputHandler = null;
112:                    if (outputStream != null) {
113:                        //Modifications by Ezequiel Cuellar
114:                        //Old code.
115:                        //outputHandler = new SimpleOutputHandler(outputStream, false);
116:                        //New code. Without setting the allowFeedback parameter to true it is assumed that SubActionComponent instances
117:                        //are never capable of returning feedback which may not always be the case.
118:                        outputHandler = new SimpleOutputHandler(outputStream,
119:                                true);
120:                        outputHandler
121:                                .setOutputPreference(IOutputHandler.OUTPUT_TYPE_DEFAULT);
122:                    }
123:                    solutionEngine.execute(solutionRef.getSolutionName(),
124:                            solutionRef.getPath(), solutionRef.getActionName(),
125:                            processName, false, true, null, persisted,
126:                            parameterProviderMap, outputHandler, null,
127:                            urlFactory, messages);
128:
129:                } finally {
130:                    PentahoSystem.systemExitPoint();
131:                }
132:                return solutionEngine;
133:            }
134:
135:            public static ISolutionEngine execute(String description,
136:                    IPentahoSession session, String actionSequence,
137:                    Map parameters, OutputStream outputStream) {
138:
139:                PentahoSystem.systemEntryPoint();
140:                ISolutionEngine solutionEngine = null;
141:                try {
142:
143:                    solutionEngine = PentahoSystem
144:                            .getSolutionEngineInstance(session);
145:                    solutionEngine.init(session);
146:
147:                    SimpleParameterProvider parameterProvider = new SimpleParameterProvider(
148:                            parameters);
149:
150:                    //Modifications by Ezequiel Cuellar
151:                    //Old code.
152:                    //String baseUrl = PentahoSystem.getApplicationContext().getBaseUrl();
153:                    //New code. Since the SubActionComponent is being instantiated below to return feedback
154:                    //it is necesary to configure the baseUrl to include the ViewAction.
155:                    String baseUrl = PentahoSystem.getApplicationContext()
156:                            .getBaseUrl();
157:                    Object actionUrlComponent = parameters
158:                            .get(StandardSettings.ACTION_URL_COMPONENT);
159:                    if (actionUrlComponent != null
160:                            && actionUrlComponent.toString().length() > 0) {
161:                        baseUrl += actionUrlComponent.toString();
162:                    } else {
163:                        baseUrl += "ViewAction?";//$NON-NLS-1$ 
164:                    }
165:
166:                    HashMap parameterProviderMap = new HashMap();
167:                    parameterProviderMap.put(
168:                            HttpRequestParameterProvider.SCOPE_REQUEST,
169:                            parameterProvider);
170:
171:                    IPentahoUrlFactory urlFactory = new SimpleUrlFactory(
172:                            baseUrl);
173:
174:                    PentahoSystem.ActionInfo solutionRef = PentahoSystem
175:                            .parseActionString(actionSequence);
176:
177:                    String processName = description;
178:                    boolean persisted = false;
179:                    List messages = new ArrayList();
180:
181:                    if (outputStream == null) {
182:                        outputStream = new ByteArrayOutputStream(0);
183:                    }
184:                    SimpleOutputHandler outputHandler = null;
185:                    if (outputStream != null) {
186:
187:                        //Modifications by Ezequiel Cuellar
188:                        //Old code.
189:                        //outputHandler = new SimpleOutputHandler(outputStream, false);
190:                        //New code. Without setting the allowFeedback parameter to true it is assumed that SubActionComponent instances
191:                        //are never capable of returning feedback which may not always be the case.
192:                        outputHandler = new SimpleOutputHandler(outputStream,
193:                                true);
194:                        outputHandler
195:                                .setOutputPreference(IOutputHandler.OUTPUT_TYPE_DEFAULT);
196:                    }
197:                    solutionEngine.execute(solutionRef.getSolutionName(),
198:                            solutionRef.getPath(), solutionRef.getActionName(),
199:                            processName, false, true, null, persisted,
200:                            parameterProviderMap, outputHandler, null,
201:                            urlFactory, messages);
202:
203:                } finally {
204:                    PentahoSystem.systemExitPoint();
205:                }
206:                return solutionEngine;
207:
208:            }
209:
210:            public static void execute(IRuntimeContext context,
211:                    String actionSequence, Map parameters,
212:                    OutputStream outputStream) {
213:
214:                PentahoSystem.systemEntryPoint();
215:                try {
216:                    // create a generic session object
217:                    IPentahoSession session = context.getSession();
218:
219:                    ISolutionEngine solutionEngine = PentahoSystem
220:                            .getSolutionEngineInstance(session);
221:                    solutionEngine.init(session);
222:
223:                    SimpleParameterProvider parameterProvider = new SimpleParameterProvider(
224:                            parameters);
225:
226:                    HashMap parameterProviderMap = new HashMap();
227:                    parameterProviderMap.put(
228:                            HttpRequestParameterProvider.SCOPE_REQUEST,
229:                            parameterProvider);
230:
231:                    PentahoSystem.ActionInfo solutionRef = PentahoSystem
232:                            .parseActionString(actionSequence);
233:
234:                    String processName = context.getProcessId();
235:
236:                    if (outputStream == null) {
237:                        outputStream = new ByteArrayOutputStream(0);
238:                    }
239:                    SimpleOutputHandler outputHandler = null;
240:                    if (outputStream != null) {
241:                        outputHandler = new SimpleOutputHandler(outputStream,
242:                                false);
243:                        outputHandler
244:                                .setOutputPreference(IOutputHandler.OUTPUT_TYPE_DEFAULT);
245:                    }
246:                    context = solutionEngine.execute(context, solutionRef
247:                            .getSolutionName(), solutionRef.getPath(),
248:                            solutionRef.getActionName(), processName, false,
249:                            true, parameterProviderMap, outputHandler);
250:
251:                } finally {
252:                    PentahoSystem.systemExitPoint();
253:                }
254:            }
255:
256:            public static void execute(ISolutionEngine solutionEngine,
257:                    String actionSequence, Map parameters,
258:                    OutputStream outputStream) {
259:
260:                PentahoSystem.systemEntryPoint();
261:                try {
262:
263:                    if (solutionEngine == null) {
264:                        return;
265:                    }
266:
267:                    IRuntimeContext context = solutionEngine
268:                            .getExecutionContext();
269:
270:                    // create a generic session object
271:                    IPentahoSession session = context.getSession();
272:
273:                    solutionEngine.init(session);
274:
275:                    if (parameters == null) {
276:                        parameters = new HashMap();
277:                    }
278:                    SimpleParameterProvider parameterProvider = new SimpleParameterProvider(
279:                            parameters);
280:
281:                    HashMap parameterProviderMap = new HashMap();
282:                    parameterProviderMap.put(
283:                            HttpRequestParameterProvider.SCOPE_REQUEST,
284:                            parameterProvider);
285:
286:                    PentahoSystem.ActionInfo solutionRef = PentahoSystem
287:                            .parseActionString(actionSequence);
288:                    String processName = context.getProcessId();
289:
290:                    if (outputStream == null) {
291:                        outputStream = new ByteArrayOutputStream(0);
292:                    }
293:                    SimpleOutputHandler outputHandler = null;
294:                    if (outputStream != null) {
295:                        outputHandler = new SimpleOutputHandler(outputStream,
296:                                false);
297:                        outputHandler
298:                                .setOutputPreference(IOutputHandler.OUTPUT_TYPE_DEFAULT);
299:                    }
300:                    context = solutionEngine.execute(context, solutionRef
301:                            .getSolutionName(), solutionRef.getPath(),
302:                            solutionRef.getActionName(), processName, false,
303:                            true, parameterProviderMap, outputHandler);
304:
305:                } finally {
306:                    PentahoSystem.systemExitPoint();
307:                }
308:                return;
309:
310:            }
311:
312:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.