diff --git a/.gitignore b/.gitignore index 506d561..44e30f3 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,8 @@ cache.properties /build /db +/.classpath +/.project +/.settings +/.springBeans diff --git a/pom.xml b/pom.xml index 27e53e6..88da5df 100644 --- a/pom.xml +++ b/pom.xml @@ -25,12 +25,11 @@ PST + + UTF-8 + - album - src - - etc - + photo org.apache.maven.plugins @@ -40,27 +39,17 @@ 1.5 - - org.apache.maven.plugins - maven-war-plugin - - webapp - - org.mortbay.jetty maven-jetty-plugin 6.1.14 - - ${basedir}/webapp - org.apache.maven.plugins maven-eclipse-plugin 1.5 - album + photo J2EE Preview org.springframework.ide.eclipse.core.springnature @@ -98,7 +87,7 @@ runtime - com.drew + com.drewnoakes metadata-extractor 2.3.1 @@ -113,27 +102,53 @@ log4j 1.2.14 + + junit + junit + 4.7 + com.sleepycat je 4.0.92 - junitjunit3.8.2 + - forkalsrud + central forkalsrud.org maven proxy true false - http://forkalsrud.org:8080/maven-proxy/repository - legacy + http://forkalsrud.org:8080/nexus/content/groups/public - oracleReleases - Oracle Released Java Packages - http://download.oracle.com/maven - default + snapshots + forkalsrud.org maven proxy + false + true + http://forkalsrud.org:8080/nexus/content/groups/public-snapshots + + + central + forkalsrud.org maven proxy + true + false + http://forkalsrud.org:8080/nexus/content/groups/public + + + snapshots + forkalsrud.org maven proxy + false + true + http://forkalsrud.org:8080/nexus/content/groups/public-snapshots + + diff --git a/project.properties b/project.properties deleted file mode 100644 index 1449d94..0000000 --- a/project.properties +++ /dev/null @@ -1,15 +0,0 @@ - -# point to our own maven repository -maven.repo.remote=http://www.forkalsrud.org/maven-proxy/repository - -# warn about use of deprecated classes/methods -maven.compile.deprecation=true - -# WAR plugin -#maven.war.final.name=ROOT.war -maven.war.src=webapp - -# PMD plugin -maven.pmd.cpd.enable=true - -#maven.jblanket.enable=true diff --git a/project.xml b/project.xml deleted file mode 100644 index a445914..0000000 --- a/project.xml +++ /dev/null @@ -1,134 +0,0 @@ - - - 1 - album - album - forkalsrud - 2 - - forkalsrud.org - http://www.forkalsrud.org/ - - 2008 - org.forkalsrud.album - Photo Album - http://www.forkalsrud.org/album/ - - scm:pserver:forkalsrud.org:/home/cvsroot - - - - Knut Forkalsrud - 1 - knut@forkalsrud.org - http://www.forkalsrud.org/~knut/ - PST - - - Erik Forkalsrud - 2 - erik@forkalsrud.org - http://www.forkalsrud.org/~erik/ - PST - - - - - org.springframework - spring - 2.0.6 - jar - - true - - - - commons-logging - commons-logging - 1.0.4 - jar - - true - - - - commons-digester - commons-digester - 1.7 - jar - - true - - - - commons-collections - commons-collections - 3.1 - jar - - true - - - - commons-lang - commons-lang - 2.0 - jar - - true - - - - velocity - velocity - 1.5 - jar - - true - - - - velocity-tools - velocity-tools-view - 1.2 - jar - - true - - - - com.drew - metadata-extractor - 2.3.1 - jar - - true - - - - com.drew - metadata-extractor-source - source - metadata-extractor-2.3.1-src.jar - - false - - - - servletapi - servletapi - 2.4 - jar - - - - src - - - maven-junit-report-plugin - maven-jcoverage-plugin - maven-pmd-plugin - maven-javadoc-plugin - maven-jdepend-plugin - - diff --git a/src/org/forkalsrud/album/db/ThumbnailDatabase.java b/src/main/java/org/forkalsrud/album/db/ThumbnailDatabase.java similarity index 100% rename from src/org/forkalsrud/album/db/ThumbnailDatabase.java rename to src/main/java/org/forkalsrud/album/db/ThumbnailDatabase.java diff --git a/src/org/forkalsrud/album/editor/Editor.java b/src/main/java/org/forkalsrud/album/editor/Editor.java similarity index 100% rename from src/org/forkalsrud/album/editor/Editor.java rename to src/main/java/org/forkalsrud/album/editor/Editor.java diff --git a/src/org/forkalsrud/album/editor/Makefile b/src/main/java/org/forkalsrud/album/editor/Makefile similarity index 100% rename from src/org/forkalsrud/album/editor/Makefile rename to src/main/java/org/forkalsrud/album/editor/Makefile diff --git a/src/org/forkalsrud/album/exif/ComparatorFactory.java b/src/main/java/org/forkalsrud/album/exif/ComparatorFactory.java similarity index 100% rename from src/org/forkalsrud/album/exif/ComparatorFactory.java rename to src/main/java/org/forkalsrud/album/exif/ComparatorFactory.java diff --git a/src/org/forkalsrud/album/exif/ComposingComparator.java b/src/main/java/org/forkalsrud/album/exif/ComposingComparator.java similarity index 100% rename from src/org/forkalsrud/album/exif/ComposingComparator.java rename to src/main/java/org/forkalsrud/album/exif/ComposingComparator.java diff --git a/src/org/forkalsrud/album/exif/Dimension.java b/src/main/java/org/forkalsrud/album/exif/Dimension.java similarity index 100% rename from src/org/forkalsrud/album/exif/Dimension.java rename to src/main/java/org/forkalsrud/album/exif/Dimension.java diff --git a/src/org/forkalsrud/album/exif/DirectoryEntry.java b/src/main/java/org/forkalsrud/album/exif/DirectoryEntry.java similarity index 100% rename from src/org/forkalsrud/album/exif/DirectoryEntry.java rename to src/main/java/org/forkalsrud/album/exif/DirectoryEntry.java diff --git a/src/org/forkalsrud/album/exif/Entry.java b/src/main/java/org/forkalsrud/album/exif/Entry.java similarity index 100% rename from src/org/forkalsrud/album/exif/Entry.java rename to src/main/java/org/forkalsrud/album/exif/Entry.java diff --git a/src/org/forkalsrud/album/exif/FileEntry.java b/src/main/java/org/forkalsrud/album/exif/FileEntry.java similarity index 100% rename from src/org/forkalsrud/album/exif/FileEntry.java rename to src/main/java/org/forkalsrud/album/exif/FileEntry.java diff --git a/src/org/forkalsrud/album/exif/OggIdentifier.java b/src/main/java/org/forkalsrud/album/exif/OggIdentifier.java similarity index 100% rename from src/org/forkalsrud/album/exif/OggIdentifier.java rename to src/main/java/org/forkalsrud/album/exif/OggIdentifier.java diff --git a/src/org/forkalsrud/album/exif/Thumbnail.java b/src/main/java/org/forkalsrud/album/exif/Thumbnail.java similarity index 100% rename from src/org/forkalsrud/album/exif/Thumbnail.java rename to src/main/java/org/forkalsrud/album/exif/Thumbnail.java diff --git a/src/org/forkalsrud/album/web/AlbumServlet.java b/src/main/java/org/forkalsrud/album/web/AlbumServlet.java similarity index 93% rename from src/org/forkalsrud/album/web/AlbumServlet.java rename to src/main/java/org/forkalsrud/album/web/AlbumServlet.java index 979c931..744ae7b 100644 --- a/src/org/forkalsrud/album/web/AlbumServlet.java +++ b/src/main/java/org/forkalsrud/album/web/AlbumServlet.java @@ -1,6 +1,7 @@ package org.forkalsrud.album.web; import java.io.File; +import java.io.FileReader; import java.io.IOException; import java.util.Arrays; import java.util.Calendar; @@ -83,17 +84,30 @@ public class AlbumServlet public void init() throws ServletException { + Properties props = new Properties(); + + File forkalsrudOrg = new File(System.getProperty("user.home"), "forkalsrud.org"); + if (! forkalsrudOrg.exists()) { + forkalsrudOrg.mkdirs(); + } + File photoConf = new File(forkalsrudOrg, "photo.properties"); + if (photoConf.exists()) { + try { + props.load(new FileReader(photoConf)); + } catch (Exception e) { + throw new ServletException("unable to load settings from " + photoConf.getPath(), e); + } + } + log4jInit("/log4j.properties"); System.out.println("in init of Album"); - base = new File(getServletConfig().getInitParameter("base")).getAbsoluteFile(); + base = new File(props.getProperty("base", "photos")).getAbsoluteFile(); basePrefix = "/" + base.getName(); - String dbDirName = getServletConfig().getInitParameter("dbdir"); + String dbDirName = props.getProperty("dbdir"); File dbDir = dbDirName != null ? new File(dbDirName) : new File(System.getProperty("java.io.tmpdir"), "album"); - dbDir.mkdir(); + dbDir.mkdirs(); db.init(dbDir); -// cacheManager = CacheManager.create(); -// imageCache = cacheManager.getCache("imageCache"); pictureScaler = new PictureScaler(); lastCacheFlushTime = System.currentTimeMillis(); } diff --git a/src/org/forkalsrud/album/web/CachedImage.java b/src/main/java/org/forkalsrud/album/web/CachedImage.java similarity index 100% rename from src/org/forkalsrud/album/web/CachedImage.java rename to src/main/java/org/forkalsrud/album/web/CachedImage.java diff --git a/src/org/forkalsrud/album/web/PictureScaler.java b/src/main/java/org/forkalsrud/album/web/PictureScaler.java similarity index 99% rename from src/org/forkalsrud/album/web/PictureScaler.java rename to src/main/java/org/forkalsrud/album/web/PictureScaler.java index 0859888..7fe7ae9 100644 --- a/src/org/forkalsrud/album/web/PictureScaler.java +++ b/src/main/java/org/forkalsrud/album/web/PictureScaler.java @@ -32,7 +32,7 @@ import org.forkalsrud.album.exif.Thumbnail; public class PictureScaler { ExecutorService executor; - BlockingQueue queue; + BlockingQueue queue; HashMap outstandingRequests; diff --git a/etc/ehcache-1.5.0.xsd b/src/main/resources/ehcache-1.5.0.xsd similarity index 100% rename from etc/ehcache-1.5.0.xsd rename to src/main/resources/ehcache-1.5.0.xsd diff --git a/etc/ehcache.xml b/src/main/resources/ehcache.xml similarity index 100% rename from etc/ehcache.xml rename to src/main/resources/ehcache.xml diff --git a/etc/log4j.properties b/src/main/resources/log4j.properties similarity index 100% rename from etc/log4j.properties rename to src/main/resources/log4j.properties diff --git a/webapp/.cvsignore b/src/main/webapp/.cvsignore similarity index 100% rename from webapp/.cvsignore rename to src/main/webapp/.cvsignore diff --git a/webapp/WEB-INF/velocity.properties b/src/main/webapp/WEB-INF/velocity.properties similarity index 100% rename from webapp/WEB-INF/velocity.properties rename to src/main/webapp/WEB-INF/velocity.properties diff --git a/webapp/WEB-INF/velocity/photo.vm b/src/main/webapp/WEB-INF/velocity/photo.vm similarity index 100% rename from webapp/WEB-INF/velocity/photo.vm rename to src/main/webapp/WEB-INF/velocity/photo.vm diff --git a/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml similarity index 78% rename from webapp/WEB-INF/web.xml rename to src/main/webapp/WEB-INF/web.xml index 01424c2..ea59366 100644 --- a/webapp/WEB-INF/web.xml +++ b/src/main/webapp/WEB-INF/web.xml @@ -4,10 +4,10 @@ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" - id="WebApp_ID" + id="photo" version="2.5"> - album + photo index.html @@ -15,14 +15,7 @@ album org.forkalsrud.album.web.AlbumServlet - - base - photos - - - dbdir - db - + 1 diff --git a/webapp/assets/left-inactive.png b/src/main/webapp/assets/left-inactive.png similarity index 100% rename from webapp/assets/left-inactive.png rename to src/main/webapp/assets/left-inactive.png diff --git a/webapp/assets/left.png b/src/main/webapp/assets/left.png similarity index 100% rename from webapp/assets/left.png rename to src/main/webapp/assets/left.png diff --git a/webapp/assets/right-inactive.png b/src/main/webapp/assets/right-inactive.png similarity index 100% rename from webapp/assets/right-inactive.png rename to src/main/webapp/assets/right-inactive.png diff --git a/webapp/assets/right.png b/src/main/webapp/assets/right.png similarity index 100% rename from webapp/assets/right.png rename to src/main/webapp/assets/right.png diff --git a/webapp/assets/up-inactive.png b/src/main/webapp/assets/up-inactive.png similarity index 100% rename from webapp/assets/up-inactive.png rename to src/main/webapp/assets/up-inactive.png diff --git a/webapp/assets/up.png b/src/main/webapp/assets/up.png similarity index 100% rename from webapp/assets/up.png rename to src/main/webapp/assets/up.png diff --git a/webapp/editor.html b/src/main/webapp/editor.html similarity index 100% rename from webapp/editor.html rename to src/main/webapp/editor.html diff --git a/webapp/editor.js b/src/main/webapp/editor.js similarity index 100% rename from webapp/editor.js rename to src/main/webapp/editor.js diff --git a/src/org/forkalsrud/album/exif/OggIdentifierTest.java b/src/test/java/org/forkalsrud/album/exif/OggIdentifierTest.java similarity index 55% rename from src/org/forkalsrud/album/exif/OggIdentifierTest.java rename to src/test/java/org/forkalsrud/album/exif/OggIdentifierTest.java index bcda11f..5ea9cca 100644 --- a/src/org/forkalsrud/album/exif/OggIdentifierTest.java +++ b/src/test/java/org/forkalsrud/album/exif/OggIdentifierTest.java @@ -1,30 +1,32 @@ package org.forkalsrud.album.exif; import org.forkalsrud.album.exif.OggIdentifier.Codec; +import org.junit.Assert; +import org.junit.Test; -import junit.framework.TestCase; - -public class OggIdentifierTest extends TestCase { +public class OggIdentifierTest { + @Test public void testVideoIdentifier() throws Exception { - Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("videoheader.ogg")); - assertNotNull(codec); - assertEquals("video/ogg; codecs=theora", codec.getMimeType()); + Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/videoheader.ogg")); + Assert.assertNotNull(codec); + Assert.assertEquals("video/ogg; codecs=theora", codec.getMimeType()); } - + + @Test public void testAudioIdentifier() throws Exception { - Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("musicheader.ogg")); - assertNotNull(codec); - assertEquals("audio/ogg; codecs=vorbis", codec.getMimeType()); + Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/musicheader.ogg")); + Assert.assertNotNull(codec); + Assert.assertEquals("audio/ogg; codecs=vorbis", codec.getMimeType()); } - + @Test public void testInvalidIdentifier() throws Exception { Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("OggIdentifierTest.class")); - assertNull(codec); + Assert.assertNull(codec); } } diff --git a/src/org/forkalsrud/album/exif/musicheader.ogg b/src/test/resources/musicheader.ogg similarity index 100% rename from src/org/forkalsrud/album/exif/musicheader.ogg rename to src/test/resources/musicheader.ogg diff --git a/src/org/forkalsrud/album/exif/videoheader.ogg b/src/test/resources/videoheader.ogg similarity index 100% rename from src/org/forkalsrud/album/exif/videoheader.ogg rename to src/test/resources/videoheader.ogg