Java Doc for GenericTransaction.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   dinamica.AbstractModule
      dinamica.GenericTransaction

All known Subclasses:   dinamica.security.GetMenu,  dinamica.GetBlob,  dinamica.security.Login,  dinamica.security.GetProfile,  dinamica.security.ChangePassword,  dinamica.security.GetLoginHistory,  dinamica.SortRS,  dinamica.calendar.DefaultCalendar,  dinamica.security.UpdateProfile,  dinamica.SysInfo,  dinamica.GenericChart,  dinamica.SetLanguage,  dinamica.RSSConsumer,  dinamica.security.Logout,  dinamica.MasterDetailReader,  dinamica.ErrorHandler,  dinamica.PagingControls,  dinamica.AbstractValidator,  dinamica.GenericTableManager,
GenericTransaction
public class GenericTransaction extends AbstractModule (Code)
Base class to program business transaction services (read/write). All transactions will subclass this class.
Creation date: 4/10/2003
Last Update: 4/10/2003
(c) 2003 Martin Cordova
This code is released under the LGPL license

author:
   Martin Cordova




Method Summary
protected  intcreateRecordsets(Recordset inputParams)
     Create recordsets using config.xml parameters. For recordsets created using SQL templates, all values from the inputParams recordset will be auto-replaced into the template.
protected  RecordsetdbGet(String DataSourceName, String sql, int limit)
    
protected  RecordsetdbGet(String DataSourceName, String sql)
    
public  RecordsetgetChartInfoRecordset()
     Create a recordset with all the fields required to produce a chart with ChartOutput.
public  HashMap<String, Recordset>getData()
    
protected  DataSourcegetDataSource(String name)
     Return DataSource object using JNDI prefix configured in web.xml context parameter.
protected  DataSourcegetDataSource()
     Return the default application DataSource object as configured in web.xml context parameters.
protected  StringgetEnvEntry(String name)
     Returns an "env-entry" value stored in web.xml.
protected  GenericTransactiongetObject(String className)
     Load the appropiate class and creates an object that MUST subclass GenericTransaction.
public  RecordsetgetRecordset(String id)
     Returns a recordset published by this transaction
Parameters:
  id - ID or symbolic name which was used to publish therecordset - either by code or using the config.xml elements.
protected  RecordsetgetRsFromFlatFile(String path)
     Creates a recordset according to a structure defined in a flat file.
protected  StringgetSQL(String sql, Recordset rs)
     Generate SQL command.
protected  voidpublish(String key, Recordset data)
    
public  intservice(Recordset inputParams)
     Transaction service - this method must be redefined by descendants of this class, include a super.service(inputParams) as the first line of your service() method code to reuse base functionality (auto-creation of recordsets based on recordset elements defined in config.xml). In this method the business logic will be contained, and results will be represented as recordsets that will be consumed by Output objects.



Method Detail
createRecordsets
protected int createRecordsets(Recordset inputParams) throws Throwable(Code)
Create recordsets using config.xml parameters. For recordsets created using SQL templates, all values from the inputParams recordset will be auto-replaced into the template. This recordset is only created when using a validator (validator.xml definition to auto-validate request parameters).
throws:
  Throwable - in case of invalid config.xml parameters or JDBC exceptions.



dbGet
protected Recordset dbGet(String DataSourceName, String sql, int limit) throws Throwable(Code)
Utility method to retrieve a recordset from a different data source than the one used by the action
Parameters:
  DataSourceName - Data Source name like "jdbc/xxxx"
Parameters:
  sql - SQL command that returns a result set
Parameters:
  limit - The maximum number of rows to retrieve (0 = no limit)
throws:
  Throwable -



dbGet
protected Recordset dbGet(String DataSourceName, String sql) throws Throwable(Code)
Utility method to retrieve a recordset from a different data source than the one used by the action
Parameters:
  DataSourceName - Data Source name like "jdbc/xxxx"
Parameters:
  sql - SQL command that returns a result set
throws:
  Throwable -



getChartInfoRecordset
public Recordset getChartInfoRecordset() throws Throwable(Code)
Create a recordset with all the fields required to produce a chart with ChartOutput. This recordset will contain no records. Recordset with the column structure required by the class ChartOutput
throws:
  Throwable -



getData
public HashMap<String, Recordset> getData()(Code)
Retrieve internal HashMap containing all published Recordsets in case some output module needs to serialize this object or anything else HashMap containing all published Recordsets



getDataSource
protected DataSource getDataSource(String name) throws Throwable(Code)
Return DataSource object using JNDI prefix configured in web.xml context parameter. This is an utility method to help simplify Transaction code. A DataSource can be obtained with a single line of code:

 javax.sql.DataSource ds = getDataSource("jdbc/customersDB");
 setConnection(ds.getConnection);
 ....
 

Remember that when you use your own datasource, you must close the connection in your Transaction code! consult the reference guide ("Sample code" section) for more information.
Parameters:
  name - Name of the datasource (Example: jdbc/customersdb) DataSource object
throws:
  Throwable - If DataSource cannot be obtained



getDataSource
protected DataSource getDataSource() throws Throwable(Code)
Return the default application DataSource object as configured in web.xml context parameters. This is a utility method to help simplify Transaction code. A DataSource can be obtained with a single line of code:

 javax.sql.DataSource ds = getDataSource();
 setConnection(ds.getConnection());
 ....
 

Remember that when you use your own datasource, you must close the connection in your Transaction code! please consult the reference guide ("Sample code" section) for more information. DataSource object
throws:
  Throwable - If DataSource cannot be obtained



getEnvEntry
protected String getEnvEntry(String name) throws Throwable(Code)
Returns an "env-entry" value stored in web.xml.
Parameters:
  name - env-entry-name element



getObject
protected GenericTransaction getObject(String className) throws Throwable(Code)
Load the appropiate class and creates an object that MUST subclass GenericTransaction. This method is used by Transactions that delegate work on "subtransaction" objects. All these classes subclass GenericTransaction to inherit all the code supporting business logic programming. You may define your own methods in those classes, they are intended to refactor common business code that may be used by multiple Transactions.
Typically, you will use code like this:
 MyOwnClass obj = (MyOwnClass)getObject("mypackage.MyOwnClass");
 obj.myMethod();
 

An object created this way inherits all the power of the GenericTransaction, including the availability of security information (current user), access to the same database connection as the caller, etc. Both objects participate in the same JDBC Transaction if this feature was enabled in the config.xml file.
Parameters:
  className - Name of the class to instantiate An object of class GenericTransaction
throws:
  Throwable -



getRecordset
public Recordset getRecordset(String id) throws Throwable(Code)
Returns a recordset published by this transaction
Parameters:
  id - ID or symbolic name which was used to publish therecordset - either by code or using the config.xml elements. Recordset
throws:
  Throwable - if ID oes not match any of the IDs of the published recordsets



getRsFromFlatFile
protected Recordset getRsFromFlatFile(String path) throws Throwable(Code)
Creates a recordset according to a structure defined in a flat file. The 1st line defines the column types, the second line defines the column names. From 3rd line begins data records. Columns are separated by TAB, rows are separated by CR+NL.
Parameters:
  path - Path to flat file defining recordset structure and data. If path starts with "/..." it is interpreted as a location relativeto the context, otherwise it is assumed to be located in the Action's path. Recordset according to the flat file structure
throws:
  Throwable -



getSQL
protected String getSQL(String sql, Recordset rs) throws Throwable(Code)
Generate SQL command. Encapsulates the use of the TemplateEngine class, to make it easier for developers writing Transaction Modules
Parameters:
  sql - SQL Template
Parameters:
  rs - Recordset with at least one record - there must bea current record SQL command with replaced values
throws:
  Throwable -



publish
protected void publish(String key, Recordset data) throws Throwable(Code)
Publish recordset to be consumed by Output modules
Parameters:
  key - Recordset ID
Parameters:
  data - Recordset object



service
public int service(Recordset inputParams) throws Throwable(Code)
Transaction service - this method must be redefined by descendants of this class, include a super.service(inputParams) as the first line of your service() method code to reuse base functionality (auto-creation of recordsets based on recordset elements defined in config.xml). In this method the business logic will be contained, and results will be represented as recordsets that will be consumed by Output objects. Recordsets are published using the method publish(id, rsObject). This class provides a method to retrieve a recordset using its ID and throws an error if the recordset is not present in the HashMap.
If inputParams is not null then it is published with the id "_request".
Parameters:
  inputParams - Request parameters pre-validated and represented as a Recordset with one record.Recordset fields are set according to the data types defined in the validator.xml file. 0 if success - any other return values are user defined
throws:
  Throwable -



Fields inherited from dinamica.AbstractModule
Config _config(Code)(Java Doc)
Connection _conn(Code)(Java Doc)
ServletContext _ctx(Code)(Java Doc)
PrintWriter _pw(Code)(Java Doc)
HttpServletRequest _req(Code)(Java Doc)
HttpServletResponse _res(Code)(Java Doc)

Methods inherited from dinamica.AbstractModule
protected Config getConfig()(Code)(Java Doc)
protected Connection getConnection()(Code)(Java Doc)
protected ServletContext getContext()(Code)(Java Doc)
protected Db getDb() throws Throwable(Code)(Java Doc)
protected String getLocalResource(String path) throws Throwable(Code)(Java Doc)
protected HttpServletRequest getRequest()(Code)(Java Doc)
public String getResource(String fileName) throws Throwable(Code)(Java Doc)
protected HttpServletResponse getResponse()(Code)(Java Doc)
protected HttpSession getSession()(Code)(Java Doc)
protected String getUserName()(Code)(Java Doc)
public void init(ServletContext ctx, HttpServletRequest req, HttpServletResponse res)(Code)(Java Doc)
protected boolean isUserInRole(String roleName)(Code)(Java Doc)
protected void log(String message)(Code)(Java Doc)
public void setConfig(Config config)(Code)(Java Doc)
public void setConnection(Connection connection)(Code)(Java Doc)
public void setLogWriter(PrintWriter pw)(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.