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


org.apache.ojb.broker.PersistenceBroker

All known Subclasses:   org.apache.ojb.broker.core.PersistenceBrokerBean,
PersistenceBroker
public interface PersistenceBroker extends Configurable,ObjectContainer(Code)
PersistenceBroker declares a protocol for persisting arbitrary objects. A typical implementation might wrap an RDBMS access layer.
See Also:   org.apache.ojb.broker.core.PersistenceBrokerImpl
See Also:   org.apache.ojb.broker.core.PersistenceBrokerBean
author:
   Thomas Mahler
version:
   $Id: PersistenceBroker.java,v 1.30.2.6 2005/12/22 20:40:17 tomdz Exp $




Method Summary
public  voidabortTransaction()
     Aborts and closes the current transaction.
public  voidaddListener(PBListener listener)
     Adds a temporary org.apache.ojb.broker.PBListener to this broker.
public  voidaddListener(PBListener listener, boolean permanent)
     Adds a temporary or permanent org.apache.ojb.broker.PBListener to this broker, depending on the parameter value.
public  voidaddMtoNImplementor(MtoNImplementor m2nImpl)
     Stores the given m:n implementor int the underlying persistence system.
public  voidbeginTransaction()
     Begins a transaction against the underlying RDBMS.
public  voidclearCache()
     Clears the broker's internal cache.
public  booleanclose()
     Closes this broker so that no further requests may be made on it.
public  voidcommitTransaction()
     Commits and closes the current transaction.
public  voiddelete(Object obj)
     Deletes the given object's persistent representation in the underlying persistence system. This is usually done by issuing a DELETE ...
public  voiddeleteByQuery(Query query)
     Deletes all objects matching the given query, from the underlying persistence system. This is usually done via DELETE ...
public  voiddeleteMtoNImplementor(MtoNImplementor m2nImpl)
     Deletes an m:n implementor which defines the relationship between two persistent objects. This is usually a row in an indirection table.
Note that OJB currently doesn't handle collection inheritance, so collections descriptors are written per class.
public  voidfireBrokerEvent(PersistenceBrokerEvent event)
     Fires a broker event to inform all registered PBListener instances.
public  voidfireBrokerEvent(PBLifeCycleEvent event)
     Fires a life cycle event to inform all registered PBListener instances.
public  voidfireBrokerEvent(PBStateEvent event)
     Fires a state event to inform all registered PBListener instances.
public  ClassDescriptorgetClassDescriptor(Class clazz)
     Returns the class descriptor for the given persistence capable class.
public  CollectiongetCollectionByQuery(Query query)
     Retrieves the persistent objects matching the given query.
public  ManageableCollectiongetCollectionByQuery(Class collectionClass, Query query)
     Retrieves the persistent objects matching the given query.
public  intgetCount(Query query)
     Returns the number of elements that the given query will return.
public  DescriptorRepositorygetDescriptorRepository()
     Returns the metadata descriptor repository associated with this broker.
public  IteratorgetIteratorByQuery(Query query)
     Retrieves the persistent objects matching the given query and returns them as an iterator which may, depending on the configured collection type, be reloading the objects from the database upon calling Iterator.next .
public  ObjectgetObjectByIdentity(Identity id)
     Retrieve a persistent object from the underlying datastore by its identity.
public  ObjectgetObjectByQuery(Query query)
     Retrieve the (first) persistent object from the underlying datastore that matches the given query.
public  PBKeygetPBKey()
     Get the PBKey for this broker.
public  EnumerationgetPKEnumerationByQuery(Class pkClass, Query query)
     Returns an enumeration of objects representing the primary keys for the objects that match the given query.
public  IteratorgetReportQueryIteratorByQuery(Query query)
     Retrieves the rows (as Object[] instances) matching the given query and returns them as an iterator which may, depending on the configured collection type, be reloading the objects from the database upon calling Iterator.next .
public  ClassgetTopLevelClass(Class clazz)
     Returns the top level class (most abstract class in terms of extents) from which the given class extends.
public  booleanhasClassDescriptor(Class clazz)
     Determines whether the given class is persistence capable and thus has an associated class descriptor in the metadata.
public  booleanisClosed()
     Determines whether this broker is closed.
public  booleanisInTransaction()
     Determines whether there is currently a transaction in progress.
public  voidremoveAllListeners()
     Removes all temporary listeners from this broker.
public  voidremoveAllListeners(boolean permanent)
     Removes all temporary and, if desired, permanent listeners from this broker.
public  voidremoveFromCache(Object objectOrIdentity)
     Removes the given object or, if it is an instance of org.apache.ojb.broker.Identity , the object identified by it, from the broker's internal cache.
public  voidremoveListener(PBListener listener)
     Removes the specified listener from this broker.
public  voidretrieveAllReferences(Object obj)
     Retrieve all references and collections of the given object irrespective of the metadata settings defined for them.
public  voidretrieveReference(Object obj, String attrName)
     Retrieve the specified reference or collection attribute for the given persistent object.
public  BrokerHelperserviceBrokerHelper()
     Returns the org.apache.ojb.broker.util.BrokerHelper instance associated with this broker, which makes some additional helper methods available.
public  ConnectionManagerIFserviceConnectionManager()
     Returns the org.apache.ojb.broker.accesslayer.ConnectionManagerIF instance associated with this broker.
public  IdentityFactoryserviceIdentity()
     Return the IdentityFactory instance associated with this broker.
public  JdbcAccessserviceJdbcAccess()
     Returns the org.apache.ojb.broker.accesslayer.JdbcAccess instance associated with this broker.
public  ObjectCacheserviceObjectCache()
     Returns the org.apache.ojb.broker.cache.ObjectCache instance associated with this broker.
public  SequenceManagerserviceSequenceManager()
     Returns the org.apache.ojb.broker.util.sequence.SequenceManager instance associated with this broker.
public  SqlGeneratorserviceSqlGenerator()
     Returns the org.apache.ojb.broker.accesslayer.sql.SqlGenerator instance associated with this broker.
public  StatementManagerIFserviceStatementManager()
     Returns the org.apache.ojb.broker.accesslayer.StatementManagerIF instance associated with this broker.
public  voidstore(Object obj, ObjectModification modification)
     Makes the given object persistent in the underlying persistence system. This is usually done by issuing an INSERT ...
public  voidstore(Object obj)
     Make the given object persistent in the underlying persistence system. This is usually done by issuing an INSERT ...



Method Detail
abortTransaction
public void abortTransaction() throws TransactionNotInProgressException(Code)
Aborts and closes the current transaction. This abandons all persistent object modifications and releases the associated locks.
throws:
  TransactionNotInProgressException - If no transaction is currently in progress



addListener
public void addListener(PBListener listener) throws PersistenceBrokerException(Code)
Adds a temporary org.apache.ojb.broker.PBListener to this broker. Note that temporary listeners will be removed upon closing a broker (returning it to the pool).
Parameters:
  listener - The listener to add
See Also:   PersistenceBroker.addListener(PBListener,boolean)



addListener
public void addListener(PBListener listener, boolean permanent) throws PersistenceBrokerException(Code)
Adds a temporary or permanent org.apache.ojb.broker.PBListener to this broker, depending on the parameter value. Note that temporary listeners will be removed upon closing a broker (returning it to the pool).
NOTE: Handle carefully when using this method, keep in mind you don't know which broker instance will be returned next time from the pool! To guarantee that a listener is connect to every broker, the best way is to define your own implementation of org.apache.ojb.broker.core.PersistenceBrokerFactoryIF or extend the default one, org.apache.ojb.broker.core.PersistenceBrokerFactoryDefaultImpl . There you can add the listener at creation of the org.apache.ojb.broker.PersistenceBroker instances.
Parameters:
  listener - The listener to add
Parameters:
  permanent - Whether the listener will stay registered after closingthe broker



addMtoNImplementor
public void addMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException(Code)
Stores the given m:n implementor int the underlying persistence system. This is usually done by inserting a row in an indirection table.
Note that OJB currently doesn't handle collection inheritance, so collections descriptors are written per class. We try to match one of these collection descriptors, iterating from the left side and looking for possible for classes on the right side using isAssignableFrom(rightClass).
Parameters:
  m2nImpl - The m:n implementor to delete



beginTransaction
public void beginTransaction() throws TransactionInProgressException, TransactionAbortedException(Code)
Begins a transaction against the underlying RDBMS.
throws:
  TransactionInProgressException - If there is already a transaction in progress



clearCache
public void clearCache() throws PersistenceBrokerException(Code)
Clears the broker's internal cache.



close
public boolean close()(Code)
Closes this broker so that no further requests may be made on it. Closing a broker might release it to the pool of available brokers, or might be garbage collected, at the option of the implementation. true if the broker was successfully closed



commitTransaction
public void commitTransaction() throws TransactionNotInProgressException, TransactionAbortedException(Code)
Commits and closes the current transaction. This commits all database-changing statements (e.g. UPDATE, INSERT and DELETE) issued within the transaction since the last commit to the database, and releases any locks held by the transaction.
throws:
  TransactionNotInProgressException - If there is no transaction currently in progress
throws:
  TransactionAbortedException - If the transaction cannot be committed



delete
public void delete(Object obj) throws PersistenceBrokerException(Code)
Deletes the given object's persistent representation in the underlying persistence system. This is usually done by issuing a DELETE ... in an RDBMS
Parameters:
  obj - The object to delete



deleteByQuery
public void deleteByQuery(Query query) throws PersistenceBrokerException(Code)
Deletes all objects matching the given query, from the underlying persistence system. This is usually done via DELETE ... in an RDBMS.
Note: This method directly perform the delete statement ignoring any object references and does not synchronize the cache - take care!
Parameters:
  query - The query determining the objects to delete



deleteMtoNImplementor
public void deleteMtoNImplementor(MtoNImplementor m2nImpl) throws PersistenceBrokerException(Code)
Deletes an m:n implementor which defines the relationship between two persistent objects. This is usually a row in an indirection table.
Note that OJB currently doesn't handle collection inheritance, so collections descriptors are written per class. We try to match one of these collection descriptors, iterating from the left side and looking for possible for classes on the right side using isAssignableFrom(rightClass). TODO: handle cache problems TODO: delete more than one row if possible
Parameters:
  m2nImpl - The m:n implementor to delete



fireBrokerEvent
public void fireBrokerEvent(PersistenceBrokerEvent event)(Code)
Fires a broker event to inform all registered PBListener instances.
Parameters:
  event - The event to fire



fireBrokerEvent
public void fireBrokerEvent(PBLifeCycleEvent event)(Code)
Fires a life cycle event to inform all registered PBListener instances.
Parameters:
  event - The event to fire



fireBrokerEvent
public void fireBrokerEvent(PBStateEvent event)(Code)
Fires a state event to inform all registered PBListener instances.
Parameters:
  event - The event to fire



getClassDescriptor
public ClassDescriptor getClassDescriptor(Class clazz) throws PersistenceBrokerException(Code)
Returns the class descriptor for the given persistence capable class.
Parameters:
  clazz - The target class The class descriptor
throws:
  PersistenceBrokerException - If the class is not persistence capable, i.e.if no metadata was defined for this class and hence its class descriptorwas not found



getCollectionByQuery
public Collection getCollectionByQuery(Query query) throws PersistenceBrokerException(Code)
Retrieves the persistent objects matching the given query. Note that if the Query has no criteria ALL persistent objects of the class targeted by the query will be returned.
Parameters:
  query - The query The persistent objects matching the query



getCollectionByQuery
public ManageableCollection getCollectionByQuery(Class collectionClass, Query query) throws PersistenceBrokerException(Code)
Retrieves the persistent objects matching the given query. The resulting collection will be of the supplied collection type. Note that if the Query has no criteria ALL persistent objects of the class targeted by the query will be returned.
Parameters:
  collectionClass - The collection type which needs to implementManageableCollection
Parameters:
  query - The query The persistent objects matching the query



getCount
public int getCount(Query query) throws PersistenceBrokerException(Code)
Returns the number of elements that the given query will return.
Parameters:
  query - The query The number of elements returned by the query



getDescriptorRepository
public DescriptorRepository getDescriptorRepository()(Code)
Returns the metadata descriptor repository associated with this broker. The descriptor repository



getIteratorByQuery
public Iterator getIteratorByQuery(Query query) throws PersistenceBrokerException(Code)
Retrieves the persistent objects matching the given query and returns them as an iterator which may, depending on the configured collection type, be reloading the objects from the database upon calling Iterator.next . Note that if the Query has no criteria ALL persistent objects of the class targeted by the query will be returned.
Parameters:
  query - The query The persistent objects matching the query



getObjectByIdentity
public Object getObjectByIdentity(Identity id) throws PersistenceBrokerException(Code)
Retrieve a persistent object from the underlying datastore by its identity. However, users are encouraged to use PersistenceBroker.getObjectByQuery(Query) instead, as this method is mainly intended to be used for internal handling of materialization by OID (e.g. in Proxies).
Parameters:
  id - The persistent object's id The persistent object



getObjectByQuery
public Object getObjectByQuery(Query query) throws PersistenceBrokerException(Code)
Retrieve the (first) persistent object from the underlying datastore that matches the given query.
Parameters:
  query - The query The persistent object



getPBKey
public PBKey getPBKey()(Code)
Get the PBKey for this broker. The broker key



getPKEnumerationByQuery
public Enumeration getPKEnumerationByQuery(Class pkClass, Query query) throws PersistenceBrokerException(Code)
Returns an enumeration of objects representing the primary keys for the objects that match the given query. Mainly useful for EJB Finder Methods.
Note: This method is not yet aware of extents!
Parameters:
  pkClass - The class to use for the primary keys
Parameters:
  query - The query The pk enumeration



getReportQueryIteratorByQuery
public Iterator getReportQueryIteratorByQuery(Query query) throws PersistenceBrokerException(Code)
Retrieves the rows (as Object[] instances) matching the given query and returns them as an iterator which may, depending on the configured collection type, be reloading the objects from the database upon calling Iterator.next .
Parameters:
  query - The report query The rows matching the query



getTopLevelClass
public Class getTopLevelClass(Class clazz) throws PersistenceBrokerException(Code)
Returns the top level class (most abstract class in terms of extents) from which the given class extends. This may be a (abstract) base-class, an interface or the given class itself, if no extent is defined.
Parameters:
  clazz - The class to get the top level class for The top level class for it
throws:
  PersistenceBrokerException - If the class is not persistence capable,if no metadata was defined for this class



hasClassDescriptor
public boolean hasClassDescriptor(Class clazz)(Code)
Determines whether the given class is persistence capable and thus has an associated class descriptor in the metadata.
Parameters:
  clazz - The target class true if a class descriptor was found



isClosed
public boolean isClosed()(Code)
Determines whether this broker is closed. true if this instance is closed



isInTransaction
public boolean isInTransaction() throws PersistenceBrokerException(Code)
Determines whether there is currently a transaction in progress. true if there is a transaction in progress



removeAllListeners
public void removeAllListeners() throws PersistenceBrokerException(Code)
Removes all temporary listeners from this broker. Use with care, because some internals rely on this mechanism.
See Also:   PersistenceBroker.removeListener(PBListener)



removeAllListeners
public void removeAllListeners(boolean permanent) throws PersistenceBrokerException(Code)
Removes all temporary and, if desired, permanent listeners from this broker. Use with care, because some internals rely on this mechanism.
Parameters:
  permanent - Whether the listener will stay registered after closingthe broker
See Also:   PersistenceBroker.removeListener(PBListener)



removeFromCache
public void removeFromCache(Object objectOrIdentity) throws PersistenceBrokerException(Code)
Removes the given object or, if it is an instance of org.apache.ojb.broker.Identity , the object identified by it, from the broker's internal cache. Note that the removal is not recursive. This means, objects referenced by the removed object will not be automatically removed from the cache by this operation.
Parameters:
  objectOrIdentity - The object to be removed from the cache or its identity



removeListener
public void removeListener(PBListener listener) throws PersistenceBrokerException(Code)
Removes the specified listener from this broker.
Parameters:
  listener - The listener to remove



retrieveAllReferences
public void retrieveAllReferences(Object obj) throws PersistenceBrokerException(Code)
Retrieve all references and collections of the given object irrespective of the metadata settings defined for them.
Parameters:
  obj - The persistent object



retrieveReference
public void retrieveReference(Object obj, String attrName) throws PersistenceBrokerException(Code)
Retrieve the specified reference or collection attribute for the given persistent object.
Parameters:
  obj - The persistent object
Parameters:
  attrName - The name of the attribute to retrieve



serviceBrokerHelper
public BrokerHelper serviceBrokerHelper()(Code)
Returns the org.apache.ojb.broker.util.BrokerHelper instance associated with this broker, which makes some additional helper methods available. The broker helper object



serviceConnectionManager
public ConnectionManagerIF serviceConnectionManager()(Code)
Returns the org.apache.ojb.broker.accesslayer.ConnectionManagerIF instance associated with this broker. The connection manager



serviceIdentity
public IdentityFactory serviceIdentity()(Code)
Return the IdentityFactory instance associated with this broker. The identity factory



serviceJdbcAccess
public JdbcAccess serviceJdbcAccess()(Code)
Returns the org.apache.ojb.broker.accesslayer.JdbcAccess instance associated with this broker. The JDBC access object



serviceObjectCache
public ObjectCache serviceObjectCache()(Code)
Returns the org.apache.ojb.broker.cache.ObjectCache instance associated with this broker. The object cache



serviceSequenceManager
public SequenceManager serviceSequenceManager()(Code)
Returns the org.apache.ojb.broker.util.sequence.SequenceManager instance associated with this broker. The sequence manager



serviceSqlGenerator
public SqlGenerator serviceSqlGenerator()(Code)
Returns the org.apache.ojb.broker.accesslayer.sql.SqlGenerator instance associated with this broker. The SQL generator



serviceStatementManager
public StatementManagerIF serviceStatementManager()(Code)
Returns the org.apache.ojb.broker.accesslayer.StatementManagerIF instance associated with this broker. The statement manager



store
public void store(Object obj, ObjectModification modification) throws PersistenceBrokerException(Code)
Makes the given object persistent in the underlying persistence system. This is usually done by issuing an INSERT ... or UPDATE ... in an RDBMS.
Parameters:
  obj - The object to store
Parameters:
  modification - Specifies what operation to perform (for generating optimized SQL)



store
public void store(Object obj) throws PersistenceBrokerException(Code)
Make the given object persistent in the underlying persistence system. This is usually done by issuing an INSERT ... or UPDATE ... in an RDBMS.
Parameters:
  obj - The object to store



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