Source Code Cross Referenced for GetBlob.java in  » J2EE » Dinamica » dinamica » 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 » J2EE » Dinamica » dinamica 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


01:        package dinamica;
02:
03:        /**
04:         * Generic Blob reader.<br>
05:         * This Transaction publishes a Recordset with the
06:         * information required by the BlobOutput module
07:         * to print a blob column's content, whether it is an image or
08:         * a document. It is meant to be a generic mechanism to send
09:         * blobs as response to requests without requiring special coding.<br>
10:         * The whole mechanism depends on a certain table structure, that at least 
11:         * must contain these fields: content_type, image_data and filename (required only if blob will be sent as attachment).  
12:         * A primary key to retrieve the blob is also required, usually an ID (integer).
13:         * The Action that uses this Transaction must include two query files: query-info.sql and query-blob.sql. 
14:         * They must have those names. Also include a custom element in config.xml: &gt;attach&lt;true&gt;/attach&lt; Set it to "true" if you want
15:         * the browser to open a "Save as" dialog box, otherwise it should be "false".<br>
16:         * You may include your own validation rules before this Transaction's execute() method
17:         * is invoked. The BlobOutput module will read the blob column by itself, which means that it will
18:         * open its own database connection using the default application datasource (context parameter in web.xml).<br>
19:         * The Recodset must be published with the name "blobinfo". The fields of this recordset are: 
20:         * format, filename (null if attach=false), size and sql.<br><br>
21:         * <b>NOTE:</b> A validator.xml file with the field that represents the blob ID is required. Set validator=true in config.xml.
22:         * 
23:         * <br>
24:         * Creation date: 6/jan/2004<br>
25:         * Last Update: 20/may/2004<br>
26:         * (c) 2003 Martin Cordova<br>
27:         * This code is released under the LGPL license<br>
28:         * @author Martin Cordova
29:         * */
30:        public class GetBlob extends GenericTransaction {
31:
32:            /* (non-Javadoc)
33:             * @see dinamica.GenericTransaction#service(dinamica.Recordset)
34:             */
35:            public int service(Recordset inputParams) throws Throwable {
36:
37:                //reuse superclass code
38:                int rc = super .service(inputParams);
39:
40:                //create recordset structure
41:                Recordset rs = new Recordset();
42:                rs.append("sql", java.sql.Types.VARCHAR);
43:                rs.append("filename", java.sql.Types.VARCHAR);
44:                rs.append("format", java.sql.Types.VARCHAR);
45:                rs.addNew();
46:
47:                //get image metadata
48:                String sql1 = getSQL(getResource("query-info.sql"), inputParams);
49:                Recordset rsInfo = getDb().get(sql1);
50:                rsInfo.first();
51:
52:                //create sql to retrieve blob
53:                String sql2 = getSQL(getResource("query-blob.sql"), inputParams);
54:
55:                //fill recordset fields
56:                rs.setValue("sql", sql2);
57:
58:                //content-type of the blob
59:                rs.setValue("format", rsInfo.getValue("content_type"));
60:
61:                //set filename only if attach=true
62:                String attach = getConfig().getConfigValue("attach");
63:                if (attach != null && attach.equals("true")) {
64:                    if (rsInfo.containsField("filename"))
65:                        rs.setValue("filename", rsInfo.getValue("filename"));
66:                    else
67:                        throw new Throwable(
68:                                "Cannot attach BLOB output if [filename] column is not present in the [query-info.sql] template.");
69:                }
70:
71:                publish("blobinfo", rs);
72:
73:                return rc;
74:
75:            }
76:
77:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.