Java Doc for StatementCompilerTask.java in  » Database-ORM » sqlc » biz » hammurapi » sqlc » 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 » Database ORM » sqlc » biz.hammurapi.sqlc 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


biz.hammurapi.sqlc.StatementCompilerTask

StatementCompilerTask
public class StatementCompilerTask extends Task (Code)
Compiles SQL query to interface and engine classes using metadata obtained from the database.
SQLC uses BCEL and ANTLR for code generation. If you have pvcommons.jar, bcel-5.1.jar and antlr.jar in the system classpath or in Ant lib directory then SQLC task can be defined as
<taskdef name="sqlc" classname="biz.hammurapi.sqlc.StatementCompilerTask"/>
Otherwise jars which are not in the classpath shall be specified in task definition classpath. SQLC connects to the target database during generation, therefore database driver shall also be present in the classpath
<taskdef name="sqlc" classname="biz.hammurapi.sqlc.StatementCompilerTask">
<classpath>
<fileset dir="${tools}/bcel-5.1" includes="bcel-5.1.jar"/>
<fileset dir="${tools}/ANTLR" includes="antlr.jar"/>
<fileset dir="${tools}/pvcommons/java-1.4" includes="pvcommons.jar"/>
<fileset dir="${tools}/hsqldb/lib" includes="hsqldb.jar"/>
</classpath>
</taskdef>
Usage:
<sqlc 
script="src/com/pavelvlasov/jsel/impl/Hypersonic.sql"
dir="sqlc_generated"
docDir="sqlcDoc"
package="biz.hammurapi.jsel.impl.sql"
masterEngine="Engine"
>
<query name="CompilationUnit" singleRow="yes">
SELECT * FROM COMPILATION_UNIT WHERE ID=?
</query>

<query name="CompilationUnitByStoreLevel">
SELECT * FROM COMPILATION_UNIT C
WHERE REPOSITORY=? AND C.STORE_LEVEL=? AND
EXISTS(SELECT * FROM COMPILATION_UNIT_SCAN S
WHERE S.COMPILATION_UNIT_ID=C.ID AND
S.REPOSITORY=C.REPOSITORY AND S.SCAN_ID=?)
</query>

<update name="DeleteCompilationUnit">
DELETE FROM COMPILATION_UNIT WHERE ID=?
</update>
</sqlc>

author:
   Pavel Vlasov
version:
   $Revision: 1.14 $


Field Summary
 ObjectEntrygenerationPolicyEntry
    

Constructor Summary
public  StatementCompilerTask()
    

Method Summary
public  voidaddConfiguredDbStatements(DbStatementsEntry queries)
     Statements from the database.
public  voidaddConfiguredInterface(InterfaceEntry entry)
     Interface which generated interfaces shall try to extend.
public  voidaddConfiguredScript(ScriptEntry scriptEntry)
    
public  voidaddConfiguredStatements(StatementsEntry queries)
     Statements xml file.
public  voidaddConnection(ConnectionEntry ce)
     Database connection.
public  voidaddQuery(QueryEntry query)
    
public  voidaddTable(TableEntry tableEntry)
     Table entry to generate statements from table metadata and then compile them.
public  voidaddUpdate(UpdateEntry update)
    
public  ObjectEntrycreateGenerationPolicy()
     Generation policy.
public  StatementCompilerTaskcreateSqlc()
     Subtask.
public  voidexecute()
    
 StringgetSmartBase()
    
 BooleangetUseSqlTypes()
    
protected  booleanisToBeGenerated(TableDescriptor td, TableEntry te)
    
public  voidsetDir(File dir)
    
public  voidsetDocDir(File docDir)
     Directory to output HTML documentation.
public  voidsetEngineMethodsVisibility(String engineMethodsVisibility)
     Visibility of engine methods.
public  voidsetEngineVisibility(String engineVisibility)
     Visibility of engine class.
public  voidsetIndexName(String indexName)
     Documentation index file name.
public  voidsetInheritMetadata(boolean inheritMetadata)
     Use parent's metadata file if any. Valid for nested tasks.
public  voidsetInterfaceImplVisibility(String interfaceImplVisibility)
     Visibility of interface implementation classes.
public  voidsetMasterEngine(String masterEngineName)
     Class name for master engine.
public  voidsetMetadata(File metadataFile)
    
public  voidsetNameMap(boolean useNameMap)
     If this attribute is true then: 1) All queries and updates generated for tables will have table and schema name enclosed into ${ and } e.g.
public  voidsetNameMapFile(File nameMapFile)
     Reads name map from property file.
public  voidsetPackage(String packageName)
    
public  voidsetScript(File script)
     DDL script file.
public  voidsetSmartBase(String smartBase)
     Base class (fully qualified name) for generated smart implementations.
public  voidsetUseSqlTypes(boolean useSqlTypes)
     If true then generated classes will use setObject(int, Object, int) method instead of setObject(int, Object) to set parameters of object type.
public  voidsetXmlDoc(boolean xmlDoc)
     If true documentation will be generated in XML format for further styling.

Field Detail
generationPolicyEntry
ObjectEntry generationPolicyEntry(Code)




Constructor Detail
StatementCompilerTask
public StatementCompilerTask()(Code)




Method Detail
addConfiguredDbStatements
public void addConfiguredDbStatements(DbStatementsEntry queries)(Code)
Statements from the database.
Parameters:
  queries -



addConfiguredInterface
public void addConfiguredInterface(InterfaceEntry entry)(Code)
Interface which generated interfaces shall try to extend.
Parameters:
  entry -



addConfiguredScript
public void addConfiguredScript(ScriptEntry scriptEntry)(Code)



addConfiguredStatements
public void addConfiguredStatements(StatementsEntry queries)(Code)
Statements xml file. Top element should be 'statements', containing 'query' and 'update' elements which have the same format as nested 'query' and 'update' elements.
Parameters:
  queries -



addConnection
public void addConnection(ConnectionEntry ce)(Code)
Database connection.
Parameters:
  ce -



addQuery
public void addQuery(QueryEntry query)(Code)
Query to compile
Parameters:
  query -



addTable
public void addTable(TableEntry tableEntry)(Code)
Table entry to generate statements from table metadata and then compile them.
Parameters:
  generateForTables -



addUpdate
public void addUpdate(UpdateEntry update)(Code)
Query to compile
Parameters:
  update -



createGenerationPolicy
public ObjectEntry createGenerationPolicy()(Code)
Generation policy. Must implement biz.hammurapi.sql.metadata.GenerationPolicy interface.



createSqlc
public StatementCompilerTask createSqlc()(Code)
Subtask. Inherits output directory, documentation directory, database connection, skipIndices attribute, outputXml attribute and injected/generated interfaces from the parent task.



execute
public void execute() throws BuildException(Code)



getSmartBase
String getSmartBase()(Code)
Returns the smartBase.



getUseSqlTypes
Boolean getUseSqlTypes()(Code)



isToBeGenerated
protected boolean isToBeGenerated(TableDescriptor td, TableEntry te)(Code)



setDir
public void setDir(File dir)(Code)
Directory to output compiled classes
Parameters:
  dir -



setDocDir
public void setDocDir(File docDir)(Code)
Directory to output HTML documentation.
Parameters:
  documentation -



setEngineMethodsVisibility
public void setEngineMethodsVisibility(String engineMethodsVisibility)(Code)
Visibility of engine methods. Valid values are "public" (default), "protected" and "" (empty string for default/package visibility).
Parameters:
  engineMethodsVisibility -



setEngineVisibility
public void setEngineVisibility(String engineVisibility)(Code)
Visibility of engine class. Valid values are "public" (default), and "" (empty string for default/package visibility).
Parameters:
  engineVisibility -



setIndexName
public void setIndexName(String indexName)(Code)
Documentation index file name. Defaults to 'index.xml' for XML output and 'index.html' for HTML output.
Parameters:
  indexName -



setInheritMetadata
public void setInheritMetadata(boolean inheritMetadata)(Code)
Use parent's metadata file if any. Valid for nested tasks. Default is false.
Parameters:
  inheritMetadata -



setInterfaceImplVisibility
public void setInterfaceImplVisibility(String interfaceImplVisibility)(Code)
Visibility of interface implementation classes. Valid values are "public" (default), and "" (empty string for default/package visibility).



setMasterEngine
public void setMasterEngine(String masterEngineName)(Code)
Class name for master engine. Set this attribute if you want all engine methods be held in one class and avoid generation of an engine class per statement.
Parameters:
  masterEngineName -



setMetadata
public void setMetadata(File metadataFile)(Code)
Metadata file
Parameters:
  metadataFile -



setNameMap
public void setNameMap(boolean useNameMap)(Code)
If this attribute is true then: 1) All queries and updates generated for tables will have table and schema name enclosed into ${ and } e.g. ${BANK}.${ACCOUNT} 2) SQLProcessor used to obtain This attribute creates blank name map, if you need a prepopulated name map use
Parameters:
  useNameMap -



setNameMapFile
public void setNameMapFile(File nameMapFile)(Code)
Reads name map from property file.



setPackage
public void setPackage(String packageName)(Code)
Package for generated classes
Parameters:
  packageName -



setScript
public void setScript(File script)(Code)
DDL script file. Statements shall be separated by semicolons. If this attribute is set then in-memory Hypersonic database is created, gets populated using script and query is compiled against this database. If neither connection nor script is specified the uninitialized Hypersonic in-memory database will be used. It can be useful if several sqlc tasks are executed in a row against the same database.
Parameters:
  script -



setSmartBase
public void setSmartBase(String smartBase)(Code)
Base class (fully qualified name) for generated smart implementations. Default is biz.hammurapi.sql.DatabaseObject The base class is supposed to have same constructors and methods as DatabaseObject. The idea is to subclass DatabaseObject to introduce additional qualities like audit, metrics, security, ... whithout changing class' contract. This setting is not inherited from the parent task.
Parameters:
  smartBase - The smartBase to set.



setUseSqlTypes
public void setUseSqlTypes(boolean useSqlTypes)(Code)
If true then generated classes will use setObject(int, Object, int) method instead of setObject(int, Object) to set parameters of object type. Nested tasks inherit parent setting unless overriden.
Parameters:
  useSqlTypes -



setXmlDoc
public void setXmlDoc(boolean xmlDoc)(Code)
If true documentation will be generated in XML format for further styling.



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