You are viewing a plain text version of this content. The canonical link for it is here.
Posted to photark-commits@incubator.apache.org by lr...@apache.org on 2011/06/04 06:58:16 UTC

svn commit: r1131335 - in /incubator/photark/branches/photark-rest/photark-jcr/src: main/java/org/apache/photark/services/jcr/JCRGallery.java main/java/org/apache/photark/services/jcr/JCRGalleryService.java test/resources/gallery.composite

Author: lresende
Date: Sat Jun  4 06:58:15 2011
New Revision: 1131335

URL: http://svn.apache.org/viewvc?rev=1131335&view=rev
Log:
Renaming JCRGallery to JCRGalleryService

Added:
    incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java   (contents, props changed)
      - copied, changed from r1131334, incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGallery.java
Removed:
    incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGallery.java
Modified:
    incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite

Copied: incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java (from r1131334, incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGallery.java)
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java?p2=incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java&p1=incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGallery.java&r1=1131334&r2=1131335&rev=1131335&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGallery.java (original)
+++ incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java Sat Jun  4 06:58:15 2011
@@ -51,16 +51,16 @@ import org.oasisopen.sca.annotation.Scop
  * @version $Rev$ $Date$
  */
 @Scope("COMPOSITE")
-public class JCRGallery implements GalleryService {
+public class JCRGalleryService implements GalleryService {
     private static final String JCR_ALBUM_ROOT_NODE = "albums";
 
-    private static final Logger logger = Logger.getLogger(JCRGallery.class.getName());
+    private static final Logger logger = Logger.getLogger(JCRGalleryService.class.getName());
 
     private Map<String, Album> albums = new HashMap<String, Album>();
 
     private JCRRepositoryManager repositoryManager;
 
-    public JCRGallery(@Reference(name="repositoryManager") JCRRepositoryManager repositoryManager) {
+    public JCRGalleryService(@Reference(name="repositoryManager") JCRRepositoryManager repositoryManager) {
         this.repositoryManager = repositoryManager;
     }
 
@@ -147,27 +147,27 @@ public class JCRGallery implements Galle
         }
     }
 
-    public void updateAlbum(Album album) throws PhotarkRuntimeException {
+    public void updateAlbum(String albumId, Album album) throws PhotarkRuntimeException {
         if(album.getName() == null || album.getName().isEmpty()) {
             throw new InvalidParameterException("Album has no name");
         }
 
-        if(! albums.containsKey(album.getName())) {
+        if(! albums.containsKey(albumId)) {
             if(logger.isLoggable(Level.SEVERE)) {
-                logger.log(Level.SEVERE, "Album '" + album.getName() + "' not found");
+                logger.log(Level.SEVERE, "Album '" + albumId + "' not found");
             }
-            throw new InvalidParameterException("Album '" + album.getName() + "' not found");
+            throw new InvalidParameterException("Album '" + albumId + "' not found");
         }
 
         try {
             Node albumRootNode = getAlbumRoot(repositoryManager);
 
-            if(! albumRootNode.hasNode(album.getName())) {
+            if(! albumRootNode.hasNode(albumId)) {
                 if(logger.isLoggable(Level.SEVERE)) {
-                    logger.log(Level.SEVERE, "Album node '" + album.getName() + "' not found in the JCR repository");
+                    logger.log(Level.SEVERE, "Album node '" + albumId + "' not found in the JCR repository");
                 }
 
-                throw new PhotarkRuntimeException("Album node '" + album.getName()  + "' not found in the JCR repository");
+                throw new PhotarkRuntimeException("Album node '" + albumId  + "' not found in the JCR repository");
             }
 
             Node albumNode = albumRootNode.getNode(album.getName());
@@ -184,45 +184,43 @@ public class JCRGallery implements Galle
             }
             throw new PhotarkRuntimeException("Error updating album node '" + album.getName() + "'" );
         }
-
-
     }
 
-    public void removeAlbum(String albumName) throws PhotarkRuntimeException {
-        if(albumName == null || albumName.isEmpty()) {
+    public void removeAlbum(String albumId) throws PhotarkRuntimeException {
+        if(albumId == null || albumId.isEmpty()) {
             throw new InvalidParameterException("Invalid/Empty album name");
         }
 
 
-        if(! albums.containsKey(albumName)) {
+        if(! albums.containsKey(albumId)) {
             if(logger.isLoggable(Level.SEVERE)) {
-                logger.log(Level.SEVERE, "Album '" + albumName + "' not found");
+                logger.log(Level.SEVERE, "Album '" + albumId + "' not found");
             }
-            throw new InvalidParameterException("Album '" + albumName + "' not found");
+            throw new InvalidParameterException("Album '" + albumId + "' not found");
         }
 
         try {
             Node albumRootNode = getAlbumRoot(repositoryManager);
 
-            if(! albumRootNode.hasNode(albumName)) {
+            if(! albumRootNode.hasNode(albumId)) {
                 if(logger.isLoggable(Level.SEVERE)) {
-                    logger.log(Level.SEVERE, "Album node '" + albumName + "' not found in the JCR repository");
+                    logger.log(Level.SEVERE, "Album node '" + albumId + "' not found in the JCR repository");
                 }
 
-                throw new PhotarkRuntimeException("Album node '" + albumName  + "' not found in the JCR repository");
+                throw new PhotarkRuntimeException("Album node '" + albumId  + "' not found in the JCR repository");
             }
 
-            Node albumNode = albumRootNode.getNode(albumName);
+            Node albumNode = albumRootNode.getNode(albumId);
             albumNode.remove();
             repositoryManager.getSession().save();
 
-            albums.remove(albumName);
+            albums.remove(albumId);
 
         } catch(RepositoryException e) {
             if(logger.isLoggable(Level.SEVERE)) {
-                logger.log(Level.SEVERE, "Error deleting album node '" + albumName + "'" );
+                logger.log(Level.SEVERE, "Error deleting album node '" + albumId + "'" );
             }
-            throw new PhotarkRuntimeException("Error deleting album node '" + albumName + "'" );
+            throw new PhotarkRuntimeException("Error deleting album node '" + albumId + "'" );
         }
     }
 
@@ -299,7 +297,7 @@ public class JCRGallery implements Galle
         if(image.getId() == null || image.getId().isEmpty()) {
             throw new InvalidParameterException("Image has no id");
         }
-        
+
         if(image.getName() == null || image.getName().isEmpty()) {
             throw new InvalidParameterException("Image has no name");
         }
@@ -338,7 +336,7 @@ public class JCRGallery implements Galle
     }
 
     public void removeImage(String albumName, String imageId) throws PhotarkRuntimeException {
-        
+
         if(imageId == null || imageId.isEmpty()) {
             throw new InvalidParameterException("Invalid/Empty album name");
         }

Propchange: incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/photark/branches/photark-rest/photark-jcr/src/main/java/org/apache/photark/services/jcr/JCRGalleryService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite
URL: http://svn.apache.org/viewvc/incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite?rev=1131335&r1=1131334&r2=1131335&view=diff
==============================================================================
--- incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite (original)
+++ incubator/photark/branches/photark-rest/photark-jcr/src/test/resources/gallery.composite Sat Jun  4 06:58:15 2011
@@ -34,7 +34,7 @@
 	</component>
 
 	<component name="GalleryComponent">
-		<implementation.java class="org.apache.photark.services.jcr.JCRGallery"/>
+		<implementation.java class="org.apache.photark.services.jcr.JCRGalleryService"/>
 		<service name="GalleryService">
 			<tuscany:binding.rest uri="http://localhost:8085/gallery">
 			    <tuscany:operationSelector.jaxrs />