X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fwamblee%2Fphotos%2Fmodel%2Fplumbing%2FInitializer.java;h=850f6f47720b38e49adc7de50972ed5c542b2667;hb=0edd451bb32da41f5c54ec2acfb11a693f567ec9;hp=b5ace148c012cb1b953fdacc1d0f22f13cb0a8f9;hpb=562755fd98ee5661532ae14df234eeaa9f25b5e5;p=photos diff --git a/src/main/java/org/wamblee/photos/model/plumbing/Initializer.java b/src/main/java/org/wamblee/photos/model/plumbing/Initializer.java index b5ace14..850f6f4 100644 --- a/src/main/java/org/wamblee/photos/model/plumbing/Initializer.java +++ b/src/main/java/org/wamblee/photos/model/plumbing/Initializer.java @@ -25,6 +25,7 @@ import javax.inject.Inject; import org.wamblee.inject.InjectorBuilder; import org.wamblee.photos.model.Album; import org.wamblee.security.authentication.UserAdministration; +import org.wamblee.security.authorization.AuthorizationService; /** * @author Erik Brakkee @@ -34,40 +35,44 @@ import org.wamblee.security.authentication.UserAdministration; @Startup public class Initializer { - private static final Logger LOGGER = Logger.getLogger(Initializer.class - .getName()); + private static final Logger LOGGER = Logger.getLogger(Initializer.class + .getName()); - /** - * We need this helper to do initialization of the beans from within the - * post construct method. Injecting these objects into the initializer class - * will lead to initialization outside of a transactional context and this - * is does not work because and entity manager is required. - * - * @author Erik Brakkee - * - */ - public static class Helper { - @Inject - private UserAdministration userAdmin; + /** + * We need this helper to do initialization of the beans from within the + * post construct method. Injecting these objects into the initializer class + * will lead to initialization outside of a transactional context and this + * is does not work because and entity manager is required. + * + * @author Erik Brakkee + * + */ + public static class Helper { + @Inject + private UserAdministration userAdmin; - @Inject - @AllPhotos - private Album album; + @Inject + private AuthorizationService authorizationService; - public void init() { - userAdmin.getUserCount(); - album.size(); - } - } + @Inject + @AllPhotos + private Album album; - @PostConstruct - public void scheduleInit() { - LOGGER.info("Photo application initializing"); - // timerService.createTimer(1000, 1000, null); - LOGGER.info("Initializing photo application"); - Helper helper = new Helper(); - InjectorBuilder.getInjector().inject(helper); - helper.init(); - LOGGER.info("Initialized photo application"); - } + public void init() { + userAdmin.getUserCount(); + album.size(); + authorizationService.getRules(); + } + } + + @PostConstruct + public void scheduleInit() { + LOGGER.info("Photo application initializing"); + // timerService.createTimer(1000, 1000, null); + LOGGER.info("Initializing photo application"); + Helper helper = new Helper(); + InjectorBuilder.getInjector().inject(helper); + helper.init(); + LOGGER.info("Initialized photo application"); + } }