Ignore:
Timestamp:
03/05/10 14:55:59 (14 years ago)
Author:
oschonef
Message:
  • make DataStore? property of virtualCollectionRegistry (again)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/DataStore.java

    r146 r217  
    11package eu.clarin.cmdi.virtualcollectionregistry;
    22
    3 import java.util.HashMap;
    43import java.util.Map;
    54import java.util.logging.Level;
     
    2019                }
    2120        } // inner class ThreadLocalEntityManager
    22         private static final Logger logger = Logger.getLogger(DataStore.class
    23                         .getName());
    24         private static DataStore s_instance = new DataStore();
    25         private EntityManagerFactory emf = null;
    26         private ThreadLocalEntityManager em = new ThreadLocalEntityManager();
     21        private static final Logger logger =
     22                Logger.getLogger(DataStore.class.getName());
     23        private final EntityManagerFactory emf;
     24        private final ThreadLocalEntityManager em = new ThreadLocalEntityManager();
    2725
    28         private DataStore() {
    29         }
    30 
    31         public void initalize(Map<String, String> config)
    32                         throws VirtualCollectionRegistryException {
    33                 logger.fine("initializing");
    34                 if (config != null) {
    35                         config = new HashMap<String, String>();
    36                 }
     26        DataStore(Map<String, String> config)
     27                throws VirtualCollectionRegistryException {
    3728                try {
    3829                        emf = Persistence.createEntityManagerFactory(
     
    4031                } catch (Exception e) {
    4132                        logger.log(Level.SEVERE, "error initializing data store", e);
    42                         throw new VirtualCollectionRegistryException(
    43                                         "error initializing", e);
     33                        throw new VirtualCollectionRegistryException("error initializing",
     34                                        e);
    4435                }
    4536                logger.finer("data store was successfully initialized");
     
    5243        }
    5344
    54         public static DataStore instance() {
    55                 return s_instance;
    56         }
    57        
    5845        public EntityManager getEntityManager() {
    5946                return em.get();
     
    7158                }
    7259        }
    73 }
     60
     61} // class DataStore
Note: See TracChangeset for help on using the changeset viewer.