View Javadoc
1 /* 2 * Created on Oct 12, 2003 3 * Copyright (c) 2003. All rights reserved. 4 */ 5 package portaview.server; 6 7 import java.io.File; 8 import java.util.List; 9 import java.util.Vector; 10 11 import portaview.model.Album; 12 13 /*** 14 * Represents a photo repository. A repository is a mechanism for the PortaView program to 15 * load the picutres from the disk. 16 * 17 * @author <a href="mailto:wwlee1@uiuc.edu">William Lee</a> 18 * @version $Id: Repository.java,v 1.2 2003/12/10 06:18:57 wlee Exp $ 19 */ 20 public class Repository 21 { 22 private File albumDir = null; 23 24 /*** 25 * Creates a photo repository. 26 * @param albumDir 27 */ 28 public Repository(File albumDir) 29 { 30 this.albumDir = albumDir; 31 } 32 33 /*** 34 * @return the album directory 35 */ 36 public File getAlbumDir() 37 { 38 return albumDir; 39 } 40 41 /*** 42 * Sets the album directory. 43 * @param albumDir the album directory 44 */ 45 public void setAlbumDir(File albumDir) 46 { 47 this.albumDir = albumDir; 48 } 49 50 /*** 51 * Returns a List of Album that are available in the repository. 52 * @return list of album 53 */ 54 public List listAlbums() 55 { 56 List l = new Vector(); 57 File[] albums = this.albumDir.listFiles(); 58 for (int i = 0; i < albums.length; i++) 59 { 60 File dir = albums[i]; 61 if (dir.isDirectory()) 62 { 63 Album a = new Album(dir); 64 if (a.getPhoto(0) != null) 65 { 66 l.add(a); 67 } 68 } 69 } 70 return l; 71 } 72 73 /*** 74 * Returns an album with a particular name. 75 * @param name name of album 76 * @return the album 77 */ 78 public Album getAlbum(String name) 79 { 80 return new Album(new File(this.albumDir, name)); 81 } 82 83 }

This page was automatically generated by Maven