Source Code Cross Referenced for JDOSpeedo.java in  » Database-ORM » Speedo_1.4.5 » org » objectweb » speedo » jdo » 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 » Speedo_1.4.5 » org.objectweb.speedo.jdo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (C) 2001-2005 France Telecom R&D
003:         */package org.objectweb.speedo.jdo;
004:
005:        import org.objectweb.speedo.AbstractSpeedo;
006:        import org.objectweb.speedo.lib.BooleanHelper;
007:        import org.objectweb.speedo.lib.Personality;
008:        import org.objectweb.speedo.pm.jdo.api.JDOPOManagerFactoryItf;
009:        import org.objectweb.util.monolog.api.BasicLevel;
010:
011:        import java.util.Collection;
012:        import java.util.HashMap;
013:        import java.util.Iterator;
014:        import java.util.Map;
015:        import java.util.Properties;
016:
017:        import javax.jdo.JDOUserException;
018:        import javax.jdo.PersistenceManager;
019:        import javax.jdo.PersistenceManagerFactory;
020:        import javax.jdo.datastore.DataStoreCache;
021:        import javax.jdo.listener.InstanceLifecycleListener;
022:
023:        /**
024:         * This class is a client helper which permits to create a new speedo
025:         * instance. Due to the JDO constraint the persistence manager
026:         * factory implementation must have a public empty contructor. But the use of
027:         * the fractal component (www.objectweb.org/fractal) needs to use a
028:         * fractal implementation to initialize components. Then this class is an
029:         * implementation of the PersistentManagerFactory interface which delegates all
030:         * calls on a persistent manager factory delegate. The constructor of this class
031:         * make the components creation and their initialization via Julia (fractal
032:         * implementation).
033:         *
034:         * @author S.Chassande-Barrioz
035:         */
036:        public class JDOSpeedo extends AbstractSpeedo implements 
037:                PersistenceManagerFactory {
038:
039:            private static final long serialVersionUID = 8894700146086754548L;
040:
041:            private static final Map INSTANCES = new HashMap();
042:
043:            // method called by the JDOHelper.getPersistenceManagerFactory method
044:            public static PersistenceManagerFactory getPersistenceManagerFactory(
045:                    Properties props) throws Throwable {
046:                return getPersistenceManagerFactory((Map) props);
047:            }
048:
049:            // method called by the JDOHelper.getPersistenceManagerFactory method
050:            public static PersistenceManagerFactory getPersistenceManagerFactory(
051:                    Map m) throws Throwable {
052:                AbstractSpeedo instance;
053:                synchronized (INSTANCES) {
054:                    instance = (AbstractSpeedo) INSTANCES.get(m);
055:                    if (instance == null) {
056:                        instance = new JDOSpeedo(m);
057:                        INSTANCES.put(m, instance);
058:                    }
059:                }
060:                return (PersistenceManagerFactory) instance;
061:            }
062:
063:            public static void clearInstances() {
064:                INSTANCES.clear();
065:            }
066:
067:            public JDOSpeedo() throws Throwable {
068:                super ();
069:            }
070:
071:            public JDOSpeedo(Map props) throws Throwable {
072:                super (props);
073:            }
074:
075:            protected void throwUserException(String msg) {
076:                throw new JDOUserException(msg);
077:            }
078:
079:            protected void applyProperties(Map props, Map pmfProps)
080:                    throws Throwable {
081:                super .applyProperties(props, pmfProps);
082:                for (Iterator it = props.entrySet().iterator(); it.hasNext();) {
083:                    Map.Entry me = (Map.Entry) it.next();
084:                    String key = (String) me.getKey();
085:                    String value = (String) me.getValue();
086:                    boolean knownProperty = true;
087:                    boolean print = true;
088:                    if (JDO_OPTION_RETAIN_VALUES.equals(key)) {
089:                        ((JDOPOManagerFactoryItf) delegate)
090:                                .setRetainValues(Boolean.valueOf(value)
091:                                        .booleanValue());
092:
093:                    } else if (JDO_OPTION_RESTORE_VALUES.equals(key)) {
094:                        ((JDOPOManagerFactoryItf) delegate)
095:                                .setRestoreValues(Boolean.valueOf(value)
096:                                        .booleanValue());
097:
098:                    } else if (JDO_OPTION_IGNORE_CACHE.equals(key)) {
099:                        ((JDOPOManagerFactoryItf) delegate)
100:                                .setIgnoreCache(Boolean.valueOf(value)
101:                                        .booleanValue());
102:
103:                    } else if (JDO_OPTION_NON_TRANSACTIONAL_READ.equals(key)) {
104:                        ((JDOPOManagerFactoryItf) delegate)
105:                                .setNontransactionalRead(Boolean.valueOf(value)
106:                                        .booleanValue());
107:
108:                    } else if (JDO_OPTION_NON_TRANSACTIONAL_WRITE.equals(key)) {
109:                        ((JDOPOManagerFactoryItf) delegate)
110:                                .setNontransactionalWrite(Boolean
111:                                        .valueOf(value).booleanValue());
112:
113:                    } else if (JDO_OPTION_MULTITREADED.equals(key)) {
114:                        ((JDOPOManagerFactoryItf) delegate)
115:                                .setMultithreaded(Boolean.valueOf(value)
116:                                        .booleanValue());
117:
118:                    } else if (JDO_PERSISTENCE_MANAGER_FACTORY_CLASS
119:                            .equals(key)) {
120:                        print = false;
121:                    } else {
122:                        knownProperty = false;
123:                    }
124:                    if (knownProperty) {
125:                        if (print) {
126:                            logger.log(BasicLevel.INFO, key + ": " + value);
127:                        }
128:                        it.remove();
129:                    }
130:                }
131:            }
132:
133:            protected boolean isOptimisticTransaction(Map props) {
134:                return BooleanHelper.parse(getProperty(props,
135:                        JDO_OPTION_OPTIMISTIC, "false", true), false);
136:            }
137:
138:            public Personality getPersonality() {
139:                return Personality.JDO;
140:            }
141:
142:            public PersistenceManager getPersistenceManager() {
143:                if (!isPropertiesInitialized) {
144:                    try {
145:                        Properties p = getProperties();
146:                        getSpeedoComponent(p);
147:                        init(p);
148:                    } catch (Throwable e) {
149:                        System.err
150:                                .println("Error during the initilization of the Speedo "
151:                                        + "persistence manager factory:");
152:                        e.printStackTrace(System.err);
153:                        return null;
154:                    }
155:                }
156:
157:                return ((JDOPOManagerFactoryItf) delegate)
158:                        .getPersistenceManager();
159:            }
160:
161:            public PersistenceManager getPersistenceManager(String s, String s1) {
162:                if (!isPropertiesInitialized) {
163:                    try {
164:                        Properties p = getProperties();
165:                        getSpeedoComponent(p);
166:                        init(p);
167:                    } catch (Throwable e) {
168:                        System.err
169:                                .println("Error during the initilization of the Speedo "
170:                                        + "persistence manager factory:");
171:                        e.printStackTrace(System.err);
172:                        return null;
173:                    }
174:                }
175:                return ((JDOPOManagerFactoryItf) delegate)
176:                        .getPersistenceManager(s, s1);
177:            }
178:
179:            public void setConnectionUserName(String s) {
180:                ((JDOPOManagerFactoryItf) delegate).setConnectionUserName(s);
181:            }
182:
183:            public String getConnectionUserName() {
184:                return ((JDOPOManagerFactoryItf) delegate)
185:                        .getConnectionUserName();
186:            }
187:
188:            public void setConnectionPassword(String s) {
189:                ((JDOPOManagerFactoryItf) delegate).setConnectionPassword(s);
190:            }
191:
192:            public void setConnectionURL(String s) {
193:                ((JDOPOManagerFactoryItf) delegate).setConnectionURL(s);
194:            }
195:
196:            public String getConnectionURL() {
197:                return ((JDOPOManagerFactoryItf) delegate).getConnectionURL();
198:            }
199:
200:            public void setConnectionDriverName(String s) {
201:                ((JDOPOManagerFactoryItf) delegate).setConnectionDriverName(s);
202:            }
203:
204:            public String getConnectionDriverName() {
205:                return ((JDOPOManagerFactoryItf) delegate)
206:                        .getConnectionDriverName();
207:            }
208:
209:            public void setConnectionFactoryName(String s) {
210:                ((JDOPOManagerFactoryItf) delegate).setConnectionFactoryName(s);
211:            }
212:
213:            public String getConnectionFactoryName() {
214:                return ((JDOPOManagerFactoryItf) delegate)
215:                        .getConnectionFactoryName();
216:            }
217:
218:            public void setConnectionFactory(Object o) {
219:                ((JDOPOManagerFactoryItf) delegate).setConnectionFactory(o);
220:            }
221:
222:            public Object getConnectionFactory() {
223:                return ((JDOPOManagerFactoryItf) delegate)
224:                        .getConnectionFactory();
225:            }
226:
227:            public void setConnectionFactory2Name(String s) {
228:                ((JDOPOManagerFactoryItf) delegate)
229:                        .setConnectionFactory2Name(s);
230:            }
231:
232:            public String getConnectionFactory2Name() {
233:                return ((JDOPOManagerFactoryItf) delegate)
234:                        .getConnectionFactory2Name();
235:            }
236:
237:            public void setConnectionFactory2(Object o) {
238:                ((JDOPOManagerFactoryItf) delegate).setConnectionFactory2(o);
239:            }
240:
241:            public Object getConnectionFactory2() {
242:                return ((JDOPOManagerFactoryItf) delegate)
243:                        .getConnectionFactory2();
244:            }
245:
246:            public void setMultithreaded(boolean b) {
247:                ((JDOPOManagerFactoryItf) delegate).setMultithreaded(b);
248:            }
249:
250:            public boolean getMultithreaded() {
251:                return ((JDOPOManagerFactoryItf) delegate).getMultithreaded();
252:            }
253:
254:            public void setOptimistic(boolean b) {
255:                ((JDOPOManagerFactoryItf) delegate).setOptimistic(b);
256:            }
257:
258:            public boolean getOptimistic() {
259:                return ((JDOPOManagerFactoryItf) delegate).getOptimistic();
260:            }
261:
262:            public void setRetainValues(boolean b) {
263:                ((JDOPOManagerFactoryItf) delegate).setRetainValues(b);
264:            }
265:
266:            public boolean getRetainValues() {
267:                return ((JDOPOManagerFactoryItf) delegate).getRetainValues();
268:            }
269:
270:            public void setRestoreValues(boolean b) {
271:                ((JDOPOManagerFactoryItf) delegate).setRestoreValues(b);
272:            }
273:
274:            public boolean getRestoreValues() {
275:                return ((JDOPOManagerFactoryItf) delegate).getRestoreValues();
276:            }
277:
278:            public void setNontransactionalRead(boolean b) {
279:                ((JDOPOManagerFactoryItf) delegate).setNontransactionalRead(b);
280:            }
281:
282:            public boolean getNontransactionalRead() {
283:                return ((JDOPOManagerFactoryItf) delegate)
284:                        .getNontransactionalRead();
285:            }
286:
287:            public void setNontransactionalWrite(boolean b) {
288:                ((JDOPOManagerFactoryItf) delegate).setNontransactionalWrite(b);
289:            }
290:
291:            public boolean getNontransactionalWrite() {
292:                return ((JDOPOManagerFactoryItf) delegate)
293:                        .getNontransactionalWrite();
294:            }
295:
296:            public void setIgnoreCache(boolean b) {
297:                ((JDOPOManagerFactoryItf) delegate).setIgnoreCache(b);
298:            }
299:
300:            public boolean getIgnoreCache() {
301:                return ((JDOPOManagerFactoryItf) delegate).getIgnoreCache();
302:            }
303:
304:            public Properties getProperties() {
305:                return ((JDOPOManagerFactoryItf) delegate).getProperties();
306:            }
307:
308:            public Collection supportedOptions() {
309:                return ((JDOPOManagerFactoryItf) delegate).supportedOptions();
310:            }
311:
312:            public void close() {
313:                ((JDOPOManagerFactoryItf) delegate).close();
314:                stopComponent();
315:            }
316:
317:            public DataStoreCache getDataStoreCache() {
318:                return ((JDOPOManagerFactoryItf) delegate).getDataStoreCache();
319:            }
320:
321:            public String getMapping() {
322:                return ((JDOPOManagerFactoryItf) delegate).getMapping();
323:            }
324:
325:            public boolean isClosed() {
326:                return ((JDOPOManagerFactoryItf) delegate).isClosed();
327:            }
328:
329:            public void setMapping(String arg0) {
330:                ((JDOPOManagerFactoryItf) delegate).setMapping(arg0);
331:            }
332:
333:            public void evict(Object arg0) {
334:                ((JDOPOManagerFactoryItf) delegate).evict(arg0);
335:            }
336:
337:            public void evictAll() {
338:                ((JDOPOManagerFactoryItf) delegate).evictAll();
339:            }
340:
341:            public void evictAll(Class arg0, boolean arg1) {
342:                ((JDOPOManagerFactoryItf) delegate).evictAll(arg0, arg1);
343:            }
344:
345:            public void evictAll(Collection arg0) {
346:                ((JDOPOManagerFactoryItf) delegate).evictAll(arg0);
347:            }
348:
349:            public void evictAll(Object[] arg0) {
350:                ((JDOPOManagerFactoryItf) delegate).evictAll(arg0);
351:            }
352:
353:            public void pin(Object arg0) {
354:                ((JDOPOManagerFactoryItf) delegate).pin(arg0);
355:            }
356:
357:            public void pinAll(Class arg0, boolean arg1) {
358:                ((JDOPOManagerFactoryItf) delegate).pinAll(arg0, arg1);
359:            }
360:
361:            public void pinAll(Collection arg0) {
362:                ((JDOPOManagerFactoryItf) delegate).pinAll(arg0);
363:            }
364:
365:            public void pinAll(Object[] arg0) {
366:                ((JDOPOManagerFactoryItf) delegate).pinAll(arg0);
367:            }
368:
369:            public void unpin(Object arg0) {
370:                ((JDOPOManagerFactoryItf) delegate).unpin(arg0);
371:            }
372:
373:            public void unpinAll(Class arg0, boolean arg1) {
374:                ((JDOPOManagerFactoryItf) delegate).unpinAll(arg0, arg1);
375:            }
376:
377:            public void unpinAll(Collection arg0) {
378:                ((JDOPOManagerFactoryItf) delegate).unpinAll(arg0);
379:            }
380:
381:            public void unpinAll(Object[] arg0) {
382:                ((JDOPOManagerFactoryItf) delegate).unpinAll(arg0);
383:            }
384:
385:            public void addInstanceLifecycleListener(
386:                    InstanceLifecycleListener arg0, Class[] arg1) {
387:                ((JDOPOManagerFactoryItf) delegate)
388:                        .addInstanceLifecycleListener(arg0, arg1);
389:            }
390:
391:            public void removeInstanceLifecycleListener(
392:                    InstanceLifecycleListener arg0) {
393:                ((JDOPOManagerFactoryItf) delegate)
394:                        .removeInstanceLifecycleListener(arg0);
395:            }
396:
397:            /* (non-Javadoc)
398:             * @see javax.jdo.PersistenceManagerFactory#getDetachAllOnCommit()
399:             */
400:            public boolean getDetachAllOnCommit() {
401:                // TODO Auto-generated method stub
402:                return false;
403:            }
404:
405:            /* (non-Javadoc)
406:             * @see javax.jdo.PersistenceManagerFactory#setDetachAllOnCommit(boolean)
407:             */
408:            public void setDetachAllOnCommit(boolean arg0) {
409:                // TODO Auto-generated method stub
410:
411:            }
412:
413:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.