X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fwamblee%2Fphotos%2Fmodel%2Fauthorization%2FAuthorizedAlbum.java;fp=src%2Fmain%2Fjava%2Forg%2Fwamblee%2Fphotos%2Fmodel%2Fauthorization%2FAuthorizedAlbum.java;h=96610a6c940a92e05967aed7f98bd40579179530;hb=06bf9182a5cd8b626d8e66c1fde4e8e6c722a0b5;hp=7406d9985f6e5e3308c8fab514a47c3514ecb82b;hpb=0a8bb936be1c6e6bdb85e4998c57d259ca8872a1;p=photos diff --git a/src/main/java/org/wamblee/photos/model/authorization/AuthorizedAlbum.java b/src/main/java/org/wamblee/photos/model/authorization/AuthorizedAlbum.java index 7406d99..96610a6 100644 --- a/src/main/java/org/wamblee/photos/model/authorization/AuthorizedAlbum.java +++ b/src/main/java/org/wamblee/photos/model/authorization/AuthorizedAlbum.java @@ -19,8 +19,8 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; +import java.util.logging.Logger; -import org.apache.log4j.Logger; import org.wamblee.cache.Cache; import org.wamblee.cache.CachedObject; import org.wamblee.photos.model.Album; @@ -39,8 +39,8 @@ import org.wamblee.security.authorization.WriteOperation; */ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { - private static final Logger LOGGER = Logger - .getLogger(AuthorizedAlbum.class); + private static final Logger LOGGER = Logger.getLogger(AuthorizedAlbum.class + .getName()); private AuthorizationService _authorizer; @@ -55,16 +55,16 @@ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { * Album to decorate. */ public AuthorizedAlbum(Album aAlbum, AuthorizationService aService, - Cache aCache, String aSessionId) { + Cache aCache, String aSessionId) { super(aAlbum); _authorizer = aService; _authorizedEntries = new CachedObject>( - aCache, aSessionId + "/" + aAlbum.getPath(), - new CachedObject.Computation>() { - public ArrayList getObject(String aObjectKey) { - return AuthorizedAlbum.this.compute(); - } - }); + aCache, aSessionId + "/" + aAlbum.getPath(), + new CachedObject.Computation>() { + public ArrayList getObject(String aObjectKey) { + return AuthorizedAlbum.this.compute(); + } + }); _sessionId = aSessionId; } @@ -105,10 +105,10 @@ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { return (T) new AuthorizedPhoto((Photo) aEntry); } else if (aEntry instanceof Album) { return (T) new AuthorizedAlbum((Album) aEntry, _authorizer, - _authorizedEntries.getCache(), _sessionId); + _authorizedEntries.getCache(), _sessionId); } else { throw new IllegalArgumentException( - "Entry is neither a photo nor an album: " + aEntry); + "Entry is neither a photo nor an album: " + aEntry); } } @@ -139,8 +139,8 @@ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { return entry; } else { if (!(entry instanceof Album)) { - throw new IllegalArgumentException(getPath() + " " - + aPath); + throw new IllegalArgumentException(getPath() + " " + + aPath); } return ((Album) entry).getEntry(remainder); } @@ -198,15 +198,15 @@ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { public void removeEntry(String aId) throws IOException { // Check whether deletion is allowed. PhotoEntry entry = _authorizer.check(decorated().getEntry("/" + aId), - new DeleteOperation()); + new DeleteOperation()); _authorizedEntries.invalidate(); decorated().removeEntry(aId); } public Photo findPhotoBefore(String aId) { Photo entry = decorated().findPhotoBefore(aId); - while (entry != null - && !_authorizer.isAllowed(entry, new AllOperation())) { + while (entry != null && + !_authorizer.isAllowed(entry, new AllOperation())) { entry = decorated().findPhotoBefore(entry.getId()); } return decorate(entry); @@ -214,8 +214,8 @@ public class AuthorizedAlbum extends AuthorizedPhotoEntry implements Album { public Photo findPhotoAfter(String aId) { Photo entry = decorated().findPhotoAfter(aId); - while (entry != null - && !_authorizer.isAllowed(entry, new AllOperation())) { + while (entry != null && + !_authorizer.isAllowed(entry, new AllOperation())) { entry = decorated().findPhotoAfter(entry.getId()); } return decorate(entry);