1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Installation

From djatoka

Jump to: navigation, search

Contents

Download

  • Download aDORe djatoka from the project download page.
  • Untar the contents (e.g., tar -xzf adore-djatoka-X.X.tar.gz)

Verify

cd bin

  • Compress

./compress.sh -i ../etc/test.jpg -o ../etc/test.jp2

  • Extract

./extract.sh -i ../etc/test.jp2 -o ../etc/test-size1.jpg -l 1

  • Verify that ../etc/test-size1.jpg exists and can be opened using an image viewer.

ls -l ../etc/test-size1.jpg

On Windows: See Installation#Windows Installation Instructions

Configure Tomcat

The djatoka Tomcat start-up script assumes an out of the box Tomcat 5+ installation. You'll need to change the script around if you're using different CATALINA_BASE and CATALINA_HOME dirs. You'll need to ensure the CATALINA_HOME env var is set.

cp ../dist/adore-djatoka.war $CATALINA_HOME/webapps/

./tomcat.sh start

On Windows: See Installation#Windows Installation Instructions

In a browser, open 'http://localohost:8080/adore-djatoka/'. Verify that the BaseURL is correct, and click the 'Update Image' button. This will download the an LoC American Memory Image from 'http://memory.loc.gov/gmd/gmd433/g4330/g4330/np000066.jp2' and extract a 500 x 500 region from the JP2 file and return a JPG version on the image in the response.

Server-Side Caching

Review the Caching section for more information on djatoka's Server-side Cache logic and settings.

Notes

Issue 1: The exception "gov.lanl.adore.djatoka.DjatokaException: gov.lanl.adore.djatoka.DjatokaException: java.lang.Exception: kakadu.home is not defined" appears when I click 'Update Image' Resolution: djatoka requires a number of parameters to be passed into Tomcat using JAVA_OPT, this includes the kakadu.home env var. The tomcat startup script in adore-djatoka/bin should be used to initially test the installation. Afterwards, you can extract the JAVA_OPTS settings from env.sh and add them to your preferred Tomcat initialization script, should you have one.

Issue 2: The exception "gov.lanl.adore.djatoka.DjatokaException: gov.lanl.adore.djatoka.DjatokaException: java.lang.Exception: Unknown JP2/JPX file format" appears when I click 'Update Image' Resolution: The is typically the result of a firewall or proxy server blocking a request to download a remote image. The env.sh script in adore-djatoka/bin provides the necessary JAVA_OPTS proxy settings. Uncomment and set these properties then restart the Tomcat instance using the djatoka Tomcat start-up script and try "Update Image" again.

Configure a Referent Resolver

  • New implementations can be easily created to plug djatoka into your existing image database or institutional repository system. Developers should refer to the IReferentResolver interface and provided implementations for details.

Default: SimpleListResolver

  • For locally managed JPEG 2000 content, the default implementation uses a tab delimited text file to define content identifier to file path mappings.
    • e.g. info:lanl-repo/ds/12345 /smnt/images/12345.jp2
  • Pass in the content identifier as the rft_id and the service will obtain the file handle for the associated image file.
  • For remote image files not under your control, the default implementation can access any resolvable http, ftp, or file URI, download the resource, convert it to JPEG 2000, and store a locally cached version associated with the originally requested URI. By default, the implementation will cache the 100 most frequently accessed remote images. You can override this default value by setting the following property in djatoka.properties.
SimpleListResolver.maxRemoteCacheSize=1000

Set-up SimpleListResolver

  • Compress some images
  • Update $CATALINA_HOME/webapps/adore-djatoka/WEB-INF/classes/imgIndex.txt
    • imgIndex.txt is an example the identifier resolver interface functions. It's a simple map associating a rft_id with a file path.
    • Format: 2 tab delimited columns with a single line per resource.
      • Column A being the rft_id
      • Column B being an absolute file path for the JP2 file.
      • Example: info:lanl-repo/ds/CB_TM_QQ432 /path/to/file.jp2
  • ./tomcat.sh stop
  • ./tomcat.sh start
  • Go to http://localhost:8080/adore-djatoka/
  • Enter an identifier for one of your images defined in imgIndex.txt.

Alternate: DatabaseResolver

  • For locally managed JPEG 2000 content, this implementation uses a relational database to map identifiers to file paths.
  • Pass in the content identifier as the rft_id and the service will obtain the file handle for the associated image file.
  • For remote image files not under your control, this implementation can access any resolvable http, ftp, or file URI, download the resource, convert it to JPEG 2000, and store a locally cached version associated with the originally requested URI. By default, the implementation will cache the 100 most frequently accessed remote images. You can override this default value by setting the following property in djatoka.properties.
DatabaseResolver.maxRemoteCacheSize=1000

Set-up DatabaseResolver

  • Compress some images
  • Update the $CATALINA_HOME/webapps/adore-djatoka/WEB-INF/classes/djatoka.properties file. Modify the database connection properties and define DatabaseResolver.query to map the unique identifier and file path to 'identifier' and imageFile'. You can use the default table definition below or modify the query to use your existing tables. Note: Be sure to comment out other instances of OpenURLJP2KService.referentResolverImpl.
OpenURLJP2KService.referentResolverImpl=gov.lanl.adore.djatoka.openurl.plugin.rftdb.DatabaseResolver
DatabaseResolver.url=jdbc:mysql://localhost/djatoka
DatabaseResolver.driver=com.mysql.jdbc.Driver
DatabaseResolver.login=root
DatabaseResolver.pwd=
DatabaseResolver.query=SELECT identifier, imageFile FROM resources WHERE identifier='\\i';
----- DEFAULT SCHEMA -----
CREATE TABLE `resources` (
 `identifier` varchar(100) NOT NULL,
 `imageFile` varchar(255) NOT NULL,
 PRIMARY KEY  (`identifier`)
);
  • Place the JAR file containing the database driver in $CATALINA_HOME/webapps/adore-djatoka/WEB-INF/lib.
  • ./tomcat.sh stop
  • ./tomcat.sh start
  • Go to http://localhost:8080/adore-djatoka/
  • Enter an identifier for one of your images defined in the `identifier` column of the database.

Windows Installation

  • Download the adore-djatoka archive to a directory of your choosing.
  • Extract the adore-djatoka-1.1 dir from the archive using an archive utility (e.g. WinZip).
  • In a cmd.exe prompt, cd to the %install_dir%/adore-djatoka-1.1/bin/ directory.
  • Check that java.exe is in your PATH (e.g. java -version) and that you are using a Sun JVM. If this doesn't work, you'll need to add %JAVA_HOME%/bin to your path.
  • Set/Verify the follow environment variables:

JAVA_HOME Required: Must point at your Java Development Kit installation.

 e.g. set JAVA_HOME=C:\Documents and Settings\208183\java

DJATOKA_HOME Required: Must point at your djatoka installation.

 e.g. set DJATOKA_HOME=C:\Documents and Settings\208183\adore-djatoka-1.1

KAKADU_HOME Required: Must point at your Kakadu installation. Also, you'll need to add KAKADU_HOME to your system PATH variable.

 e.g. set KAKADU_HOME=C:\Documents and Settings\208183\adore-djatoka-1.1\bin\Win32
 e.g. set PATH=%PATH%;%KAKADU_HOME%
  • Execute the following "compress.bat -i ../etc/test.jpg -o ../etc/test.jp2" to verify that compression.
  • Execute the following "extract.bat -i ../etc/test.jp2 -o ../etc/test-size1.jpg -l 1" to verify that extraction.
  • Next "cd ../etc/" and perform a "dir" to verify that test-size1.jpg exists and can be opened using an image viewer.

Then onto Tomcat...

  • Set/Verify the follow environment variable:

CATALINA_HOME Required: Must point at your Tomcat installation.

 e.g. set CATALINA_HOME=C:\Documents and Settings\208183\tomcat
  • Copy ../dist/adore-djatoka.war to $CATALINA_HOME/webapps/
  • From the adore-djatoka-1.1/bin directory run "tomcat.bat". This should launch Tomcat in a new window.
  • In a browser, open 'http://localhost:8080/adore-djatoka/'. Verify that the BaseURL is correct, and click the 'Update Image' button. This will download an LoC American Memory Image from 'http://memory.loc.gov/gmd/gmd433/g4330/g4330/np000066.jp2' and extract a 500 x 500 region from the JP2 file and return a JPG version on the image in the response.

Explore

adore-djatoka-*.*
|- bin - Contains image compression and extraction utilities and binaries
|- build.xml - Ant script to compile and create distributions
|- dist - Contains JAR/WAR distributions
|- doc - Contains javadoc and reference to online documentation
|- etc - Sample compression properties file and images
|- lib - Contains required Java and Native libraries
|- src - Contains Java source code for adore-djatoka

Installation Problems?

Ubuntu 64-bit - UnsatisfiedLinkError

The Ubuntu implementation of uname reports 'unknown' for the -p flag. As a result djatoka is unable to determine which library to map to and the default x86-32 is used. If you change 'uname -p' to 'uname -m' in env.sh it will report the proper architecture type and map to the proper library.

Ubuntu - IncompatibleClassChangeError

There's an issue with djatoka and the default JDK (OpenJDK) used by the Ubuntu distribution. Djatoka currently requires the Sun JDK. Djatoka uses a number of the classes in the Sun API, which have different interfaces on the OpenJDK implementation.

  • If you receive the following error during the extraction test:
/usr/local/djatoka/bin$ ./extract.sh -i ../etc/test.jp2 -o ../etc/test2.jpg -l 1
Exception in thread "main" java.lang.IncompatibleClassChangeError:
Found class com.sun.image.codec.jpeg.JPEGEncodeParam, but interface
was expected
       at com.sun.media.jai.codecimpl.JPEGImageEncoder.modifyEncodeParam(JPEGImageEncoder.java:84)
       at com.sun.media.jai.codecimpl.JPEGImageEncoder.encode(JPEGImageEncoder.java:205)
       at gov.lanl.adore.djatoka.io.writer.JPGWriter.writeUsingJAI(JPGWriter.java:93)
       at gov.lanl.adore.djatoka.io.writer.JPGWriter.write(JPGWriter.java:62)
       at gov.lanl.adore.djatoka.DjatokaExtractProcessor.extractImage(DjatokaExtractProcessor.java:165)
       at gov.lanl.adore.djatoka.DjatokaExtractProcessor.extractImage(DjatokaExtractProcessor.java:85)
       at gov.lanl.adore.djatoka.DjatokaExtract.main(DjatokaExtract.java:123)
  • Check the installed java version...
/usr/local/djatoka/bin$ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.4.1) (6b14-1.4.1-0ubuntu11)
OpenJDK Client VM (build 14.0-b08, mixed mode, sharing)
  • If the OpenJDK is being used, download and extract the Sun JRE or Sun JDK.
  • Then update the env paths to use the new JRE (you may need to put

this in the user's profile or another init script)

export JAVA_HOME=/usr/local/djatoka/jre1.6.0_16
export PATH=$JAVA_HOME/bin:$PATH
  • Then checke the Java version again to verify Sun JRE is installed
/usr/local/djatoka/bin$ java -version
java version "1.6.0_16"
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)
Java HotSpot(TM) Client VM (build 14.2-b01, mixed mode, sharing)
  • Then run the extraction utility to make sure things are functioning properly
/usr/local/djatoka/bin$ ./extract.sh -i ../etc/test.jp2 -o ../etc/test2.jpg -l 1
INFO  gov.lanl.adore.djatoka.DjatokaExtract - Extraction Time: 0.196 seconds
  • Then you can start up Tomcat....
    • From the adore-djatoka-1.1/bin directory,
    • To start Tomcat...
./tomcat.sh start
    • To stop Tomcat...
./tomcat.sh stop
Personal tools