incubator-photark-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r949887 - in /incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark: Album.java Image.java services/GalleryService.java services/GalleryServiceImpl.java
Date Mon, 31 May 2010 23:14:39 GMT
Author: lresende
Date: Mon May 31 23:14:38 2010
New Revision: 949887

URL: http://svn.apache.org/viewvc?rev=949887&view=rev
Log:
Enhancments to REST API

Modified:
    incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Album.java
    incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Image.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

Modified: incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Album.java
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Album.java?rev=949887&r1=949886&r2=949887&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Album.java
(original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Album.java
Mon May 31 23:14:38 2010
@@ -20,6 +20,7 @@
 package org.apache.photark;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -29,6 +30,9 @@ public class Album {
     private String name;
     private String description;
     private String location;
+    private Date dateCreated;
+    private Date dateUpdated;
+    private int size;
     
     private List<Image> images = new ArrayList<Image>();
 

Modified: incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Image.java
URL: http://svn.apache.org/viewvc/incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Image.java?rev=949887&r1=949886&r2=949887&view=diff
==============================================================================
--- incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Image.java
(original)
+++ incubator/photark/sandbox/lresende/photark-rest/src/main/java/org/apache/photark/Image.java
Mon May 31 23:14:38 2010
@@ -19,9 +19,6 @@
 
 package org.apache.photark;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -30,13 +27,13 @@ import java.util.List;
  * Model representing an album image
  */
 public class Image {
-    private String imageName;
+    private String name;
+    private String title;
     private Date datePosted;
     
     private String url;
     private String urlThumb;
     
-    private InputStream imageStream;
     private List<ImageMetadata> imageAttributes = new ArrayList<ImageMetadata>();
 
     /**
@@ -44,14 +41,8 @@ public class Image {
      * @param imageFile a File representing the image
      * @param datePosted Date when image is being added
      */
-    public Image(File imageFile, Date datePosted) {
-        this.imageName = imageFile.getName();
-        this.datePosted = datePosted;
-        try {
-            this.imageStream = new FileInputStream(imageFile);
-        } catch(Exception fnf) {
-            fnf.printStackTrace();
-        }
+    public Image() {
+
     }
     
     /**
@@ -60,10 +51,10 @@ public class Image {
      * @param datePosted Date when image is being added
      * @param imageStream Image stream content
      */
-    public Image(String name, Date datePosted, InputStream imageStream) {
-        this.imageName = name;
+    public Image(String name, String title, Date datePosted) {
+        this.name = name;
+        this.title = title;
         this.datePosted = datePosted;
-        this.imageStream = imageStream;
     }
 
     /**
@@ -71,10 +62,34 @@ public class Image {
      * @return image file name
      */
     public String getName() {
-        return imageName;
+        return name;
+    }
+    
+    /**
+     * Set image file name
+     * @param name image file name
+     */
+    public void setName(String name) {
+        this.name = name;
     }
 
     /**
+     * Get image title
+     * @return image title
+     */
+    public String getTitle() {
+        return title;
+    }
+    
+    /**
+     * Set image title
+     * @param title image title
+     */
+    public void setTitle(String title) {
+        this.title = title;
+    }
+    
+    /**
      * Get date when image was posted
      * @return date posted
      */
@@ -113,14 +128,6 @@ public class Image {
     public void setThumbnailLocation(String thumbnailLocation) {
         this.urlThumb = thumbnailLocation;
     }
-
-    /**
-     * Return image content as stream
-     * @return image stream
-     */
-    public InputStream getImageAsStream() {
-        return imageStream;
-    }
     
     /**
      * Return image metadata retrieved from EXIF properties

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=949887&r1=949886&r2=949887&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
Mon May 31 23:14:38 2010
@@ -20,6 +20,7 @@
 package org.apache.photark.services;
 
 import javax.ws.rs.GET;
+import javax.ws.rs.Path;
 import javax.ws.rs.Produces;
 import javax.ws.rs.core.MediaType;
 
@@ -29,8 +30,22 @@ import org.oasisopen.sca.annotation.Remo
 @Remotable
 public interface GalleryService {
 
+    /**
+     * Retrieve a list of all Albums from the Gallery
+     * @return
+     */
     @GET
+    @Path("albums")
     @Produces(MediaType.APPLICATION_JSON)
-    Gallery get();
+    Gallery getAlbums();
+    
+    /**
+     * Retrieve a list of recent updated Albums
+     * @return
+     */
+    @GET
+    @Path("newalbums")
+    @Produces(MediaType.APPLICATION_JSON)
+    Gallery getUpdatedAlbums();
     
 }

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=949887&r1=949886&r2=949887&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
Mon May 31 23:14:38 2010
@@ -31,19 +31,36 @@ public class GalleryServiceImpl implemen
     @Init
     public void init() {
         
-        Album album = new Album();
+        Album album;
+        AlbumRef albumRef;
+        
+        album = new Album();
         album.setName("Album 1");
         album.setDescription("Album Description");
         album.setLocation("http://localhost:8080/gallery/album1");
         
         
-        AlbumRef albumRef = AlbumRef.createAlbumRef(album);
+        albumRef = AlbumRef.createAlbumRef(album);        
+        gallery.getAlbums().add(albumRef);
+        
+        album = new Album();
+        album.setName("Album 2");
+        album.setDescription("Album Description");
+        album.setLocation("http://localhost:8080/gallery/album2");
+        
         
+        albumRef = AlbumRef.createAlbumRef(album);
         gallery.getAlbums().add(albumRef);
+        
     }
     
-    public Gallery get() {
+
+    public Gallery getAlbums() {
         return gallery;
     }
 
+    public Gallery getUpdatedAlbums() {
+        return gallery;
+        
+    }
 }



Mime
View raw message