Java 类io.dropwizard.migrations.MigrationsBundle 实例源码

项目:pay-adminusers    文件:AdminUsersApp.java   
@Override
public void initialize(Bootstrap<AdminUsersConfig> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(NON_STRICT_VARIABLE_SUBSTITUTOR)
            )
    );

    bootstrap.addBundle(new MigrationsBundle<AdminUsersConfig>() {
        @Override
        public DataSourceFactory getDataSourceFactory(AdminUsersConfig configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    bootstrap.addCommand(new DependentResourceWaitCommand());
    bootstrap.addCommand(new MigrateToInitialDbState());
}
项目:dropwizard-microservices-example    文件:ProductCatalogApplication.java   
@Override
public void initialize(final Bootstrap<ProductCatalogConfiguration> bootstrap) {
    bootstrap.addBundle(discoveryBundle);
    bootstrap.addBundle(new MigrationsBundle<ProductCatalogConfiguration>() {

        @Override
        public PooledDataSourceFactory getDataSourceFactory(ProductCatalogConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
    guiceBundle = GuiceBundle.<ProductCatalogConfiguration> newBuilder().addModule(new ProductCatalogModule())
            .enableAutoConfig(getClass().getPackage().getName()).setConfigClass(ProductCatalogConfiguration.class)
            .build(Stage.PRODUCTION);
    bootstrap.addBundle(guiceBundle);
    // Uncomment below to read the yaml file from Jar
    // bootstrap.setConfigurationSourceProvider(new
    // ResourceConfigurationSourceProvider());
}
项目:dropwizard-microservices-example    文件:ProductReviewApplication.java   
@Override
public void initialize(final Bootstrap<ProductReviewConfiguration> bootstrap) {
    bootstrap.addBundle(discoveryBundle);
    bootstrap.addBundle(new MigrationsBundle<ProductReviewConfiguration>() {

        @Override
        public PooledDataSourceFactory getDataSourceFactory(ProductReviewConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
    guiceBundle = GuiceBundle.<ProductReviewConfiguration> newBuilder().addModule(new ProductReviewModule())
            .enableAutoConfig(getClass().getPackage().getName()).setConfigClass(ProductReviewConfiguration.class)
            .build(Stage.PRODUCTION);
    bootstrap.addBundle(guiceBundle);
    // Uncomment below to read the yaml file from Jar
    // bootstrap.setConfigurationSourceProvider(new
    // ResourceConfigurationSourceProvider());
}
项目:pay-publicauth    文件:PublicAuthApp.java   
@Override
public void initialize(Bootstrap<PublicAuthConfiguration> bootstrap) {
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    bootstrap.addBundle(new DBIExceptionsBundle());

    bootstrap.addBundle(new MigrationsBundle<PublicAuthConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(PublicAuthConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    bootstrap.addCommand(new DependentResourceWaitCommand());
}
项目:authrite    文件:AuthriteServiceApplication.java   
@Override
public void initialize(final Bootstrap<AuthriteServiceConfiguration> bootstrap) {
    bootstrap.addBundle(new Java8Bundle());

    if (useClasspathAssets) {
        bootstrap.addBundle(new AssetsBundle("/assets/", "/"));
    } else {
        bootstrap.addBundle(new FileAssetsBundle("src/main/resources/assets", "/"));
    }

    bootstrap.addBundle(new MigrationsBundle<AuthriteServiceConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(final AuthriteServiceConfiguration configuration) {
            return configuration.getDatabase();
        }
    });
}
项目:budgetapp    文件:BudgetApplication.java   
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
    MigrationsBundle<AppConfiguration> migrationBundle = new MigrationsBundle<AppConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(AppConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    };

    // allow using Environment variable in yaml
    bootstrap.setConfigurationSourceProvider(
            new SubstitutingSourceProvider(
                    bootstrap.getConfigurationSourceProvider(),
                    new EnvironmentVariableSubstitutor(false)
            )
    );

    bootstrap.addBundle(migrationBundle);
    bootstrap.addBundle(hibernate);
    bootstrap.addBundle(new ConfiguredAssetsBundle("/app", "/app", "index.html"));
}
项目:Nebula    文件:NebulaService.java   
@Override
public void initialize(Bootstrap<NebulaServiceConfiguration> bootstrap) {
  GuiceBundle<NebulaServiceConfiguration> guiceBundle = GuiceBundle.<NebulaServiceConfiguration>newBuilder()
      .addModule(new NebulaServiceModule())
      .enableAutoConfig(getClass().getPackage().getName())
      .setConfigClass(NebulaServiceConfiguration.class)
      .build(Stage.DEVELOPMENT);

  bootstrap.addBundle(guiceBundle);

  // database migrations
  bootstrap.addBundle(new MigrationsBundle<NebulaServiceConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(NebulaServiceConfiguration configuration) {
      return configuration.getDatabase();
    }
  });

  bootstrap.getObjectMapper().registerModule(new ProtobufModule());
  bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
项目:dropwizard-experiment    文件:TodoListApplication.java   
@Override
public void initialize(Bootstrap<TodoListConfiguration> bootstrap) {
    ebeanBundle = new EbeanBundle();
    //rabbitMqBundle = new RabbitMQBundle();

    // This outputs xDateTimes as ISO strings rather than an array of numbers in JSON.
    bootstrap.getObjectMapper().disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);

    bootstrap.addBundle(new Java8Bundle());
    bootstrap.addBundle(ebeanBundle);
    //bootstrap.addBundle(rabbitMqBundle);
    bootstrap.addBundle(new OAuth2Bundle(ebeanBundle));
    bootstrap.addBundle(new TodoClientBundle());
    bootstrap.addBundle(new MigrationsBundle<TodoListConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(TodoListConfiguration configuration) {
            return configuration.getDatabaseConfig();
        }
    });

    // The anonymous subclass seems to be needed for the config type to be picked up correctly.
    bootstrap.addCommand(new WorkersCommand<TodoListConfiguration>(TodoListApplication.this) {});
    bootstrap.addCommand(new DbDiffCommand<TodoListConfiguration>() {});
}
项目:skid-road    文件:SkidRoadDropwizardExampleService.java   
@Override
public void initialize(Bootstrap<SkidRoadDropwizardExampleConfiguration> bootstrap) {

    ObjectMapper om = bootstrap.getObjectMapper();
    om.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
    om.registerModule(new JodaModule());
    om.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);

    bootstrap.addBundle(new DBIExceptionsBundle());
    bootstrap.addBundle(new MigrationsBundle<SkidRoadDropwizardExampleConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(SkidRoadDropwizardExampleConfiguration configuration) {
            return configuration.getSkidRoad().getDatabaseConfiguration();
        }
    });
    bootstrap.addCommand(new GenerateRandomKey());
}
项目:SAPNetworkMonitor    文件:NiPingMonitorApplication.java   
@Override
public void initialize(Bootstrap<ServerConfiguration> bootstrap) {

    bootstrap.addBundle(new MigrationsBundle<ServerConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(ServerConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });

    bootstrap.addBundle(new AssetsBundle("/com/cloudwise/sap/niping/view/static", "/static", null, "static"));
    bootstrap.addBundle(new AssetsBundle("/com/cloudwise/sap/niping/view/vendor", "/vendor", null, "vendor"));
    bootstrap.addBundle(new ViewBundle<ServerConfiguration>());
}
项目:rufus    文件:RufusApplication.java   
@Override
public void initialize(Bootstrap<RufusConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/app", "/", "index.html"));
    bootstrap.addBundle(new ViewBundle<>());
    bootstrap.addBundle(new MultiPartBundle());
    bootstrap.addBundle(new MigrationsBundle<RufusConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(RufusConfiguration conf) {
            return conf.getDataSourceFactory();
        }
    });
}
项目:dropwizard-myblog    文件:BlogApplication.java   
@Override
public void initialize(Bootstrap<BlogConfiguration> bootstrap) {
    bootstrap.addBundle(hibernate);
    bootstrap.addBundle(new MigrationsBundle<BlogConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(BlogConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
}
项目:Mastering-Mesos    文件:SingularityService.java   
@Override
public void initialize(final Bootstrap<T> bootstrap) {
  if (!Strings.isNullOrEmpty(System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY))) {
    bootstrap.setConfigurationSourceProvider(new MergingSourceProvider(bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory()));
  }

  final Iterable<? extends Module> additionalModules = checkNotNull(getGuiceModules(bootstrap), "getGuiceModules() returned null");
  final Iterable<? extends Bundle> additionalBundles = checkNotNull(getDropwizardBundles(bootstrap), "getDropwizardBundles() returned null");
  final Iterable<? extends ConfiguredBundle<T>> additionalConfiguredBundles = checkNotNull(getDropwizardConfiguredBundles(bootstrap), "getDropwizardConfiguredBundles() returned null");

  final GuiceBundle<SingularityConfiguration> guiceBundle = GuiceBundle.defaultBuilder(SingularityConfiguration.class)
      .modules(new SingularityServiceModule())
      .modules(additionalModules)
      .build();
  bootstrap.addBundle(guiceBundle);

  bootstrap.addBundle(new CorsBundle());
  bootstrap.addBundle(new ViewBundle());
  bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/"));
  bootstrap.addBundle(new AssetsBundle("/assets/api-docs/", "/api-docs/", "index.html", "api-docs"));
  bootstrap.addBundle(new MigrationsBundle<SingularityConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(final SingularityConfiguration configuration) {
      return configuration.getDatabaseConfiguration().get();
    }
  });

  for (Bundle bundle : additionalBundles) {
    bootstrap.addBundle(bundle);
  }

  for (ConfiguredBundle<T> configuredBundle : additionalConfiguredBundles) {
    bootstrap.addBundle(configuredBundle);
  }

  bootstrap.getObjectMapper().registerModule(new ProtobufModule());
  bootstrap.getObjectMapper().registerModule(new GuavaModule());
  bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_NULL);
  bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
项目:heroku-gradle-dropwizard    文件:WebApplication.java   
@Override
public void initialize(Bootstrap<AppConfiguration> bootstrap) {
    bootstrap.addBundle(new AssetsBundle("/ui", "/", "index.html"));
    bootstrap.addBundle(hibernate);
    bootstrap.addBundle(new MigrationsBundle<AppConfiguration>() {

        @Override
        public PooledDataSourceFactory getDataSourceFactory(AppConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
}
项目:AugumentedSzczecin_java    文件:AugmentedApplication.java   
private MigrationsBundle<AugmentedConfiguration> createMigrationBundle() {
    return new MigrationsBundle<AugmentedConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(final AugmentedConfiguration configuration) {
            return configuration.getRdbmsConfig();
        }
    };
}
项目:Pinot    文件:ThirdEyeDetectorApplication.java   
@Override
public void initialize(final Bootstrap<ThirdEyeDetectorConfiguration> bootstrap) {
  bootstrap.addBundle(new MigrationsBundle<ThirdEyeDetectorConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(ThirdEyeDetectorConfiguration config) {
      return config.getDatabase();
    }
  });

  bootstrap.addBundle(hibernate);

  bootstrap.addBundle(new AssetsBundle("/assets/", "/", "index.html"));
}
项目:fiware-keypass    文件:AcService.java   
@Override
public void initialize(Bootstrap<AcConfig> bootstrap) {
    bootstrap.addBundle(hibernate);
    bootstrap.addBundle(new MigrationsBundle<AcConfig>() {
        @Override
        public DataSourceFactory getDataSourceFactory(AcConfig configuration) {
            return configuration.getDataSourceFactory();
        }
    });
}
项目:restwars    文件:RestwarsApplication.java   
@Override
public void initialize(Bootstrap<RestwarsConfiguration> bootstrap) {
    bootstrap.addBundle(new MigrationsBundle<RestwarsConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(RestwarsConfiguration configuration) {
            return configuration.getDatabase();
        }
    });
}
项目:tnpresidential    文件:MainApplication.java   
@Override
public void initialize(Bootstrap<MainConfiguration> bootstrap) {
    bootstrap.addBundle(new MigrationsBundle<MainConfiguration>() {
        @Override
        public DataSourceFactory getDataSourceFactory(MainConfiguration configuration) {
            return configuration.getDataSourceFactory();
        }
    });
}
项目:api_dropwizard    文件:RentMyCourtApplication.java   
@Override
public void initialize(Bootstrap<RentMyCourtConfiguration> bootstrap) {
   bootstrap.addBundle(hibernate);
   bootstrap.addBundle(new MigrationsBundle<RentMyCourtConfiguration>() {
    @Override
      public DataSourceFactory getDataSourceFactory(RentMyCourtConfiguration configuration) {
        return configuration.getDataSourceFactory();
      }
   });
   swaggerDropwizard.onInitialize(bootstrap);
 }
项目:Singularity    文件:SingularityService.java   
@Override
public void initialize(final Bootstrap<T> bootstrap) {
  if (!Strings.isNullOrEmpty(System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY))) {
    bootstrap.setConfigurationSourceProvider(new MergingSourceProvider(bootstrap.getConfigurationSourceProvider(), System.getProperty(SINGULARITY_DEFAULT_CONFIGURATION_PROPERTY), bootstrap.getObjectMapper(), new YAMLFactory()));
  }

  final Iterable<? extends Module> additionalModules = checkNotNull(getGuiceModules(bootstrap), "getGuiceModules() returned null");
  final Iterable<? extends Bundle> additionalBundles = checkNotNull(getDropwizardBundles(bootstrap), "getDropwizardBundles() returned null");
  final Iterable<? extends ConfiguredBundle<T>> additionalConfiguredBundles = checkNotNull(getDropwizardConfiguredBundles(bootstrap), "getDropwizardConfiguredBundles() returned null");

  guiceBundle = GuiceBundle.defaultBuilder(SingularityConfiguration.class)
      .modules(new SingularityServiceModule())
      .modules(new SingularityAuthModule())
      .modules(additionalModules)
      .build();
  bootstrap.addBundle(guiceBundle);

  bootstrap.addBundle(new CorsBundle());
  bootstrap.addBundle(new ViewBundle<>());
  bootstrap.addBundle(new AssetsBundle("/assets/static/", "/static/"));
  bootstrap.addBundle(new AssetsBundle("/assets/api-docs/", "/api-docs/", "index.html", "api-docs"));
  bootstrap.addBundle(new MigrationsBundle<SingularityConfiguration>() {
    @Override
    public DataSourceFactory getDataSourceFactory(final SingularityConfiguration configuration) {
      return configuration.getDatabaseConfiguration().get();
    }
  });

  for (Bundle bundle : additionalBundles) {
    bootstrap.addBundle(bundle);
  }

  for (ConfiguredBundle<T> configuredBundle : additionalConfiguredBundles) {
    bootstrap.addBundle(configuredBundle);
  }

  bootstrap.getObjectMapper().registerModule(new ProtobufModule());
  bootstrap.getObjectMapper().registerModule(new GuavaModule());
  bootstrap.getObjectMapper().setSerializationInclusion(Include.NON_NULL);
  bootstrap.getObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}