Java Doc for CompassTemplate.java in  » Search-Engine » compass-2.0 » org » compass » core » 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 » Search Engine » compass 2.0 » org.compass.core 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.compass.core.CompassTemplate

CompassTemplate
public class CompassTemplate implements CompassOperations(Code)
Helper class that simplifies the Compass access code using the template design pattern.

The central method is "execute", supporting Compass code implementing the CompassCallback interface. It provides Compass Session handling such that neither the CompassCallback implementation nor the calling code needs to explicitly care about retrieving/closing Compass Sessions, handling Session lifecycle exceptions, or managing transactions. The template code is similar to

 CompassSession session = compass.openSession();
 CompassTransaction tx = null;
 try {
 tx = session.beginTransaction();
 Object result = compassCallback.doInCompass(session);
 tx.commit();
 return result;
 } catch (RuntimeException e) {
 if (tx != null) {
 tx.rollback();
 }
 throw e;
 } finally {
 session.close();
 }
 

The template must have a Compass reference set, either using the tempalte constructor or using the set method.

CompassTemplate also provides the same operations available when working with CompassSession, just that they are executed using the "execute" template method, which means that they enjoy it's session lifecycle and transaction support.
author:
   kimchy




Constructor Summary
public  CompassTemplate()
     Creates a new CompassTemplate instance (remember to set Compass using the setCompass method).
public  CompassTemplate(Compass compass)
     Creates a new CompassTemplate instance, already initialized with a Compass instance.

Method Summary
public  voidcreate(Object obj)
    
public  voidcreate(String alias, Object obj)
    
public  voiddelete(Object obj)
    
public  voiddelete(Resource resource)
    
public  voiddelete(Class clazz, Object obj)
    
public  voiddelete(String alias, Object obj)
    
public  voiddelete(CompassQuery query)
    
public  voiddelete(String alias, Object... ids)
    
public  voiddelete(Class clazz, Object... ids)
    
public  voidevict(Object obj)
    
public  voidevict(String alias, Object id)
    
public  voidevict(Resource resource)
    
public  voidevictAll()
    
public  Texecute(CompassCallback<T> action)
     Executes the compass callback within a session and a transaction context.
public  Texecute(TransactionIsolation transactionIsolation, CompassCallback<T> action)
     Executes the compass callback within a session and a transaction context.
public  CompassHitsOperationsexecuteFind(CompassCallback<CompassHitsOperations> action)
     A helper execute method for find operations.
Parameters:
  action - the callback to execute.
public  TexecuteLocal(CompassCallback<T> action)
     Executes the compass callback within a session and a local transaction context.
public  CompassHitsfind(String query)
    
public  CompassDetachedHitsfindWithDetach(String query)
    
public  CompassDetachedHitsfindWithDetach(String query, int from, int size)
    
public  Tget(Class<T> clazz, Object id)
    
public  Objectget(String alias, Object id)
    
public  Tget(Class<T> clazz, Object... ids)
    
public  Objectget(String alias, Object... ids)
    
public  CompassgetCompass()
     Returns the compass instance used by the template.
public  ResourcegetResource(Class clazz, Object id)
    
public  ResourcegetResource(String alias, Object id)
    
public  ResourcegetResource(Class clazz, Object... ids)
    
public  ResourcegetResource(String alias, Object... ids)
    
public  CompassSettingsgetSettings()
    
public  Tload(Class<T> clazz, Object... ids)
    
public  Tload(Class<T> clazz, Object id)
    
public  Objectload(String alias, Object... ids)
    
public  Objectload(String alias, Object id)
    
public  ResourceloadResource(Class clazz, Object id)
    
public  ResourceloadResource(String alias, Object id)
    
public  ResourceloadResource(Class clazz, Object... ids)
    
public  ResourceloadResource(String alias, Object... ids)
    
public  voidsave(Object obj)
    
public  voidsave(String alias, Object obj)
    
public  voidsaveResource(Resource resource)
    
public  voidsetCompass(Compass compass)
     Sets the compass instance that will be used by the template.


Constructor Detail
CompassTemplate
public CompassTemplate()(Code)
Creates a new CompassTemplate instance (remember to set Compass using the setCompass method).



CompassTemplate
public CompassTemplate(Compass compass)(Code)
Creates a new CompassTemplate instance, already initialized with a Compass instance.




Method Detail
create
public void create(Object obj) throws CompassException(Code)



create
public void create(String alias, Object obj) throws CompassException(Code)



delete
public void delete(Object obj) throws CompassException(Code)



delete
public void delete(Resource resource) throws CompassException(Code)



delete
public void delete(Class clazz, Object obj) throws CompassException(Code)



delete
public void delete(String alias, Object obj) throws CompassException(Code)



delete
public void delete(CompassQuery query) throws CompassException(Code)



delete
public void delete(String alias, Object... ids) throws CompassException(Code)



delete
public void delete(Class clazz, Object... ids) throws CompassException(Code)



evict
public void evict(Object obj)(Code)



evict
public void evict(String alias, Object id)(Code)



evict
public void evict(Resource resource)(Code)



evictAll
public void evictAll()(Code)



execute
public T execute(CompassCallback<T> action) throws CompassException(Code)
Executes the compass callback within a session and a transaction context.
Parameters:
  action - The action to execute witin a compass transaction An object as the result of the compass action
throws:
  CompassException -



execute
public T execute(TransactionIsolation transactionIsolation, CompassCallback<T> action) throws CompassException(Code)
Executes the compass callback within a session and a transaction context. Applies the given transaction isolation level.
Parameters:
  transactionIsolation - The transaction isolation
Parameters:
  action - The action to execute witin a compass transaction An object as the result of the compass action
throws:
  CompassException -



executeFind
public CompassHitsOperations executeFind(CompassCallback<CompassHitsOperations> action) throws CompassException(Code)
A helper execute method for find operations.
Parameters:
  action - the callback to execute. The hits that match the query
throws:
  CompassException -



executeLocal
public T executeLocal(CompassCallback<T> action) throws CompassException(Code)
Executes the compass callback within a session and a local transaction context. Applies the given transaction isolation level.
Parameters:
  action - The action to execute witin a compass transaction An object as the result of the compass action
throws:
  CompassException -



find
public CompassHits find(String query) throws CompassException(Code)



findWithDetach
public CompassDetachedHits findWithDetach(String query) throws CompassException(Code)



findWithDetach
public CompassDetachedHits findWithDetach(String query, int from, int size) throws CompassException(Code)



get
public T get(Class<T> clazz, Object id) throws CompassException(Code)



get
public Object get(String alias, Object id) throws CompassException(Code)



get
public T get(Class<T> clazz, Object... ids) throws CompassException(Code)



get
public Object get(String alias, Object... ids) throws CompassException(Code)



getCompass
public Compass getCompass()(Code)
Returns the compass instance used by the template. the compass instance



getResource
public Resource getResource(Class clazz, Object id) throws CompassException(Code)



getResource
public Resource getResource(String alias, Object id) throws CompassException(Code)



getResource
public Resource getResource(Class clazz, Object... ids) throws CompassException(Code)



getResource
public Resource getResource(String alias, Object... ids) throws CompassException(Code)



getSettings
public CompassSettings getSettings()(Code)



load
public T load(Class<T> clazz, Object... ids) throws CompassException(Code)



load
public T load(Class<T> clazz, Object id) throws CompassException(Code)



load
public Object load(String alias, Object... ids) throws CompassException(Code)



load
public Object load(String alias, Object id) throws CompassException(Code)



loadResource
public Resource loadResource(Class clazz, Object id) throws CompassException(Code)



loadResource
public Resource loadResource(String alias, Object id) throws CompassException(Code)



loadResource
public Resource loadResource(Class clazz, Object... ids) throws CompassException(Code)



loadResource
public Resource loadResource(String alias, Object... ids) throws CompassException(Code)



save
public void save(Object obj) throws CompassException(Code)



save
public void save(String alias, Object obj) throws CompassException(Code)



saveResource
public void saveResource(Resource resource) throws CompassException(Code)



setCompass
public void setCompass(Compass compass)(Code)
Sets the compass instance that will be used by the template.



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.