Java 类com.google.inject.persist.jpa.JpaPersistModule 实例源码

项目:J-Kinopoisk2IMDB    文件:ConfigurationModule.java   
protected void bindJPAPersistModule() {
    JpaPersistModule jpa = new JpaPersistModule("K2IDB");

    Config dbConfig = config.getConfig("db");

    Properties properties = new Properties();
    properties.put("javax.persistence.jdbc.driver", dbConfig.getString("driver"));
    properties.put("javax.persistence.jdbc.url", dbConfig.getString("url"));
    properties.put("javax.persistence.jdbc.user", dbConfig.getString("user"));
    properties.put("javax.persistence.jdbc.password", dbConfig.getString("password"));

    dbConfig.getObject("additional").entrySet()
            .forEach(e -> properties.put(e.getKey(), (String) e.getValue().unwrapped()));

    jpa.properties(properties);
    install(jpa);
}
项目:endpoint-health    文件:EndPointHealthServletContextListener.java   
@Override
protected Injector getInjector() {
    final Properties persistenceUnitProperties = new Properties();

    persistenceUnitProperties.put(AvailableSettings.JPA_JDBC_URL,
        Utils.getDatabaseUrl(endPointHealthConfiguration.databaseFile()));

    persistenceUnitProperties.put(AvailableSettings.JPA_JDBC_USER,
        endPointHealthConfiguration.databaseUser());

    persistenceUnitProperties.put(AvailableSettings.JPA_JDBC_PASSWORD,
        endPointHealthConfiguration.databasePassword());

    return Guice.createInjector(
        new JpaPersistModule(PERSISTENCE_UNIT).properties(persistenceUnitProperties),
        new EndPointHealthServletModule());
}
项目:che    文件:ResourceTckModule.java   
@Override
protected void configure() {
  install(new JpaPersistModule("main"));
  H2DBTestServer server = H2DBTestServer.startDefault();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<TckRepository<FreeResourcesLimitImpl>>() {})
      .toInstance(new JpaTckRepository<>(FreeResourcesLimitImpl.class));
  bind(new TypeLiteral<TckRepository<AccountImpl>>() {})
      .toInstance(new JpaTckRepository<>(AccountImpl.class));

  bind(FreeResourcesLimitDao.class).to(JpaFreeResourcesLimitDao.class);
}
项目:che    文件:OrganizationJpaTckModule.java   
@Override
protected void configure() {
  install(new JpaPersistModule("main"));
  H2DBTestServer server = H2DBTestServer.startDefault();
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(server.getDataSource(), "che-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).toInstance(new H2JpaCleaner(server));

  bind(new TypeLiteral<AbstractPermissionsDomain<MemberImpl>>() {}).to(OrganizationDomain.class);

  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .to(JpaOrganizationImplTckRepository.class);
  bind(new TypeLiteral<TckRepository<UserImpl>>() {})
      .toInstance(new JpaTckRepository<>(UserImpl.class));
  bind(new TypeLiteral<TckRepository<MemberImpl>>() {})
      .toInstance(new JpaTckRepository<>(MemberImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationDistributedResourcesImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationDistributedResourcesImpl.class));

  bind(OrganizationDao.class).to(JpaOrganizationDao.class);
  bind(MemberDao.class).to(JpaMemberDao.class);

  bind(OrganizationDistributedResourcesDao.class)
      .to(JpaOrganizationDistributedResourcesDao.class);
}
项目:eureka    文件:AppTestModule.java   
@Override
protected void configure() {

    install(new JpaPersistModule("services-jpa-unit"));

    bind(UserDao.class).to(JpaUserDao.class);
    bind(org.eurekaclinical.standardapis.dao.UserDao.class).to(JpaUserDao.class);
    bind(RoleDao.class).to(JpaRoleDao.class);
    bind(TimeUnitDao.class).to(JpaTimeUnitDao.class);
    bind(ValueComparatorDao.class).to(JpaValueComparatorDao.class);
    bind(FrequencyTypeDao.class).to(JpaFrequencyTypeDao.class);
    bind(RelationOperatorDao.class).to(JpaRelationOperatorDao.class);
    bind(PhenotypeEntityDao.class).to(JpaPhenotypeEntityDao.class);
    bind(ThresholdsOperatorDao.class).to(JpaThresholdsOperatorDao.class);
    bind(new TypeLiteral<PropositionFinder<String>>(){}).to(TestPropositionFinder.class);
}
项目:eureka    文件:AppTestModule.java   
@Override
protected void configure() {
    install(new JpaPersistModule("backend-jpa-unit"));
    bind(JobDao.class).to(JpaJobDao.class);
    bind(JobEventDao.class).to(JpaJobEventDao.class);
    bind(AuthorizedUserDao.class).to(JpaEtlUserDao.class);
    bind(RoleDao.class).to(JpaRoleDao.class);
    bind(EtlGroupDao.class).to(JpaEtlGroupDao.class);
    bind(DestinationDao.class).to(JpaDestinationDao.class);
    bind(DeidPerPatientParamsDao.class).to(JpaDeidPerPatientParamsDao.class);
    bind(SourceConfigDao.class).to(JpaSourceConfigDao.class);
    bind(EurekaDeidConfigFactory.class).to(JpaEurekaDeidConfigFactory.class);
    bind(EurekaDeidConfigDao.class).to(JpaEurekaDeidConfigDao.class);
    bind(LinkDao.class).to(JpaLinkDao.class);
    bind(EncryptionAlgorithmDao.class).to(JpaEncryptionAlgorithmDao.class);
}
项目:git-webapp    文件:GuiceListener.java   
@Override
protected Injector getInjector() {
  injector = Guice.createInjector(new ServletModule() {
    @Override
    protected void configureServlets() {
      String persistenceUnitName = PersistenceInitializeListener.getPersistenceUnitName();

      install(new JpaPersistModule(persistenceUnitName));
      filter("/*").through(PersistFilter.class);

      requestStaticInjection(EntityOperatorProvider.class);

      bind(GitOperation.class).in(Singleton.class);
      bind(GitApi.class).in(Singleton.class);

      ClassFinder.findClasses("gw.service").forEach(clazz -> bind(clazz).in(Singleton.class));
    }
  });
  return injector;
}
项目:ineform    文件:ShowcaseServletConfig.java   
@Override
    protected Injector getInjector() {
        return Guice.createInjector(new ServletModule() {
                                        protected void configureServlets() {
                                            install(new JpaPersistModule("IneFormShowCaseWithEjbs"));

                                            filter("/*").through(PersistFilter.class);
                                        };
                                    }
                                    , new IneFrameBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
//                                  , new IneCoreBaseServletModule("ineformshowcasewithejbs", ShowcaseDispatchServlet.class)
                                    , new UploadServletModule() 
                                    , new TestServletModule()
                                    , new IneFrameBaseActionHanlderModule()
                                    , new IneFrameBaseModule()
                                    , new IneFormActionHanlderModule()
                                    , new IneFormDispatcherGuiceModule()
//                                  , new IneFrameModuleGuiceModule()
                                    , new IneModuleGuiceModule(false)
                                    );
    }
项目:fiware-cosmos-ambari    文件:AgentResourceTest.java   
private void installDependencies() {
  install(new JpaPersistModule("ambari-javadb"));
  install(new FactoryModuleBuilder().implement(
      Cluster.class, ClusterImpl.class).build(ClusterFactory.class));
  install(new FactoryModuleBuilder().implement(
      Host.class, HostImpl.class).build(HostFactory.class));
  install(new FactoryModuleBuilder().implement(
      Service.class, ServiceImpl.class).build(ServiceFactory.class));
  install(new FactoryModuleBuilder().implement(
      ServiceComponent.class, ServiceComponentImpl.class).build(
      ServiceComponentFactory.class));
  install(new FactoryModuleBuilder().implement(
      ServiceComponentHost.class, ServiceComponentHostImpl.class).build(
      ServiceComponentHostFactory.class));
  install(new FactoryModuleBuilder().implement(
      Config.class, ConfigImpl.class).build(ConfigFactory.class));
  install(new FactoryModuleBuilder().build(StageFactory.class));
  install(new FactoryModuleBuilder().build(HostRoleCommandFactory.class));
}
项目:realtime-server-appengine    文件:RealtimeApisModule.java   
@Override
protected void configureServlets() {
  install(new JpaPersistModule("transactions-optional"));
  filterRegex("^/(?!_ah/(upload|admin)).*$").through(PersistFilter.class);
  MethodInterceptor finderInterceptor = new JpaFinderProxy();
  requestInjection(finderInterceptor);
  bindInterceptor(Matchers.any(), Matchers.annotatedWith(Finder.class), finderInterceptor);

  filter(ProxyFilter.PROXY_PATH + "*").through(ProxyFilter.class);
  if (SystemProperty.environment.value() == SystemProperty.Environment.Value.Development) {
    filter("/_ah/api/" + "*").through(LocalDevServerFilter.class);
  }

  Set<Class<?>> serviceClasses = new HashSet<Class<?>>();
  serviceClasses.add(DeviceEndpoint.class);
  serviceClasses.add(AccountEndpoint.class);
  serviceClasses.add(PresenceEndpoint.class);
  serviceClasses.add(AppEngineChannelService.class);
  serviceClasses.add(GoogleCloudMessaging.class);
  serviceClasses.add(ApplePushNotification.class);
  this.serveGuiceSystemServiceServlet("/_ah/spi/*", serviceClasses);
}
项目:oregami-server    文件:OregamiApplication.java   
@Override
public void initialize(Bootstrap<OregamiConfiguration> bootstrap) {

    OregamiConfiguration configuration = StartHelper.createConfiguration(StartHelper.getConfigFilename());
    Properties jpaProperties = StartHelper.createPropertiesFromConfiguration(configuration);

    JpaPersistModule jpaPersistModule = new JpaPersistModule(configuration.getDatabaseConfiguration().getJpaUnit());
    jpaPersistModule.properties(jpaProperties);

    guiceBundle = GuiceBundle.<OregamiConfiguration>newBuilder()
            .addModule(new OregamiGuiceModule())
            .addModule(jpaPersistModule)
            .enableAutoConfig("org.oregami")
            .setConfigClass(OregamiConfiguration.class)
            .build();
    bootstrap.addBundle(guiceBundle);

    SimpleModule module = new SimpleModule();
    //module.addSerializer(LocalDateTime.class, new CustomLocalDateTimeSerializer());
    //module.addSerializer(LocalDate.class, new CustomLocalDateSerializer());
    bootstrap.getObjectMapper().registerModule(module);

}
项目:joynr    文件:DiscoveryEntryStorePersistedTest.java   
@Before
public void setUp() throws Exception {

    Injector injector = Guice.createInjector(new JpaPersistModule("CapabilitiesDirectory"), new AbstractModule() {

        @Override
        protected void configure() {
            bind(DiscoveryEntryStore.class).to(DiscoveryEntryStorePersisted.class);
            bind(DiscoveryEntry.class).to(GlobalDiscoveryEntryPersisted.class);
            bind(CapabilitiesProvisioning.class).to(DefaultCapabilitiesProvisioning.class);
        }
    });
    service = injector.getInstance(PersistService.class);
    store = injector.getInstance(DiscoveryEntryStore.class);
    entityManager = injector.getInstance(EntityManager.class);
}
项目:joynr    文件:DiscoveryDirectoriesModule.java   
@Override
protected void configure() {
    install(new JpaPersistModule("Discovery"));
    AbstractModule discoveryDirectoryModule = new AbstractModule() {

        @Override
        protected void configure() {
        }

        @Provides
        @Named(AbstractJoynrApplication.PROPERTY_JOYNR_DOMAIN_LOCAL)
        String provideCapabilitiesDirectoryDomain(@Named(MessagingPropertyKeys.CAPABILITIES_DIRECTORY_DISCOVERY_ENTRY) GlobalDiscoveryEntry capabilitiesDirectoryEntry) {
            return capabilitiesDirectoryEntry.getDomain();
        }

        @Provides
        @Named(MessagingPropertyKeys.CHANNELID)
        String provideCapabilitiesDirectoryChannelId(@Named(ConfigurableMessagingSettings.PROPERTY_CAPABILITIES_DIRECTORY_CHANNEL_ID) String discoveryDirectoriesChannelId) {
            return discoveryDirectoriesChannelId;
        }
    };

    install(Modules.override(new CapabilitiesDirectoryModule()).with(discoveryDirectoryModule));
}
项目:vidada-desktop    文件:JPAModule.java   
@Override
protected void configure() {

    JpaPersistModule jpa = new JpaPersistModule("manager");

    jpa.properties(properties);
    jpa.configure(binder());

    bind(DALInitializer.class).asEagerSingleton();

    bind(ICredentialRepository.class).to(CredentialRepository.class);
    bind(IDatabaseSettingsRepository.class).to(DatabaseSettingsRepository.class);
    bind(IMediaLibraryRepository.class).to(MediaLibraryRepository.class);
    bind(IMediaRepository.class).to(MediaRepository.class);
    bind(ITagRepository.class).to(TagRepository.class);
}
项目:postguice    文件:PostguiceModule.java   
@Override
protected void configure() {
    install(Modules.override(new JpaPersistModule(persistenceUnitName)).with(new PostguiceBridgeModule()));

    requestStaticInjection(EM.class);
    requestStaticInjection(Transactions.class);
}
项目:server-vot    文件:ConfigModule.java   
private void bindCoreComponents() {
    install(new JpaPersistModule(new MemoryServerConfig().getString(ServerVariable.DATA_SOURCE)));
    bind(DBInitializer.class).asEagerSingleton();
    bind(ServerConfig.class).to(MemoryServerConfig.class).in(Singleton.class);
    bind(RESTContext.class).in(Singleton.class);
    bind(RouteInitializer.class).in(Singleton.class);
    bind(SparkPluginInitializer.class).in(Singleton.class);
}
项目:metacat    文件:S3ConnectorFactory.java   
private void init() {
    //JPA module
    final Map<String, Object> props = Maps.newHashMap(configuration);
    props.put("hibernate.connection.datasource",
        DataSourceManager.get().load(name, configuration).get(name));
    final Module jpaModule = new JpaPersistModule("s3").properties(props);
    final Module s3Module = new S3Module(name, configuration, infoConverter);
    final Injector injector = Guice.createInjector(jpaModule, s3Module);
    persistService = injector.getInstance(PersistService.class);
    persistService.start();
    this.databaseService = injector.getInstance(ConnectorDatabaseService.class);
    this.tableService = injector.getInstance(ConnectorTableService.class);
    this.partitionService = injector.getInstance(ConnectorPartitionService.class);
}
项目:sparkled    文件:PersistenceModule.java   
@Override
protected void configure() {
    install(new JpaPersistModule("sparkled"));

    bind(SongPersistenceService.class).to(SongPersistenceServiceImpl.class).asEagerSingleton();
    bind(ScheduledSongPersistenceService.class).to(ScheduledSongPersistenceServiceImpl.class).asEagerSingleton();
    bind(StagePersistenceService.class).to(StagePersistenceServiceImpl.class).asEagerSingleton();
}
项目:geeMVC-Java-MVC-Framework    文件:GeeticketGuiceServletContextListener.java   
@Override
protected Injector getInjector() {
    try {
        injector = Guice.createInjector(new GeeMvcModule(), new GeeTicketModule(), new ServletModule() {
            @Override
            protected void configureServlets() {
                install(new JpaPersistModule("geeticketPU"));

                filter("/*").through(PersistFilter.class);

                Map<String, String> params = new HashMap<String, String>();
                params.put(Configuration.VIEW_PREFIX_KEY, "/jsp/pages");
                params.put(Configuration.VIEW_SUFFIX_KEY, ".jsp");
                params.put(Configuration.SUPPORTED_LOCALES_KEY, "en, de_DE, fr_FR, es_ES, ru_RU:UTF-8, ja_JP:Shift_JIS, zh:UTF-8");
                params.put(Configuration.DEFAULT_CHARACTER_ENCODING_KEY, "UTF-8");
                params.put(Configuration.DEFAULT_CONTENT_TYPE_KEY, "text/html");

                serve("/geeticket/*").with(DispatcherServlet.class, params);
            }
        });

    } catch (Throwable t) {
        System.out.println("!! An error occured during initialization of the GeeticketGuiceServletContextListener.");

        if (t instanceof com.google.inject.CreationException) {
            System.out.println("It seems that Guice was not able to create the injector due to problems with unregistered or incorrectly registered classes. Please check the Guice errors below!");
        }

        t.printStackTrace();
    }

    return injector;
}
项目:geeMVC-Java-MVC-Framework    文件:BaseTest.java   
protected static void initializeInjector() {
    if (injector == null) {
        injector = Guice.createInjector(new TestModule(), new JpaPersistModule("testPU"));

        Injectors.set(new InjectorProvider() {

            @Override
            public Injector provide() {
                return injector;
            }
        });

        injector.getInstance(PersistService.class).start();
    }
}
项目:pay-adminusers    文件:DaoTestBase.java   
@BeforeClass
public static void setup() throws Exception {
    final Properties properties = new Properties();
    properties.put("javax.persistence.jdbc.driver", postgres.getDriverClass());
    properties.put("javax.persistence.jdbc.url", postgres.getConnectionUrl());
    properties.put("javax.persistence.jdbc.user", postgres.getUsername());
    properties.put("javax.persistence.jdbc.password", postgres.getPassword());

    jpaModule = new JpaPersistModule("AdminUsersUnit");
    jpaModule.properties(properties);

    databaseHelper = new DatabaseTestHelper(new DBI(postgres.getConnectionUrl(), postgres.getUsername(), postgres.getPassword()));

    Connection connection = null;
    try {
        connection = DriverManager.getConnection(postgres.getConnectionUrl(), postgres.getUsername(), postgres.getPassword());

        Liquibase migrator = new Liquibase("config/initial-db-state.xml", new ClassLoaderResourceAccessor(), new JdbcConnection(connection));
        Liquibase migrator2 = new Liquibase("migrations.xml", new ClassLoaderResourceAccessor(), new JdbcConnection(connection));
        migrator.update("");
        migrator2.update("");
    } finally {
        if(connection != null)
            connection.close();
    }

    env = GuicedTestEnvironment.from(jpaModule).start();
}
项目:pay-adminusers    文件:DropwizardAppWithPostgresRule.java   
private JpaPersistModule createJpaModule(final PostgresDockerRule postgres) {
    final Properties properties = new Properties();
    properties.put("javax.persistence.jdbc.driver", postgres.getDriverClass());
    properties.put("javax.persistence.jdbc.url", postgres.getConnectionUrl());
    properties.put("javax.persistence.jdbc.user", postgres.getUsername());
    properties.put("javax.persistence.jdbc.password", postgres.getPassword());

    final JpaPersistModule jpaModule = new JpaPersistModule(JPA_UNIT);
    jpaModule.properties(properties);

    return jpaModule;
}
项目:codenvy    文件:AdminUserCreatorTest.java   
@Override
protected void configure() {
  install(new InitModule(PostConstruct.class));
  install(new JpaPersistModule("test"));
  bind(SchemaInitializer.class)
      .toInstance(
          new FlywaySchemaInitializer(inMemoryDefault(), "che-schema", "codenvy-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bindConstant().annotatedWith(Names.named("codenvy.admin.name")).to(NAME);
  bindConstant().annotatedWith(Names.named("codenvy.admin.initial_password")).to(PASSWORD);
  bindConstant().annotatedWith(Names.named("codenvy.admin.email")).to(EMAIL);
  bind(PermissionsManager.class).toInstance(permissionsManager);
  bind(UserManager.class).toInstance(mock(UserManager.class));
}
项目:codenvy    文件:JpaIntegrationTckModule.java   
@Override
protected void configure() {
  final Map<String, String> properties = new HashMap<>();
  properties.put(TRANSACTION_TYPE, PersistenceUnitTransactionType.RESOURCE_LOCAL.name());

  final String dbUrl = System.getProperty("jdbc.url");
  final String dbUser = System.getProperty("jdbc.user");
  final String dbPassword = System.getProperty("jdbc.password");

  waitConnectionIsEstablished(dbUrl, dbUser, dbPassword);

  properties.put(JDBC_URL, dbUrl);
  properties.put(JDBC_USER, dbUser);
  properties.put(JDBC_PASSWORD, dbPassword);
  properties.put(JDBC_DRIVER, System.getProperty("jdbc.driver"));

  JpaPersistModule main = new JpaPersistModule("main");
  main.properties(properties);
  install(main);
  final PGSimpleDataSource dataSource = new PGSimpleDataSource();
  dataSource.setUser(dbUser);
  dataSource.setPassword(dbPassword);
  dataSource.setUrl(dbUrl);
  bind(SchemaInitializer.class)
      .toInstance(new FlywaySchemaInitializer(dataSource, "che-schema", "codenvy-schema"));
  bind(DBInitializer.class).asEagerSingleton();
  bind(TckResourcesCleaner.class).to(JpaCleaner.class);

  bind(new TypeLiteral<TckRepository<InviteImpl>>() {})
      .toInstance(new JpaTckRepository<>(InviteImpl.class));
  bind(new TypeLiteral<TckRepository<OrganizationImpl>>() {})
      .toInstance(new JpaTckRepository<>(OrganizationImpl.class));
  bind(new TypeLiteral<TckRepository<WorkspaceImpl>>() {})
      .toInstance(new JpaTckRepository<>(WorkspaceImpl.class));

  bind(InviteDao.class).to(JpaInviteDao.class);
}
项目:che    文件:PersistTestModuleBuilder.java   
@Override
protected void configure() {
  try {
    savePersistenceXml();
  } catch (Exception x) {
    throw new RuntimeException(x.getMessage());
  }
  install(new JpaPersistModule(persistenceUnit));
}
项目:eureka    文件:ConfigListener.java   
@Override
protected Injector getInjector() {
    this.injector = new InjectorSupport(
            new Module[]{
                new AppModule(this.etlClientProvider),
                new ProxyingServiceServletModule(this.serviceProperties, PACKAGE_NAMES),
                new JpaPersistModule(JPA_UNIT)
            },
            this.serviceProperties).getInjector();
    return this.injector;
}
项目:eureka    文件:BackEndContextListener.java   
@Override
protected Injector getInjector() {
    this.injector = new InjectorSupport(
            new Module[]{
                new AppModule(),
                new ServiceServletModule(this.etlProperties, PACKAGE_NAMES),
                new JpaPersistModule(JPA_UNIT)
            },
            this.etlProperties).getInjector();
    return this.injector;
}
项目:First-Dash-Service    文件:DashGuiceH4ServletModule.java   
protected void configureServlets() {
    h4Properties = new Properties();
    String configFile = System.getProperty(FDC.DASH_H4_CONFIG_FILE);
    logger.info("Building Persistence Manager - Servlet Persistence");
    JpaPersistModule persistModule = new JpaPersistModule(FDC.H4_MANAGER);
    persistModule.properties(ConfigUtil.loadConfig(h4Properties, configFile));
    logger.info("Installing Persistence Manager for filter {}", FDC.PERSISTENCE_FILTER);
    install(persistModule);
    filter(FDC.PERSISTENCE_FILTER).through(PersistFilter.class);
}
项目:MoodCat.me-Core    文件:DbModule.java   
@Override
@SneakyThrows
protected void configure() {
    final JpaPersistModule jpaModule = new JpaPersistModule(MOODCAT_PERSISTENCE_UNIT);

    final Properties properties = getProperties();
    setDatabasePassword(properties);

    jpaModule.properties(properties);

    install(jpaModule);
}
项目:st-toolset    文件:AbstractPersistenceTest.java   
@Before
public final void setUp() {
    final Injector injector = Guice.createInjector(new JpaPersistModule(getPersistModuleName()));
    injector.injectMembers(this);

    final PersistService persistService = injector.getInstance(PersistService.class);
    persistService.start();
}
项目:guice    文件:EdslTest.java   
public void testModuleConfigUsingJpa() throws Exception {
  Logger.getLogger(getClass().getName()).info("Starting EDSL test.");
  Guice.createInjector(
      Stage.PRODUCTION,
      new AbstractModule() {
        @Override
        protected void configure() {
          install(new JpaPersistModule("myunit"));
          binder().requireExplicitBindings();
        }
      });
  Logger.getLogger(getClass().getName()).info("Completed EDSL test.");
}
项目:ineform    文件:AppServletModule.java   
@Override
protected void configureServlets() {
    install(new JpaPersistModule("translatorapp"));

    filter("/*").through(InePersistFilter.class);

    Map<String, String> params = new HashMap<String, String>();
    params.put("width", "200");
    params.put("height", "50");
    serve("/SimpleCaptcha.jpg").with(CaptchaServlet.class, params);

    serve("/moduleRowsDownload").with(ModuleRowsDownloadServlet.class);
}
项目:ineform    文件:AppServletModule.java   
@Override
protected void configureServlets() {
    install(new JpaPersistModule("ContactManager"));

    filter("/*").through(InePersistFilter.class);

    Map<String, String> params = new HashMap<String, String>();
    params.put("width", "200");
    params.put("height", "50");
    serve("/SimpleCaptcha.jpg").with(CaptchaServlet.class, params);
}
项目:Jersey2-Guice3-JPA2    文件:GuiceModule.java   
@Override
protected void configureServlets() {
   // start the JPA service
   bind(JPAInitializer.class).asEagerSingleton();

   // PersistFilter
   filter("/*").through(PersistFilter.class);

   // jpa + guice
   install(new JpaPersistModule("persistenceUnit")); // same as persistence.xml

   // Guice bindings
   bind(UserService.class).to(UserServiceImpl.class);
}
项目:guice-old    文件:EdslTest.java   
public void testModuleConfigUsingJpa() throws Exception {
  Logger.getLogger(getClass().getName()).info("Starting EDSL test.");
  Guice.createInjector(Stage.PRODUCTION, new AbstractModule() {
    @Override
    protected void configure() {
      install(new JpaPersistModule("myunit"));
      binder().requireExplicitBindings();
    }
  });
  Logger.getLogger(getClass().getName()).info("Completed EDSL test.");
}
项目:google-guice    文件:EdslTest.java   
public void testModuleConfigUsingJpa() throws Exception {
  Guice.createInjector(Stage.PRODUCTION, new AbstractModule() {
    @Override
    protected void configure() {
      install(new JpaPersistModule("myunit"));
      binder().requireExplicitBindings();
    };
  });
}
项目:devhub-prototype    文件:PersistenceModule.java   
@Override
protected void configure() {
    LOG.debug("Installing JPA Module");
    bind(DatabaseProperties.class).toInstance(config);
    bind(String.class).annotatedWith(Names.named("liquibaseContext")).toInstance(liquibaseContext);

    JpaPersistModule jpaModule = new JpaPersistModule(config.getPersistanceUnit());
    jpaModule.properties(config.asJpaProperties());

    install(jpaModule);
    bind(DatabaseStructure.class).asEagerSingleton();
    bind(StatisticDao.class).asEagerSingleton();
}
项目:oregami-server    文件:StartHelper.java   
public static void init(String localConfigFilename) {
    configFilename = localConfigFilename;
    OregamiConfiguration configuration = createConfiguration(localConfigFilename);
    Properties properties = createPropertiesFromConfiguration(configuration);
    jpaUnit = configuration.getDatabaseConfiguration().getJpaUnit();
    JpaPersistModule jpaPersistModule = new JpaPersistModule(jpaUnit);
    jpaPersistModule.properties(properties);
    injector = Guice.createInjector(jpaPersistModule, new OregamiGuiceModule());
    try {
        injector.getInstance(PersistService.class).start();
    } catch (PersistenceException e) {
        throw new RuntimeException("Database error", e);
    }

}
项目:joynr    文件:CapabilitiesDirectoryLauncher.java   
public static void start(Properties joynrConfig) {

        // LongPollingMessagingModule is only added in main(), since the servletMessagingModule will be used otherwise
        JoynrInjectorFactory injectorFactory = new JoynrInjectorFactory(joynrConfig,
                                                                        Modules.override(new JpaPersistModule("CapabilitiesDirectory"),
                                                                                         new CCInProcessRuntimeModule())
                                                                               .with(new TestGlobalAddressModule(),
                                                                                     new CapabilitiesDirectoryModule()));
        capabilitiesDirectoryLauncher = injectorFactory.createApplication(new JoynrApplicationModule("capabilitiesDirectoryLauncher",
                                                                                                     CapabilitiesDirectoryLauncher.class));
        capabilitiesDirectoryLauncher.run();
        capabilitiesDirectory = injectorFactory.getInjector().getInstance(CapabilitiesDirectoryImpl.class);
    }
项目:joynr    文件:JdbcModule.java   
@Override
protected void configure() {
    install(new JpaPersistModule(BPC_PERSISTENCE_UNIT_NAME));

    bind(BounceProxyDirectory.class).to(BounceProxyDatabase.class);
    bind(ChannelDirectory.class).to(ChannelDatabase.class);
}