Formatting

This commit is contained in:
neviyn 2018-09-26 11:35:26 +01:00
parent 906bf90fd3
commit d1d3b35699

View File

@ -25,17 +25,13 @@ import uk.co.neviyn.Observations.resources.TutorResource;
public class ObservationsApplication extends Application<ObservationsConfiguration> { public class ObservationsApplication extends Application<ObservationsConfiguration> {
private final HibernateBundle<ObservationsConfiguration> hibernate = new HibernateBundle<ObservationsConfiguration>( private final HibernateBundle<ObservationsConfiguration> hibernate = new HibernateBundle<ObservationsConfiguration>(
Observation.class, Observation.class, Tutor.class, Site.class) {
Tutor.class,
Site.class
) {
@Override @Override
public DataSourceFactory getDataSourceFactory(ObservationsConfiguration configuration) { public DataSourceFactory getDataSourceFactory(ObservationsConfiguration configuration) {
return configuration.getDataSourceFactory(); return configuration.getDataSourceFactory();
} }
}; };
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
new ObservationsApplication().run(args); new ObservationsApplication().run(args);
} }
@ -50,12 +46,9 @@ public class ObservationsApplication extends Application<ObservationsConfigurati
@Override @Override
public void run(ObservationsConfiguration observationsConfiguration, Environment environment) { public void run(ObservationsConfiguration observationsConfiguration, Environment environment) {
final JerseyEnvironment jersey = environment.jersey(); final JerseyEnvironment jersey = environment.jersey();
jersey.register(new AuthDynamicFeature( jersey.register(new AuthDynamicFeature(new BasicCredentialAuthFilter.Builder<User>()
new BasicCredentialAuthFilter.Builder<User>() .setAuthenticator(new SimpleAuthenticator(observationsConfiguration.getAdminPassword())).setRealm("SECURITY")
.setAuthenticator(new SimpleAuthenticator(observationsConfiguration.getAdminPassword())) .buildAuthFilter()));
.setRealm("SECURITY")
.buildAuthFilter()
));
jersey.register(new AuthValueFactoryProvider.Binder<>(User.class)); jersey.register(new AuthValueFactoryProvider.Binder<>(User.class));
TutorDao tutorDao = new TutorDao(hibernate.getSessionFactory()); TutorDao tutorDao = new TutorDao(hibernate.getSessionFactory());
SiteDao siteDao = new SiteDao(hibernate.getSessionFactory()); SiteDao siteDao = new SiteDao(hibernate.getSessionFactory());