|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| AbstractPersistenceManager.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* AbstractPersistenceManager.java
|
|
| 3 |
* Copyright 2002-2004 Bill2, Inc.
|
|
| 4 |
*
|
|
| 5 |
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
| 6 |
* you may not use this file except in compliance with the License.
|
|
| 7 |
* You may obtain a copy of the License at
|
|
| 8 |
*
|
|
| 9 |
* http://www.apache.org/licenses/LICENSE-2.0
|
|
| 10 |
*
|
|
| 11 |
* Unless required by applicable law or agreed to in writing, software
|
|
| 12 |
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
| 13 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
| 14 |
* See the License for the specific language governing permissions and
|
|
| 15 |
* limitations under the License.
|
|
| 16 |
*/
|
|
| 17 |
package org.dentaku.services.persistence.hibernate;
|
|
| 18 |
|
|
| 19 |
import org.codehaus.plexus.personality.plexus.lifecycle.phase.Initializable;
|
|
| 20 |
import org.dentaku.services.persistence.PersistenceException;
|
|
| 21 |
import org.dentaku.services.persistence.PersistenceFactory;
|
|
| 22 |
import org.dentaku.services.persistence.PersistenceManager;
|
|
| 23 |
|
|
| 24 |
import java.util.Iterator;
|
|
| 25 |
import java.util.Map;
|
|
| 26 |
|
|
| 27 |
public abstract class AbstractPersistenceManager implements PersistenceManager, Initializable { |
|
| 28 |
protected SessionProvider sessionProvider = null; |
|
| 29 |
private Map factories = null; |
|
| 30 |
|
|
| 31 | 0 |
public PersistenceFactory getPersistenceFactory(String name) throws PersistenceException { |
| 32 | 0 |
PersistenceFactory persistenceFactory = (PersistenceFactory) factories.get(name); |
| 33 | 0 |
return persistenceFactory;
|
| 34 |
} |
|
| 35 |
|
|
| 36 | 0 |
public SessionProvider getSessionProvider() {
|
| 37 | 0 |
return sessionProvider;
|
| 38 |
} |
|
| 39 |
|
|
| 40 | 0 |
public void releaseSession() throws PersistenceException { |
| 41 | 0 |
sessionProvider.releaseSession(); |
| 42 |
} |
|
| 43 |
|
|
| 44 | 0 |
public void rollback() { |
| 45 | 0 |
sessionProvider.rollback(); |
| 46 |
} |
|
| 47 |
|
|
| 48 | 0 |
public void initialize() throws Exception { |
| 49 | 0 |
for (Iterator it = factories.values().iterator(); it.hasNext();) {
|
| 50 | 0 |
PersistenceFactory factory = (PersistenceFactory) it.next(); |
| 51 | 0 |
factory.setManager(this);
|
| 52 |
} |
|
| 53 |
} |
|
| 54 |
} |
|
| 55 |
|
|
||||||||||