[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r9946 - in Extractor-java: . native org org/gnu/libextracto
From: |
gnunet |
Subject: |
[GNUnet-SVN] r9946 - in Extractor-java: . native org org/gnu/libextractor |
Date: |
Fri, 1 Jan 2010 01:28:58 +0100 |
Author: grothoff
Date: 2010-01-01 01:28:58 +0100 (Fri, 01 Jan 2010)
New Revision: 9946
Added:
Extractor-java/native/org_gnu_libextractor_Extractor.h
Extractor-java/org/gnu/
Removed:
Extractor-java/native/org_gnunet_libextractor_Extractor.h
Extractor-java/org/gnunet/
Modified:
Extractor-java/ChangeLog
Extractor-java/INSTALL
Extractor-java/README.debian
Extractor-java/configure.ac
Extractor-java/native/Makefile.am
Extractor-java/native/extractor.c
Extractor-java/org/Makefile.am
Extractor-java/org/gnu/libextractor/Extractor.java
Extractor-java/org/gnu/libextractor/Makefile.am
Extractor-java/org/gnu/libextractor/Xtract.java
Log:
updating code to work with libextractor 0.6
Modified: Extractor-java/ChangeLog
===================================================================
--- Extractor-java/ChangeLog 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/ChangeLog 2010-01-01 00:28:58 UTC (rev 9946)
@@ -1,3 +1,8 @@
+Fri Jan 1 00:22:43 CET 2010
+ Changing API and implementation to work with libextractor 0.6.
+ Changing package to 'org.gnu.libextractor' to avoid conflicts
+ with previous versions (and to fit the package better as well).
+
Sat Apr 21 17:09:03 MDT 2007
Added method to support extracting data from in-memory
byte array. Changed API to use ArrayList instead of Vector.
Modified: Extractor-java/INSTALL
===================================================================
--- Extractor-java/INSTALL 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/INSTALL 2010-01-01 00:28:58 UTC (rev 9946)
@@ -1,13 +1,19 @@
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
-Foundation, Inc.
+Installation Instructions
+*************************
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
Basic Installation
==================
- These are generic installation instructions.
+ Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package. The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -20,9 +26,9 @@
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
-the results of its tests to speed up reconfiguring. (Caching is
+the results of its tests to speed up reconfiguring. Caching is
disabled by default to prevent problems with accidental use of stale
-cache files.)
+cache files.
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
@@ -32,20 +38,17 @@
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
-`configure' by a program called `autoconf'. You only need
-`configure.ac' if you want to change it or regenerate `configure' using
-a newer version of `autoconf'.
+`configure' by a program called `autoconf'. You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
- `./configure' to configure the package for your system. If you're
- using `csh' on an old version of System V, you might need to type
- `sh ./configure' instead to prevent `csh' from trying to execute
- `configure' itself.
+ `./configure' to configure the package for your system.
- Running `configure' takes awhile. While running, it prints some
- messages telling which features it is checking for.
+ Running `configure' might take a while. While running, it prints
+ some messages telling which features it is checking for.
2. Type `make' to compile the package.
@@ -64,6 +67,9 @@
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
@@ -75,7 +81,7 @@
by setting variables in the command line or in the environment. Here
is an example:
- ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix
+ ./configure CC=c99 CFLAGS=-g LIBS=-lposix
*Note Defining Variables::, for more details.
@@ -84,34 +90,46 @@
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
-own directory. To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'. `cd' to the
+own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
- If you have to use a `make' that does not support the `VPATH'
-variable, you have to compile the package for one architecture at a
-time in the source code directory. After you have installed the
-package for one architecture, use `make distclean' before reconfiguring
-for another architecture.
+ With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory. After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
Installation Names
==================
- By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc. You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
+ By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc. You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
-options like `--bindir=PATH' to specify different values for particular
+options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
@@ -134,6 +152,38 @@
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
Specifying the System Type
==========================
@@ -149,14 +199,15 @@
where SYSTEM can have one of these forms:
- OS KERNEL-OS
+ OS
+ KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
-use the `--target=TYPE' option to select the type of system they will
+use the option `--target=TYPE' to select the type of system they will
produce code for.
If you want to _use_ a cross compiler, that generates code for a
@@ -186,9 +237,14 @@
./configure CC=/usr/local2/bin/gcc
-will cause the specified gcc to be used as the C compiler (unless it is
+causes the specified `gcc' to be used as the C compiler (unless it is
overridden in the site shell script).
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug. Until the bug is fixed you can use this workaround:
+
+ CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
`configure' Invocation
======================
@@ -197,8 +253,15 @@
`--help'
`-h'
- Print a summary of the options to `configure', and exit.
+ Print a summary of all of the options to `configure', and exit.
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
+
`--version'
`-V'
Print the version of Autoconf used to generate the `configure'
@@ -224,6 +287,16 @@
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
+`--prefix=DIR'
+ Use DIR as the installation prefix. *Note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
Modified: Extractor-java/README.debian
===================================================================
--- Extractor-java/README.debian 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/README.debian 2010-01-01 00:28:58 UTC (rev 9946)
@@ -17,7 +17,7 @@
subversion
autoconf
-automake1.8
+automake
==============================================
Modified: Extractor-java/configure.ac
===================================================================
--- Extractor-java/configure.ac 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/configure.ac 2010-01-01 00:28:58 UTC (rev 9946)
@@ -1,8 +1,8 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.57)
-AC_INIT([libextractor-java], [0.5.18], address@hidden)
+AC_INIT([libextractor-java], [0.6.0], address@hidden)
AC_REVISION($Revision: 1.67 $)
-AM_INIT_AUTOMAKE([libextractor-java], [0.5.18])
+AM_INIT_AUTOMAKE([libextractor-java], [0.6.0])
AM_CONFIG_HEADER(native/config.h)
AH_TOP([#define _GNU_SOURCE 1])
@@ -111,14 +111,14 @@
;;
yes)
AC_CHECK_HEADERS(extractor.h,
- AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
+ AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
extractor=1))
;;
*)
LDFLAGS="-L$with_extractor/lib $LDFLAGS"
CPPFLAGS="-I$with_extractor/include $CPPFLAGS"
AC_CHECK_HEADERS(extractor.h,
- AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
+ AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
EXT_LIB_PATH="-L$with_extractor/lib $EXT_LIB_PATH"
extractor=1))
;;
@@ -126,7 +126,7 @@
],
[AC_MSG_RESULT([--with-extractor not specified])
AC_CHECK_HEADERS(extractor.h,
- AC_CHECK_LIB([extractor], [EXTRACTOR_loadDefaultLibraries],
+ AC_CHECK_LIB([extractor], [EXTRACTOR_plugin_add_defaults],
extractor=1))])
if test "$extractor" != 1
then
@@ -138,8 +138,8 @@
Makefile
native/Makefile
org/Makefile
-org/gnunet/Makefile
-org/gnunet/libextractor/Makefile
+org/gnu/Makefile
+org/gnu/libextractor/Makefile
])
AC_OUTPUT
Modified: Extractor-java/native/Makefile.am
===================================================================
--- Extractor-java/native/Makefile.am 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/native/Makefile.am 2010-01-01 00:28:58 UTC (rev 9946)
@@ -10,4 +10,4 @@
libextractor_java_la_SOURCES = \
extractor.c jni.h \
- org_gnunet_libextractor_Extractor.h
+ org_gnu_libextractor_Extractor.h
Modified: Extractor-java/native/extractor.c
===================================================================
--- Extractor-java/native/extractor.c 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/native/extractor.c 2010-01-01 00:28:58 UTC (rev 9946)
@@ -32,238 +32,247 @@
#define JNICALL
#endif
-#include "org_gnunet_libextractor_Extractor.h"
+#include "org_gnu_libextractor_Extractor.h"
-#define HIGHEST_TYPE_NUMBER EXTRACTOR_getHighestKeywordTypeNumber()
+#define HIGHEST_TYPE_NUMBER EXTRACTOR_metatype_get_max()
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: loadDefaultInternal
* Signature: ()J
*/
JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_loadDefaultInternal(JNIEnv * env,
+Java_org_gnu_libextractor_Extractor_loadDefaultInternal(JNIEnv * env,
jclass c) {
- return (jlong) (long) EXTRACTOR_loadDefaultLibraries();
+ return (jlong) (long) EXTRACTOR_plugin_add_defaults
(EXTRACTOR_OPTION_DEFAULT_POLICY);
}
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: unloadInternal
* Signature: (J)V
*/
JNIEXPORT void JNICALL
-Java_org_gnunet_libextractor_Extractor_unloadInternal(JNIEnv * env,
- jclass c,
- jlong arg) {
- EXTRACTOR_removeAll((EXTRACTOR_ExtractorList*) (long) arg);
+Java_org_gnu_libextractor_Extractor_unloadAllInternal(JNIEnv * env,
+ jclass c,
+ jlong arg) {
+ EXTRACTOR_plugin_remove_all((struct EXTRACTOR_PluginList*) (long) arg);
}
/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: extractInternal
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_extractInternal(JNIEnv * env,
- jclass c,
- jlong arg,
- jstring f) {
- const char * fname;
- jboolean bo;
- jlong ret;
-
- bo = JNI_FALSE;
- fname = (*env)->GetStringUTFChars(env,
- f,
- &bo);
- if (fname == NULL)
- return 0;
- ret = (jlong) (long) EXTRACTOR_getKeywords((EXTRACTOR_ExtractorList*) (long)
arg,
- fname);
- (*env)->ReleaseStringUTFChars(env,
- f,
- fname);
- return ret;
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: extractInternal
- * Signature: (J[B)J
- */
-JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_extractInternal2(JNIEnv * env,
- jclass c,
- jlong arg,
- jbyteArray f) {
- void * data;
- jboolean bo;
- jlong ret;
- jsize asize;
-
- bo = JNI_FALSE;
- asize = (*env)->GetArrayLength(env, f);
- data = (*env)->GetPrimitiveArrayCritical(env,
- f,
- &bo);
- if (data == NULL)
- return 0;
- ret = (jlong) (long) EXTRACTOR_getKeywords2((EXTRACTOR_ExtractorList*)
(long) arg,
- data,
- (size_t) asize);
- (*env)->ReleasePrimitiveArrayCritical(env,
- f,
- data,
- JNI_ABORT);
- return ret;
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: freeInternal
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL
-Java_org_gnunet_libextractor_Extractor_freeInternal(JNIEnv * env,
- jclass c,
- jlong list) {
- EXTRACTOR_freeKeywords( (EXTRACTOR_KeywordList*) (long) list);
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: typeInternal
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL
-Java_org_gnunet_libextractor_Extractor_typeInternal(JNIEnv * env,
- jclass c,
- jlong list) {
- if (list == 0)
- return -1; /* error! */
- return ((EXTRACTOR_KeywordList*) (long) list)->keywordType;
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: keywordInternal
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
-Java_org_gnunet_libextractor_Extractor_keywordInternal(JNIEnv * env,
- jclass c,
- jlong list) {
- char * str;
- if (list == 0)
- return NULL; /* error! */
- str = ((EXTRACTOR_KeywordList*) (long) list)->keyword;
- return (*env)->NewStringUTF(env, str);
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: nextInternal
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_nextInternal(JNIEnv * env,
- jclass j,
- jlong list) {
- if (list == 0)
- return 0; /* error! */
- return (jlong) (long) ((EXTRACTOR_KeywordList*) (long) list)->next;
-}
-
-/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: getTypeAsStringInternal
* Signature: (I)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL
-Java_org_gnunet_libextractor_Extractor_getTypeAsStringInternal(JNIEnv * env,
+Java_org_gnu_libextractor_Extractor_getTypeAsStringInternal(JNIEnv * env,
jclass c,
jint type) {
const char * str;
+
if ( (type < 0) || (type > HIGHEST_TYPE_NUMBER) )
return NULL; /* error! */
- str = EXTRACTOR_getKeywordTypeAsString((EXTRACTOR_KeywordType)type);
+ str = EXTRACTOR_metatype_to_string((enum EXTRACTOR_MetaType)type);
if (str == NULL)
return NULL;
- return (*env)->NewStringUTF(env,
- str);
+ return (*env)->NewStringUTF(env, str);
}
-
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: getVersionInternal
* Signature: ()I
*/
JNIEXPORT jint JNICALL
-Java_org_gnunet_libextractor_Extractor_getVersionInternal(JNIEnv * env,
+Java_org_gnu_libextractor_Extractor_getVersionInternal(JNIEnv * env,
jclass c) {
return EXTRACTOR_VERSION;
}
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: getMaxTypeInternal
* Signature: ()I
*/
JNIEXPORT jint JNICALL
-Java_org_gnunet_libextractor_Extractor_getMaxTypeInternal(JNIEnv * env,
+Java_org_gnu_libextractor_Extractor_getMaxTypeInternal(JNIEnv * env,
jclass c) {
return HIGHEST_TYPE_NUMBER;
}
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: unloadPlugin
* Signature: (JLjava/lang/String;)J
*/
JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_unloadPlugin(JNIEnv * env,
-
jclass c,
- jlong
handle,
-
jstring name) {
+Java_org_gnu_libextractor_Extractor_unloadPluginInternal(JNIEnv * env,
+ jclass c,
+ jlong handle,
+ jstring name) {
const char * lname;
jboolean bo;
jlong ret;
bo = JNI_FALSE;
lname = (*env)->GetStringUTFChars(env, name, &bo);
- ret = (jlong) (long) EXTRACTOR_removeLibrary((EXTRACTOR_ExtractorList*)
(long) handle,
+ ret = (jlong) (long) EXTRACTOR_plugin_remove((struct EXTRACTOR_PluginList*)
(long) handle,
lname);
(*env)->ReleaseStringUTFChars(env, name, lname);
return ret;
}
/*
- * Class: org_gnunet_libextractor_Extractor
+ * Class: org_gnu_libextractor_Extractor
* Method: loadPlugin
* Signature: (JLjava/lang/String;Z)J
*/
JNIEXPORT jlong JNICALL
-Java_org_gnunet_libextractor_Extractor_loadPlugin(JNIEnv * env,
- jclass c,
- jlong handle,
- jstring name,
- jboolean place) {
+Java_org_gnu_libextractor_Extractor_loadPluginInternal(JNIEnv * env,
+ jclass c,
+ jlong handle,
+ jstring name) {
const char * lname;
jboolean bo;
jlong ret;
bo = JNI_FALSE;
lname = (*env)->GetStringUTFChars(env, name, &bo);
- if (place == JNI_TRUE) {
- ret = (jlong) (long) EXTRACTOR_addLibraryLast((EXTRACTOR_ExtractorList*)
(long) handle,
- lname);
- } else {
- ret = (jlong) (long) EXTRACTOR_addLibrary((EXTRACTOR_ExtractorList*)
(long) handle,
- lname);
- }
+ ret = (jlong) (long) EXTRACTOR_plugin_add((struct EXTRACTOR_PluginList*)
(long) handle,
+ lname,
+ NULL,
+ EXTRACTOR_OPTION_DEFAULT_POLICY);
(*env)->ReleaseStringUTFChars(env, name, lname);
return ret;
}
+
+/**
+ * Closure of 'add_meta' function.
+ */
+struct AddMetaContext
+{
+ JNIEnv *env;
+ jobject ret;
+ jclass metadata;
+ jmethodID meta_ctor;
+ jmethodID alist_add;
+};
+
+
+/**
+ * Function called by libextractor for each meta data item.
+ */
+static int
+add_meta (void *cls,
+ const char *plugin_name,
+ enum EXTRACTOR_MetaType type,
+ enum EXTRACTOR_MetaFormat format,
+ const char *data_mime_type,
+ const char *data,
+ size_t data_len)
+{
+ struct AddMetaContext *ctx = cls;
+ jbyteArray bdata;
+ jstring mimestring;
+ jobject metadata;
+
+ mimestring = (*ctx->env)->NewStringUTF (ctx->env,
+ data_mime_type);
+ bdata = (*ctx->env)->NewByteArray (ctx->env,
+ data_len);
+ (*ctx->env)->SetByteArrayRegion (ctx->env,
+ bdata,
+ 0,
+ data_len,
+ (jbyte*) data);
+ metadata = (*ctx->env)->NewObject (ctx->env,
+ ctx->metadata,
+ ctx->meta_ctor,
+ type, format, bdata,
+ mimestring);
+ (*ctx->env)->CallBooleanMethod (ctx->env,
+ ctx->ret,
+ ctx->alist_add,
+ metadata);
+ return 0;
+}
+
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: extractInternal
+ * Signature: (JLjava/lang/String;[BLjava/util/ArrayList;)V
+ */
+JNIEXPORT void JNICALL Java_org_gnu_libextractor_Extractor_extractInternal
+ (JNIEnv *env, jclass c, jlong arg, jstring f, jbyteArray ba, jobject ret)
+{
+ const char * fname;
+ void * data;
+ jboolean bo;
+ jsize asize;
+ struct AddMetaContext am_ctx;
+ jclass alist;
+
+ am_ctx.env = env;
+ am_ctx.ret = ret;
+ am_ctx.metadata = (*env)->FindClass (env, "org/gnu/libextractor/MetaData");
+ if (am_ctx.metadata == 0)
+ return;
+ am_ctx.meta_ctor = (*env)->GetMethodID (env,
+ am_ctx.metadata,
+ "<init>",
+ "(II[BLjava/lang/String;)V");
+ if (am_ctx.meta_ctor == 0)
+ return;
+ alist = (*env)->FindClass (env, "java/util/ArrayList");
+ if (alist == 0)
+ return;
+ am_ctx.alist_add = (*env)->GetMethodID (env,
+ alist,
+ "add",
+ "(Ljava/lang/Object;)Z");
+ if (am_ctx.alist_add == 0)
+ return;
+ bo = JNI_FALSE;
+ if (f != 0)
+ {
+ fname = (*env)->GetStringUTFChars(env,
+ f,
+ &bo);
+ }
+ else
+ {
+ fname = NULL;
+ }
+ if (ba != 0)
+ {
+ asize = (*env)->GetArrayLength(env, ba);
+ data = (*env)->GetPrimitiveArrayCritical(env,
+ ba,
+ &bo);
+ }
+ else
+ {
+ asize = 0;
+ data = 0;
+ }
+ if ( (data == NULL) && (fname == NULL) )
+ return;
+ EXTRACTOR_extract((struct EXTRACTOR_PluginList*) (long) arg,
+ fname,
+ data,
+ (size_t) asize,
+ &add_meta,
+ &am_ctx);
+ if (fname != NULL)
+ (*env)->ReleaseStringUTFChars(env,
+ f,
+ fname);
+ if (data != NULL)
+ (*env)->ReleasePrimitiveArrayCritical(env,
+ f,
+ data,
+ JNI_ABORT);
+}
+
Added: Extractor-java/native/org_gnu_libextractor_Extractor.h
===================================================================
--- Extractor-java/native/org_gnu_libextractor_Extractor.h
(rev 0)
+++ Extractor-java/native/org_gnu_libextractor_Extractor.h 2010-01-01
00:28:58 UTC (rev 9946)
@@ -0,0 +1,77 @@
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_gnu_libextractor_Extractor */
+
+#ifndef _Included_org_gnu_libextractor_Extractor
+#define _Included_org_gnu_libextractor_Extractor
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: unloadPluginInternal
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL
Java_org_gnu_libextractor_Extractor_unloadPluginInternal
+ (JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: loadPluginInternal
+ * Signature: (JLjava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_gnu_libextractor_Extractor_loadPluginInternal
+ (JNIEnv *, jclass, jlong, jstring);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: loadDefaultInternal
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_gnu_libextractor_Extractor_loadDefaultInternal
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: unloadAllInternal
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_gnu_libextractor_Extractor_unloadAllInternal
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: extractInternal
+ * Signature: (JLjava/lang/String;[BLjava/util/ArrayList;)J
+ */
+JNIEXPORT void JNICALL Java_org_gnu_libextractor_Extractor_extractInternal
+ (JNIEnv *, jclass, jlong, jstring, jbyteArray, jobject);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: getVersionInternal
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_gnu_libextractor_Extractor_getVersionInternal
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: getTypeAsStringInternal
+ * Signature: (I)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL
Java_org_gnu_libextractor_Extractor_getTypeAsStringInternal
+ (JNIEnv *, jclass, jint);
+
+/*
+ * Class: org_gnu_libextractor_Extractor
+ * Method: getMaxTypeInternal
+ * Signature: ()I
+ */
+JNIEXPORT jint JNICALL Java_org_gnu_libextractor_Extractor_getMaxTypeInternal
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Deleted: Extractor-java/native/org_gnunet_libextractor_Extractor.h
===================================================================
--- Extractor-java/native/org_gnunet_libextractor_Extractor.h 2010-01-01
00:18:03 UTC (rev 9945)
+++ Extractor-java/native/org_gnunet_libextractor_Extractor.h 2010-01-01
00:28:58 UTC (rev 9946)
@@ -1,117 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_gnunet_libextractor_Extractor */
-
-#ifndef _Included_org_gnunet_libextractor_Extractor
-#define _Included_org_gnunet_libextractor_Extractor
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: loadDefaultInternal
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL
Java_org_gnunet_libextractor_Extractor_loadDefaultInternal
- (JNIEnv *, jclass);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: unloadInternal
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_gnunet_libextractor_Extractor_unloadInternal
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: extractInternal
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL
Java_org_gnunet_libextractor_Extractor_extractInternal__JLjava_lang_String_2
- (JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: extractInternal
- * Signature: (J[B)J
- */
-JNIEXPORT jlong JNICALL
Java_org_gnunet_libextractor_Extractor_extractInternal__J_3B
- (JNIEnv *, jclass, jlong, jbyteArray);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: freeInternal
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_gnunet_libextractor_Extractor_freeInternal
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: typeInternal
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL Java_org_gnunet_libextractor_Extractor_typeInternal
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: keywordInternal
- * Signature: (J)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
Java_org_gnunet_libextractor_Extractor_keywordInternal
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: nextInternal
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_gnunet_libextractor_Extractor_nextInternal
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: getTypeAsStringInternal
- * Signature: (I)Ljava/lang/String;
- */
-JNIEXPORT jstring JNICALL
Java_org_gnunet_libextractor_Extractor_getTypeAsStringInternal
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: getVersionInternal
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL
Java_org_gnunet_libextractor_Extractor_getVersionInternal
- (JNIEnv *, jclass);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: getMaxTypeInternal
- * Signature: ()I
- */
-JNIEXPORT jint JNICALL
Java_org_gnunet_libextractor_Extractor_getMaxTypeInternal
- (JNIEnv *, jclass);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: unloadPlugin
- * Signature: (JLjava/lang/String;)J
- */
-JNIEXPORT jlong JNICALL Java_org_gnunet_libextractor_Extractor_unloadPlugin
- (JNIEnv *, jclass, jlong, jstring);
-
-/*
- * Class: org_gnunet_libextractor_Extractor
- * Method: loadPlugin
- * Signature: (JLjava/lang/String;Z)J
- */
-JNIEXPORT jlong JNICALL Java_org_gnunet_libextractor_Extractor_loadPlugin
- (JNIEnv *, jclass, jlong, jstring, jboolean);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
Modified: Extractor-java/org/Makefile.am
===================================================================
--- Extractor-java/org/Makefile.am 2010-01-01 00:18:03 UTC (rev 9945)
+++ Extractor-java/org/Makefile.am 2010-01-01 00:28:58 UTC (rev 9946)
@@ -1 +1 @@
-SUBDIRS = gnunet
+SUBDIRS = gnu
Modified: Extractor-java/org/gnu/libextractor/Extractor.java
===================================================================
--- Extractor-java/org/gnunet/libextractor/Extractor.java 2009-12-31
09:47:42 UTC (rev 9944)
+++ Extractor-java/org/gnu/libextractor/Extractor.java 2010-01-01 00:28:58 UTC
(rev 9946)
@@ -1,6 +1,6 @@
/*
This file is part of libextractor.
- (C) 2002, 2003, 2004, 2007 Vidyut Samanta and Christian Grothoff
+ (C) 2002, 2003, 2004, 2007, 2010 Vidyut Samanta and Christian Grothoff
libextractor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -17,15 +17,18 @@
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
-package org.gnunet.libextractor;
+package org.gnu.libextractor;
import java.util.ArrayList;
import java.io.File;
+import java.io.FileInputStream;
/**
- * Java Binding for libextractor.
+ * Java Binding for libextractor. Each Extractor instance
+ * represents a set of meta data extraction plugins.
*
* @see Xtract
+ * @see MetaData
* @author Christian Grothoff
*/
public final class Extractor {
@@ -39,11 +42,6 @@
*/
private static final int version_;
- /**
- * Cached list of Strings describing keyword types.
- */
- private final static String[] typeCache_;
-
static {
// first, initialize warn_
boolean warn = false;
@@ -53,7 +51,7 @@
} catch (SecurityException se) {
// ignore
} finally {
- warn_ = warn;
+ warn_ = true; // warn;
}
// next, load library and determine version_
@@ -73,20 +71,15 @@
}
}
version_ = ver;
-
- // finally, initialize typeCache_
- if (ver > 0) {
- typeCache_ = new String[getMaxTypeInternal()];
- } else {
- typeCache_ = null;
- }
}
+
private static void warn(String warning) {
if (warn_)
System.err.println("WARNING: " + warning);
}
+
/**
* @return -1 if LE library was not found, 0 if LE library
* was found but compiled without JNI support, otherwise
@@ -96,6 +89,7 @@
return version_;
}
+
/**
* Get the 'default' extractor, that is an extractor that loads
* the default set of extractor plugins.
@@ -106,6 +100,7 @@
return new Extractor(0);
}
+
/**
* Get the 'empty' extractor, that is an extractor that does not
* have any plugins loaded. This is useful to manually construct
@@ -115,29 +110,6 @@
return new Extractor(0L);
}
- /**
- * Note that the current implementation of function is quite
- * costly, we should probably build a cache (String[]) of all
- * keyword types on startup and keep that around instead of
- * doing a native call each time (initialize cache lazily!,
- * just determine the size in the static initializer!).
- *
- * @throws IllegalArgumentException if the type is not within range
- * @return an empty string if LE was not loaded
- */
- public static String getTypeAsString(int type) {
- if (version_ > 0) {
- if ( (type >= 0) &&
- (type <= typeCache_.length) ) {
- if (typeCache_[type] == null)
- typeCache_[type]
- = getTypeAsStringInternal(type);
- return typeCache_[type];
- }
- throw new IllegalArgumentException("Type out of range
[0,"+typeCache_.length+")");
- }
- return "";
- }
/**
* Handle to the list of plugins (a C pointer, long to support
@@ -145,6 +117,7 @@
*/
private long pluginHandle_;
+
/**
* Creates an extractor.
*
@@ -155,282 +128,117 @@
pluginHandle_ = pluginHandle;
}
+
+ /**
+ * Unloads all loaded plugins on "exit".
+ */
protected void finalize() {
if (pluginHandle_ != 0)
- unloadInternal(pluginHandle_);
+ unloadAllInternal(pluginHandle_);
}
+
+ /**
+ * Remove a plugin from the list of plugins.
+ *
+ * @param pluginName name of the plugin to unload
+ */
public void unloadPlugin(String pluginName) {
if (pluginHandle_ != 0)
- pluginHandle_ = unloadPlugin(pluginHandle_,
- pluginName);
+ pluginHandle_ = unloadPluginInternal(pluginHandle_,
+ pluginName);
}
+
/**
- * @param append if true, add the plugin at the end, otherwise at the
- * beginning
+ * Add an additional plugin to the list of plugins
+ * used.
+ *
+ * @param pluginName name of the plugin to load
*/
- public void loadPlugin(String pluginName,
- boolean append) {
+ public void loadPlugin(String pluginName) {
if (version_ <= 0)
return;
- pluginHandle_ = loadPlugin(pluginHandle_,
- pluginName,
- append);
+ pluginHandle_ = loadPluginInternal(pluginHandle_,
+ pluginName);
}
+
/**
* Extract keywords (meta-data) from the given file.
*
* @param f the file to extract meta-data from
- * @return a ArrayList of Extractor.Keywords
+ * @return extracted meta data (ArrayList<MetaData>)
*/
public ArrayList extract(File f) {
return extract(f.getAbsolutePath());
}
+
/**
* Extract keywords (meta-data) from the given file.
*
* @param file the name of the file
- * @return a ArrayList of Extractor.Keywords
+ * @return extracted meta data (ArrayList<MetaData>)
*/
public ArrayList extract(String filename) {
+ ArrayList ret = new ArrayList(0);
if (pluginHandle_ == 0)
- return new ArrayList(0); // fast way out
- long list
- = extractInternal(pluginHandle_,
- filename); // toChars?
- ArrayList ret = convert(list);
- freeInternal(list);
+ return ret; // fast way out
+ extractInternal(pluginHandle_,
+ filename,
+ null,
+ ret);
return ret;
}
+
/**
* Extract keywords (meta-data) from the given block
* of data.
*
* @param data the file data
- * @return a ArrayList of Extractor.Keywords
+ * @return extracted meta data (ArrayList<MetaData>)
*/
public ArrayList extract(byte[] data) {
+ ArrayList ret = new ArrayList(0);
if (pluginHandle_ == 0)
- return new ArrayList(0); // fast way out
- long list
- = extractInternal2(pluginHandle_,
- data);
- ArrayList ret = convert(list);
- freeInternal(list);
+ return ret; // fast way out
+ extractInternal(pluginHandle_,
+ null,
+ data,
+ ret);
return ret;
}
- /**
- * Convert a list of keywords in C to an ArrayList
- * in Java.
- */
- private ArrayList convert(long list) {
- long pos
- = list;
- ArrayList res
- = new ArrayList();
- while (pos != 0) {
- int type
- = typeInternal(pos);
- String keyword
- = keywordInternal(pos);
- res.add(new Keyword(type, keyword));
- pos = nextInternal(pos);
- }
- return res;
- }
-
/* ********************* native calls ******************** */
+ private static native long unloadPluginInternal(long handle,
+ String pluginName);
+
+ private static native long loadPluginInternal(long handle,
+ String pluginName);
+
private static native long loadDefaultInternal();
- private static native void unloadInternal(long handle);
+ private static native void unloadAllInternal(long handle);
- private static native long extractInternal(long handle,
- String filename);
+ private static native void extractInternal(long handle,
+ String filename,
+ byte[] data,
+ ArrayList result);
- private static native long extractInternal2(long handle,
- byte[] data);
-
- // free memory allocated by extractInternal
- private static native void freeInternal(long list);
-
- private static native int typeInternal(long pos);
-
- private static native String keywordInternal(long pos);
-
- private static native long nextInternal(long pos);
-
- private static native String getTypeAsStringInternal(int type);
-
private static native int getVersionInternal();
- private static native int getMaxTypeInternal();
-
- private static native long unloadPlugin(long handle,
- String pluginName);
-
/**
- * @param append if true, add the plugin at the end, otherwise at the
- * beginning
+ * Not private since we use this from "MetaData".
*/
- private static native long loadPlugin(long handle,
- String pluginName,
- boolean append);
+ static native String getTypeAsStringInternal(int type);
/**
- * Representation of a keyword. Each keyword in libextractor
- * has a type (in Java modeled as an int) which describes what
- * the keyword is about.
- *
- * @author Christian Grothoff
+ * Not private since we use this from "MetaData".
*/
- public static final class Keyword {
-
- //Keyword types
- public static final int EXTRACTOR_UNKNOWN = 0;
- public static final int EXTRACTOR_FILENAME = 1;
- public static final int EXTRACTOR_MIMETYPE = 2;
- public static final int EXTRACTOR_TITLE = 3;
- public static final int EXTRACTOR_AUTHOR = 4;
- public static final int EXTRACTOR_ARTIST = 5;
- public static final int EXTRACTOR_DESCRIPTION = 6;
- public static final int EXTRACTOR_COMMENT = 7;
- public static final int EXTRACTOR_DATE = 8;
- public static final int EXTRACTOR_PUBLISHER = 9;
- public static final int EXTRACTOR_LANGUAGE = 10;
- public static final int EXTRACTOR_ALBUM = 11;
- public static final int EXTRACTOR_GENRE = 12;
- public static final int EXTRACTOR_LOCATION = 13;
- public static final int EXTRACTOR_VERSIONNUMBER = 14;
- public static final int EXTRACTOR_ORGANIZATION = 15;
- public static final int EXTRACTOR_COPYRIGHT = 16;
- public static final int EXTRACTOR_SUBJECT = 17;
- public static final int EXTRACTOR_KEYWORDS = 18;
- public static final int EXTRACTOR_CONTRIBUTOR = 19;
- public static final int EXTRACTOR_RESOURCE_TYPE = 20;
- public static final int EXTRACTOR_FORMAT = 21;
- public static final int EXTRACTOR_RESOURCE_IDENTIFIER = 22;
- public static final int EXTRACTOR_SOURCE = 23;
- public static final int EXTRACTOR_RELATION = 24;
- public static final int EXTRACTOR_COVERAGE = 25;
- public static final int EXTRACTOR_SOFTWARE = 26;
- public static final int EXTRACTOR_DISCLAIMER = 27;
- public static final int EXTRACTOR_WARNING = 28;
- public static final int EXTRACTOR_TRANSLATED = 29;
- public static final int EXTRACTOR_CREATION_DATE = 30;
- public static final int EXTRACTOR_MODIFICATION_DATE = 31;
- public static final int EXTRACTOR_CREATOR = 32;
- public static final int EXTRACTOR_PRODUCER = 33;
- public static final int EXTRACTOR_PAGE_COUNT = 34;
- public static final int EXTRACTOR_PAGE_ORIENTATION = 35;
- public static final int EXTRACTOR_PAPER_SIZE = 36;
- public static final int EXTRACTOR_USED_FONTS = 37;
- public static final int EXTRACTOR_PAGE_ORDER = 38;
- public static final int EXTRACTOR_CREATED_FOR = 39;
- public static final int EXTRACTOR_MAGNIFICATION = 40;
- public static final int EXTRACTOR_RELEASE = 41;
- public static final int EXTRACTOR_GROUP = 42;
- public static final int EXTRACTOR_SIZE = 43;
- public static final int EXTRACTOR_SUMMARY = 44;
- public static final int EXTRACTOR_PACKAGER = 45;
- public static final int EXTRACTOR_VENDOR = 46;
- public static final int EXTRACTOR_LICENSE = 47;
- public static final int EXTRACTOR_DISTRIBUTION = 48;
- public static final int EXTRACTOR_BUILDHOST = 49;
- public static final int EXTRACTOR_OS = 50;
- public static final int EXTRACTOR_DEPENDENCY = 51;
- public static final int EXTRACTOR_HASH_MD4 = 52;
- public static final int EXTRACTOR_HASH_MD5 = 53;
- public static final int EXTRACTOR_HASH_SHA0 = 54;
- public static final int EXTRACTOR_HASH_SHA1 = 55;
- public static final int EXTRACTOR_HASH_RMD160 = 56;
- public static final int EXTRACTOR_RESOLUTION = 57;
- public static final int EXTRACTOR_CATEGORY = 58;
- public static final int EXTRACTOR_BOOKTITLE = 59;
- public static final int EXTRACTOR_PRIORITY = 60;
- public static final int EXTRACTOR_CONFLICTS = 61;
- public static final int EXTRACTOR_REPLACES = 62;
- public static final int EXTRACTOR_PROVIDES = 63;
- public static final int EXTRACTOR_CONDUCTOR = 64;
- public static final int EXTRACTOR_INTERPRET = 65;
- public static final int EXTRACTOR_OWNER = 66;
- public static final int EXTRACTOR_LYRICS = 67;
- public static final int EXTRACTOR_MEDIA_TYPE = 68;
- public static final int EXTRACTOR_CONTACT = 69;
- public static final int EXTRACTOR_THUMBNAIL_DATA = 70;
- public static final int EXTRACTOR_PUBLICATION_DATE = 71;
- public static final int EXTRACTOR_CAMERA_MAKE = 72;
- public static final int EXTRACTOR_CAMERA_MODEL = 73;
- public static final int EXTRACTOR_EXPOSURE = 74;
- public static final int EXTRACTOR_APERTURE = 75;
- public static final int EXTRACTOR_EXPOSURE_BIAS = 76;
- public static final int EXTRACTOR_FLASH = 77;
- public static final int EXTRACTOR_FLASH_BIAS = 78;
- public static final int EXTRACTOR_FOCAL_LENGTH = 79;
- public static final int EXTRACTOR_FOCAL_LENGTH_35MM = 80;
- public static final int EXTRACTOR_ISO_SPEED = 81;
- public static final int EXTRACTOR_EXPOSURE_MODE = 82;
- public static final int EXTRACTOR_METERING_MODE = 83;
- public static final int EXTRACTOR_MACRO_MODE = 84;
- public static final int EXTRACTOR_IMAGE_QUALITY = 85;
- public static final int EXTRACTOR_WHITE_BALANCE = 86;
- public static final int EXTRACTOR_ORIENTATION = 87;
- public static final int EXTRACTOR_TEMPLATE = 88;
- public static final int EXTRACTOR_SPLIT = 89;
- public static final int EXTRACTOR_PRODUCTVERSION = 90;
- public static final int EXTRACTOR_LAST_SAVED_BY = 91;
- public static final int EXTRACTOR_LAST_PRINTED = 92;
- public static final int EXTRACTOR_WORD_COUNT = 93;
- public static final int EXTRACTOR_CHARACTER_COUNT = 94;
- public static final int EXTRACTOR_TOTAL_EDITING_TIME = 95;
- public static final int EXTRACTOR_THUMBNAILS = 96;
- public static final int EXTRACTOR_SECURITY = 97;
- public static final int EXTRACTOR_CREATED_BY_SOFTWARE = 98;
- public static final int EXTRACTOR_MODIFIED_BY_SOFTWARE = 99;
- public static final int EXTRACTOR_REVISION_HISTORY = 100;
- public static final int EXTRACTOR_LOWERCASE = 101;
- public static final int EXTRACTOR_COMPANY = 102;
- public static final int EXTRACTOR_GENERATOR = 103;
- public static final int EXTRACTOR_CHARACTER_SET = 104;
- public static final int EXTRACTOR_LINE_COUNT = 105;
- public static final int EXTRACTOR_PARAGRAPH_COUNT = 106;
- public static final int EXTRACTOR_EDITING_CYCLES = 107;
- public static final int EXTRACTOR_SCALE = 108;
- public static final int EXTRACTOR_MANAGER = 109;
- public static final int EXTRACTOR_MOVIE_DIRECTOR = 110;
- public static final int EXTRACTOR_DURATION = 111;
- public static final int EXTRACTOR_INFORMATION = 112;
- public static final int EXTRACTOR_FULL_NAME = 113;
- public static final int EXTRACTOR_CHAPTER = 114;
+ static native int getMaxTypeInternal();
- private final int type_;
-
- private final String keyword_;
-
- Keyword(int type,
- String key) {
- this.type_ = type;
- this.keyword_ = key;
- }
-
- public String toString() {
- return getTypeAsString(type_) + ": " + keyword_;
- }
-
- public int getType() {
- return type_;
- }
-
- public String getKeyword() {
- return keyword_;
- }
-
- } // end of Extractor.Keyword
-
} // end of Extractor
Modified: Extractor-java/org/gnu/libextractor/Makefile.am
===================================================================
--- Extractor-java/org/gnunet/libextractor/Makefile.am 2009-12-31 09:47:42 UTC
(rev 9944)
+++ Extractor-java/org/gnu/libextractor/Makefile.am 2010-01-01 00:28:58 UTC
(rev 9946)
@@ -1,12 +1,14 @@
SUBDIRS = .
noinst_JAVA = \
Extractor.java \
+ MetaData.java \
Xtract.java
EXTRA_DIST = \
Extractor.java \
+ MetaData.java \
Xtract.java
install-exec-local:
mkdir -p $(prefix)/share/java
- cd ../../..; @JAR@ -cvf $(prefix)/share/java/libextractor.jar
org/gnunet/libextractor/*.class
+ cd ../../..; @JAR@ -cvf $(prefix)/share/java/libextractor.jar
org/gnu/libextractor/*.class
Modified: Extractor-java/org/gnu/libextractor/Xtract.java
===================================================================
--- Extractor-java/org/gnunet/libextractor/Xtract.java 2009-12-31 09:47:42 UTC
(rev 9944)
+++ Extractor-java/org/gnu/libextractor/Xtract.java 2010-01-01 00:28:58 UTC
(rev 9946)
@@ -1,6 +1,6 @@
/*
This file is part of libextractor.
- (C) 2002, 2003, 2004, 2007 Vidyut Samanta and Christian Grothoff
+ (C) 2002, 2003, 2004, 2007, 2010 Vidyut Samanta and Christian Grothoff
libextractor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
@@ -17,7 +17,7 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-package org.gnunet.libextractor;
+package org.gnu.libextractor;
import java.util.ArrayList;
@@ -34,7 +34,7 @@
Extractor ex = Extractor.getDefault();
for (int i=0;i<args.length;i++) {
ArrayList keywords = ex.extract(args[i]);
- System.out.println("Keywords for " + args[i] + ":\n");
+ System.out.println("Keywords for " + args[i] + ":");
for (int j=0;j<keywords.size();j++)
System.out.println(keywords.get(j));
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r9946 - in Extractor-java: . native org org/gnu/libextractor,
gnunet <=