Clover coverage report - JFox Service-Oriented Application Framework - 1.0-RC1 Coverage timestamp: 星期五 八月 19 2005 13:21:55 CST FRAMES NO FRAMES |
file stats: | LOC: | 754 |  | Methods: | 39
| NCLOC: | 553 |  | Classes: | 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
Source file | Conditionals | Statements | Methods | TOTAL
JdoServiceImpl.java | 6.2% | 2.1% | 7.7% | 2.8% |

1 |  |
     /**
2 |  |
      * @(#)JDOServiceImpl.java
3 |  |
      *
4 |  |
      * JFoxSOAF, Service-Oriented Application Framework
5 |  |
      *
6 |  |
      * Copyright(c) JFoxSOAF Team
7 |  |
      *
8 |  |
      * Licensed under the GNU LGPL, Version 2.1 (the "License");
9 |  |
      * you may not use this file except in compliance with the License.
10 |  |
      * You may obtain a copy of the License at
11 |  |
      *
12 |  |
      * http://www.gnu.org/copyleft/lesser.html
13 |  |
      *
14 |  |
      * Unless required by applicable law or agreed to in writing, software
15 |  |
      * distributed under the License is distributed on an "AS IS" BASIS,
16 |  |
      * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 |  |
      * See the License for the specific language governing permissions and
18 |  |
      * limitations under the License.
19 |  |
      *
20 |  |
      * For more information, please visit:
21 |  |
      * http://www.jfox.cn/confluence/display/JFoxSOAF/Home
22 |  |
      * http://www.huihoo.org/jfox/jfoxsoaf
23 |  |
      */
24 |  |
25 |  |
     package org.huihoo.jfox.soaf.services.persistence;
26 |  |
27 |  |
     import java.io.IOException;
28 |  |
     import java.util.Collection;
29 |  |
     import java.util.Map;
30 |  |
     import java.util.Properties;
31 |  |
32 |  |
     import javax.jdo.JDOException;
33 |  |
     import javax.jdo.JDOHelper;
34 |  |
     import javax.jdo.PersistenceManager;
35 |  |
     import javax.jdo.PersistenceManagerFactory;
36 |  |
     import javax.jdo.Query;
37 |  |
     import javax.jdo.Transaction;
38 |  |
39 |  |
     import org.apache.commons.logging.Log;
40 |  |
     import org.apache.commons.logging.LogFactory;
41 |  |
     import org.huihoo.jfox.soaf.exception.DAOException;
42 |  |
     import org.huihoo.jfox.soaf.util.resource.ResourceHelper;
43 |  |
     import org.picocontainer.Startable;
44 |  |
45 |  |
     /**
46 |  |
      * <p>
47 |  |
      * JDO persistence service wrapper implementation
48 |  |
      * </p>
49 |  |
      *
50 |  |
      * @author <a href="mailto:founder_chen@yahoo.com.cn">Peter Cheng </a>
51 |  |
      * @version $Revision:$ $Date:$
52 |  |
      * @version Revision: 1.0
53 |  |
      */
54 |  |
55 |  |
     public class JdoServiceImpl implements JdoService, Startable {
56 |  |
57 |  |
         private final Log logger = LogFactory.getLog(getClass());
58 |  |
59 |  |
         private static final String JDO_CONFIG = "jpox.properties";
60 |  |
61 |  |
         private PersistenceManagerFactory pmFactory;
62 |  |
63 |  |
         private Transaction transaction;
64 |  |
65 |  |
         private PersistenceManager pm;
66 |  |
67 |  |
         /**
68 |  |
          * Default Constructor.
69 |  |
          */
70 | 4 |
         public JdoServiceImpl() throws Exception {
71 |  |
         }
72 |  |
73 |  |
         /**
74 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getPersistenceManager()
75 |  |
          */
76 | 1 |
         public PersistenceManager getPersistenceManager() throws JDOException {
77 | 1 |
             if (pm == null) {
78 | 1 |
                 pm = pmFactory.getPersistenceManager();
79 |  |
             }
80 | 1 |
             return pm;
81 |  |
         }
82 |  |
83 |  |
         /**
84 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#openTransaction()
85 |  |
          */
86 | 0 |
         public void beginTransaction() throws JDOException {
87 | 0 |
             if (pm == null && transaction == null) {
88 | 0 |
                 pm = getPersistenceManager();
89 | 0 |
                 transaction = pm.currentTransaction();
90 | 0 |
                 transaction.begin();
91 |  |
             }
92 |  |
         }
93 |  |
94 |  |
         /**
95 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#commit()
96 |  |
          */
97 | 0 |
         public void commit() throws JDOException {
98 | 0 |
             if (pm != null && !pm.isClosed() && transaction != null
99 |  |
                     && transaction.isActive()) {
100 | 0 |
                 transaction.commit();
101 |  |
             }
102 |  |
         }
103 |  |
104 |  |
         /**
105 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#rollback()
106 |  |
          */
107 | 0 |
         public void rollback() throws JDOException {
108 | 0 |
             if (pm != null && !pm.isClosed() && transaction != null
109 |  |
                     && transaction.isActive()) {
110 | 0 |
                 transaction.rollback();
111 |  |
             }
112 |  |
         }
113 |  |
114 |  |
         /**
115 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#close()
116 |  |
          */
117 | 0 |
         public void close() throws JDOException {
118 | 0 |
             if (pm != null && !pm.isClosed()) {
119 | 0 |
                 pm.close();
120 | 0 |
                 pm = null;
121 |  |
             }
122 |  |
         }
123 |  |
124 |  |
         /**
125 |  |
          * @see org.picocontainer.Startable#start()
126 |  |
          */
127 | 4 |
         public void start() {
128 | 4 |
             try {
129 | 4 |
                 Properties prop = ResourceHelper
130 |  |
                         .getResourceAsProperties(JDO_CONFIG);
131 | 4 |
                 pmFactory = JDOHelper.getPersistenceManagerFactory(prop);
132 |  |
             } catch (IOException e) {
133 | 0 |
                 logger.error("Failed to start JDO service " + e.getMessage());
134 |  |
             }
135 | 4 |
             logger.info("Start jdo service successful.");
136 |  |
         }
137 |  |
138 |  |
         /**
139 |  |
          * @see org.picocontainer.Startable#stop()
140 |  |
          */
141 | 0 |
         public void stop() {
142 |  |
         }
143 |  |
144 |  |
         /**
145 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Object)
146 |  |
          */
147 | 0 |
         public Object getObjectById(Object oid) throws JDOException, DAOException {
148 | 0 |
             Object obj;
149 | 0 |
             PersistenceManager pm;
150 | 0 |
             try {
151 | 0 |
                 pm = getPersistenceManager();
152 | 0 |
                 beginTransaction();
153 | 0 |
                 obj = pm.getObjectById(oid);
154 | 0 |
                 commit();
155 |  |
             } catch (Exception e) {
156 | 0 |
                 rollback();
157 | 0 |
                 throw new DAOException(e);
158 |  |
             } finally {
159 | 0 |
                 pm = null;
160 | 0 |
                 close();
161 |  |
             }
162 | 0 |
             return obj;
163 |  |
         }
164 |  |
165 |  |
         /**
166 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Class, Object)
167 |  |
          */
168 | 0 |
         public Object getObjectById(Class clazz, Object oid) throws JDOException,
169 |  |
                 DAOException {
170 | 0 |
             Object obj;
171 | 0 |
             PersistenceManager pm;
172 | 0 |
             try {
173 | 0 |
                 pm = getPersistenceManager();
174 | 0 |
                 beginTransaction();
175 | 0 |
                 obj = pm.getObjectById(clazz, oid);
176 | 0 |
                 commit();
177 |  |
             } catch (Exception e) {
178 | 0 |
                 rollback();
179 | 0 |
                 throw new DAOException(e);
180 |  |
             } finally {
181 | 0 |
                 pm = null;
182 | 0 |
                 close();
183 |  |
             }
184 | 0 |
             return obj;
185 |  |
         }
186 |  |
187 |  |
         /**
188 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Object, boolean)
189 |  |
          */
190 | 0 |
         public Object getObjectById(Object oid, boolean validate)
191 |  |
                 throws JDOException, DAOException {
192 | 0 |
             Object obj;
193 | 0 |
             PersistenceManager pm;
194 | 0 |
             try {
195 | 0 |
                 pm = getPersistenceManager();
196 | 0 |
                 beginTransaction();
197 | 0 |
                 obj = pm.getObjectById(oid, validate);
198 | 0 |
                 commit();
199 |  |
             } catch (Exception e) {
200 | 0 |
                 rollback();
201 | 0 |
                 throw new DAOException(e);
202 |  |
             } finally {
203 | 0 |
                 pm = null;
204 | 0 |
                 close();
205 |  |
             }
206 | 0 |
             return obj;
207 |  |
         }
208 |  |
209 |  |
         /**
210 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Object)
211 |  |
          */
212 | 0 |
         public Object getObjectId(Object pc) throws JDOException, DAOException {
213 | 0 |
             Object obj;
214 | 0 |
             PersistenceManager pm;
215 | 0 |
             try {
216 | 0 |
                 pm = getPersistenceManager();
217 | 0 |
                 beginTransaction();
218 | 0 |
                 obj = pm.getObjectById(pc);
219 | 0 |
                 commit();
220 |  |
             } catch (Exception e) {
221 | 0 |
                 rollback();
222 | 0 |
                 throw new DAOException(e);
223 |  |
             } finally {
224 | 0 |
                 pm = null;
225 | 0 |
                 close();
226 |  |
             }
227 | 0 |
             return obj;
228 |  |
         }
229 |  |
230 |  |
         /**
231 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Class)
232 |  |
          */
233 | 0 |
         public Class getObjectIdClass(Class clazz) throws JDOException,
234 |  |
                 DAOException {
235 | 0 |
             Class claz;
236 | 0 |
             PersistenceManager pm;
237 | 0 |
             try {
238 | 0 |
                 pm = getPersistenceManager();
239 | 0 |
                 beginTransaction();
240 | 0 |
                 claz = pm.getObjectIdClass(clazz);
241 | 0 |
                 commit();
242 |  |
             } catch (Exception e) {
243 | 0 |
                 rollback();
244 | 0 |
                 throw new DAOException(e);
245 |  |
             } finally {
246 | 0 |
                 pm = null;
247 | 0 |
                 close();
248 |  |
             }
249 | 0 |
             return claz;
250 |  |
         }
251 |  |
252 |  |
         /**
253 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectsById(Collection)
254 |  |
          */
255 | 0 |
         public Collection getObjectsById(Collection oids) throws JDOException,
256 |  |
                 DAOException {
257 | 0 |
             Collection coll;
258 | 0 |
             PersistenceManager pm;
259 | 0 |
             try {
260 | 0 |
                 pm = getPersistenceManager();
261 | 0 |
                 beginTransaction();
262 | 0 |
                 coll = pm.getObjectsById(oids);
263 | 0 |
                 commit();
264 |  |
             } catch (Exception e) {
265 | 0 |
                 rollback();
266 | 0 |
                 throw new DAOException(e);
267 |  |
             } finally {
268 | 0 |
                 pm = null;
269 | 0 |
                 close();
270 |  |
             }
271 | 0 |
             return coll;
272 |  |
         }
273 |  |
274 |  |
         /**
275 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectById(Object, boolean)
276 |  |
          */
277 | 0 |
         public Collection getObjectsById(Collection oids, boolean validate)
278 |  |
                 throws JDOException, DAOException {
279 | 0 |
             Collection coll;
280 | 0 |
             PersistenceManager pm;
281 | 0 |
             try {
282 | 0 |
                 pm = getPersistenceManager();
283 | 0 |
                 beginTransaction();
284 | 0 |
                 coll = pm.getObjectsById(oids, validate);
285 | 0 |
                 commit();
286 |  |
             } catch (Exception e) {
287 | 0 |
                 rollback();
288 | 0 |
                 throw new DAOException(e);
289 |  |
             } finally {
290 | 0 |
                 pm = null;
291 | 0 |
                 close();
292 |  |
             }
293 | 0 |
             return coll;
294 |  |
         }
295 |  |
296 |  |
         /**
297 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectsById(Object[])
298 |  |
          */
299 | 0 |
         public Object[] getObjectsById(Object[] oids) throws JDOException,
300 |  |
                 DAOException {
301 | 0 |
             Object[] objects;
302 | 0 |
             PersistenceManager pm;
303 | 0 |
             try {
304 | 0 |
                 pm = getPersistenceManager();
305 | 0 |
                 beginTransaction();
306 | 0 |
                 objects = pm.getObjectsById(oids);
307 | 0 |
                 commit();
308 |  |
             } catch (Exception e) {
309 | 0 |
                 rollback();
310 | 0 |
                 throw new DAOException(e);
311 |  |
             } finally {
312 | 0 |
                 pm = null;
313 | 0 |
                 close();
314 |  |
             }
315 | 0 |
             return objects;
316 |  |
         }
317 |  |
318 |  |
         /**
319 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#getObjectsById(Object[], boolean)
320 |  |
          */
321 | 0 |
         public Object[] getObjectsById(Object[] oids, boolean validate)
322 |  |
                 throws JDOException, DAOException {
323 | 0 |
             Object[] objects;
324 | 0 |
             PersistenceManager pm;
325 | 0 |
             try {
326 | 0 |
                 pm = getPersistenceManager();
327 | 0 |
                 beginTransaction();
328 | 0 |
                 objects = pm.getObjectsById(oids, validate);
329 | 0 |
                 commit();
330 |  |
             } catch (Exception e) {
331 | 0 |
                 rollback();
332 | 0 |
                 throw new DAOException(e);
333 |  |
             } finally {
334 | 0 |
                 pm = null;
335 | 0 |
                 close();
336 |  |
             }
337 | 0 |
             return objects;
338 |  |
         }
339 |  |
340 |  |
         /**
341 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Class)
342 |  |
          */
343 | 0 |
         public Collection query(Class clazz) throws JDOException, DAOException {
344 | 0 |
             Collection coll;
345 | 0 |
             PersistenceManager pm;
346 | 0 |
             Query query;
347 | 0 |
             try {
348 | 0 |
                 pm = getPersistenceManager();
349 | 0 |
                 beginTransaction();
350 | 0 |
                 query = pm.newQuery(clazz);
351 | 0 |
                 coll = (Collection) query.execute();
352 | 0 |
                 commit();
353 |  |
             } catch (Exception e) {
354 | 0 |
                 rollback();
355 | 0 |
                 throw new DAOException(e);
356 |  |
             } finally {
357 | 0 |
                 pm = null;
358 | 0 |
                 close();
359 |  |
             }
360 | 0 |
             return coll;
361 |  |
         }
362 |  |
363 |  |
         /**
364 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Class, String)
365 |  |
          */
366 | 0 |
         public Collection query(Class clazz, String filter) throws JDOException,
367 |  |
                 DAOException {
368 | 0 |
             return query(clazz, filter, null);
369 |  |
         }
370 |  |
371 |  |
         /**
372 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Class, String)
373 |  |
          */
374 | 0 |
         public Collection query(Class clazz, String filter, String ordering)
375 |  |
                 throws JDOException, DAOException {
376 | 0 |
             Collection coll;
377 | 0 |
             PersistenceManager pm;
378 | 0 |
             Query query;
379 | 0 |
             try {
380 | 0 |
                 pm = getPersistenceManager();
381 | 0 |
                 beginTransaction();
382 | 0 |
                 query = pm.newQuery(clazz, filter);
383 | 0 |
                 if (ordering != null) {
384 | 0 |
                     query.setOrdering(ordering);
385 |  |
                 }
386 | 0 |
                 coll = (Collection) query.execute();
387 | 0 |
                 commit();
388 |  |
             } catch (Exception e) {
389 | 0 |
                 rollback();
390 | 0 |
                 throw new DAOException(e);
391 |  |
             } finally {
392 | 0 |
                 pm = null;
393 | 0 |
                 close();
394 |  |
             }
395 | 0 |
             return coll;
396 |  |
         }
397 |  |
398 |  |
         /**
399 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#queryWithMap(Class, String, String, Map)
400 |  |
          */
401 | 0 |
         public Collection queryWithMap(Class clazz, String filter,
402 |  |
                 String parameters, Map values) throws JDOException, DAOException {
403 | 0 |
             return queryWithMap(clazz, filter, null, parameters, values);
404 |  |
         }
405 |  |
406 |  |
         /**
407 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#queryWithMap(Class, String, String, String, Map)
408 |  |
          */
409 | 0 |
         public Collection queryWithMap(Class clazz, String filter, String ordering,
410 |  |
                 String parameters, Map values) throws JDOException, DAOException {
411 | 0 |
             Collection coll;
412 | 0 |
             PersistenceManager pm;
413 | 0 |
             Query query;
414 | 0 |
             try {
415 | 0 |
                 pm = getPersistenceManager();
416 | 0 |
                 beginTransaction();
417 | 0 |
                 query = pm.newQuery(clazz, filter);
418 | 0 |
                 if (ordering != null) {
419 | 0 |
                     query.setOrdering(ordering);
420 |  |
                 }
421 | 0 |
                 query.declareParameters(parameters);
422 | 0 |
                 coll = (Collection) query.executeWithMap(values);
423 | 0 |
                 commit();
424 |  |
             } catch (Exception e) {
425 | 0 |
                 rollback();
426 | 0 |
                 throw new DAOException(e);
427 |  |
             } finally {
428 | 0 |
                 pm = null;
429 | 0 |
                 close();
430 |  |
             }
431 | 0 |
             return coll;
432 |  |
         }
433 |  |
434 |  |
         /**
435 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#queryWithMap(Class, String, String, Object[])
436 |  |
          */
437 | 0 |
         public Collection queryWithMap(Class clazz, String filter,
438 |  |
                 String parameters, Object[] values) throws JDOException,
439 |  |
                 DAOException {
440 | 0 |
             return queryWithMap(clazz, filter, null, parameters, values);
441 |  |
         }
442 |  |
443 |  |
         /**
444 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#queryWithMap(Class, String, String, String, Object[])
445 |  |
          */
446 | 0 |
         public Collection queryWithMap(Class clazz, String filter, String ordering,
447 |  |
                 String parameters, Object[] values) throws JDOException,
448 |  |
                 DAOException {
449 | 0 |
             Collection coll;
450 | 0 |
             PersistenceManager pm;
451 | 0 |
             Query query;
452 | 0 |
             try {
453 | 0 |
                 pm = getPersistenceManager();
454 | 0 |
                 beginTransaction();
455 | 0 |
                 query = pm.newQuery(clazz, filter);
456 | 0 |
                 if (ordering != null) {
457 | 0 |
                     query.setOrdering(ordering);
458 |  |
                 }
459 | 0 |
                 query.declareParameters(parameters);
460 | 0 |
                 coll = (Collection) query.executeWithArray(values);
461 | 0 |
                 commit();
462 |  |
             } catch (Exception e) {
463 | 0 |
                 rollback();
464 | 0 |
                 throw new DAOException(e);
465 |  |
             } finally {
466 | 0 |
                 pm = null;
467 | 0 |
                 close();
468 |  |
             }
469 | 0 |
             return coll;
470 |  |
         }
471 |  |
472 |  |
         /**
473 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Class, Collection)
474 |  |
          */
475 | 0 |
         public Collection query(Class clazz, Collection coll) throws JDOException,
476 |  |
                 DAOException {
477 | 0 |
             Collection cln;
478 | 0 |
             PersistenceManager pm;
479 | 0 |
             Query query;
480 | 0 |
             try {
481 | 0 |
                 pm = getPersistenceManager();
482 | 0 |
                 beginTransaction();
483 | 0 |
                 query = pm.newQuery(clazz, coll);
484 | 0 |
                 cln = (Collection) query.execute();
485 | 0 |
                 commit();
486 |  |
             } catch (Exception e) {
487 | 0 |
                 rollback();
488 | 0 |
                 throw new DAOException(e);
489 |  |
             } finally {
490 | 0 |
                 pm = null;
491 | 0 |
                 close();
492 |  |
             }
493 | 0 |
             return cln;
494 |  |
495 |  |
         }
496 |  |
497 |  |
         /**
498 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Class, Collection, String)
499 |  |
          */
500 | 0 |
         public Collection query(Class clazz, Collection coll, String filter)
501 |  |
                 throws JDOException, DAOException {
502 | 0 |
             Collection cln;
503 | 0 |
             PersistenceManager pm;
504 | 0 |
             Query query;
505 | 0 |
             try {
506 | 0 |
                 pm = getPersistenceManager();
507 | 0 |
                 beginTransaction();
508 | 0 |
                 query = pm.newQuery(clazz, coll, filter);
509 | 0 |
                 cln = (Collection) query.execute();
510 | 0 |
                 commit();
511 |  |
             } catch (Exception e) {
512 | 0 |
                 rollback();
513 | 0 |
                 throw new DAOException(e);
514 |  |
             } finally {
515 | 0 |
                 pm = null;
516 | 0 |
                 close();
517 |  |
             }
518 | 0 |
             return cln;
519 |  |
         }
520 |  |
521 |  |
         /**
522 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(Object)
523 |  |
          */
524 | 0 |
         public Collection query(Object object) throws JDOException, DAOException {
525 | 0 |
             Collection cln;
526 | 0 |
             PersistenceManager pm;
527 | 0 |
             Query query;
528 | 0 |
             try {
529 | 0 |
                 pm = getPersistenceManager();
530 | 0 |
                 beginTransaction();
531 | 0 |
                 query = pm.newQuery(object);
532 | 0 |
                 cln = (Collection) query.execute();
533 | 0 |
                 commit();
534 |  |
             } catch (Exception e) {
535 | 0 |
                 rollback();
536 | 0 |
                 throw new DAOException(e);
537 |  |
             } finally {
538 | 0 |
                 pm = null;
539 | 0 |
                 close();
540 |  |
             }
541 | 0 |
             return cln;
542 |  |
         }
543 |  |
544 |  |
         /**
545 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#query(String)
546 |  |
          */
547 | 0 |
         public Collection query(String queryStr) throws JDOException, DAOException {
548 | 0 |
             Collection cln;
549 | 0 |
             PersistenceManager pm;
550 | 0 |
             Query query;
551 | 0 |
             try {
552 | 0 |
                 pm = getPersistenceManager();
553 | 0 |
                 beginTransaction();
554 | 0 |
                 query = pm.newQuery(queryStr);
555 | 0 |
                 cln = (Collection) query.execute();
556 | 0 |
                 commit();
557 |  |
             } catch (Exception e) {
558 | 0 |
                 rollback();
559 | 0 |
                 throw new DAOException(e);
560 |  |
             } finally {
561 | 0 |
                 pm = null;
562 | 0 |
                 close();
563 |  |
             }
564 | 0 |
             return cln;
565 |  |
         }
566 |  |
567 |  |
         /**
568 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#evict(Object)
569 |  |
          */
570 | 0 |
         public void evict(Object object) throws JDOException, DAOException {
571 | 0 |
             PersistenceManager pm;
572 | 0 |
             try {
573 | 0 |
                 pm = getPersistenceManager();
574 | 0 |
                 pm.evict(object);
575 |  |
             } catch (Exception e) {
576 | 0 |
                 throw new DAOException(e);
577 |  |
             } finally {
578 | 0 |
                 pm = null;
579 | 0 |
                 close();
580 |  |
             }
581 |  |
         }
582 |  |
583 |  |
         /**
584 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#evictAll()
585 |  |
          */
586 | 0 |
         public void evictAll() throws JDOException, DAOException {
587 | 0 |
             PersistenceManager pm;
588 | 0 |
             try {
589 | 0 |
                 pm = getPersistenceManager();
590 | 0 |
                 pm.evictAll();
591 |  |
             } catch (Exception e) {
592 | 0 |
                 throw new DAOException(e);
593 |  |
             } finally {
594 | 0 |
                 pm = null;
595 | 0 |
                 close();
596 |  |
             }
597 |  |
         }
598 |  |
599 |  |
         /**
600 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#evictAll(Collection)
601 |  |
          */
602 | 0 |
         public void evictAll(Collection coll) throws JDOException, DAOException {
603 | 0 |
             PersistenceManager pm;
604 | 0 |
             try {
605 | 0 |
                 pm = getPersistenceManager();
606 | 0 |
                 pm.evictAll(coll);
607 |  |
             } catch (Exception e) {
608 | 0 |
                 throw new DAOException(e);
609 |  |
             } finally {
610 | 0 |
                 pm = null;
611 | 0 |
                 close();
612 |  |
             }
613 |  |
         }
614 |  |
615 |  |
         /**
616 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#evictAll(Object[])
617 |  |
          */
618 | 0 |
         public void evictAll(Object[] objects) throws JDOException, DAOException {
619 | 0 |
             PersistenceManager pm;
620 | 0 |
             try {
621 | 0 |
                 pm = getPersistenceManager();
622 | 0 |
                 pm.evictAll(objects);
623 |  |
             } catch (Exception e) {
624 | 0 |
                 rollback();
625 | 0 |
                 throw new DAOException(e);
626 |  |
             } finally {
627 | 0 |
                 pm = null;
628 | 0 |
                 close();
629 |  |
             }
630 |  |
         }
631 |  |
632 |  |
         /**
633 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#flush()
634 |  |
          */
635 | 0 |
         public void flush() throws JDOException, DAOException {
636 | 0 |
             PersistenceManager pm;
637 | 0 |
             try {
638 | 0 |
                 pm = getPersistenceManager();
639 | 0 |
                 pm.flush();
640 |  |
             } catch (Exception e) {
641 | 0 |
                 rollback();
642 | 0 |
                 throw new DAOException(e);
643 |  |
             } finally {
644 | 0 |
                 pm = null;
645 | 0 |
                 close();
646 |  |
             }
647 |  |
         }
648 |  |
649 |  |
         /**
650 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#makePersistent(Object)
651 |  |
          */
652 | 0 |
         public void makePersistent(Object object) throws JDOException, DAOException {
653 | 0 |
             PersistenceManager pm;
654 | 0 |
             try {
655 | 0 |
                 pm = getPersistenceManager();
656 | 0 |
                 pm.makePersistent(object);
657 |  |
             } catch (Exception e) {
658 | 0 |
                 rollback();
659 | 0 |
                 throw new DAOException(e);
660 |  |
             } finally {
661 | 0 |
                 pm = null;
662 | 0 |
                 close();
663 |  |
             }
664 |  |
         }
665 |  |
666 |  |
         /**
667 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#makePersistentAll(Collection)
668 |  |
          */
669 | 0 |
         public void makePersistentAll(Collection coll) throws JDOException,
670 |  |
                 DAOException {
671 | 0 |
             PersistenceManager pm;
672 | 0 |
             try {
673 | 0 |
                 pm = getPersistenceManager();
674 | 0 |
                 pm.makePersistentAll(coll);
675 |  |
             } catch (Exception e) {
676 | 0 |
                 rollback();
677 | 0 |
                 throw new DAOException(e);
678 |  |
             } finally {
679 | 0 |
                 pm = null;
680 | 0 |
                 close();
681 |  |
             }
682 |  |
         }
683 |  |
684 |  |
         /**
685 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#makePersistentAll(Object[])
686 |  |
          */
687 | 0 |
         public void makePersistentAll(Object[] objects) throws JDOException,
688 |  |
                 DAOException {
689 | 0 |
             PersistenceManager pm;
690 | 0 |
             try {
691 | 0 |
                 pm = getPersistenceManager();
692 | 0 |
                 pm.makePersistentAll(objects);
693 |  |
             } catch (Exception e) {
694 | 0 |
                 rollback();
695 | 0 |
                 throw new DAOException(e);
696 |  |
             } finally {
697 | 0 |
                 pm = null;
698 | 0 |
                 close();
699 |  |
             }
700 |  |
         }
701 |  |
702 |  |
         /**
703 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#deletePersistent(Object)
704 |  |
          */
705 | 0 |
         public void deletePersistent(Object object) throws JDOException,
706 |  |
                 DAOException {
707 | 0 |
             PersistenceManager pm;
708 | 0 |
             try {
709 | 0 |
                 pm = getPersistenceManager();
710 | 0 |
                 pm.deletePersistent(object);
711 |  |
             } catch (Exception e) {
712 | 0 |
                 rollback();
713 | 0 |
                 throw new DAOException(e);
714 |  |
             } finally {
715 | 0 |
                 pm = null;
716 | 0 |
                 close();
717 |  |
             }
718 |  |
         }
719 |  |
720 |  |
         /**
721 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#deletePersistentAll(Collection)
722 |  |
          */
723 | 0 |
         public void deletePersistentAll(Collection coll) throws JDOException,
724 |  |
                 DAOException {
725 | 0 |
             PersistenceManager pm;
726 | 0 |
             try {
727 | 0 |
                 pm = getPersistenceManager();
728 | 0 |
                 pm.deletePersistent(coll);
729 |  |
             } catch (Exception e) {
730 | 0 |
                 rollback();
731 | 0 |
                 throw new DAOException(e);
732 |  |
             } finally {
733 | 0 |
                 pm = null;
734 | 0 |
                 close();
735 |  |
             }
736 |  |
         }
737 |  |
738 |  |
         /**
739 |  |
          * @see org.huihoo.jfox.soaf.services.persistence.JdoService#deletePersistentAll(Object[])
740 |  |
          */
741 | 0 |
         public void deletePersistentAll(Object[] objects) {
742 | 0 |
             PersistenceManager pm;
743 | 0 |
             try {
744 | 0 |
                 pm = getPersistenceManager();
745 | 0 |
                 pm.deletePersistent(objects);
746 |  |
             } catch (Exception e) {
747 | 0 |
                 rollback();
748 | 0 |
                 throw new DAOException(e);
749 |  |
             } finally {
750 | 0 |
                 pm = null;
751 | 0 |
                 close();
752 |  |
             }
753 |  |
         }
754 |  |
     }