- UserAdministration admin = new UserAdministrationImpl(userset,
- groupset, uservalidator, groupvalidator);
- UserAdminInitializer initializer = new UserAdminInitializer(admin,
- new String[] { "erik", "admin" }, new String[] { "users",
- "administrators" }, new String[] { "abc123", "abc123" });
- return admin;
- } catch (IOException e) {
- throw new RuntimeException(
- "Could not initialize user administration", e);
+ UserAdministration admin = new UserAdministrationImpl(userset, groupset, uservalidator, groupvalidator);
+ UserAdminInitializer initializer =
+ new UserAdminInitializer(admin, new String[]{"erik", "admin"}, new String[]{"users", "administrators"},
+ new String[]{"abc123", "abc123"});
+ return admin;
+ }
+
+ @Produces
+ @ApplicationScoped
+ @UserCache
+ public Cache<String, User> getUserCache() {
+ try {
+ InputResource cacheConfig = new ClassPathResource("META-INF/ehcache.xml");
+ return new EhCache(cacheConfig, "users");
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Could not create user cache", e);
+ }
+ }
+
+ @Produces
+ @ApplicationScoped
+ @PhotoCache
+ public Cache<String, ArrayList<PhotoEntry>> getPhotoCache() {
+ try {
+ InputResource cacheConfig = new ClassPathResource("META-INF/ehcache.xml");
+ return new EhCache<String, ArrayList<PhotoEntry>>(cacheConfig, "photos");
+ }
+ catch (IOException e) {
+ throw new RuntimeException("Could not create photo cache", e);