Merge branch 'master' of ssh://forkalsrud.org/home/gitroot/album
4
.gitignore
vendored
|
|
@ -2,4 +2,8 @@
|
|||
cache.properties
|
||||
/build
|
||||
/db
|
||||
/.classpath
|
||||
/.project
|
||||
/.settings
|
||||
/.springBeans
|
||||
|
||||
|
|
|
|||
65
pom.xml
|
|
@ -25,12 +25,11 @@
|
|||
<timezone>PST</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<finalName>album</finalName>
|
||||
<sourceDirectory>src</sourceDirectory>
|
||||
<resources>
|
||||
<resource><directory>etc</directory></resource>
|
||||
</resources>
|
||||
<finalName>photo</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
@ -40,27 +39,17 @@
|
|||
<target>1.5</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<configuration>
|
||||
<warSourceDirectory>webapp</warSourceDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>maven-jetty-plugin</artifactId>
|
||||
<version>6.1.14</version>
|
||||
<configuration>
|
||||
<webAppSourceDirectory>${basedir}/webapp</webAppSourceDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<configuration>
|
||||
<wtpversion>1.5</wtpversion>
|
||||
<wtpContextName>album</wtpContextName>
|
||||
<wtpContextName>photo</wtpContextName>
|
||||
<wtpdefaultserver>J2EE Preview</wtpdefaultserver>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
|
||||
|
|
@ -98,7 +87,7 @@
|
|||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.drew</groupId>
|
||||
<groupId>com.drewnoakes</groupId>
|
||||
<artifactId>metadata-extractor</artifactId>
|
||||
<version>2.3.1</version>
|
||||
</dependency>
|
||||
|
|
@ -113,27 +102,53 @@
|
|||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sleepycat</groupId>
|
||||
<artifactId>je</artifactId>
|
||||
<version>4.0.92</version>
|
||||
</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>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>forkalsrud</id>
|
||||
<id>central</id>
|
||||
<name>forkalsrud.org maven proxy</name>
|
||||
<releases><enabled>true</enabled></releases>
|
||||
<snapshots><enabled>false</enabled></snapshots>
|
||||
<url>http://forkalsrud.org:8080/maven-proxy/repository</url>
|
||||
<layout>legacy</layout>
|
||||
<url>http://forkalsrud.org:8080/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>oracleReleases</id>
|
||||
<name>Oracle Released Java Packages</name>
|
||||
<url>http://download.oracle.com/maven</url>
|
||||
<layout>default</layout>
|
||||
<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>
|
||||
</repository>
|
||||
</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>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ import org.forkalsrud.album.exif.Thumbnail;
|
|||
public class PictureScaler {
|
||||
|
||||
ExecutorService executor;
|
||||
BlockingQueue queue;
|
||||
BlockingQueue<PictureRequest> queue;
|
||||
HashMap<String, PictureRequest> outstandingRequests;
|
||||
|
||||
|
||||
|
|
@ -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">
|
||||
|
||||
<display-name>album</display-name>
|
||||
<display-name>photo</display-name>
|
||||
<welcome-file-list>
|
||||
<welcome-file>index.html</welcome-file>
|
||||
</welcome-file-list>
|
||||
|
|
@ -15,14 +15,7 @@
|
|||
<servlet>
|
||||
<servlet-name>album</servlet-name>
|
||||
<servlet-class>org.forkalsrud.album.web.AlbumServlet</servlet-class>
|
||||
<init-param>
|
||||
<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>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||