Skip to content

Commit

Permalink
Refactored ApiModule so common module installation will not be repeated
Browse files Browse the repository at this point in the history
in child class and some modules installation can be overridden.
  • Loading branch information
jcwuzoegiver committed Jan 10, 2017
1 parent 5d848a6 commit 6aef993
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions modules/api/src/main/java/com/intuit/wasabi/api/ApiModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,8 @@ public class ApiModule extends AbstractModule {

@Override
protected void configure() {
LOGGER.debug("installing module: {}", ApiModule.class.getSimpleName());
//these modules are either free of other dependencies or they are required by later modules
install(new com.intuit.autumn.api.ApiModule());
install(new UserDirectoryModule());
install(new DatabaseExperimentRepositoryModule());
install(new DatabaseModule());
install(new JacksonModule());
install(new AuditLogModule());
install(new AuthorizationModule());

install(new EmailModule());
install(new EventsModule());
install(new ExperimentsModule());
install(new FeedbackModule());
install(new AnalyticsModule());

installModules();

Properties properties = create(PROPERTY_NAME, ApiModule.class);

Expand Down Expand Up @@ -101,6 +87,38 @@ protected void configure() {
// e.printStackTrace();
// }

LOGGER.debug("installed module: {}", ApiModule.class.getSimpleName());
}

protected void installUserModule() {
install(new UserDirectoryModule());
}

protected void installAuthModule() {
install(new AuthorizationModule());
}

protected void installEventModule() {
install(new EventsModule());
}

private void installModules() {
LOGGER.debug("installing module: {}", ApiModule.class.getCanonicalName());

//these modules are either free of other dependencies or they are required by later modules
install(new com.intuit.autumn.api.ApiModule());
installUserModule();
install(new DatabaseExperimentRepositoryModule());
install(new DatabaseModule());
install(new JacksonModule());
install(new AuditLogModule());
installAuthModule();

install(new EmailModule());
installEventModule();
install(new ExperimentsModule());
install(new FeedbackModule());
install(new AnalyticsModule());

LOGGER.debug("installed module: {}", ApiModule.class.getCanonicalName());
}
}

0 comments on commit 6aef993

Please sign in to comment.