public static ServiceRegistryImpl buildServiceRegistry(Map serviceRegistryConfig) {
   Properties properties = new Properties();
   properties.putAll(serviceRegistryConfig);
   Environment.verifyProperties(properties);
   ConfigurationHelper.resolvePlaceHolders(properties);
   return new ServiceRegistryImpl(properties);
 }
Beispiel #2
0
  static {
    try {
      Map<Object, Object> properties = getEntityManagerProperties();

      Environment.verifyProperties(properties);
      ConfigurationHelper.resolvePlaceHolders(properties);
      ServiceRegistry reg =
          new ServiceRegistryBuilder().applySettings(properties).buildServiceRegistry();

      DbOpenHelper openHelper =
          new DbOpenHelper(reg) {

            @Override
            public void onCreate() throws Exception {
              executeAllScript(0);
            }

            @Override
            public void onUpgrade(int oldVersion, int newVersion) throws Exception {
              // TODO Auto-generated method stub
            }
          };
      openHelper.open();

      emfInstance =
          Persistence.createEntityManagerFactory(
              "transactions-optional", getEntityManagerProperties());

    } catch (Throwable t) {
      log.error("Error creating EMF", t);
    }
  }
  protected StandardServiceRegistryImpl buildServiceRegistry(Configuration configuration) {
    Properties properties = new Properties();
    properties.putAll(configuration.getProperties());
    Environment.verifyProperties(properties);
    ConfigurationHelper.resolvePlaceHolders(properties);

    final BootstrapServiceRegistry bootstrapServiceRegistry = generateBootstrapRegistry(properties);
    ServiceRegistryBuilder registryBuilder =
        new ServiceRegistryBuilder(bootstrapServiceRegistry).applySettings(properties);
    prepareBasicRegistryBuilder(registryBuilder);
    return (StandardServiceRegistryImpl) registryBuilder.buildServiceRegistry();
  }
Beispiel #4
0
 private static StandardServiceRegistryImpl createServiceRegistry(Properties properties) {
   Environment.verifyProperties(properties);
   ConfigurationHelper.resolvePlaceHolders(properties);
   return (StandardServiceRegistryImpl)
       new ServiceRegistryBuilder().applySettings(properties).buildServiceRegistry();
 }