Merge branch 'master' of ssh://forkalsrud.org/home/gitroot/album
4
.gitignore
vendored
|
|
@ -2,4 +2,8 @@
|
||||||
cache.properties
|
cache.properties
|
||||||
/build
|
/build
|
||||||
/db
|
/db
|
||||||
|
/.classpath
|
||||||
|
/.project
|
||||||
|
/.settings
|
||||||
|
/.springBeans
|
||||||
|
|
||||||
|
|
|
||||||
65
pom.xml
|
|
@ -25,12 +25,11 @@
|
||||||
<timezone>PST</timezone>
|
<timezone>PST</timezone>
|
||||||
</developer>
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<finalName>album</finalName>
|
<finalName>photo</finalName>
|
||||||
<sourceDirectory>src</sourceDirectory>
|
|
||||||
<resources>
|
|
||||||
<resource><directory>etc</directory></resource>
|
|
||||||
</resources>
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
|
@ -40,27 +39,17 @@
|
||||||
<target>1.5</target>
|
<target>1.5</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<warSourceDirectory>webapp</warSourceDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.mortbay.jetty</groupId>
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
<artifactId>maven-jetty-plugin</artifactId>
|
<artifactId>maven-jetty-plugin</artifactId>
|
||||||
<version>6.1.14</version>
|
<version>6.1.14</version>
|
||||||
<configuration>
|
|
||||||
<webAppSourceDirectory>${basedir}/webapp</webAppSourceDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-eclipse-plugin</artifactId>
|
<artifactId>maven-eclipse-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<wtpversion>1.5</wtpversion>
|
<wtpversion>1.5</wtpversion>
|
||||||
<wtpContextName>album</wtpContextName>
|
<wtpContextName>photo</wtpContextName>
|
||||||
<wtpdefaultserver>J2EE Preview</wtpdefaultserver>
|
<wtpdefaultserver>J2EE Preview</wtpdefaultserver>
|
||||||
<additionalProjectnatures>
|
<additionalProjectnatures>
|
||||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||||
|
|
@ -98,7 +87,7 @@
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.drew</groupId>
|
<groupId>com.drewnoakes</groupId>
|
||||||
<artifactId>metadata-extractor</artifactId>
|
<artifactId>metadata-extractor</artifactId>
|
||||||
<version>2.3.1</version>
|
<version>2.3.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
@ -113,27 +102,53 @@
|
||||||
<artifactId>log4j</artifactId>
|
<artifactId>log4j</artifactId>
|
||||||
<version>1.2.14</version>
|
<version>1.2.14</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.7</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sleepycat</groupId>
|
<groupId>com.sleepycat</groupId>
|
||||||
<artifactId>je</artifactId>
|
<artifactId>je</artifactId>
|
||||||
<version>4.0.92</version>
|
<version>4.0.92</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>3.8.2</version></dependency>
|
<!--
|
||||||
|
<dependency><groupId>com.caucho</groupId><artifactId>resin</artifactId><version>3.1.8</version></dependency>
|
||||||
|
<dependency><groupId>org.springframework</groupId><artifactId>spring-webmvc</artifactId><version>3.0.0.RELEASE</version></dependency>
|
||||||
|
<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>3.0.0.RELEASE</version></dependency>
|
||||||
|
<dependency><groupId>org.springframework</groupId><artifactId>spring-orm</artifactId><version>3.0.0.RELEASE</version></dependency>
|
||||||
|
-->
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<id>forkalsrud</id>
|
<id>central</id>
|
||||||
<name>forkalsrud.org maven proxy</name>
|
<name>forkalsrud.org maven proxy</name>
|
||||||
<releases><enabled>true</enabled></releases>
|
<releases><enabled>true</enabled></releases>
|
||||||
<snapshots><enabled>false</enabled></snapshots>
|
<snapshots><enabled>false</enabled></snapshots>
|
||||||
<url>http://forkalsrud.org:8080/maven-proxy/repository</url>
|
<url>http://forkalsrud.org:8080/nexus/content/groups/public</url>
|
||||||
<layout>legacy</layout>
|
|
||||||
</repository>
|
</repository>
|
||||||
<repository>
|
<repository>
|
||||||
<id>oracleReleases</id>
|
<id>snapshots</id>
|
||||||
<name>Oracle Released Java Packages</name>
|
<name>forkalsrud.org maven proxy</name>
|
||||||
<url>http://download.oracle.com/maven</url>
|
<releases><enabled>false</enabled></releases>
|
||||||
<layout>default</layout>
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
|
<url>http://forkalsrud.org:8080/nexus/content/groups/public-snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>central</id>
|
||||||
|
<name>forkalsrud.org maven proxy</name>
|
||||||
|
<releases><enabled>true</enabled></releases>
|
||||||
|
<snapshots><enabled>false</enabled></snapshots>
|
||||||
|
<url>http://forkalsrud.org:8080/nexus/content/groups/public</url>
|
||||||
|
</pluginRepository>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>snapshots</id>
|
||||||
|
<name>forkalsrud.org maven proxy</name>
|
||||||
|
<releases><enabled>false</enabled></releases>
|
||||||
|
<snapshots><enabled>true</enabled></snapshots>
|
||||||
|
<url>http://forkalsrud.org:8080/nexus/content/groups/public-snapshots</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
134
project.xml
|
|
@ -1,134 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project>
|
|
||||||
<pomVersion>1</pomVersion>
|
|
||||||
<artifactId>album</artifactId>
|
|
||||||
<name>album</name>
|
|
||||||
<groupId>forkalsrud</groupId>
|
|
||||||
<currentVersion>2</currentVersion>
|
|
||||||
<organization>
|
|
||||||
<name>forkalsrud.org</name>
|
|
||||||
<url>http://www.forkalsrud.org/</url>
|
|
||||||
</organization>
|
|
||||||
<inceptionYear>2008</inceptionYear>
|
|
||||||
<package>org.forkalsrud.album</package>
|
|
||||||
<shortDescription>Photo Album</shortDescription>
|
|
||||||
<siteAddress>http://www.forkalsrud.org/album/</siteAddress>
|
|
||||||
<repository>
|
|
||||||
<connection>scm:pserver:forkalsrud.org:/home/cvsroot</connection>
|
|
||||||
</repository>
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<name>Knut Forkalsrud</name>
|
|
||||||
<id>1</id>
|
|
||||||
<email>knut@forkalsrud.org</email>
|
|
||||||
<url>http://www.forkalsrud.org/~knut/</url>
|
|
||||||
<timezone>PST</timezone>
|
|
||||||
</developer>
|
|
||||||
<developer>
|
|
||||||
<name>Erik Forkalsrud</name>
|
|
||||||
<id>2</id>
|
|
||||||
<email>erik@forkalsrud.org</email>
|
|
||||||
<url>http://www.forkalsrud.org/~erik/</url>
|
|
||||||
<timezone>PST</timezone>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring</artifactId>
|
|
||||||
<version>2.0.6</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-logging</groupId>
|
|
||||||
<artifactId>commons-logging</artifactId>
|
|
||||||
<version>1.0.4</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-digester</groupId>
|
|
||||||
<artifactId>commons-digester</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-collections</groupId>
|
|
||||||
<artifactId>commons-collections</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-lang</groupId>
|
|
||||||
<artifactId>commons-lang</artifactId>
|
|
||||||
<version>2.0</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>velocity</groupId>
|
|
||||||
<artifactId>velocity</artifactId>
|
|
||||||
<version>1.5</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>velocity-tools</groupId>
|
|
||||||
<artifactId>velocity-tools-view</artifactId>
|
|
||||||
<version>1.2</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.drew</groupId>
|
|
||||||
<artifactId>metadata-extractor</artifactId>
|
|
||||||
<version>2.3.1</version>
|
|
||||||
<type>jar</type>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>true</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.drew</groupId>
|
|
||||||
<artifactId>metadata-extractor-source</artifactId>
|
|
||||||
<type>source</type>
|
|
||||||
<jar>metadata-extractor-2.3.1-src.jar</jar>
|
|
||||||
<properties>
|
|
||||||
<war.bundle>false</war.bundle>
|
|
||||||
</properties>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>servletapi</groupId>
|
|
||||||
<artifactId>servletapi</artifactId>
|
|
||||||
<version>2.4</version>
|
|
||||||
<type>jar</type>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<sourceDirectory>src</sourceDirectory>
|
|
||||||
</build>
|
|
||||||
<reports>
|
|
||||||
<report>maven-junit-report-plugin</report>
|
|
||||||
<report>maven-jcoverage-plugin</report>
|
|
||||||
<report>maven-pmd-plugin</report>
|
|
||||||
<report>maven-javadoc-plugin</report>
|
|
||||||
<report>maven-jdepend-plugin</report>
|
|
||||||
</reports>
|
|
||||||
</project>
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.forkalsrud.album.web;
|
package org.forkalsrud.album.web;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
|
@ -83,17 +84,30 @@ public class AlbumServlet
|
||||||
public void init()
|
public void init()
|
||||||
throws ServletException
|
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");
|
log4jInit("/log4j.properties");
|
||||||
System.out.println("in init of Album");
|
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();
|
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");
|
File dbDir = dbDirName != null ? new File(dbDirName) : new File(System.getProperty("java.io.tmpdir"), "album");
|
||||||
dbDir.mkdir();
|
dbDir.mkdirs();
|
||||||
db.init(dbDir);
|
db.init(dbDir);
|
||||||
// cacheManager = CacheManager.create();
|
|
||||||
// imageCache = cacheManager.getCache("imageCache");
|
|
||||||
pictureScaler = new PictureScaler();
|
pictureScaler = new PictureScaler();
|
||||||
lastCacheFlushTime = System.currentTimeMillis();
|
lastCacheFlushTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
@ -32,7 +32,7 @@ import org.forkalsrud.album.exif.Thumbnail;
|
||||||
public class PictureScaler {
|
public class PictureScaler {
|
||||||
|
|
||||||
ExecutorService executor;
|
ExecutorService executor;
|
||||||
BlockingQueue queue;
|
BlockingQueue<PictureRequest> queue;
|
||||||
HashMap<String, PictureRequest> outstandingRequests;
|
HashMap<String, PictureRequest> outstandingRequests;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
xmlns="http://java.sun.com/xml/ns/javaee"
|
xmlns="http://java.sun.com/xml/ns/javaee"
|
||||||
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
|
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"
|
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">
|
version="2.5">
|
||||||
|
|
||||||
<display-name>album</display-name>
|
<display-name>photo</display-name>
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>index.html</welcome-file>
|
<welcome-file>index.html</welcome-file>
|
||||||
</welcome-file-list>
|
</welcome-file-list>
|
||||||
|
|
@ -15,14 +15,7 @@
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>album</servlet-name>
|
<servlet-name>album</servlet-name>
|
||||||
<servlet-class>org.forkalsrud.album.web.AlbumServlet</servlet-class>
|
<servlet-class>org.forkalsrud.album.web.AlbumServlet</servlet-class>
|
||||||
<init-param>
|
<load-on-startup>1</load-on-startup>
|
||||||
<param-name>base</param-name>
|
|
||||||
<param-value>photos</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<param-name>dbdir</param-name>
|
|
||||||
<param-value>db</param-value>
|
|
||||||
</init-param>
|
|
||||||
</servlet>
|
</servlet>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
|
Before Width: | Height: | Size: 499 B After Width: | Height: | Size: 499 B |
|
Before Width: | Height: | Size: 540 B After Width: | Height: | Size: 540 B |
|
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 550 B |
|
Before Width: | Height: | Size: 443 B After Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 511 B |
|
|
@ -1,30 +1,32 @@
|
||||||
package org.forkalsrud.album.exif;
|
package org.forkalsrud.album.exif;
|
||||||
|
|
||||||
import org.forkalsrud.album.exif.OggIdentifier.Codec;
|
import org.forkalsrud.album.exif.OggIdentifier.Codec;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
public class OggIdentifierTest {
|
||||||
|
|
||||||
public class OggIdentifierTest extends TestCase {
|
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testVideoIdentifier() throws Exception {
|
public void testVideoIdentifier() throws Exception {
|
||||||
|
|
||||||
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("videoheader.ogg"));
|
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/videoheader.ogg"));
|
||||||
assertNotNull(codec);
|
Assert.assertNotNull(codec);
|
||||||
assertEquals("video/ogg; codecs=theora", codec.getMimeType());
|
Assert.assertEquals("video/ogg; codecs=theora", codec.getMimeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testAudioIdentifier() throws Exception {
|
public void testAudioIdentifier() throws Exception {
|
||||||
|
|
||||||
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("musicheader.ogg"));
|
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("/musicheader.ogg"));
|
||||||
assertNotNull(codec);
|
Assert.assertNotNull(codec);
|
||||||
assertEquals("audio/ogg; codecs=vorbis", codec.getMimeType());
|
Assert.assertEquals("audio/ogg; codecs=vorbis", codec.getMimeType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void testInvalidIdentifier() throws Exception {
|
public void testInvalidIdentifier() throws Exception {
|
||||||
|
|
||||||
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("OggIdentifierTest.class"));
|
Codec codec = OggIdentifier.getIdentifier(getClass().getResourceAsStream("OggIdentifierTest.class"));
|
||||||
assertNull(codec);
|
Assert.assertNull(codec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||