Java Doc for DatabaseAction.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » cocoon » acting » modular » 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 » Content Management System » apache lenya 2.0 » org.apache.cocoon.acting.modular 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.cocoon.acting.AbstractComplementaryConfigurableAction
   org.apache.cocoon.acting.modular.DatabaseAction

All known Subclasses:   org.apache.cocoon.acting.modular.DatabaseUpdateAction,  org.apache.cocoon.acting.modular.DatabaseSelectAction,  org.apache.cocoon.acting.modular.DatabaseAddAction,  org.apache.cocoon.acting.modular.DatabaseQueryAction,  org.apache.cocoon.acting.modular.DatabaseDeleteAction,
DatabaseAction
abstract public class DatabaseAction extends AbstractComplementaryConfigurableAction implements Disposable,ThreadSafe(Code)
Abstract action for common function needed by database actions. The difference to the other Database*Actions is, that the actions in this package use additional components ("modules") for reading and writing parameters. In addition the descriptor format has changed to accomodate the new features.

This action is heavily based upon the original DatabaseAddActions.

Modes have to be configured in cocoon.xconf. Mode names from descriptor.xml file are looked up in the component service. Default mode names can only be set during action setup.

The number of affected rows is returned to the sitemap with the "row-count" parameter if at least one row was affected.

All known column types can be found in org.apache.cocoon.util.JDBCTypeConversions JDBCTypeConversions .

Configuration options (setup):
input default mode name for reading values (request-param)
autoincrement default mode name for obtaining values from autoincrement columns (auto)
append-row append row number in square brackets to column name for output (yes)
append-table-nameadd table name to column name for both in- and output (yes)
first-row row index of first row (0)
path-separator string to separate table name from column name (.)
Configuration options (setup and per invocation):
throw-exception throw an exception when an error occurs (default: false)
descriptor file containing database description
table-set table-set name to work with
output mode name for writing values (request-attr)
reloadable dynamically reload descriptor file if change is detected
use-transactions defaults to yes
connection configured datasource connection to use (overrides value from descriptor file)
fail-on-empty (boolean) fail is statement affected zero rows (true)

author:
   Christian Haul
version:
   $Id: DatabaseAction.java 433543 2006-08-22 06:22:54Z crossley $
See Also:   org.apache.cocoon.components.modules.input
See Also:   org.apache.cocoon.components.modules.output
See Also:   org.apache.cocoon.components.modules.database
See Also:   org.apache.cocoon.util.JDBCTypeConversions

Inner Class :protected static class Column
Inner Class :protected static class CacheHelper
Inner Class :protected static class LookUpKey

Field Summary
final static  StringATTRIBUTE_KEY
    
final static  StringDATABASE_MODULE_SELECTOR
    
final static  StringINPUT_MODULE_SELECTOR
    
final static  IntegerMODE_AUTOINCR
    
final static  IntegerMODE_OTHERS
    
final static  IntegerMODE_OUTPUT
    
final static  StringOUTPUT_MODULE_SELECTOR
    
final protected  HashMapcachedQueryData
    
final static  StringdatabaseHint
    
protected  ServiceSelectordbselector
    
protected  MapdefaultModeNames
    
protected  booleanfailOnEmpty
    
protected  intfirstRow
    
final static  StringinputHint
    
final static  StringoutputHint
    
protected  StringpathSeparator
    


Method Summary
public  Mapact(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters param)
     Add a record to the database.
public  voidconfigure(Configuration conf)
    
public  voiddispose()
    
protected  voidfillModes(Configuration[] conf, boolean isKey, Map defaultModeNames, Map modeTypes, CacheHelper set)
    
protected  Object[]getColumnValue(Configuration tableConf, Column column, Map objectModel)
    
abstract  Object[][]getColumnValues(Configuration tableConf, CacheHelper queryData, Map objectModel)
     Fetch all values for all columns that are needed to do the database operation. This method is intended to be overridden by classes that implement other operations e.g.
protected  DataSourceComponentgetDataSource(Configuration conf, Parameters parameters)
     Get the Datasource we need.
protected  ConfigurationgetMode(Configuration conf, String type)
     Choose a mode configuration based on its name.
Parameters:
  conf - Configuration (i.e.
protected  StringgetOutputName(Configuration tableConf, Configuration columnConf)
    
protected  StringgetOutputName(Configuration tableConf, Configuration columnConf, int rowIndex)
     compose name for output a long the lines of "table.column[row]" or "table.column" if rowIndex is -1.
abstract protected  CacheHelpergetQuery(Configuration table, Map modeTypes, Map defaultModeNames)
     Get the String representation of the PreparedStatement.
abstract protected  booleanhonourAutoIncrement()
     determine whether autoincrement columns should be honoured by this operation.
final protected  booleanisLargeObject(String type)
     Return whether a type is a Large Object (BLOB/CLOB).
abstract protected  intprocessRow(Map objectModel, Connection conn, PreparedStatement statement, String outputMode, Configuration table, CacheHelper queryData, Object[][] columnValues, int rowIndex, Map results)
     set all necessary ?s and execute the query return number of rows processed This method is intended to be overridden by classes that implement other operations e.g.
protected  intprocessTable(Configuration table, Connection conn, Map objectModel, Map results, Map modeTypes)
    
abstract protected  StringselectMode(boolean isAutoIncrement, Map modes)
     determine which mode to use as default mode This method is intended to be overridden by classes that implement other operations e.g.
public  voidservice(ServiceManager manager)
     Compose the Actions so that we can select our databases.
protected  voidsetColumn(PreparedStatement statement, int position, Configuration entry, Object value)
     set a column in a statement using the appropriate JDBC setXXX method.
protected  voidsetColumn(Map objectModel, String outputMode, Map results, Configuration table, Configuration column, int rowIndex, Object value, PreparedStatement statement, int position)
     set a column in a statement using the appropriate JDBC setXXX method and propagate the value to the output module and results map if present.
protected  voidsetOutput(Map objectModel, String outputMode, Map results, Configuration table, Configuration column, int rowIndex, Object value)
     create a unique name using the getOutputName method and write the value to the output module and the results map if present.
protected  voidsetOutputAttribute(Map objectModel, String outputMode, String key, Object value)
     Store a key/value pair in the output attributes.

Field Detail
ATTRIBUTE_KEY
final static String ATTRIBUTE_KEY(Code)



DATABASE_MODULE_SELECTOR
final static String DATABASE_MODULE_SELECTOR(Code)



INPUT_MODULE_SELECTOR
final static String INPUT_MODULE_SELECTOR(Code)



MODE_AUTOINCR
final static Integer MODE_AUTOINCR(Code)



MODE_OTHERS
final static Integer MODE_OTHERS(Code)



MODE_OUTPUT
final static Integer MODE_OUTPUT(Code)



OUTPUT_MODULE_SELECTOR
final static String OUTPUT_MODULE_SELECTOR(Code)



cachedQueryData
final protected HashMap cachedQueryData(Code)



databaseHint
final static String databaseHint(Code)



dbselector
protected ServiceSelector dbselector(Code)



defaultModeNames
protected Map defaultModeNames(Code)



failOnEmpty
protected boolean failOnEmpty(Code)



firstRow
protected int firstRow(Code)



inputHint
final static String inputHint(Code)



outputHint
final static String outputHint(Code)



pathSeparator
protected String pathSeparator(Code)





Method Detail
act
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters param) throws Exception(Code)
Add a record to the database. This action assumes that the file referenced by the "descriptor" parameter conforms to the AbstractDatabaseAction specifications.



configure
public void configure(Configuration conf) throws ConfigurationException(Code)



dispose
public void dispose()(Code)
dispose



fillModes
protected void fillModes(Configuration[] conf, boolean isKey, Map defaultModeNames, Map modeTypes, CacheHelper set) throws ConfigurationException(Code)
Setup parsed attribute configuration object



getColumnValue
protected Object[] getColumnValue(Configuration tableConf, Column column, Map objectModel) throws ConfigurationException, ServiceException(Code)



getColumnValues
abstract Object[][] getColumnValues(Configuration tableConf, CacheHelper queryData, Map objectModel) throws ConfigurationException, ServiceException(Code)
Fetch all values for all columns that are needed to do the database operation. This method is intended to be overridden by classes that implement other operations e.g. delete



getDataSource
protected DataSourceComponent getDataSource(Configuration conf, Parameters parameters) throws ServiceException(Code)
Get the Datasource we need.



getMode
protected Configuration getMode(Configuration conf, String type) throws ConfigurationException(Code)
Choose a mode configuration based on its name.
Parameters:
  conf - Configuration (i.e. a column's configuration) that might haveseveral children configurations named "mode".
Parameters:
  type - desired type (i.e. every mode has a typeattribute), find the first mode that has a compatible type.Special mode "all" matches all queried types. configuration that has desired type or type "all" or null.



getOutputName
protected String getOutputName(Configuration tableConf, Configuration columnConf)(Code)
compose name for output a long the lines of "table.column"



getOutputName
protected String getOutputName(Configuration tableConf, Configuration columnConf, int rowIndex)(Code)
compose name for output a long the lines of "table.column[row]" or "table.column" if rowIndex is -1. If the section of the sitemap corresponding to the action contains false the name for output is "column[row]" If the section of the sitemap corresponding to the action contains false the name for output is "column"



getQuery
abstract protected CacheHelper getQuery(Configuration table, Map modeTypes, Map defaultModeNames) throws ConfigurationException, ServiceException(Code)
Get the String representation of the PreparedStatement. This is mapped to the Configuration object itself, so if it doesn't exist, it will be created. This method is intended to be overridden by classes that implement other operations e.g. delete
Parameters:
  table - the table's configuration object the insert query as a string



honourAutoIncrement
abstract protected boolean honourAutoIncrement()(Code)
determine whether autoincrement columns should be honoured by this operation. This is usually snsible only for INSERTs. This method is intended to be overridden by classes that implement other operations e.g. delete



isLargeObject
final protected boolean isLargeObject(String type)(Code)
Return whether a type is a Large Object (BLOB/CLOB).



processRow
abstract protected int processRow(Map objectModel, Connection conn, PreparedStatement statement, String outputMode, Configuration table, CacheHelper queryData, Object[][] columnValues, int rowIndex, Map results) throws SQLException, ConfigurationException, Exception(Code)
set all necessary ?s and execute the query return number of rows processed This method is intended to be overridden by classes that implement other operations e.g. delete



processTable
protected int processTable(Configuration table, Connection conn, Map objectModel, Map results, Map modeTypes) throws SQLException, ConfigurationException, Exception(Code)
Inserts a row or a set of rows into the given table based on the request parameters
Parameters:
  table - the table's configuration
Parameters:
  conn - the database connection
Parameters:
  objectModel - the objectModel



selectMode
abstract protected String selectMode(boolean isAutoIncrement, Map modes)(Code)
determine which mode to use as default mode This method is intended to be overridden by classes that implement other operations e.g. delete



service
public void service(ServiceManager manager) throws ServiceException(Code)
Compose the Actions so that we can select our databases.



setColumn
protected void setColumn(PreparedStatement statement, int position, Configuration entry, Object value) throws Exception(Code)
set a column in a statement using the appropriate JDBC setXXX method.



setColumn
protected void setColumn(Map objectModel, String outputMode, Map results, Configuration table, Configuration column, int rowIndex, Object value, PreparedStatement statement, int position) throws Exception(Code)
set a column in a statement using the appropriate JDBC setXXX method and propagate the value to the output module and results map if present. Effectively combines calls to setColumn and setOutput.



setOutput
protected void setOutput(Map objectModel, String outputMode, Map results, Configuration table, Configuration column, int rowIndex, Object value)(Code)
create a unique name using the getOutputName method and write the value to the output module and the results map if present.



setOutputAttribute
protected void setOutputAttribute(Map objectModel, String outputMode, String key, Object value)(Code)
Store a key/value pair in the output attributes. We prefix the key with the name of this class to prevent potential name collisions.



Methods inherited from org.apache.cocoon.acting.AbstractComplementaryConfigurableAction
protected Configuration getConfiguration(String descriptor) throws ConfigurationException(Code)(Java Doc)
protected Configuration getConfiguration(String descriptor, boolean reloadable) throws ConfigurationException(Code)(Java Doc)
protected Configuration getConfiguration(String descriptor, SourceResolver resolver, boolean reloadable) throws ConfigurationException(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.