You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tika.apache.org by ju...@apache.org on 2010/09/02 16:46:48 UTC
svn commit: r991956 [3/6] - in /tika/trunk: src/site/apt/
tika-core/src/main/java/org/apache/tika/
tika-core/src/main/java/org/apache/tika/detect/
tika-core/src/main/java/org/apache/tika/metadata/
tika-core/src/main/java/org/apache/tika/parser/ tika-co...
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Property.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Property.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Property.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Property.java Thu Sep 2 14:46:46 2010
@@ -1,177 +1,177 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.metadata;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * XMP property definition. Each instance of this class defines a single
- * metadata property like "dc:format". In addition to the property name,
- * the {@link ValueType value type} and category (internal or external)
- * of the property are included in the property definition. The available
- * choice values are also stored for open and closed choice value types.
- *
- * @since Apache Tika 0.7
- */
-public final class Property {
-
- public static enum PropertyType {
- SIMPLE, STRUCTURE, BAG, SEQ, ALT
- }
-
- public static enum ValueType {
- BOOLEAN, OPEN_CHOICE, CLOSED_CHOICE, DATE, INTEGER, LOCALE,
- MIME_TYPE, PROPER_NAME, RATIONAL, REAL, TEXT, URI, URL, XPATH
- }
-
- private final String name;
-
- private final boolean internal;
-
- private final PropertyType propertyType;
-
- private final ValueType valueType;
-
- /**
- * The available choices for the open and closed choice value types.
- */
- private final Set<String> choices;
-
- private Property(
- String name, boolean internal, PropertyType propertyType,
- ValueType valueType, String[] choices) {
- this.name = name;
- this.internal = internal;
- this.propertyType = propertyType;
- this.valueType = valueType;
- if (choices != null) {
- this.choices = Collections.unmodifiableSet(
- new HashSet<String>(Arrays.asList(choices)));
- } else {
- this.choices = null;
- }
- }
-
- private Property(
- String name, boolean internal,
- ValueType valueType, String[] choices) {
- this(name, internal, PropertyType.SIMPLE, valueType, choices);
- }
-
- private Property(String name, boolean internal, ValueType valueType) {
- this(name, internal, PropertyType.SIMPLE, valueType, null);
- }
-
- private Property(
- String name, boolean internal,
- PropertyType propertyType, ValueType valueType) {
- this(name, internal, propertyType, valueType, null);
- }
-
- public String getName() {
- return name;
- }
-
- public boolean isInternal() {
- return internal;
- }
-
- public boolean isExternal() {
- return !internal;
- }
-
- public PropertyType getPropertyType() {
- return propertyType;
- }
-
- public ValueType getValueType() {
- return valueType;
- }
-
- /**
- * Returns the (immutable) set of choices for the values of this property.
- * Only defined for {@link ValueType#OPEN_CHOICE open} and
- * {@link ValueType#CLOSED_CHOICE closed choice} value types.
- *
- * @return available choices, or <code>null</code>
- */
- public Set<String> getChoices() {
- return choices;
- }
-
- public static Property internalBoolean(String name) {
- return new Property(name, true, ValueType.BOOLEAN);
- }
-
- public static Property internalClosedChoise(
- String name, String... choices) {
- return new Property(name, true, ValueType.CLOSED_CHOICE, choices);
- }
-
- public static Property internalDate(String name) {
- return new Property(name, true, ValueType.DATE);
- }
-
- public static Property internalInteger(String name) {
- return new Property(name, true, ValueType.INTEGER);
- }
-
- public static Property internalIntegerSequence(String name) {
- return new Property(name, true, PropertyType.SEQ, ValueType.INTEGER);
- }
-
- public static Property internalRational(String name) {
- return new Property(name, true, ValueType.RATIONAL);
- }
-
- public static Property internalOpenChoise(
- String name, String... choices) {
- return new Property(name, true, ValueType.OPEN_CHOICE, choices);
- }
- public static Property internalReal(String name) {
- return new Property(name, true, ValueType.REAL);
- }
-
- public static Property internalText(String name) {
- return new Property(name, true, ValueType.TEXT);
- }
-
- public static Property internalURI(String name) {
- return new Property(name, true, ValueType.URI);
- }
-
- public static Property externalClosedChoise(
- String name, String... choices) {
- return new Property(name, false, ValueType.CLOSED_CHOICE, choices);
- }
-
- public static Property externalDate(String name) {
- return new Property(name, false, ValueType.DATE);
- }
-
- public static Property externalInteger(String name) {
- return new Property(name, false, ValueType.INTEGER);
- }
-
- public static Property externalText(String name) {
- return new Property(name, false, ValueType.TEXT);
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.metadata;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * XMP property definition. Each instance of this class defines a single
+ * metadata property like "dc:format". In addition to the property name,
+ * the {@link ValueType value type} and category (internal or external)
+ * of the property are included in the property definition. The available
+ * choice values are also stored for open and closed choice value types.
+ *
+ * @since Apache Tika 0.7
+ */
+public final class Property {
+
+ public static enum PropertyType {
+ SIMPLE, STRUCTURE, BAG, SEQ, ALT
+ }
+
+ public static enum ValueType {
+ BOOLEAN, OPEN_CHOICE, CLOSED_CHOICE, DATE, INTEGER, LOCALE,
+ MIME_TYPE, PROPER_NAME, RATIONAL, REAL, TEXT, URI, URL, XPATH
+ }
+
+ private final String name;
+
+ private final boolean internal;
+
+ private final PropertyType propertyType;
+
+ private final ValueType valueType;
+
+ /**
+ * The available choices for the open and closed choice value types.
+ */
+ private final Set<String> choices;
+
+ private Property(
+ String name, boolean internal, PropertyType propertyType,
+ ValueType valueType, String[] choices) {
+ this.name = name;
+ this.internal = internal;
+ this.propertyType = propertyType;
+ this.valueType = valueType;
+ if (choices != null) {
+ this.choices = Collections.unmodifiableSet(
+ new HashSet<String>(Arrays.asList(choices)));
+ } else {
+ this.choices = null;
+ }
+ }
+
+ private Property(
+ String name, boolean internal,
+ ValueType valueType, String[] choices) {
+ this(name, internal, PropertyType.SIMPLE, valueType, choices);
+ }
+
+ private Property(String name, boolean internal, ValueType valueType) {
+ this(name, internal, PropertyType.SIMPLE, valueType, null);
+ }
+
+ private Property(
+ String name, boolean internal,
+ PropertyType propertyType, ValueType valueType) {
+ this(name, internal, propertyType, valueType, null);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public boolean isInternal() {
+ return internal;
+ }
+
+ public boolean isExternal() {
+ return !internal;
+ }
+
+ public PropertyType getPropertyType() {
+ return propertyType;
+ }
+
+ public ValueType getValueType() {
+ return valueType;
+ }
+
+ /**
+ * Returns the (immutable) set of choices for the values of this property.
+ * Only defined for {@link ValueType#OPEN_CHOICE open} and
+ * {@link ValueType#CLOSED_CHOICE closed choice} value types.
+ *
+ * @return available choices, or <code>null</code>
+ */
+ public Set<String> getChoices() {
+ return choices;
+ }
+
+ public static Property internalBoolean(String name) {
+ return new Property(name, true, ValueType.BOOLEAN);
+ }
+
+ public static Property internalClosedChoise(
+ String name, String... choices) {
+ return new Property(name, true, ValueType.CLOSED_CHOICE, choices);
+ }
+
+ public static Property internalDate(String name) {
+ return new Property(name, true, ValueType.DATE);
+ }
+
+ public static Property internalInteger(String name) {
+ return new Property(name, true, ValueType.INTEGER);
+ }
+
+ public static Property internalIntegerSequence(String name) {
+ return new Property(name, true, PropertyType.SEQ, ValueType.INTEGER);
+ }
+
+ public static Property internalRational(String name) {
+ return new Property(name, true, ValueType.RATIONAL);
+ }
+
+ public static Property internalOpenChoise(
+ String name, String... choices) {
+ return new Property(name, true, ValueType.OPEN_CHOICE, choices);
+ }
+ public static Property internalReal(String name) {
+ return new Property(name, true, ValueType.REAL);
+ }
+
+ public static Property internalText(String name) {
+ return new Property(name, true, ValueType.TEXT);
+ }
+
+ public static Property internalURI(String name) {
+ return new Property(name, true, ValueType.URI);
+ }
+
+ public static Property externalClosedChoise(
+ String name, String... choices) {
+ return new Property(name, false, ValueType.CLOSED_CHOICE, choices);
+ }
+
+ public static Property externalDate(String name) {
+ return new Property(name, false, ValueType.DATE);
+ }
+
+ public static Property externalInteger(String name) {
+ return new Property(name, false, ValueType.INTEGER);
+ }
+
+ public static Property externalText(String name) {
+ return new Property(name, false, ValueType.TEXT);
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Property.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TIFF.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TIFF.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TIFF.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TIFF.java Thu Sep 2 14:46:46 2010
@@ -1,54 +1,54 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.metadata;
-
-/**
- * XMP Exif TIFF schema. This is a collection of
- * {@link Property property definition} constants for the Exif TIFF
- * properties defined in the XMP standard.
- *
- * @since Apache Tika 0.8
- * @see <a href="http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf"
- * >XMP Specification, Part 2: Standard Schemas</a>
- */
-public interface TIFF {
-
- /**
- * "Number of bits per component in each channel."
- */
- Property BITS_PER_SAMPLE =
- Property.internalIntegerSequence("tiff:BitsPerSample");
-
- /**
- * "Image height in pixels."
- */
- Property IMAGE_LENGTH =
- Property.internalInteger("tiff:ImageLength");
-
- /**
- * "Image width in pixels."
- */
- Property IMAGE_WIDTH =
- Property.internalInteger("tiff:ImageWidth");
-
- /**
- * "Number of components per pixel."
- */
- Property SAMPLES_PER_PIXEL =
- Property.internalInteger("tiff:SamplesPerPixel");
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.metadata;
+
+/**
+ * XMP Exif TIFF schema. This is a collection of
+ * {@link Property property definition} constants for the Exif TIFF
+ * properties defined in the XMP standard.
+ *
+ * @since Apache Tika 0.8
+ * @see <a href="http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf"
+ * >XMP Specification, Part 2: Standard Schemas</a>
+ */
+public interface TIFF {
+
+ /**
+ * "Number of bits per component in each channel."
+ */
+ Property BITS_PER_SAMPLE =
+ Property.internalIntegerSequence("tiff:BitsPerSample");
+
+ /**
+ * "Image height in pixels."
+ */
+ Property IMAGE_LENGTH =
+ Property.internalInteger("tiff:ImageLength");
+
+ /**
+ * "Image width in pixels."
+ */
+ Property IMAGE_WIDTH =
+ Property.internalInteger("tiff:ImageWidth");
+
+ /**
+ * "Number of components per pixel."
+ */
+ Property SAMPLES_PER_PIXEL =
+ Property.internalInteger("tiff:SamplesPerPixel");
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TIFF.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/XMPDM.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/XMPDM.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/XMPDM.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/XMPDM.java Thu Sep 2 14:46:46 2010
@@ -1,361 +1,361 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.metadata;
-
-/**
- * XMP Dynamic Media schema. This is a collection of
- * {@link Property property definition} constants for the dynamic media
- * properties defined in the XMP standard.
- *
- * @since Apache Tika 0.7
- * @see <a href="http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf"
- * >XMP Specification, Part 2: Standard Schemas</a>
- */
-public interface XMPDM {
-
- /**
- * "The absolute path to the file's peak audio file. If empty, no peak
- * file exists."
- */
- Property ABS_PEAK_AUDIO_FILE_PATH =
- Property.internalURI("xmpDM:absPeakAudioFilePath");
-
- /**
- * "The name of the album."
- */
- Property ALBUM = Property.externalText("xmpDM:album");
-
- /**
- * "An alternative tape name, set via the project window or timecode
- * dialog in Premiere. If an alternative name has been set and has not
- * been reverted, that name is displayed."
- */
- Property ALT_TAPE_NAME = Property.externalText("xmpDM:altTapeName");
-
-// /**
-// * "A timecode set by the user. When specified, it is used instead
-// * of the startTimecode."
-// */
-// Property ALT_TIMECODE = "xmpDM:altTimecode";
-
- /**
- * "The name of the artist or artists."
- */
- Property ARTIST = Property.externalText("xmpDM:artist");
-
- /**
- * "The date and time when the audio was last modified."
- */
- Property AUDIO_MOD_DATE = Property.internalDate("xmpDM:audioModDate");
-
- /**
- * "The audio sample rate. Can be any value, but commonly 32000, 41100,
- * or 48000."
- */
- Property AUDIO_SAMPLE_RATE =
- Property.internalInteger("xmpDM:audioSampleRate");
-
- /**
- * "The audio sample type."
- */
- Property AUDIO_SAMPLE_TYPE = Property.internalClosedChoise(
- "xmpDM:audioSampleType", "8Int", "16Int", "32Int", "32Float");
-
- /**
- * "The audio channel type."
- */
- Property AUDIO_CHANNEL_TYPE = Property.internalClosedChoise(
- "xmpDM:audioChannelType", "Mono", "Stereo", "5.1", "7.1");
-
- /**
- * "The audio compression used. For example, MP3."
- */
- Property AUDIO_COMPRESSOR = Property.internalText("xmpDM:audioCompressor");
-
-// /**
-// * "Additional parameters for Beat Splice stretch mode."
-// */
-// Property BEAT_SPLICE_PARAMS = "xmpDM:beatSpliceParams";
-
- /**
- * "The composer's name."
- */
- Property COMPOSER = Property.externalText("xmpDM:composer");
-
-// /**
-// * "An unordered list of all media used to create this media."
-// */
-// Property CONTRIBUTED_MEDIA = "xmpDM:contributedMedia";
-
- /**
- * "The copyright information."
- */
- Property COPYRIGHT = Property.externalText("xmpDM:copyright");
-
-// /**
-// * "The duration of the media file."
-// */
-// Property DURATION = "xmpDM:duration";
-
- /**
- * "The engineer's name."
- */
- Property ENGINEER = Property.externalText("xmpDM:engineer");
-
- /**
- * "The file data rate in megabytes per second. For example:
- * '36/10' = 3.6 MB/sec"
- */
- Property FILE_DATA_RATE = Property.internalRational("xmpDM:fileDataRate");
-
- /**
- * "The name of the genre."
- */
- Property GENRE = Property.externalText("xmpDM:genre");
-
- /**
- * "The musical instrument."
- */
- Property INSTRUMENT = Property.externalText("xmpDM:instrument");
-
-// /**
-// * "The duration of lead time for queuing music."
-// */
-// Property INTRO_TIME = "xmpDM:introTime";
-
- /**
- * "The audio's musical key."
- */
- Property KEY = Property.internalClosedChoise(
- "xmpDM:key", "C", "C#", "D", "D#", "E", "F", "F#",
- "G", "G#", "A", "A#", "B");
-
- /**
- * "User's log comments."
- */
- Property LOG_COMMENT = Property.externalText("xmpDM:logComment");
-
- /**
- * "When true, the clip can be looped seamlessly."
- */
- Property LOOP = Property.internalBoolean("xmpDM:loop");
-
- /**
- * "The number of beats."
- */
- Property NUMBER_OF_BEATS = Property.internalReal("xmpDM:numberOfBeats");
-
-// /**
-// * An ordered list of markers. See also {@link #TRACKS xmpDM:Tracks}.
-// */
-// Property MARKERS = "xmpDM:markers";
-
- /**
- * "The date and time when the metadata was last modified."
- */
- Property METADATA_MOD_DATE = Property.internalDate("xmpDM:metadataModDate");
-
-// /**
-// * "The time at which to fade out."
-// */
-// Property OUT_CUE = "xmpDM:outCue";
-
-// /**
-// * "A reference to the project that created this file."
-// */
-// Property PROJECT_REF = "xmpDM:projectRef";
-
- /**
- * "The sampling phase of film to be converted to video (pull-down)."
- */
- Property PULL_DOWN = Property.internalClosedChoise(
- "xmpDM:pullDown", "WSSWW", "SSWWW", "SWWWS", "WWWSS", "WWSSW",
- "WSSWW_24p", "SSWWW_24p", "SWWWS_24p", "WWWSS_24p", "WWSSW_24p");
-
- /**
- * "The relative path to the file's peak audio file. If empty, no peak
- * file exists."
- */
- Property RELATIVE_PEAK_AUDIO_FILE_PATH =
- Property.internalURI("xmpDM:relativePeakAudioFilePath");
-
-// /**
-// * "The start time of the media inside the audio project."
-// */
-// Property RELATIVE_TIMESTAMP = "xmpDM:relativeTimestamp";
-
- /**
- * "The date the title was released."
- */
- Property RELEASE_DATE = Property.externalDate("xmpDM:releaseDate");
-
-// /**
-// * "Additional parameters for Resample stretch mode."
-// */
-// Property RESAMPLE_PARAMS = "xmpDM:resampleParams";
-
- /**
- * "The musical scale used in the music. 'Neither' is most often used
- * for instruments with no associated scale, such as drums."
- */
- Property SCALE_TYPE = Property.internalClosedChoise(
- "xmpDM:scaleType", "Major", "Minor", "Both", "Neither");
-
- /**
- * "The name of the scene."
- */
- Property SCENE = Property.externalText("xmpDM:scene");
-
- /**
- * "The date and time when the video was shot."
- */
- Property SHOT_DATE = Property.externalDate("xmpDM:shotDate");
-
- /**
- * "The name of the location where the video was shot. For example:
- * 'Oktoberfest, Munich, Germany'. For more accurate positioning,
- * use the EXIF GPS values."
- */
- Property SHOT_LOCATION = Property.externalText("xmpDM:shotLocation");
-
- /**
- * "The name of the shot or take."
- */
- Property SHOT_NAME = Property.externalText("xmpDM:shotName");
-
- /**
- * "A description of the speaker angles from center front in degrees.
- * For example: 'Left = -30, Right = 30, Center = 0, LFE = 45,
- * Left Surround = -110, Right Surround = 110'"
- */
- Property SPEAKER_PLACEMENT =
- Property.externalText("xmpDM:speakerPlacement");
-
-// /**
-// * "The timecode of the first frame of video in the file, as obtained
-// * from the device control."
-// */
-// Property START_TIMECODE = "xmpDM:startTimecode";
-
- /**
- * "The audio stretch mode."
- */
- Property STRETCH_MODE = Property.internalClosedChoise(
- "xmpDM:stretchMode", "Fixed length", "Time-Scale", "Resample",
- "Beat Splice", "Hybrid");
-
- /**
- * "The name of the tape from which the clip was captured, as set during
- * the capture process."
- */
- Property TAPE_NAME = Property.externalText("xmpDM:tapeName");
-
- /**
- * "The audio's tempo."
- */
- Property TEMPO = Property.internalReal("xmpDM:tempo");
-
-// /**
-// * "Additional parameters for Time-Scale stretch mode."
-// */
-// Property TIME_SCALE_PARAMS = "xmpDM:timeScaleParams";
-
- /**
- * "The time signature of the music."
- */
- Property TIME_SIGNATURE = Property.internalClosedChoise(
- "xmpDM:timeSignature", "2/4", "3/4", "4/4", "5/4", "7/4",
- "6/8", "9/8", "12/8", "other");
-
- /**
- * "A numeric value indicating the order of the audio file within its
- * original recording."
- */
- Property TRACK_NUMBER = Property.externalInteger("xmpDM:trackNumber");
-
-// /**
-// * "An unordered list of tracks. A track is a named set of markers,
-// * which can specify a frame rate for all markers in the set.
-// * See also {@link #MARKERS xmpDM:markers}."
-// */
-// Property TRACKS = "xmpDM:Tracks";
-
- /**
- * "The alpha mode."
- */
- Property VIDEO_ALPHA_MODE = Property.externalClosedChoise(
- "xmpDM:videoAlphaMode", "straight", "pre-multiplied");
-
-// /**
-// * "A color in CMYK or RGB to be used as the pre-multiple color when
-// * alpha mode is pre-multiplied."
-// */
-// Property VIDEO_ALPHA_PREMULTIPLE_COLOR = "xmpDM:videoAlphaPremultipleColor";
-
- /**
- * "When true, unity is clear, when false, it is opaque."
- */
- Property VIDEO_ALPHA_UNITY_IS_TRANSPARENT =
- Property.internalBoolean("xmpDM:videoAlphaUnityIsTransparent");
-
- /**
- * "The color space."
- */
- Property VIDEO_COLOR_SPACE = Property.internalClosedChoise(
- "xmpDM:videoColorSpace", "sRGB", "CCIR-601", "CCIR-709");
-
- /**
- * "Video compression used. For example, jpeg."
- */
- Property VIDEO_COMPRESSOR = Property.internalText("xmpDM:videoCompressor");
-
- /**
- * "The field order for video."
- */
- Property VIDEO_FIELD_ORDER = Property.internalClosedChoise(
- "xmpDM:videoFieldOrder", "Upper", "Lower", "Progressive");
-
- /**
- * "The video frame rate."
- */
- Property VIDEO_FRAME_RATE = Property.internalOpenChoise(
- "xmpDM:videoFrameRate", "24", "NTSC", "PAL");
-
-// /**
-// * "The frame size. For example: w:720, h: 480, unit:pixels"
-// */
-// Property VIDEO_FRAME_SIZE = "xmpDM:videoFrameSize";
-
- /**
- * "The date and time when the video was last modified."
- */
- Property VIDEO_MOD_DATE = Property.internalDate("xmpDM:videoModDate");
-
- /**
- * "The size in bits of each color component of a pixel. Standard
- * Windows 32-bit pixels have 8 bits per component."
- */
- Property VIDEO_PIXEL_DEPTH = Property.internalClosedChoise(
- "xmpDM:videoPixelDepth", "8Int", "16Int", "32Int", "32Float");
-
- /**
- * "The aspect ratio, expressed as wd/ht. For example: '648/720' = 0.9"
- */
- Property VIDEO_PIXEL_ASPECT_RATIO =
- Property.internalRational("xmpDM:videoPixelAspectRatio");
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.metadata;
+
+/**
+ * XMP Dynamic Media schema. This is a collection of
+ * {@link Property property definition} constants for the dynamic media
+ * properties defined in the XMP standard.
+ *
+ * @since Apache Tika 0.7
+ * @see <a href="http://www.adobe.com/devnet/xmp/pdfs/XMPSpecificationPart2.pdf"
+ * >XMP Specification, Part 2: Standard Schemas</a>
+ */
+public interface XMPDM {
+
+ /**
+ * "The absolute path to the file's peak audio file. If empty, no peak
+ * file exists."
+ */
+ Property ABS_PEAK_AUDIO_FILE_PATH =
+ Property.internalURI("xmpDM:absPeakAudioFilePath");
+
+ /**
+ * "The name of the album."
+ */
+ Property ALBUM = Property.externalText("xmpDM:album");
+
+ /**
+ * "An alternative tape name, set via the project window or timecode
+ * dialog in Premiere. If an alternative name has been set and has not
+ * been reverted, that name is displayed."
+ */
+ Property ALT_TAPE_NAME = Property.externalText("xmpDM:altTapeName");
+
+// /**
+// * "A timecode set by the user. When specified, it is used instead
+// * of the startTimecode."
+// */
+// Property ALT_TIMECODE = "xmpDM:altTimecode";
+
+ /**
+ * "The name of the artist or artists."
+ */
+ Property ARTIST = Property.externalText("xmpDM:artist");
+
+ /**
+ * "The date and time when the audio was last modified."
+ */
+ Property AUDIO_MOD_DATE = Property.internalDate("xmpDM:audioModDate");
+
+ /**
+ * "The audio sample rate. Can be any value, but commonly 32000, 41100,
+ * or 48000."
+ */
+ Property AUDIO_SAMPLE_RATE =
+ Property.internalInteger("xmpDM:audioSampleRate");
+
+ /**
+ * "The audio sample type."
+ */
+ Property AUDIO_SAMPLE_TYPE = Property.internalClosedChoise(
+ "xmpDM:audioSampleType", "8Int", "16Int", "32Int", "32Float");
+
+ /**
+ * "The audio channel type."
+ */
+ Property AUDIO_CHANNEL_TYPE = Property.internalClosedChoise(
+ "xmpDM:audioChannelType", "Mono", "Stereo", "5.1", "7.1");
+
+ /**
+ * "The audio compression used. For example, MP3."
+ */
+ Property AUDIO_COMPRESSOR = Property.internalText("xmpDM:audioCompressor");
+
+// /**
+// * "Additional parameters for Beat Splice stretch mode."
+// */
+// Property BEAT_SPLICE_PARAMS = "xmpDM:beatSpliceParams";
+
+ /**
+ * "The composer's name."
+ */
+ Property COMPOSER = Property.externalText("xmpDM:composer");
+
+// /**
+// * "An unordered list of all media used to create this media."
+// */
+// Property CONTRIBUTED_MEDIA = "xmpDM:contributedMedia";
+
+ /**
+ * "The copyright information."
+ */
+ Property COPYRIGHT = Property.externalText("xmpDM:copyright");
+
+// /**
+// * "The duration of the media file."
+// */
+// Property DURATION = "xmpDM:duration";
+
+ /**
+ * "The engineer's name."
+ */
+ Property ENGINEER = Property.externalText("xmpDM:engineer");
+
+ /**
+ * "The file data rate in megabytes per second. For example:
+ * '36/10' = 3.6 MB/sec"
+ */
+ Property FILE_DATA_RATE = Property.internalRational("xmpDM:fileDataRate");
+
+ /**
+ * "The name of the genre."
+ */
+ Property GENRE = Property.externalText("xmpDM:genre");
+
+ /**
+ * "The musical instrument."
+ */
+ Property INSTRUMENT = Property.externalText("xmpDM:instrument");
+
+// /**
+// * "The duration of lead time for queuing music."
+// */
+// Property INTRO_TIME = "xmpDM:introTime";
+
+ /**
+ * "The audio's musical key."
+ */
+ Property KEY = Property.internalClosedChoise(
+ "xmpDM:key", "C", "C#", "D", "D#", "E", "F", "F#",
+ "G", "G#", "A", "A#", "B");
+
+ /**
+ * "User's log comments."
+ */
+ Property LOG_COMMENT = Property.externalText("xmpDM:logComment");
+
+ /**
+ * "When true, the clip can be looped seamlessly."
+ */
+ Property LOOP = Property.internalBoolean("xmpDM:loop");
+
+ /**
+ * "The number of beats."
+ */
+ Property NUMBER_OF_BEATS = Property.internalReal("xmpDM:numberOfBeats");
+
+// /**
+// * An ordered list of markers. See also {@link #TRACKS xmpDM:Tracks}.
+// */
+// Property MARKERS = "xmpDM:markers";
+
+ /**
+ * "The date and time when the metadata was last modified."
+ */
+ Property METADATA_MOD_DATE = Property.internalDate("xmpDM:metadataModDate");
+
+// /**
+// * "The time at which to fade out."
+// */
+// Property OUT_CUE = "xmpDM:outCue";
+
+// /**
+// * "A reference to the project that created this file."
+// */
+// Property PROJECT_REF = "xmpDM:projectRef";
+
+ /**
+ * "The sampling phase of film to be converted to video (pull-down)."
+ */
+ Property PULL_DOWN = Property.internalClosedChoise(
+ "xmpDM:pullDown", "WSSWW", "SSWWW", "SWWWS", "WWWSS", "WWSSW",
+ "WSSWW_24p", "SSWWW_24p", "SWWWS_24p", "WWWSS_24p", "WWSSW_24p");
+
+ /**
+ * "The relative path to the file's peak audio file. If empty, no peak
+ * file exists."
+ */
+ Property RELATIVE_PEAK_AUDIO_FILE_PATH =
+ Property.internalURI("xmpDM:relativePeakAudioFilePath");
+
+// /**
+// * "The start time of the media inside the audio project."
+// */
+// Property RELATIVE_TIMESTAMP = "xmpDM:relativeTimestamp";
+
+ /**
+ * "The date the title was released."
+ */
+ Property RELEASE_DATE = Property.externalDate("xmpDM:releaseDate");
+
+// /**
+// * "Additional parameters for Resample stretch mode."
+// */
+// Property RESAMPLE_PARAMS = "xmpDM:resampleParams";
+
+ /**
+ * "The musical scale used in the music. 'Neither' is most often used
+ * for instruments with no associated scale, such as drums."
+ */
+ Property SCALE_TYPE = Property.internalClosedChoise(
+ "xmpDM:scaleType", "Major", "Minor", "Both", "Neither");
+
+ /**
+ * "The name of the scene."
+ */
+ Property SCENE = Property.externalText("xmpDM:scene");
+
+ /**
+ * "The date and time when the video was shot."
+ */
+ Property SHOT_DATE = Property.externalDate("xmpDM:shotDate");
+
+ /**
+ * "The name of the location where the video was shot. For example:
+ * 'Oktoberfest, Munich, Germany'. For more accurate positioning,
+ * use the EXIF GPS values."
+ */
+ Property SHOT_LOCATION = Property.externalText("xmpDM:shotLocation");
+
+ /**
+ * "The name of the shot or take."
+ */
+ Property SHOT_NAME = Property.externalText("xmpDM:shotName");
+
+ /**
+ * "A description of the speaker angles from center front in degrees.
+ * For example: 'Left = -30, Right = 30, Center = 0, LFE = 45,
+ * Left Surround = -110, Right Surround = 110'"
+ */
+ Property SPEAKER_PLACEMENT =
+ Property.externalText("xmpDM:speakerPlacement");
+
+// /**
+// * "The timecode of the first frame of video in the file, as obtained
+// * from the device control."
+// */
+// Property START_TIMECODE = "xmpDM:startTimecode";
+
+ /**
+ * "The audio stretch mode."
+ */
+ Property STRETCH_MODE = Property.internalClosedChoise(
+ "xmpDM:stretchMode", "Fixed length", "Time-Scale", "Resample",
+ "Beat Splice", "Hybrid");
+
+ /**
+ * "The name of the tape from which the clip was captured, as set during
+ * the capture process."
+ */
+ Property TAPE_NAME = Property.externalText("xmpDM:tapeName");
+
+ /**
+ * "The audio's tempo."
+ */
+ Property TEMPO = Property.internalReal("xmpDM:tempo");
+
+// /**
+// * "Additional parameters for Time-Scale stretch mode."
+// */
+// Property TIME_SCALE_PARAMS = "xmpDM:timeScaleParams";
+
+ /**
+ * "The time signature of the music."
+ */
+ Property TIME_SIGNATURE = Property.internalClosedChoise(
+ "xmpDM:timeSignature", "2/4", "3/4", "4/4", "5/4", "7/4",
+ "6/8", "9/8", "12/8", "other");
+
+ /**
+ * "A numeric value indicating the order of the audio file within its
+ * original recording."
+ */
+ Property TRACK_NUMBER = Property.externalInteger("xmpDM:trackNumber");
+
+// /**
+// * "An unordered list of tracks. A track is a named set of markers,
+// * which can specify a frame rate for all markers in the set.
+// * See also {@link #MARKERS xmpDM:markers}."
+// */
+// Property TRACKS = "xmpDM:Tracks";
+
+ /**
+ * "The alpha mode."
+ */
+ Property VIDEO_ALPHA_MODE = Property.externalClosedChoise(
+ "xmpDM:videoAlphaMode", "straight", "pre-multiplied");
+
+// /**
+// * "A color in CMYK or RGB to be used as the pre-multiple color when
+// * alpha mode is pre-multiplied."
+// */
+// Property VIDEO_ALPHA_PREMULTIPLE_COLOR = "xmpDM:videoAlphaPremultipleColor";
+
+ /**
+ * "When true, unity is clear, when false, it is opaque."
+ */
+ Property VIDEO_ALPHA_UNITY_IS_TRANSPARENT =
+ Property.internalBoolean("xmpDM:videoAlphaUnityIsTransparent");
+
+ /**
+ * "The color space."
+ */
+ Property VIDEO_COLOR_SPACE = Property.internalClosedChoise(
+ "xmpDM:videoColorSpace", "sRGB", "CCIR-601", "CCIR-709");
+
+ /**
+ * "Video compression used. For example, jpeg."
+ */
+ Property VIDEO_COMPRESSOR = Property.internalText("xmpDM:videoCompressor");
+
+ /**
+ * "The field order for video."
+ */
+ Property VIDEO_FIELD_ORDER = Property.internalClosedChoise(
+ "xmpDM:videoFieldOrder", "Upper", "Lower", "Progressive");
+
+ /**
+ * "The video frame rate."
+ */
+ Property VIDEO_FRAME_RATE = Property.internalOpenChoise(
+ "xmpDM:videoFrameRate", "24", "NTSC", "PAL");
+
+// /**
+// * "The frame size. For example: w:720, h: 480, unit:pixels"
+// */
+// Property VIDEO_FRAME_SIZE = "xmpDM:videoFrameSize";
+
+ /**
+ * "The date and time when the video was last modified."
+ */
+ Property VIDEO_MOD_DATE = Property.internalDate("xmpDM:videoModDate");
+
+ /**
+ * "The size in bits of each color component of a pixel. Standard
+ * Windows 32-bit pixels have 8 bits per component."
+ */
+ Property VIDEO_PIXEL_DEPTH = Property.internalClosedChoise(
+ "xmpDM:videoPixelDepth", "8Int", "16Int", "32Int", "32Float");
+
+ /**
+ * "The aspect ratio, expressed as wd/ht. For example: '648/720' = 0.9"
+ */
+ Property VIDEO_PIXEL_ASPECT_RATIO =
+ Property.internalRational("xmpDM:videoPixelAspectRatio");
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/XMPDM.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessClient.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessClient.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessClient.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessClient.java Thu Sep 2 14:46:46 2010
@@ -1,191 +1,191 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.Enumeration;
-
-import org.apache.tika.io.IOExceptionWithCause;
-import org.apache.tika.io.IOUtils;
-
-class OutOfProcessClient {
-
- private final ClassLoader loader;
-
- private final File directory;
-
- private final Process process;
-
- private final DataOutputStream output;
-
- private final DataInputStream input;
-
- private final InputStream error;
-
- public OutOfProcessClient(ClassLoader loader) throws IOException {
- this.loader = loader;
-
- this.directory = File.createTempFile("apache-tika-", "-oop");
- directory.delete();
- directory.mkdir();
-
- boolean ok = false;
- try {
- copyClassToDirectory(OutOfProcessServer.class);
- copyClassToDirectory(OutOfProcessSerializer.class);
-
- ProcessBuilder builder = new ProcessBuilder();
- builder.directory(directory);
- builder.command("java", OutOfProcessServer.class.getName());
- this.process = builder.start();
- this.output = new DataOutputStream(process.getOutputStream());
- this.input = new DataInputStream(process.getInputStream());
- this.error = process.getErrorStream();
-
- ok = true;
- } finally {
- if (!ok) {
- delete(directory);
- }
- }
- }
-
- private void copyClassToDirectory(Class<?> klass)
- throws FileNotFoundException, IOException {
- String path = klass.getName().replace('.', '/') + ".class";
- InputStream input = loader.getResourceAsStream(path);
- try {
- File file = new File(directory, path);
- file.getParentFile().mkdirs();
- OutputStream output = new FileOutputStream(file);
- try {
- IOUtils.copy(input, output);
- } finally {
- output.close();
- }
- } finally {
- input.close();
- }
- }
-
- public synchronized Object echo(Object message) throws IOException {
- consumeErrors();
- output.write(OutOfProcessServer.ECHO);
- OutOfProcessSerializer.serialize(output, message);
- output.flush();
-
- readResponseType();
- try {
- return OutOfProcessSerializer.deserialize(input, loader).toString();
- } catch (ClassNotFoundException e) {
- throw new IOExceptionWithCause("Unable to read echo response", e);
- }
- }
-
-
- public synchronized void close() {
- try {
- output.close();
- input.close();
- error.close();
- } catch (IOException ignore) {
- }
- process.destroy();
- delete(directory);
- }
-
- private byte readResponseType() throws IOException {
- while (true) {
- consumeErrors();
- int type = input.read();
- if (type == -1) {
- throw new IOException("Unexpected end of stream encountered");
- } else if (type == OutOfProcessServer.FIND_RESOURCE) {
- findResource(input.readUTF());
- } else if (type == OutOfProcessServer.FIND_RESOURCES) {
- findResources(input.readUTF());
- } else {
- return (byte) type;
- }
- }
- }
-
- private void findResource(String name) throws IOException {
- InputStream stream = loader.getResourceAsStream(name);
- if (stream != null) {
- output.writeBoolean(true);
- writeAndCloseStream(stream);
- } else {
- output.writeBoolean(false);
- }
- output.flush();
- }
-
- private void findResources(String name) throws IOException {
- Enumeration<URL> resources = loader.getResources(name);
- while (resources.hasMoreElements()) {
- output.writeBoolean(true);
- writeAndCloseStream(resources.nextElement().openStream());
- }
- output.writeBoolean(false);
- output.flush();
- }
-
- private void writeAndCloseStream(InputStream stream) throws IOException {
- try {
- byte[] buffer = new byte[0xffff];
- int n;
- while ((n = stream.read(buffer)) != -1) {
- output.writeShort(n);
- output.write(buffer, 0, n);
- }
- output.writeShort(0);
- } finally {
- stream.close();
- }
- }
-
- private void consumeErrors() throws IOException {
- int n;
- while ((n = error.available()) > 0) {
- byte[] b = new byte[n];
- n = error.read(b);
- if (n > 0) {
- System.err.write(b, 0, n);
- }
- }
- }
-
- private void delete(File file) {
- File[] children = file.listFiles();
- if (children != null) {
- for (File child : children) {
- delete(child);
- }
- }
- file.delete();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Enumeration;
+
+import org.apache.tika.io.IOExceptionWithCause;
+import org.apache.tika.io.IOUtils;
+
+class OutOfProcessClient {
+
+ private final ClassLoader loader;
+
+ private final File directory;
+
+ private final Process process;
+
+ private final DataOutputStream output;
+
+ private final DataInputStream input;
+
+ private final InputStream error;
+
+ public OutOfProcessClient(ClassLoader loader) throws IOException {
+ this.loader = loader;
+
+ this.directory = File.createTempFile("apache-tika-", "-oop");
+ directory.delete();
+ directory.mkdir();
+
+ boolean ok = false;
+ try {
+ copyClassToDirectory(OutOfProcessServer.class);
+ copyClassToDirectory(OutOfProcessSerializer.class);
+
+ ProcessBuilder builder = new ProcessBuilder();
+ builder.directory(directory);
+ builder.command("java", OutOfProcessServer.class.getName());
+ this.process = builder.start();
+ this.output = new DataOutputStream(process.getOutputStream());
+ this.input = new DataInputStream(process.getInputStream());
+ this.error = process.getErrorStream();
+
+ ok = true;
+ } finally {
+ if (!ok) {
+ delete(directory);
+ }
+ }
+ }
+
+ private void copyClassToDirectory(Class<?> klass)
+ throws FileNotFoundException, IOException {
+ String path = klass.getName().replace('.', '/') + ".class";
+ InputStream input = loader.getResourceAsStream(path);
+ try {
+ File file = new File(directory, path);
+ file.getParentFile().mkdirs();
+ OutputStream output = new FileOutputStream(file);
+ try {
+ IOUtils.copy(input, output);
+ } finally {
+ output.close();
+ }
+ } finally {
+ input.close();
+ }
+ }
+
+ public synchronized Object echo(Object message) throws IOException {
+ consumeErrors();
+ output.write(OutOfProcessServer.ECHO);
+ OutOfProcessSerializer.serialize(output, message);
+ output.flush();
+
+ readResponseType();
+ try {
+ return OutOfProcessSerializer.deserialize(input, loader).toString();
+ } catch (ClassNotFoundException e) {
+ throw new IOExceptionWithCause("Unable to read echo response", e);
+ }
+ }
+
+
+ public synchronized void close() {
+ try {
+ output.close();
+ input.close();
+ error.close();
+ } catch (IOException ignore) {
+ }
+ process.destroy();
+ delete(directory);
+ }
+
+ private byte readResponseType() throws IOException {
+ while (true) {
+ consumeErrors();
+ int type = input.read();
+ if (type == -1) {
+ throw new IOException("Unexpected end of stream encountered");
+ } else if (type == OutOfProcessServer.FIND_RESOURCE) {
+ findResource(input.readUTF());
+ } else if (type == OutOfProcessServer.FIND_RESOURCES) {
+ findResources(input.readUTF());
+ } else {
+ return (byte) type;
+ }
+ }
+ }
+
+ private void findResource(String name) throws IOException {
+ InputStream stream = loader.getResourceAsStream(name);
+ if (stream != null) {
+ output.writeBoolean(true);
+ writeAndCloseStream(stream);
+ } else {
+ output.writeBoolean(false);
+ }
+ output.flush();
+ }
+
+ private void findResources(String name) throws IOException {
+ Enumeration<URL> resources = loader.getResources(name);
+ while (resources.hasMoreElements()) {
+ output.writeBoolean(true);
+ writeAndCloseStream(resources.nextElement().openStream());
+ }
+ output.writeBoolean(false);
+ output.flush();
+ }
+
+ private void writeAndCloseStream(InputStream stream) throws IOException {
+ try {
+ byte[] buffer = new byte[0xffff];
+ int n;
+ while ((n = stream.read(buffer)) != -1) {
+ output.writeShort(n);
+ output.write(buffer, 0, n);
+ }
+ output.writeShort(0);
+ } finally {
+ stream.close();
+ }
+ }
+
+ private void consumeErrors() throws IOException {
+ int n;
+ while ((n = error.available()) > 0) {
+ byte[] b = new byte[n];
+ n = error.read(b);
+ if (n > 0) {
+ System.err.write(b, 0, n);
+ }
+ }
+ }
+
+ private void delete(File file) {
+ File[] children = file.listFiles();
+ if (children != null) {
+ for (File child : children) {
+ delete(child);
+ }
+ }
+ file.delete();
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessClient.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessParser.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessParser.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessParser.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessParser.java Thu Sep 2 14:46:46 2010
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.LinkedList;
-import java.util.Queue;
-
-import org.apache.tika.exception.TikaException;
-import org.apache.tika.metadata.Metadata;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.SAXException;
-
-public class OutOfProcessParser extends DelegatingParser {
-
- private final ClassLoader loader;
-
- private final Queue<OutOfProcessClient> pool =
- new LinkedList<OutOfProcessClient>();
-
- private int poolSize = 5;
-
- public static void main(String[] args) throws Exception {
- OutOfProcessParser parser = new OutOfProcessParser(
- Thread.currentThread().getContextClassLoader());
- try {
- ParseContext context = new ParseContext();
- context.set(Parser.class, new AutoDetectParser());
- parser.parse(null, null, null, context);
- } finally {
- parser.close();
- }
- }
-
- public OutOfProcessParser(ClassLoader loader) {
- this.loader = loader;
- }
-
- /**
- *
- */
- @Override
- public void parse(
- InputStream stream, ContentHandler handler,
- Metadata metadata, ParseContext context)
- throws IOException, SAXException, TikaException {
- OutOfProcessClient client = acquireClient();
- try {
- System.out.println(client.echo(getDelegateParser(context)));
- } finally {
- releaseClient(client);
- }
- }
-
- public synchronized void close() {
- for (OutOfProcessClient client : pool) {
- client.close();
- }
- pool.clear();
- poolSize = 0;
- }
-
- private synchronized OutOfProcessClient acquireClient()
- throws IOException {
- OutOfProcessClient client = pool.poll();
- if (client == null) {
- client = new OutOfProcessClient(loader);
- }
- return client;
- }
-
- private synchronized void releaseClient(OutOfProcessClient client) {
- if (pool.size() < poolSize) {
- pool.offer(client);
- } else {
- client.close();
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.LinkedList;
+import java.util.Queue;
+
+import org.apache.tika.exception.TikaException;
+import org.apache.tika.metadata.Metadata;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+public class OutOfProcessParser extends DelegatingParser {
+
+ private final ClassLoader loader;
+
+ private final Queue<OutOfProcessClient> pool =
+ new LinkedList<OutOfProcessClient>();
+
+ private int poolSize = 5;
+
+ public static void main(String[] args) throws Exception {
+ OutOfProcessParser parser = new OutOfProcessParser(
+ Thread.currentThread().getContextClassLoader());
+ try {
+ ParseContext context = new ParseContext();
+ context.set(Parser.class, new AutoDetectParser());
+ parser.parse(null, null, null, context);
+ } finally {
+ parser.close();
+ }
+ }
+
+ public OutOfProcessParser(ClassLoader loader) {
+ this.loader = loader;
+ }
+
+ /**
+ *
+ */
+ @Override
+ public void parse(
+ InputStream stream, ContentHandler handler,
+ Metadata metadata, ParseContext context)
+ throws IOException, SAXException, TikaException {
+ OutOfProcessClient client = acquireClient();
+ try {
+ System.out.println(client.echo(getDelegateParser(context)));
+ } finally {
+ releaseClient(client);
+ }
+ }
+
+ public synchronized void close() {
+ for (OutOfProcessClient client : pool) {
+ client.close();
+ }
+ pool.clear();
+ poolSize = 0;
+ }
+
+ private synchronized OutOfProcessClient acquireClient()
+ throws IOException {
+ OutOfProcessClient client = pool.poll();
+ if (client == null) {
+ client = new OutOfProcessClient(loader);
+ }
+ return client;
+ }
+
+ private synchronized void releaseClient(OutOfProcessClient client) {
+ if (pool.size() < poolSize) {
+ pool.offer(client);
+ } else {
+ client.close();
+ }
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessParser.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessSerializer.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessSerializer.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessSerializer.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessSerializer.java Thu Sep 2 14:46:46 2010
@@ -1,69 +1,69 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
-
-class OutOfProcessSerializer extends ObjectInputStream {
-
- private final ClassLoader loader;
-
- public OutOfProcessSerializer(InputStream input, ClassLoader loader)
- throws IOException {
- super(input);
- this.loader = loader;
- }
-
- @Override
- protected Class<?> resolveClass(ObjectStreamClass desc)
- throws IOException, ClassNotFoundException {
- return Class.forName(desc.getName(), false, loader);
- }
-
- static void serialize(DataOutputStream output, Object object)
- throws IOException {
- ByteArrayOutputStream buffer = new ByteArrayOutputStream();
-
- ObjectOutputStream serializer = new ObjectOutputStream(buffer);
- serializer.writeObject(object);
- serializer.close();
-
- byte[] data = buffer.toByteArray();
- output.writeInt(data.length);
- output.write(data);
- }
-
- static Object deserialize(DataInputStream input, ClassLoader loader)
- throws IOException, ClassNotFoundException {
- int n = input.readInt();
- byte[] data = new byte[n];
- input.readFully(data);
-
- ObjectInputStream deserializer =
- new OutOfProcessSerializer(new ByteArrayInputStream(data), loader);
- return deserializer.readObject();
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamClass;
+
+class OutOfProcessSerializer extends ObjectInputStream {
+
+ private final ClassLoader loader;
+
+ public OutOfProcessSerializer(InputStream input, ClassLoader loader)
+ throws IOException {
+ super(input);
+ this.loader = loader;
+ }
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException {
+ return Class.forName(desc.getName(), false, loader);
+ }
+
+ static void serialize(DataOutputStream output, Object object)
+ throws IOException {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+
+ ObjectOutputStream serializer = new ObjectOutputStream(buffer);
+ serializer.writeObject(object);
+ serializer.close();
+
+ byte[] data = buffer.toByteArray();
+ output.writeInt(data.length);
+ output.write(data);
+ }
+
+ static Object deserialize(DataInputStream input, ClassLoader loader)
+ throws IOException, ClassNotFoundException {
+ int n = input.readInt();
+ byte[] data = new byte[n];
+ input.readFully(data);
+
+ ObjectInputStream deserializer =
+ new OutOfProcessSerializer(new ByteArrayInputStream(data), loader);
+ return deserializer.readObject();
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessSerializer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessServer.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessServer.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessServer.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessServer.java Thu Sep 2 14:46:46 2010
@@ -1,175 +1,175 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.parser;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Enumeration;
-import java.util.List;
-
-class OutOfProcessServer extends ClassLoader {
-
- public static final byte ERROR = -1;
-
- public static final byte REPLY = 0;
-
- public static final byte ECHO = 1;
-
- public static final byte FIND_RESOURCE = 2;
-
- public static final byte FIND_RESOURCES = 3;
-
- public static void main(String[] args) throws Exception {
- OutOfProcessServer server =
- new OutOfProcessServer(System.in, System.out);
- Thread.currentThread().setContextClassLoader(server);
-
- // Redirect standard input and output streams to prevent
- // stray code from interfering with the message stream
- System.setIn(new ByteArrayInputStream(new byte[0]));
- System.setOut(System.err);
-
- server.run();
- }
-
- private final DataInputStream input;
-
- private final DataOutputStream output;
-
- private int count = 0;
-
- public OutOfProcessServer(InputStream input, OutputStream output)
- throws IOException {
- this.input = new DataInputStream(input);
- this.output = new DataOutputStream(output);
- }
-
- public void run() throws IOException {
- int b;
- while ((b = input.read()) != -1) {
- if (b == ECHO) {
- try {
- Object message =
- OutOfProcessSerializer.deserialize(input, this);
- output.write(ECHO);
- OutOfProcessSerializer.serialize(output, "echo: " + message);
- } catch (ClassNotFoundException e) {
- output.write(ERROR);
- OutOfProcessSerializer.serialize(output, e);
- }
- output.flush();
- }
- }
- }
-
- @Override
- protected synchronized URL findResource(String name) {
- try {
- // Send a request to load the resource data
- output.write(FIND_RESOURCE);
- output.writeUTF(name);
- output.flush();
-
- // Receive the response
- if (input.readBoolean()) {
- return readStreamToFile().toURI().toURL();
- } else {
- return null;
- }
- } catch (IOException e) {
- return null;
- }
- }
-
- @Override
- protected synchronized Enumeration<URL> findResources(String name)
- throws IOException {
- // Send a request to load the resources
- output.write(FIND_RESOURCE);
- output.writeUTF(name);
- output.flush();
-
- // Receive the response
- List<URL> resources = new ArrayList<URL>();
- while (input.readBoolean()) {
- resources.add(readStreamToFile().toURI().toURL());
- }
- return Collections.enumeration(resources);
- }
-
- @Override
- protected synchronized Class<?> findClass(String name)
- throws ClassNotFoundException {
- try {
- // Send a request to load the class data
- output.write(FIND_RESOURCE);
- output.writeUTF(name.replace('.', '/') + ".class");
- output.flush();
-
- // Receive the response
- if (input.readBoolean()) {
- byte[] data = readStreamToMemory();
- return defineClass(name, data, 0, data.length);
- } else {
- return null;
- }
- } catch (IOException e) {
- e.printStackTrace();
- throw new ClassNotFoundException("Unable load class " + name, e);
- }
- }
-
- private byte[] readStreamToMemory() throws IOException {
- ByteArrayOutputStream stream = new ByteArrayOutputStream();
- byte[] buffer = new byte[0xffff];
- int n;
- while ((n = input.readUnsignedShort()) > 0) {
- input.readFully(buffer, 0, n);
- stream.write(buffer, 0, n);
- }
- return stream.toByteArray();
- }
-
- private File readStreamToFile() throws IOException {
- File file = new File("resource-" + count++ + ".bin");
-
- OutputStream stream = new FileOutputStream(file);
- try {
- byte[] buffer = new byte[0xffff];
- int n;
- while ((n = input.readUnsignedShort()) > 0) {
- input.readFully(buffer, 0, n);
- stream.write(buffer, 0, n);
- }
- } finally {
- stream.close();
- }
-
- return file;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.parser;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.List;
+
+class OutOfProcessServer extends ClassLoader {
+
+ public static final byte ERROR = -1;
+
+ public static final byte REPLY = 0;
+
+ public static final byte ECHO = 1;
+
+ public static final byte FIND_RESOURCE = 2;
+
+ public static final byte FIND_RESOURCES = 3;
+
+ public static void main(String[] args) throws Exception {
+ OutOfProcessServer server =
+ new OutOfProcessServer(System.in, System.out);
+ Thread.currentThread().setContextClassLoader(server);
+
+ // Redirect standard input and output streams to prevent
+ // stray code from interfering with the message stream
+ System.setIn(new ByteArrayInputStream(new byte[0]));
+ System.setOut(System.err);
+
+ server.run();
+ }
+
+ private final DataInputStream input;
+
+ private final DataOutputStream output;
+
+ private int count = 0;
+
+ public OutOfProcessServer(InputStream input, OutputStream output)
+ throws IOException {
+ this.input = new DataInputStream(input);
+ this.output = new DataOutputStream(output);
+ }
+
+ public void run() throws IOException {
+ int b;
+ while ((b = input.read()) != -1) {
+ if (b == ECHO) {
+ try {
+ Object message =
+ OutOfProcessSerializer.deserialize(input, this);
+ output.write(ECHO);
+ OutOfProcessSerializer.serialize(output, "echo: " + message);
+ } catch (ClassNotFoundException e) {
+ output.write(ERROR);
+ OutOfProcessSerializer.serialize(output, e);
+ }
+ output.flush();
+ }
+ }
+ }
+
+ @Override
+ protected synchronized URL findResource(String name) {
+ try {
+ // Send a request to load the resource data
+ output.write(FIND_RESOURCE);
+ output.writeUTF(name);
+ output.flush();
+
+ // Receive the response
+ if (input.readBoolean()) {
+ return readStreamToFile().toURI().toURL();
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ return null;
+ }
+ }
+
+ @Override
+ protected synchronized Enumeration<URL> findResources(String name)
+ throws IOException {
+ // Send a request to load the resources
+ output.write(FIND_RESOURCE);
+ output.writeUTF(name);
+ output.flush();
+
+ // Receive the response
+ List<URL> resources = new ArrayList<URL>();
+ while (input.readBoolean()) {
+ resources.add(readStreamToFile().toURI().toURL());
+ }
+ return Collections.enumeration(resources);
+ }
+
+ @Override
+ protected synchronized Class<?> findClass(String name)
+ throws ClassNotFoundException {
+ try {
+ // Send a request to load the class data
+ output.write(FIND_RESOURCE);
+ output.writeUTF(name.replace('.', '/') + ".class");
+ output.flush();
+
+ // Receive the response
+ if (input.readBoolean()) {
+ byte[] data = readStreamToMemory();
+ return defineClass(name, data, 0, data.length);
+ } else {
+ return null;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new ClassNotFoundException("Unable load class " + name, e);
+ }
+ }
+
+ private byte[] readStreamToMemory() throws IOException {
+ ByteArrayOutputStream stream = new ByteArrayOutputStream();
+ byte[] buffer = new byte[0xffff];
+ int n;
+ while ((n = input.readUnsignedShort()) > 0) {
+ input.readFully(buffer, 0, n);
+ stream.write(buffer, 0, n);
+ }
+ return stream.toByteArray();
+ }
+
+ private File readStreamToFile() throws IOException {
+ File file = new File("resource-" + count++ + ".bin");
+
+ OutputStream stream = new FileOutputStream(file);
+ try {
+ byte[] buffer = new byte[0xffff];
+ int n;
+ while ((n = input.readUnsignedShort()) > 0) {
+ input.readFully(buffer, 0, n);
+ stream.write(buffer, 0, n);
+ }
+ } finally {
+ stream.close();
+ }
+
+ return file;
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/parser/OutOfProcessServer.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/EmbeddedContentHandler.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/EmbeddedContentHandler.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/EmbeddedContentHandler.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/EmbeddedContentHandler.java Thu Sep 2 14:46:46 2010
@@ -1,56 +1,56 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.sax;
-
-import org.xml.sax.ContentHandler;
-
-/**
- * Content handler decorator that prevents the {@link #startDocument()}
- * and {@link #endDocument()} events from reaching the decorated handler.
- * This is useful when you want to direct the results of parsing multiple
- * different XML documents into a single target document without worrying
- * about the {@link #startDocument()} and {@link #endDocument()} methods
- * being called more than once.
- */
-public class EmbeddedContentHandler extends ContentHandlerDecorator {
-
- /**
- * Created a decorator that prevents the given handler from
- * receiving {@link #startDocument()} and {@link #endDocument()}
- * events.
- *
- * @param handler the content handler to be decorated
- */
- public EmbeddedContentHandler(ContentHandler handler) {
- super(handler);
- }
-
- /**
- * Ignored.
- */
- @Override
- public void startDocument() {
- }
-
- /**
- * Ignored.
- */
- @Override
- public void endDocument() {
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.sax;
+
+import org.xml.sax.ContentHandler;
+
+/**
+ * Content handler decorator that prevents the {@link #startDocument()}
+ * and {@link #endDocument()} events from reaching the decorated handler.
+ * This is useful when you want to direct the results of parsing multiple
+ * different XML documents into a single target document without worrying
+ * about the {@link #startDocument()} and {@link #endDocument()} methods
+ * being called more than once.
+ */
+public class EmbeddedContentHandler extends ContentHandlerDecorator {
+
+ /**
+ * Created a decorator that prevents the given handler from
+ * receiving {@link #startDocument()} and {@link #endDocument()}
+ * events.
+ *
+ * @param handler the content handler to be decorated
+ */
+ public EmbeddedContentHandler(ContentHandler handler) {
+ super(handler);
+ }
+
+ /**
+ * Ignored.
+ */
+ @Override
+ public void startDocument() {
+ }
+
+ /**
+ * Ignored.
+ */
+ @Override
+ public void endDocument() {
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/EmbeddedContentHandler.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/OfflineContentHandler.java
URL: http://svn.apache.org/viewvc/tika/trunk/tika-core/src/main/java/org/apache/tika/sax/OfflineContentHandler.java?rev=991956&r1=991955&r2=991956&view=diff
==============================================================================
--- tika/trunk/tika-core/src/main/java/org/apache/tika/sax/OfflineContentHandler.java (original)
+++ tika/trunk/tika-core/src/main/java/org/apache/tika/sax/OfflineContentHandler.java Thu Sep 2 14:46:46 2010
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tika.sax;
-
-import org.apache.tika.io.ClosedInputStream;
-import org.xml.sax.ContentHandler;
-import org.xml.sax.InputSource;
-
-/**
- * Content handler decorator that always returns an empty stream from the
- * {@link #resolveEntity(String, String)} method to prevent potential
- * network or other external resources from being accessed by an XML parser.
- *
- * @see <a href="https://issues.apache.org/jira/browse/TIKA-185">TIKA-185</a>
- */
-public class OfflineContentHandler extends ContentHandlerDecorator {
-
- public OfflineContentHandler(ContentHandler handler) {
- super(handler);
- }
-
- /**
- * Returns an empty stream. This will make an XML parser silently
- * ignore any external entities.
- */
- @Override
- public InputSource resolveEntity(String publicId, String systemId) {
- return new InputSource(new ClosedInputStream());
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tika.sax;
+
+import org.apache.tika.io.ClosedInputStream;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+
+/**
+ * Content handler decorator that always returns an empty stream from the
+ * {@link #resolveEntity(String, String)} method to prevent potential
+ * network or other external resources from being accessed by an XML parser.
+ *
+ * @see <a href="https://issues.apache.org/jira/browse/TIKA-185">TIKA-185</a>
+ */
+public class OfflineContentHandler extends ContentHandlerDecorator {
+
+ public OfflineContentHandler(ContentHandler handler) {
+ super(handler);
+ }
+
+ /**
+ * Returns an empty stream. This will make an XML parser silently
+ * ignore any external entities.
+ */
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) {
+ return new InputSource(new ClosedInputStream());
+ }
+
+}
Propchange: tika/trunk/tika-core/src/main/java/org/apache/tika/sax/OfflineContentHandler.java
------------------------------------------------------------------------------
svn:eol-style = native