PHOTARK-38 - Applying patch from Henry Saputra to tyde up package names for fileSystem implementation
git-svn-id: https://svn.apache.org/repos/asf/incubator/photark/trunk@943794 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/AlbumImpl.java b/photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemAlbumImpl.java
similarity index 80%
rename from photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/AlbumImpl.java
rename to photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemAlbumImpl.java
index bc216e9..7c3724d 100644
--- a/photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/AlbumImpl.java
+++ b/photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemAlbumImpl.java
@@ -17,7 +17,7 @@
* under the License.
*/
-package org.apache.photark.filesystem.impl;
+package org.apache.photark.filesystem.services;
import java.io.File;
import java.util.ArrayList;
@@ -29,15 +29,14 @@
import org.oasisopen.sca.annotation.Init;
import org.oasisopen.sca.annotation.Property;
-
-public class AlbumImpl implements Album {
+public class FileSystemAlbumImpl implements org.apache.photark.services.album.Album {
private String name;
private String location;
- private String description;
+ private String description;
private boolean initialized;
- private List<String> pictures = new ArrayList<String>();
+ private java.util.List<String> pictures = new java.util.ArrayList<String>();
- @Init
+ @org.oasisopen.sca.annotation.Init
public void init() {
try {
/*
@@ -48,9 +47,9 @@
}*/
if(location != null) {
- File album = new File(location);
+ java.io.File album = new java.io.File(location);
if (album.isDirectory() && album.exists()) {
- String[] listPictures = album.list(new ImageFilter(".jpg"));
+ String[] listPictures = album.list(new org.apache.photark.services.album.ImageFilter(".jpg"));
for(String image : listPictures) {
pictures.add(image);
}
@@ -66,7 +65,7 @@
return name;
}
- @Property
+ @org.oasisopen.sca.annotation.Property
public void setName(String name) {
this.name = name;
this.location = null;
@@ -76,7 +75,7 @@
return location;
}
- @Property
+ @org.oasisopen.sca.annotation.Property
public void setLocation(String location) {
this.location = location;
}
@@ -90,11 +89,11 @@
return pictureArray;
}
- public void addPicture(Image picture){
+ public void addPicture(org.apache.photark.Image picture){
throw new UnsupportedOperationException("Not implemented");
}
- public void deletePicture(Image picture){
+ public void deletePicture(org.apache.photark.Image picture){
throw new UnsupportedOperationException("Not implemented");
}
@@ -109,4 +108,5 @@
public void setDescription(String description) {
this.description=description;
}
-}
\ No newline at end of file
+}
+
diff --git a/photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/GalleryImpl.java b/photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemGalleryImpl.java
similarity index 69%
rename from photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/GalleryImpl.java
rename to photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemGalleryImpl.java
index 9a3bb54..a3459cf 100644
--- a/photark-filesystem/src/main/java/org/apache/photark/filesystem/impl/GalleryImpl.java
+++ b/photark-filesystem/src/main/java/org/apache/photark/filesystem/services/FileSystemGalleryImpl.java
@@ -6,18 +6,18 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
-package org.apache.photark.filesystem.impl;
+package org.apache.photark.filesystem.services;
import java.io.File;
import java.net.URL;
@@ -28,45 +28,46 @@
import org.apache.photark.services.gallery.Gallery;
import org.oasisopen.sca.annotation.Init;
-public class GalleryImpl extends BaseGalleryImpl implements Gallery {
- private static final Logger logger = Logger.getLogger(GalleryImpl.class.getName());
+public class FileSystemGalleryImpl extends BaseGalleryImpl implements Gallery {
+ private static final java.util.logging.Logger logger =
+ java.util.logging.Logger.getLogger(FileSystemGalleryImpl.class.getName());
- public GalleryImpl(){
+ public FileSystemGalleryImpl() {
}
- public GalleryImpl(String name){
+ public FileSystemGalleryImpl(String name) {
super(name);
}
- @Init
+ @org.oasisopen.sca.annotation.Init
public void init() {
logger.info("Initializing fileSystem Gallery");
try {
- URL galleryURL = this.getClass().getClassLoader().getResource(name);
+ java.net.URL galleryURL = this.getClass().getClassLoader().getResource(name);
if(galleryURL == null) {
// Accomodate for J2EE classpath that starts in WEB-INF\classes
galleryURL = this.getClass().getClassLoader().getResource("../../" + name);
}
if(galleryURL == null) {
- // Workaroud for Google apps Engine
+ // Workaroud for Google apps Engine
String galleryDir = System.getProperty("user.dir") + "/" + name;
- galleryURL = new URL("file://" + galleryDir);
+ galleryURL = new java.net.URL("file://" + galleryDir);
}
if(galleryURL != null) {
- File album = new File(galleryURL.toURI());
+ java.io.File album = new java.io.File(galleryURL.toURI());
if (album.isDirectory() && album.exists()) {
- File[] albums = album.listFiles();
- for(File albumFile : albums) {
+ java.io.File[] albums = album.listFiles();
+ for(java.io.File albumFile : albums) {
if(! albumFile.getName().startsWith(".")) {
if(albumFile.isDirectory() && albumFile.exists()) {
- Album newAlbum = new org.apache.photark.filesystem.impl.AlbumImpl();
+ org.apache.photark.services.album.Album newAlbum = new FileSystemAlbumImpl();
newAlbum.setName(albumFile.getName());
newAlbum.setLocation(albumFile.getPath());
this.albums.add(newAlbum);
- }
+ }
}
}
}
@@ -78,11 +79,11 @@
initialized = true;
}
- public void addAlbum(String albumName){
+ public void addAlbum(String albumName) {
}
public void deleteAlbum(String albumName) {
-
+
}
}
\ No newline at end of file
diff --git a/photark-filesystem/src/test/java/org/apache/photark/filesystem/impl/GalleryTestCase.java b/photark-filesystem/src/test/java/org/apache/photark/filesystem/services/FileSystemGalleryTestCase.java
similarity index 84%
rename from photark-filesystem/src/test/java/org/apache/photark/filesystem/impl/GalleryTestCase.java
rename to photark-filesystem/src/test/java/org/apache/photark/filesystem/services/FileSystemGalleryTestCase.java
index 48a28a8..5d5aae8 100644
--- a/photark-filesystem/src/test/java/org/apache/photark/filesystem/impl/GalleryTestCase.java
+++ b/photark-filesystem/src/test/java/org/apache/photark/filesystem/services/FileSystemGalleryTestCase.java
@@ -6,39 +6,39 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
-package org.apache.photark.filesystem.impl;
+package org.apache.photark.filesystem.services;
import junit.framework.Assert;
-import org.apache.photark.filesystem.impl.GalleryImpl;
+import org.apache.photark.filesystem.services.FileSystemGalleryImpl;
import org.apache.photark.services.album.Album;
import org.apache.photark.services.gallery.Gallery;
import org.junit.BeforeClass;
import org.junit.Test;
-public class GalleryTestCase {
+public class FileSystemGalleryTestCase {
private static Gallery gallery;
-
+
@BeforeClass
public static void BeforeClass() {
- gallery = new GalleryImpl("gallery-home");
+ gallery = new FileSystemGalleryImpl("gallery-home");
}
-
+
@Test
public void testDiscoverAlbums() {
Album[] albums = gallery.getAlbums();
-
+
Assert.assertEquals(2, albums.length);
Assert.assertTrue(albums[0].getName().startsWith("album-"));
Assert.assertTrue(albums[1].getName().startsWith("album-"));