Java Doc for SqlHandler.java in  » Database-ORM » MMBase » org » mmbase » storage » search » implementation » database » 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 » MMBase » org.mmbase.storage.search.implementation.database 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.mmbase.storage.search.implementation.database.SqlHandler

All known Subclasses:   org.mmbase.storage.search.implementation.database.PostgreSqlSqlHandler,  org.mmbase.storage.search.implementation.database.ChainedSqlHandler,  org.mmbase.storage.search.implementation.database.BasicSqlHandler,  org.mmbase.storage.search.implementation.database.InformixSqlHandler,  org.mmbase.storage.search.implementation.database.informix.excalibur.EtxSqlHandler,  org.mmbase.storage.search.implementation.database.functions.FunctionSqlHandler,  org.mmbase.storage.search.implementation.database.MySqlSqlHandler,  org.mmbase.storage.search.implementation.database.MSSqlSqlHandler,  org.mmbase.storage.search.implementation.database.HSqlSqlHandler,
SqlHandler
public interface SqlHandler (Code)
Interface for handler classes that are used to create SQL string representations of SearchQuery SearchQuery objects.

A number of SqlHandler objects can create a chain of handlers, following the Chain Of Responsibility design pattern.

In short:

  • A chain is formed of SqlHandler objects, where each element in the chain, except the last one, is called a chained handler. Each chained handler has a successor, which is the next element in the chain.
  • The first element receives all requests first (a request = call of one of the methods in the interface). When a chained element receives a request, it can either handle it or pass it on to its successor.
  • The last element in the chain, handles all remaining requests.

Each handler in the chain adds functionality to its successor(s), in a way similar to subclassing. The chained design enables a chain of handlers to be configured and created at runtime.

In addition to the methods defined in the interface, the concrete SqlHandler class for the last element in the chain is required to have a constructor with this signature:

public <constructor>(Map disallowedValues) { .. }
where disallowedValues is a map that maps disallowed table/fieldnames to allowed alternatives.

The concrete SqlHandler class for the other, chained, elements in the chain are required to have a constructor with this signature:

public <constructor>(SqlHandler successor) { .. }
where successor is the successor in the chain of responsibility.
author:
   Rob van Maris
version:
   $Id: SqlHandler.java,v 1.8 2007/06/12 10:59:41 michiel Exp $
since:
   MMBase-1.7




Method Summary
 voidappendConstraintToSql(StringBuilder sb, Constraint constraint, SearchQuery query, boolean inverse, boolean inComposite)
     Represents Constraint object, that is not a CompositeConstraint, as a constraint in SQL format, appending the result to a stringbuffer.
public  voidappendQueryBodyToSql(StringBuilder sb, SearchQuery query, SqlHandler firstInChain)
     Represents body of a SearchQuery object as a string in SQL format, using the database configuration.
public  StringgetAllowedValue(String value)
     Maps string to value that is allowed as table or field name. org.mmbase.storage.StorageManagerFactory.getStorageIdentifier
Parameters:
  value - The string value.
public  intgetSupportLevel(int feature, SearchQuery query)
     Gets the level at which a feature is supported for a query by this handler.
public  intgetSupportLevel(Constraint constraint, SearchQuery query)
     Gets the level at which a constraint is supported for a query by this handler.
 StringtoSql(SearchQuery query, SqlHandler firstInChain)
     Represents a SearchQuery object as a string in SQL format, using the database configuration.
Parameters:
  query - The searchquery.
Parameters:
  firstInChain - The first element in the chain of handlers.At some point appendQueryBodyToSql() will haveto be called on this handler, to generate the body of the query.



Method Detail
appendConstraintToSql
void appendConstraintToSql(StringBuilder sb, Constraint constraint, SearchQuery query, boolean inverse, boolean inComposite) throws SearchQueryException(Code)
Represents Constraint object, that is not a CompositeConstraint, as a constraint in SQL format, appending the result to a stringbuffer. When it is part of a composite expression, it will be surrounded by parenthesis when needed.
Parameters:
  sb - The stringbuffer to append to.
Parameters:
  constraint - The (non-composite) constraint.
Parameters:
  query - The searchquery containing the constraint.
Parameters:
  inverse - True when the inverse constraint must be represented,false otherwise.
Parameters:
  inComposite - True when the constraint is part ofa composite expression.



appendQueryBodyToSql
public void appendQueryBodyToSql(StringBuilder sb, SearchQuery query, SqlHandler firstInChain) throws SearchQueryException(Code)
Represents body of a SearchQuery object as a string in SQL format, using the database configuration. Appends this to a stringbuffer.
The body of the SQL query string is defined as the substring containing fields, tables, constraints and orders.
Parameters:
  sb - The stringbuffer to append to.
Parameters:
  query - The searchquery.
Parameters:
  firstInChain - The first element in the chain of handlers.At some point appendConstraintToSql() will haveto be called on this handler, to generate the constraints inthe query.



getAllowedValue
public String getAllowedValue(String value)(Code)
Maps string to value that is allowed as table or field name. org.mmbase.storage.StorageManagerFactory.getStorageIdentifier
Parameters:
  value - The string value. The mapped value.



getSupportLevel
public int getSupportLevel(int feature, SearchQuery query) throws SearchQueryException(Code)
Gets the level at which a feature is supported for a query by this handler. This is one of either: Given the choice, the query handler with the highest level of support is prefered.



getSupportLevel
public int getSupportLevel(Constraint constraint, SearchQuery query) throws SearchQueryException(Code)
Gets the level at which a constraint is supported for a query by this handler. This is one of either: Given the choice, the query handler with the highest level of support is prefered.



toSql
String toSql(SearchQuery query, SqlHandler firstInChain) throws SearchQueryException(Code)
Represents a SearchQuery object as a string in SQL format, using the database configuration.
Parameters:
  query - The searchquery.
Parameters:
  firstInChain - The first element in the chain of handlers.At some point appendQueryBodyToSql() will haveto be called on this handler, to generate the body of the query. SQL string representation of the query.



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