incubator-photark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r948682 - in /incubator/photark/sandbox/lresende/photark-rest/src: main/java/org/apache/photark/ main/java/org/apache/photark/services/ main/resources/META-INF/ test/resources/
Date Thu, 27 May 2010 06:02:50 GMT
Author: lresende
Date: Thu May 27 06:02:49 2010
New Revision: 948682

URL: http://svn.apache.org/viewvc?rev=948682&view=rev
Log:
Small enhancments to REST API and cleanup of unused files/folders

Removed:
    incubator/photark/sandbox/lresende/photark-rest/src/main/resources/META-INF/
Modified:
    incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/AlbumRef.java
    incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryService.java
    incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryServiceImpl.java
    incubator/photark/sandbox/lresende/photark-rest/src/test/resources/gallery.composite

Modified: incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/AlbumRef.java
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/AlbumRef.java?rev=948682&r1=948681&r2=948682&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/AlbumRef.java
(original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/AlbumRef.java
Thu May 27 06:02:49 2010
@@ -21,10 +21,12 @@ package org.apache.photark;
 
 
 public class AlbumRef {
-    private final Album album;
+    private String albumName;
+    private String coverImageRef;
+    private String albumRef;
+
+    public AlbumRef() {
 
-    public AlbumRef(Album album) {
-        this.album = album;
     }
     
     /**
@@ -32,15 +34,31 @@ public class AlbumRef {
      * @return the album name
      */
     public String getName() {
-        return album.getName();
+        return albumName;
     }
 
     /**
+     * Set Album name
+     * @param name the album name
+     */
+    public void setName(String name) {
+        this.albumName = name;
+    }
+    
+    /**
      * Get cover image reference
-     * @return 
+     * @return the cover image url reference
      */
     public String getCoverImageRef() {
-        return album.getImages().get(0).getLocation();
+        return coverImageRef;
+    }
+    
+    /**
+     * Set cover image reference
+     * @param coverImageRef the cover image url reference
+     */
+    public void setCoverImageRef(String coverImageRef) {
+        this.coverImageRef = coverImageRef;
     }
 
     /**
@@ -48,6 +66,29 @@ public class AlbumRef {
      * @return album ref
      */
     public String getRef() {
-        return album.getLocation();
+        return albumRef;
+    }
+    
+    /**
+     * Set album ref
+     * @param albumRef album ref
+     */
+    public void setRef(String albumRef) {
+        this.albumRef = albumRef;
+    }
+    
+    /**
+     * Utility method to create a AlbumRef from a Album
+     * @param album
+     * @return
+     */
+    public static AlbumRef createAlbumRef(Album album) {
+        AlbumRef albumRef = new AlbumRef();
+        
+        albumRef.setName(album.getName());
+        albumRef.setCoverImageRef(album.getImages().get(0).getLocation());
+        albumRef.setRef(album.getLocation());
+        
+        return albumRef;
     }
 }

Modified: incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryService.java
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryService.java?rev=948682&r1=948681&r2=948682&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryService.java
(original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryService.java
Thu May 27 06:02:49 2010
@@ -19,17 +19,15 @@
 
 package org.apache.photark.services;
 
-import java.util.List;
-
 import javax.ws.rs.GET;
 
-import org.apache.photark.AlbumRef;
+import org.apache.photark.Gallery;
 import org.oasisopen.sca.annotation.Remotable;
 
 @Remotable
 public interface GalleryService {
 
     @GET
-    List<AlbumRef> get();
+    Gallery get();
     
 }

Modified: incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryServiceImpl.java?rev=948682&r1=948681&r2=948682&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryServiceImpl.java
(original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/services/GalleryServiceImpl.java
Thu May 27 06:02:49 2010
@@ -19,15 +19,15 @@
 
 package org.apache.photark.services;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.photark.Album;
 import org.apache.photark.AlbumRef;
+import org.apache.photark.Gallery;
 import org.oasisopen.sca.annotation.Init;
+import org.oasisopen.sca.annotation.Scope;
 
+@Scope("COMPOSITE")
 public class GalleryServiceImpl implements GalleryService {
-    private List<AlbumRef> albumReferences = new ArrayList<AlbumRef>();
+    private Gallery gallery;
     
     @Init
     public void init() {
@@ -38,13 +38,13 @@ public class GalleryServiceImpl implemen
         album.setLocation("http://localhost:8080/gallery/album1");
         
         
-        AlbumRef albumRef = new AlbumRef(album);
+        AlbumRef albumRef = AlbumRef.createAlbumRef(album);
         
-        albumReferences.add(albumRef);
+        gallery.getAlbums().add(albumRef);
     }
     
-    public List<AlbumRef> get() {
-        return albumReferences;
+    public Gallery get() {
+        return gallery;
     }
 
 }

Modified: incubator/photark/sandbox/lresende/photark-rest/src/test/resources/gallery.composite
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/test/resources/gallery.composite?rev=948682&r1=948681&r2=948682&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/test/resources/gallery.composite (original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/test/resources/gallery.composite Thu
May 27 06:02:49 2010
@@ -26,7 +26,7 @@
 		<implementation.java class="org.apache.photark.services.GalleryServiceImpl"/> 
 		<service name="GalleryService">
 			<tuscany:binding.rest uri="http://localhost:8085/gallery">
-    		    <tuscany:wireFormat.xml />
+    		    <tuscany:wireFormat.json />
 			    <tuscany:operationSelector.jaxrs />
     		</tuscany:binding.rest>
    		</service>	



Mime
View raw message