Java Doc for RsIterator.java in  » Database-ORM » db-ojb » org » apache » ojb » broker » accesslayer » 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 » db ojb » org.apache.ojb.broker.accesslayer 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.ojb.broker.accesslayer.RsIterator

All known Subclasses:   org.apache.ojb.broker.accesslayer.SqlBasedRsIterator,  org.apache.ojb.broker.accesslayer.ReportQueryRsIterator,
RsIterator
public class RsIterator implements OJBIterator(Code)
RsIterator can be used to iterate over a jdbc ResultSet to retrieve persistent objects step-by-step and not all at once. In fact the PersistenceBroker::getCollectionByQuery(...) method uses a RsIterator internally to build up a Collection of objects

NOTE: OJB is very strict in handling RsIterator instances. RsIterator is bound very closely to the used org.apache.ojb.broker.PersistenceBroker instance. Thus if you do a
- org.apache.ojb.broker.PersistenceBroker.close
- org.apache.ojb.broker.PersistenceBroker.commitTransaction
- org.apache.ojb.broker.PersistenceBroker.abortTransaction
call, the current RsIterator instance resources will be cleaned up automatic and invalidate current instance.

NOTE: this code uses features that only JDBC 2.0 compliant Drivers support. It will NOT work with JDBC 1.0 Drivers (e.g. SUN's JdbcOdbcDriver) If you are forced to use such a driver, you can use code from the 0.1.30 release.


author:
   Thomas Mahler
author:
  
Matthew Baird - added the
author:
   support for extents mapped to single table - added the .size
author:
   functionality - added cursor control
version:
   $Id: RsIterator.java,v 1.63.2.19 2005/12/21 22:22:58 tomdz Exp $

Inner Class :public static class ResourceWrapper implements PBStateListener
Inner Class :public static class ResourceClosedException extends OJBRuntimeException
Inner Class :public static class ResourceNotClosedException extends OJBRuntimeException

Field Summary
protected  Loggerlogger
    

Constructor Summary
public  RsIterator(RsQueryObject queryObject, PersistenceBrokerImpl broker)
     RsIterator constructor.

Method Summary
public  booleanabsolute(int row)
     Moves the cursor to the given row number in the iterator.
protected  voidautoReleaseDbResources()
     Internally used by this class to close used resources as soon as possible.
protected  intcountedSize()
    
public  voiddisableLifeCycleEvents()
    
protected  voidfinalize()
     safety just in case someone leaks.
public  intfullSize()
    
protected  PBLifeCycleEventgetAfterLookupEvent()
    
protected  PersistenceBrokerInternalgetBroker()
    
protected  MaterializationCachegetCache()
    
public  ClassDescriptorgetClassDescriptor()
    
protected  JdbcConnectionDescriptorgetConnectionDescriptor()
    
protected  DescriptorRepositorygetDescriptorRepository()
    
protected  booleangetHasNext()
    
protected  IdentitygetIdentityFromResultSet()
    
protected  ClassgetItemProxyClass()
    
protected  ObjectgetObjectFromResultSet()
     returns a fully materialized Object from the current row of the underlying resultset.
protected  ObjectgetProxyFromResultSet()
     Reads primary key information from current RS row and generates a corresponding Identity, and returns a proxy from the Identity.
protected  RsQueryObjectgetQueryObject()
    
protected  MapgetRow()
    
protected  ResultSetAndStatementgetRsAndStmt()
    
protected  ClassgetTopLevelClass()
    
public synchronized  booleanhasNext()
     returns true if there are still more rows in the underlying ResultSet.
protected  booleanisHasCalledCheck()
    
protected  booleanisInBatchedMode()
    
public synchronized  Objectnext()
     moves to the next row of the underlying ResultSet and returns the corresponding Object materialized from this row.
public  booleanrelative(int row)
     Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the iterator positions the cursor before/after the the first/last row.
 voidrelease(boolean removeResourceListener)
    
public  voidreleaseDbResources()
     Release all internally used Database resources of the iterator.
public  voidremove()
    
protected  voidsetAfterLookupEvent(PBLifeCycleEvent afterLookupEvent)
    
public  voidsetAutoRelease(boolean autoRelease)
     Allows user to switch off/on automatic resource cleanup.
protected  voidsetBroker(PersistenceBrokerImpl broker)
    
protected  voidsetCache(MaterializationCache cache)
    
protected  voidsetHasCalledCheck(boolean hasCalledCheck)
    
protected  voidsetHasNext(boolean hasNext)
    
protected  voidsetInBatchedMode(boolean inBatchedMode)
    
protected  voidsetItemProxyClass(Class itemProxyClass)
    
protected  voidsetQueryObject(RsQueryObject queryObject)
    
protected  voidsetRow(Map row)
    
protected  voidsetRsAndStmt(ResultSetAndStatement rsAndStmt)
    
public  intsize()
    
public  StringtoString()
    

Field Detail
logger
protected Logger logger(Code)




Constructor Detail
RsIterator
public RsIterator(RsQueryObject queryObject, PersistenceBrokerImpl broker)(Code)
RsIterator constructor.
Parameters:
  queryObject - query object
Parameters:
  broker - the broker we should use.




Method Detail
absolute
public boolean absolute(int row) throws PersistenceBrokerException(Code)
Moves the cursor to the given row number in the iterator. If the row number is positive, the cursor moves to the given row number with respect to the beginning of the iterator. The first row is row 1, the second is row 2, and so on.
Parameters:
  row - the row to move to in this iterator, by absolute number



autoReleaseDbResources
protected void autoReleaseDbResources()(Code)
Internally used by this class to close used resources as soon as possible.



countedSize
protected int countedSize() throws PersistenceBrokerException(Code)
Answer the counted size int



disableLifeCycleEvents
public void disableLifeCycleEvents()(Code)

See Also:   org.apache.ojb.broker.accesslayer.OJBIterator.disableLifeCycleEvents



finalize
protected void finalize()(Code)
safety just in case someone leaks.



fullSize
public int fullSize() throws PersistenceBrokerException(Code)



getAfterLookupEvent
protected PBLifeCycleEvent getAfterLookupEvent()(Code)



getBroker
protected PersistenceBrokerInternal getBroker()(Code)



getCache
protected MaterializationCache getCache()(Code)



getClassDescriptor
public ClassDescriptor getClassDescriptor()(Code)
Returns the cld.



getConnectionDescriptor
protected JdbcConnectionDescriptor getConnectionDescriptor()(Code)



getDescriptorRepository
protected DescriptorRepository getDescriptorRepository()(Code)
Return the DescriptorRepository



getHasNext
protected boolean getHasNext()(Code)



getIdentityFromResultSet
protected Identity getIdentityFromResultSet() throws PersistenceBrokerException(Code)
returns an Identity object representing the current resultset row



getItemProxyClass
protected Class getItemProxyClass()(Code)



getObjectFromResultSet
protected Object getObjectFromResultSet() throws PersistenceBrokerException(Code)
returns a fully materialized Object from the current row of the underlying resultset. Works as follows: - read Identity from the primary key values of current row - check if Object is in cache - return cached object or read it from current row and put it in cache



getProxyFromResultSet
protected Object getProxyFromResultSet() throws PersistenceBrokerException(Code)
Reads primary key information from current RS row and generates a corresponding Identity, and returns a proxy from the Identity.
throws:
  PersistenceBrokerException - if there was an error creating the proxy class



getQueryObject
protected RsQueryObject getQueryObject()(Code)



getRow
protected Map getRow()(Code)



getRsAndStmt
protected ResultSetAndStatement getRsAndStmt()(Code)



getTopLevelClass
protected Class getTopLevelClass()(Code)



hasNext
public synchronized boolean hasNext()(Code)
returns true if there are still more rows in the underlying ResultSet. Returns false if ResultSet is exhausted.



isHasCalledCheck
protected boolean isHasCalledCheck()(Code)



isInBatchedMode
protected boolean isInBatchedMode()(Code)



next
public synchronized Object next() throws NoSuchElementException(Code)
moves to the next row of the underlying ResultSet and returns the corresponding Object materialized from this row.



relative
public boolean relative(int row) throws PersistenceBrokerException(Code)
Moves the cursor a relative number of rows, either positive or negative. Attempting to move beyond the first/last row in the iterator positions the cursor before/after the the first/last row. Calling relative(0) is valid, but does not change the cursor position.
Parameters:
  row - the row to move to in this iterator, by relative number



release
void release(boolean removeResourceListener)(Code)



releaseDbResources
public void releaseDbResources()(Code)
Release all internally used Database resources of the iterator. Clients must call this methods explicitely if the iterator is not exhausted by the client application. If the Iterator is exhauseted this method will be called implicitely.



remove
public void remove()(Code)
removing is not supported



setAfterLookupEvent
protected void setAfterLookupEvent(PBLifeCycleEvent afterLookupEvent)(Code)



setAutoRelease
public void setAutoRelease(boolean autoRelease)(Code)
Allows user to switch off/on automatic resource cleanup. Set false to take responsibility of resource cleanup for this class, means after use it's mandatory to call RsIterator.releaseDbResources .
By default it's true and resource cleanup is done automatic.



setBroker
protected void setBroker(PersistenceBrokerImpl broker)(Code)



setCache
protected void setCache(MaterializationCache cache)(Code)



setHasCalledCheck
protected void setHasCalledCheck(boolean hasCalledCheck)(Code)



setHasNext
protected void setHasNext(boolean hasNext)(Code)



setInBatchedMode
protected void setInBatchedMode(boolean inBatchedMode)(Code)



setItemProxyClass
protected void setItemProxyClass(Class itemProxyClass)(Code)



setQueryObject
protected void setQueryObject(RsQueryObject queryObject)(Code)



setRow
protected void setRow(Map row)(Code)



setRsAndStmt
protected void setRsAndStmt(ResultSetAndStatement rsAndStmt)(Code)



size
public int size() throws PersistenceBrokerException(Code)
the size of the iterator, aka the number of rows in thisiterator.



toString
public String toString()(Code)



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.