From 1447618d96238bccaa7817a8eed93a8bef2aeefe Mon Sep 17 00:00:00 2001 From: Erik Forkalsrud Date: Fri, 5 Feb 2010 22:01:17 -0800 Subject: [PATCH 1/4] fix repository url and include junit 4.7 --- pom.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9909a11..dbcddd9 100644 --- a/pom.xml +++ b/pom.xml @@ -118,6 +118,11 @@ log4j 1.2.14 + + junit + junit + 4.7 + @@ -125,7 +130,7 @@ forkalsrud.org maven proxy true false - http://www.forkalsrud.org/maven-proxy/repository + http://forkalsrud.org:8080/maven-proxy/repository legacy From 74c29c8ac135576d33c37b116819cdbe2ab776f5 Mon Sep 17 00:00:00 2001 From: Erik Forkalsrud Date: Sat, 6 Feb 2010 12:14:58 -0800 Subject: [PATCH 2/4] change maven repository to our new nexus instance and update junit version to 4.7 --- pom.xml | 44 ++++++++++++------- .../album/exif/OggIdentifierTest.java | 22 +++++----- .../forkalsrud/album/web/PictureScaler.java | 2 +- 3 files changed, 42 insertions(+), 26 deletions(-) diff --git a/pom.xml b/pom.xml index 2587ee3..b6635d4 100644 --- a/pom.xml +++ b/pom.xml @@ -123,29 +123,43 @@ je 4.0.92 + 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:8081/nexus/content/groups/public + 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/src/org/forkalsrud/album/exif/OggIdentifierTest.java b/src/org/forkalsrud/album/exif/OggIdentifierTest.java index bcda11f..f483c55 100644 --- a/src/org/forkalsrud/album/exif/OggIdentifierTest.java +++ b/src/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()); + 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()); + 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/web/PictureScaler.java b/src/org/forkalsrud/album/web/PictureScaler.java index 0859888..7fe7ae9 100644 --- a/src/org/forkalsrud/album/web/PictureScaler.java +++ b/src/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; From a6d3fc333f36da42b7452b8670ed59953aede2b7 Mon Sep 17 00:00:00 2001 From: Erik Forkalsrud Date: Sat, 6 Feb 2010 12:52:30 -0800 Subject: [PATCH 3/4] changed layout to default maven2 structure --- pom.xml | 16 ++++------------ .../forkalsrud/album/db/ThumbnailDatabase.java | 0 .../org/forkalsrud/album/editor/Editor.java | 0 .../java}/org/forkalsrud/album/editor/Makefile | 0 .../album/exif/ComparatorFactory.java | 0 .../album/exif/ComposingComparator.java | 0 .../org/forkalsrud/album/exif/Dimension.java | 0 .../forkalsrud/album/exif/DirectoryEntry.java | 0 .../java}/org/forkalsrud/album/exif/Entry.java | 0 .../org/forkalsrud/album/exif/FileEntry.java | 0 .../forkalsrud/album/exif/OggIdentifier.java | 0 .../org/forkalsrud/album/exif/Thumbnail.java | 0 .../org/forkalsrud/album/web/AlbumServlet.java | 0 .../org/forkalsrud/album/web/CachedImage.java | 0 .../org/forkalsrud/album/web/PictureScaler.java | 0 {etc => src/main/resources}/ehcache-1.5.0.xsd | 0 {etc => src/main/resources}/ehcache.xml | 0 {etc => src/main/resources}/log4j.properties | 0 {webapp => src/main/webapp}/.cvsignore | 0 .../main/webapp}/WEB-INF/velocity.properties | 0 .../main/webapp}/WEB-INF/velocity/photo.vm | 0 {webapp => src/main/webapp}/WEB-INF/web.xml | 0 .../main/webapp}/assets/left-inactive.png | Bin {webapp => src/main/webapp}/assets/left.png | Bin .../main/webapp}/assets/right-inactive.png | Bin {webapp => src/main/webapp}/assets/right.png | Bin .../main/webapp}/assets/up-inactive.png | Bin {webapp => src/main/webapp}/assets/up.png | Bin {webapp => src/main/webapp}/editor.html | 0 {webapp => src/main/webapp}/editor.js | 0 .../album/exif/OggIdentifierTest.java | 4 ++-- .../exif => test/resources}/musicheader.ogg | Bin .../exif => test/resources}/videoheader.ogg | Bin 33 files changed, 6 insertions(+), 14 deletions(-) rename src/{ => main/java}/org/forkalsrud/album/db/ThumbnailDatabase.java (100%) rename src/{ => main/java}/org/forkalsrud/album/editor/Editor.java (100%) rename src/{ => main/java}/org/forkalsrud/album/editor/Makefile (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/ComparatorFactory.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/ComposingComparator.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/Dimension.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/DirectoryEntry.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/Entry.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/FileEntry.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/OggIdentifier.java (100%) rename src/{ => main/java}/org/forkalsrud/album/exif/Thumbnail.java (100%) rename src/{ => main/java}/org/forkalsrud/album/web/AlbumServlet.java (100%) rename src/{ => main/java}/org/forkalsrud/album/web/CachedImage.java (100%) rename src/{ => main/java}/org/forkalsrud/album/web/PictureScaler.java (100%) rename {etc => src/main/resources}/ehcache-1.5.0.xsd (100%) rename {etc => src/main/resources}/ehcache.xml (100%) rename {etc => src/main/resources}/log4j.properties (100%) rename {webapp => src/main/webapp}/.cvsignore (100%) rename {webapp => src/main/webapp}/WEB-INF/velocity.properties (100%) rename {webapp => src/main/webapp}/WEB-INF/velocity/photo.vm (100%) rename {webapp => src/main/webapp}/WEB-INF/web.xml (100%) rename {webapp => src/main/webapp}/assets/left-inactive.png (100%) rename {webapp => src/main/webapp}/assets/left.png (100%) rename {webapp => src/main/webapp}/assets/right-inactive.png (100%) rename {webapp => src/main/webapp}/assets/right.png (100%) rename {webapp => src/main/webapp}/assets/up-inactive.png (100%) rename {webapp => src/main/webapp}/assets/up.png (100%) rename {webapp => src/main/webapp}/editor.html (100%) rename {webapp => src/main/webapp}/editor.js (100%) rename src/{ => test/java}/org/forkalsrud/album/exif/OggIdentifierTest.java (92%) rename src/{org/forkalsrud/album/exif => test/resources}/musicheader.ogg (100%) rename src/{org/forkalsrud/album/exif => test/resources}/videoheader.ogg (100%) diff --git a/pom.xml b/pom.xml index b6635d4..73a7c60 100644 --- a/pom.xml +++ b/pom.xml @@ -25,12 +25,11 @@ PST + + UTF-8 + - album - src - - etc - + photo org.apache.maven.plugins @@ -40,13 +39,6 @@ 1.5 - - org.apache.maven.plugins - maven-war-plugin - - webapp - - org.mortbay.jetty maven-jetty-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 100% rename from src/org/forkalsrud/album/web/AlbumServlet.java rename to src/main/java/org/forkalsrud/album/web/AlbumServlet.java 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 100% rename from src/org/forkalsrud/album/web/PictureScaler.java rename to src/main/java/org/forkalsrud/album/web/PictureScaler.java 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 100% rename from webapp/WEB-INF/web.xml rename to src/main/webapp/WEB-INF/web.xml 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 92% rename from src/org/forkalsrud/album/exif/OggIdentifierTest.java rename to src/test/java/org/forkalsrud/album/exif/OggIdentifierTest.java index f483c55..5ea9cca 100644 --- a/src/org/forkalsrud/album/exif/OggIdentifierTest.java +++ b/src/test/java/org/forkalsrud/album/exif/OggIdentifierTest.java @@ -9,7 +9,7 @@ public class OggIdentifierTest { @Test public void testVideoIdentifier() throws Exception { - Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("videoheader.ogg")); + Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/videoheader.ogg")); Assert.assertNotNull(codec); Assert.assertEquals("video/ogg; codecs=theora", codec.getMimeType()); } @@ -18,7 +18,7 @@ public class OggIdentifierTest { @Test public void testAudioIdentifier() throws Exception { - Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("musicheader.ogg")); + Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/musicheader.ogg")); Assert.assertNotNull(codec); Assert.assertEquals("audio/ogg; codecs=vorbis", codec.getMimeType()); } 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 From 639ab48cd1eb4a18331ebc20420f7c6ecec111e7 Mon Sep 17 00:00:00 2001 From: Erik Forkalsrud Date: Sat, 6 Feb 2010 13:38:43 -0800 Subject: [PATCH 4/4] use settings from ${user.home}/forkalsrud.org/ --- .gitignore | 4 + pom.xml | 5 +- project.properties | 15 -- project.xml | 134 ------------------ .../forkalsrud/album/web/AlbumServlet.java | 24 +++- src/main/webapp/WEB-INF/web.xml | 13 +- 6 files changed, 27 insertions(+), 168 deletions(-) delete mode 100644 project.properties delete mode 100644 project.xml 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 73a7c60..88da5df 100644 --- a/pom.xml +++ b/pom.xml @@ -43,16 +43,13 @@ 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 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/main/java/org/forkalsrud/album/web/AlbumServlet.java b/src/main/java/org/forkalsrud/album/web/AlbumServlet.java index 979c931..744ae7b 100644 --- a/src/main/java/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/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml index 01424c2..ea59366 100644 --- a/src/main/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