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


001:        package org.apache.ojb.broker.core;
002:
003:        /* Copyright 2003-2005 The Apache Software Foundation
004:         *
005:         * Licensed under the Apache License, Version 2.0 (the "License");
006:         * you may not use this file except in compliance with the License.
007:         * You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        import org.apache.ojb.broker.Identity;
019:        import org.apache.ojb.broker.MtoNImplementor;
020:        import org.apache.ojb.broker.ManageableCollection;
021:        import org.apache.ojb.broker.PBKey;
022:        import org.apache.ojb.broker.PBListener;
023:        import org.apache.ojb.broker.PBState;
024:        import org.apache.ojb.broker.PersistenceBroker;
025:        import org.apache.ojb.broker.PersistenceBrokerEvent;
026:        import org.apache.ojb.broker.PBLifeCycleEvent;
027:        import org.apache.ojb.broker.PBStateEvent;
028:        import org.apache.ojb.broker.PersistenceBrokerException;
029:        import org.apache.ojb.broker.TransactionAbortedException;
030:        import org.apache.ojb.broker.TransactionInProgressException;
031:        import org.apache.ojb.broker.TransactionNotInProgressException;
032:        import org.apache.ojb.broker.IdentityFactory;
033:        import org.apache.ojb.broker.PersistenceBrokerInternal;
034:        import org.apache.ojb.broker.accesslayer.ConnectionManagerIF;
035:        import org.apache.ojb.broker.accesslayer.JdbcAccess;
036:        import org.apache.ojb.broker.accesslayer.StatementManagerIF;
037:        import org.apache.ojb.broker.accesslayer.RelationshipPrefetcherFactory;
038:        import org.apache.ojb.broker.accesslayer.sql.SqlGenerator;
039:        import org.apache.ojb.broker.cache.ObjectCache;
040:        import org.apache.ojb.broker.core.proxy.ProxyFactory;
041:        import org.apache.ojb.broker.metadata.ClassDescriptor;
042:        import org.apache.ojb.broker.metadata.DescriptorRepository;
043:        import org.apache.ojb.broker.query.Query;
044:        import org.apache.ojb.broker.util.BrokerHelper;
045:        import org.apache.ojb.broker.util.ObjectModification;
046:        import org.apache.ojb.broker.util.configuration.Configuration;
047:        import org.apache.ojb.broker.util.configuration.ConfigurationException;
048:        import org.apache.ojb.broker.util.sequence.SequenceManager;
049:
050:        import java.util.Collection;
051:        import java.util.Enumeration;
052:        import java.util.Iterator;
053:
054:        /**
055:         * Delegating implementation of a PersistenceBroker.
056:         *
057:         * @author <a href="mailto:armin@codeAuLait.de">Armin Waibel</a>
058:         * @version $Id: DelegatingPersistenceBroker.java,v 1.11.2.7 2005/09/05 23:37:26 arminw Exp $
059:         */
060:        public class DelegatingPersistenceBroker implements 
061:                PersistenceBrokerInternal, PBState {
062:            protected PersistenceBrokerInternal m_broker;
063:
064:            public DelegatingPersistenceBroker(PersistenceBrokerInternal broker) {
065:                this .m_broker = broker;
066:            }
067:
068:            /**
069:             * All delegated method use this method to
070:             * get the wrapped broker.
071:             */
072:            protected PersistenceBrokerInternal getBroker() {
073:                if (m_broker != null) {
074:                    return m_broker;
075:                } else {
076:                    throw new IllegalStateException(
077:                            "This PersistenceBroker instance is already closed and no longer useable."
078:                                    + " It's not possible to re-use a closed instance.");
079:                }
080:
081:            }
082:
083:            /**
084:             * Returns only the wrapped
085:             * {@link org.apache.ojb.broker.PersistenceBroker} instance
086:             */
087:            public PersistenceBrokerInternal getDelegate() {
088:                return this .m_broker;
089:            }
090:
091:            public void setDelegate(PersistenceBrokerInternal broker) {
092:                this .m_broker = broker;
093:            }
094:
095:            /**
096:             * If my underlying {@link org.apache.ojb.broker.PersistenceBroker}
097:             * is not a {@link DelegatingPersistenceBroker}, returns it,
098:             * otherwise recursively invokes this method on my delegate.
099:             * <p>
100:             * Hence this method will return the first
101:             * delegate that is not a {@link DelegatingPersistenceBroker},
102:             * or <tt>null</tt> when no non-{@link DelegatingPersistenceBroker}
103:             * delegate can be found by transversing this chain.
104:             * <p>
105:             * This method is useful when you may have nested
106:             * {@link DelegatingPersistenceBroker}s, and you want to make
107:             * sure to obtain a "genuine" {@link org.apache.ojb.broker.PersistenceBroker}
108:             * implementaion instance.
109:             */
110:            public PersistenceBroker getInnermostDelegate() {
111:                PersistenceBroker broker = this .m_broker;
112:                while (broker != null
113:                        && broker instanceof  DelegatingPersistenceBroker) {
114:                    broker = ((DelegatingPersistenceBroker) broker)
115:                            .getDelegate();
116:                    if (this  == broker) {
117:                        return null;
118:                    }
119:                }
120:                return broker;
121:            }
122:
123:            public boolean isManaged() {
124:                return m_broker.isManaged();
125:            }
126:
127:            public void setManaged(boolean managed) {
128:                m_broker.setManaged(managed);
129:            }
130:
131:            public QueryReferenceBroker getReferenceBroker() {
132:                return m_broker.getReferenceBroker();
133:            }
134:
135:            public void checkRefreshRelationships(Object obj, Identity oid,
136:                    ClassDescriptor cld) {
137:                m_broker.checkRefreshRelationships(obj, oid, cld);
138:            }
139:
140:            public RelationshipPrefetcherFactory getRelationshipPrefetcherFactory() {
141:                return m_broker.getRelationshipPrefetcherFactory();
142:            }
143:
144:            public void store(Object obj, Identity oid, ClassDescriptor cld,
145:                    boolean insert, boolean ignoreReferences) {
146:                m_broker.store(obj, oid, cld, insert, ignoreReferences);
147:            }
148:
149:            public void delete(Object obj, boolean ignoreReferences)
150:                    throws PersistenceBrokerException {
151:                m_broker.delete(obj, ignoreReferences);
152:            }
153:
154:            public boolean isInTransaction() throws PersistenceBrokerException {
155:                return m_broker != null && getBroker().isInTransaction();
156:            }
157:
158:            public boolean isClosed() {
159:                return m_broker == null || getBroker().isClosed();
160:            }
161:
162:            public void setClosed(boolean closed) {
163:                ((PBState) getBroker()).setClosed(closed);
164:            }
165:
166:            public void beginTransaction()
167:                    throws TransactionInProgressException,
168:                    TransactionAbortedException {
169:                getBroker().beginTransaction();
170:            }
171:
172:            public void commitTransaction()
173:                    throws TransactionNotInProgressException,
174:                    TransactionAbortedException {
175:                getBroker().commitTransaction();
176:            }
177:
178:            public void abortTransaction()
179:                    throws TransactionNotInProgressException {
180:                getBroker().abortTransaction();
181:            }
182:
183:            public boolean close() {
184:                return getBroker().close();
185:            }
186:
187:            public SqlGenerator serviceSqlGenerator() {
188:                return getBroker().serviceSqlGenerator();
189:            }
190:
191:            public JdbcAccess serviceJdbcAccess() {
192:                return getBroker().serviceJdbcAccess();
193:            }
194:
195:            public void delete(Object obj) throws PersistenceBrokerException {
196:                getBroker().delete(obj);
197:            }
198:
199:            public void store(Object obj) throws PersistenceBrokerException {
200:                getBroker().store(obj);
201:            }
202:
203:            public void store(Object obj, ObjectModification modification)
204:                    throws PersistenceBrokerException {
205:                getBroker().store(obj, modification);
206:            }
207:
208:            public PBKey getPBKey() {
209:                return getBroker().getPBKey();
210:            }
211:
212:            public void removeFromCache(Object obj)
213:                    throws PersistenceBrokerException {
214:                getBroker().removeFromCache(obj);
215:            }
216:
217:            public void clearCache() throws PersistenceBrokerException {
218:                getBroker().clearCache();
219:            }
220:
221:            public DescriptorRepository getDescriptorRepository() {
222:                return getBroker().getDescriptorRepository();
223:            }
224:
225:            public void removeAllListeners() throws PersistenceBrokerException {
226:                getBroker().removeAllListeners();
227:            }
228:
229:            public void removeAllListeners(boolean permanent)
230:                    throws PersistenceBrokerException {
231:                getBroker().removeAllListeners(permanent);
232:            }
233:
234:            public void retrieveReference(Object pInstance,
235:                    String pAttributeName) throws PersistenceBrokerException {
236:                getBroker().retrieveReference(pInstance, pAttributeName);
237:            }
238:
239:            public void retrieveAllReferences(Object pInstance)
240:                    throws PersistenceBrokerException {
241:                getBroker().retrieveAllReferences(pInstance);
242:            }
243:
244:            public ConnectionManagerIF serviceConnectionManager() {
245:                return getBroker().serviceConnectionManager();
246:            }
247:
248:            public StatementManagerIF serviceStatementManager() {
249:                return getBroker().serviceStatementManager();
250:            }
251:
252:            public SequenceManager serviceSequenceManager() {
253:                return getBroker().serviceSequenceManager();
254:            }
255:
256:            public BrokerHelper serviceBrokerHelper() {
257:                return getBroker().serviceBrokerHelper();
258:            }
259:
260:            public ObjectCache serviceObjectCache() {
261:                return getBroker().serviceObjectCache();
262:            }
263:
264:            public IdentityFactory serviceIdentity() {
265:                return getBroker().serviceIdentity();
266:            }
267:
268:            public void fireBrokerEvent(PersistenceBrokerEvent event) {
269:                getBroker().fireBrokerEvent(event);
270:            }
271:
272:            public void fireBrokerEvent(PBLifeCycleEvent event) {
273:                getBroker().fireBrokerEvent(event);
274:            }
275:
276:            public void fireBrokerEvent(PBStateEvent event) {
277:                getBroker().fireBrokerEvent(event);
278:            }
279:
280:            public void addListener(PBListener listener)
281:                    throws PersistenceBrokerException {
282:                getBroker().addListener(listener);
283:            }
284:
285:            public void addListener(PBListener listener, boolean permanent)
286:                    throws PersistenceBrokerException {
287:                getBroker().addListener(listener, permanent);
288:            }
289:
290:            public void removeListener(PBListener listener)
291:                    throws PersistenceBrokerException {
292:                //do nothing	    
293:            }
294:
295:            public Class getTopLevelClass(Class clazz)
296:                    throws PersistenceBrokerException {
297:                return getBroker().getTopLevelClass(clazz);
298:            }
299:
300:            public boolean hasClassDescriptor(Class clazz) {
301:                return getBroker().hasClassDescriptor(clazz);
302:            }
303:
304:            public ClassDescriptor getClassDescriptor(Class clazz)
305:                    throws PersistenceBrokerException {
306:                return getBroker().getClassDescriptor(clazz);
307:            }
308:
309:            public Enumeration getPKEnumerationByQuery(Class primaryKeyClass,
310:                    Query query) throws PersistenceBrokerException {
311:                return getBroker().getPKEnumerationByQuery(primaryKeyClass,
312:                        query);
313:            }
314:
315:            public Object getObjectByQuery(Query query)
316:                    throws PersistenceBrokerException {
317:                return getBroker().getObjectByQuery(query);
318:            }
319:
320:            public Object getObjectByIdentity(Identity id)
321:                    throws PersistenceBrokerException {
322:                return getBroker().getObjectByIdentity(id);
323:            }
324:
325:            public Iterator getReportQueryIteratorByQuery(Query query)
326:                    throws PersistenceBrokerException {
327:                return getBroker().getReportQueryIteratorByQuery(query);
328:            }
329:
330:            public Iterator getIteratorByQuery(Query query)
331:                    throws PersistenceBrokerException {
332:                return getBroker().getIteratorByQuery(query);
333:            }
334:
335:            public ManageableCollection getCollectionByQuery(
336:                    Class collectionClass, Query query)
337:                    throws PersistenceBrokerException {
338:                return getBroker().getCollectionByQuery(collectionClass, query);
339:            }
340:
341:            public int getCount(Query query) throws PersistenceBrokerException {
342:                return getBroker().getCount(query);
343:            }
344:
345:            public Collection getCollectionByQuery(Query query)
346:                    throws PersistenceBrokerException {
347:                return getBroker().getCollectionByQuery(query);
348:            }
349:
350:            public void configure(Configuration pConfig)
351:                    throws ConfigurationException {
352:                getBroker().configure(pConfig);
353:            }
354:
355:            public org.odbms.Query query() {
356:                return getBroker().query();
357:            }
358:
359:            public void deleteByQuery(Query query)
360:                    throws PersistenceBrokerException {
361:                getBroker().deleteByQuery(query);
362:            }
363:
364:            /**
365:             * @see org.apache.ojb.broker.PersistenceBroker#deleteMtoNImplementor
366:             */
367:            public void deleteMtoNImplementor(MtoNImplementor m2nImpl)
368:                    throws PersistenceBrokerException {
369:                getBroker().deleteMtoNImplementor(m2nImpl);
370:            }
371:
372:            /**
373:             * @see org.apache.ojb.broker.PersistenceBroker#addMtoNImplementor
374:             */
375:            public void addMtoNImplementor(MtoNImplementor m2nImpl)
376:                    throws PersistenceBrokerException {
377:                getBroker().addMtoNImplementor(m2nImpl);
378:            }
379:
380:            public ProxyFactory getProxyFactory() {
381:                return getBroker().getProxyFactory();
382:            }
383:
384:            public Object createProxy(Class proxyClass,
385:                    Identity realSubjectsIdentity) {
386:                return getBroker()
387:                        .createProxy(proxyClass, realSubjectsIdentity);
388:            }
389:
390:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.