Author: jukka
Date: Thu Aug 6 15:39:15 2009
New Revision: 801678
URL: http://svn.apache.org/viewvc?rev=801678&view=rev
Log:
Code style: Reindent at four spaces, remove unused access modifiers, inline
singleton classes.
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/CreativeCommons.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/DublinCore.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/HttpHeaders.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/MSOffice.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Metadata.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMetadataKeys.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMimeKeys.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Clause.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/MimeTypesReaderMetKeys.java
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Operator.java
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/CreativeCommons.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/CreativeCommons.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/CreativeCommons.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/CreativeCommons.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -20,15 +20,13 @@
* A collection of Creative Commons properties names.
*
* @see <a href="http://www.creativecommons.org/">creativecommons.org</a>
- *
- *
*/
public interface CreativeCommons {
- public final static String LICENSE_URL = "License-Url";
+ String LICENSE_URL = "License-Url";
- public final static String LICENSE_LOCATION = "License-Location";
+ String LICENSE_LOCATION = "License-Location";
- public final static String WORK_TYPE = "Work-Type";
+ String WORK_TYPE = "Work-Type";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/DublinCore.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/DublinCore.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/DublinCore.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/DublinCore.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -20,141 +20,144 @@
* A collection of Dublin Core metadata names.
*
* @see <a href="http://dublincore.org">dublincore.org</a>
- *
- *
*/
public interface DublinCore {
- /**
- * Typically, Format may include the media-type or dimensions of the
resource.
- * Format may be used to determine the software, hardware or other equipment
- * needed to display or operate the resource. Examples of dimensions include
- * size and duration. Recommended best practice is to select a value from a
- * controlled vocabulary (for example, the list of Internet Media Types
[MIME]
- * defining computer media formats).
- */
- public static final String FORMAT = "format";
-
- /**
- * Recommended best practice is to identify the resource by means of a string
- * or number conforming to a formal identification system. Example formal
- * identification systems include the Uniform Resource Identifier (URI)
- * (including the Uniform Resource Locator (URL)), the Digital Object
- * Identifier (DOI) and the International Standard Book Number (ISBN).
- */
- public static final String IDENTIFIER = "identifier";
-
- /**
- * Date on which the resource was changed.
- */
- public static final String MODIFIED = "modified";
-
- /**
- * An entity responsible for making contributions to the content of the
- * resource. Examples of a Contributor include a person, an organisation, or
a
- * service. Typically, the name of a Contributor should be used to indicate
- * the entity.
- */
- public static final String CONTRIBUTOR = "contributor";
-
- /**
- * The extent or scope of the content of the resource. Coverage will
typically
- * include spatial location (a place name or geographic coordinates),
temporal
- * period (a period label, date, or date range) or jurisdiction (such as a
- * named administrative entity). Recommended best practice is to select a
- * value from a controlled vocabulary (for example, the Thesaurus of
- * Geographic Names [TGN]) and that, where appropriate, named places or time
- * periods be used in preference to numeric identifiers such as sets of
- * coordinates or date ranges.
- */
- public static final String COVERAGE = "coverage";
-
- /**
- * An entity primarily responsible for making the content of the resource.
- * Examples of a Creator include a person, an organisation, or a service.
- * Typically, the name of a Creator should be used to indicate the entity.
- */
- public static final String CREATOR = "creator";
-
- /**
- * A date associated with an event in the life cycle of the resource.
- * Typically, Date will be associated with the creation or availability of
the
- * resource. Recommended best practice for encoding the date value is defined
- * in a profile of ISO 8601 [W3CDTF] and follows the YYYY-MM-DD format.
- */
- public static final String DATE = "date";
-
- /**
- * An account of the content of the resource. Description may include but is
- * not limited to: an abstract, table of contents, reference to a graphical
- * representation of content or a free-text account of the content.
- */
- public static final String DESCRIPTION = "description";
-
- /**
- * A language of the intellectual content of the resource. Recommended best
- * practice is to use RFC 3066 [RFC3066], which, in conjunction with ISO 639
- * [ISO639], defines two- and three-letter primary language tags with
optional
- * subtags. Examples include "en" or "eng" for English, "akk" for Akkadian,
- * and "en-GB" for English used in the United Kingdom.
- */
- public static final String LANGUAGE = "language";
-
- /**
- * An entity responsible for making the resource available. Examples of a
- * Publisher include a person, an organisation, or a service. Typically, the
- * name of a Publisher should be used to indicate the entity.
- */
- public static final String PUBLISHER = "publisher";
-
- /**
- * A reference to a related resource. Recommended best practice is to
- * reference the resource by means of a string or number conforming to a
- * formal identification system.
- */
- public static final String RELATION = "relation";
-
- /**
- * Information about rights held in and over the resource. Typically, a
Rights
- * element will contain a rights management statement for the resource, or
- * reference a service providing such information. Rights information often
- * encompasses Intellectual Property Rights (IPR), Copyright, and various
- * Property Rights. If the Rights element is absent, no assumptions can be
- * made about the status of these and other rights with respect to the
- * resource.
- */
- public static final String RIGHTS = "rights";
-
- /**
- * A reference to a resource from which the present resource is derived. The
- * present resource may be derived from the Source resource in whole or in
- * part. Recommended best practice is to reference the resource by means of a
- * string or number conforming to a formal identification system.
- */
- public static final String SOURCE = "source";
-
- /**
- * The topic of the content of the resource. Typically, a Subject will be
- * expressed as keywords, key phrases or classification codes that describe a
- * topic of the resource. Recommended best practice is to select a value from
- * a controlled vocabulary or formal classification scheme.
- */
- public static final String SUBJECT = "subject";
-
- /**
- * A name given to the resource. Typically, a Title will be a name by which
- * the resource is formally known.
- */
- public static final String TITLE = "title";
-
- /**
- * The nature or genre of the content of the resource. Type includes terms
- * describing general categories, functions, genres, or aggregation levels
for
- * content. Recommended best practice is to select a value from a controlled
- * vocabulary (for example, the DCMI Type Vocabulary [DCMITYPE]). To describe
- * the physical or digital manifestation of the resource, use the Format
- * element.
- */
- public static final String TYPE = "type";
+ /**
+ * Typically, Format may include the media-type or dimensions of the
+ * resource. Format may be used to determine the software, hardware or
+ * other equipment needed to display or operate the resource. Examples
+ * of dimensions include size and duration. Recommended best practice is
+ * to select a value from a controlled vocabulary (for example, the list
+ * of Internet Media Types [MIME] defining computer media formats).
+ */
+ String FORMAT = "format";
+
+ /**
+ * Recommended best practice is to identify the resource by means of
+ * a string or number conforming to a formal identification system.
+ * Example formal identification systems include the Uniform Resource
+ * Identifier (URI) (including the Uniform Resource Locator (URL)),
+ * the Digital Object Identifier (DOI) and the International Standard
+ * Book Number (ISBN).
+ */
+ String IDENTIFIER = "identifier";
+
+ /**
+ * Date on which the resource was changed.
+ */
+ String MODIFIED = "modified";
+
+ /**
+ * An entity responsible for making contributions to the content of the
+ * resource. Examples of a Contributor include a person, an organisation,
+ * or a service. Typically, the name of a Contributor should be used to
+ * indicate the entity.
+ */
+ String CONTRIBUTOR = "contributor";
+
+ /**
+ * The extent or scope of the content of the resource. Coverage will
+ * typically include spatial location (a place name or geographic
+ * coordinates), temporal period (a period label, date, or date range)
+ * or jurisdiction (such as a named administrative entity). Recommended
+ * best practice is to select a value from a controlled vocabulary (for
+ * example, the Thesaurus of Geographic Names [TGN]) and that, where
+ * appropriate, named places or time periods be used in preference to
+ * numeric identifiers such as sets of coordinates or date ranges.
+ */
+ String COVERAGE = "coverage";
+
+ /**
+ * An entity primarily responsible for making the content of the resource.
+ * Examples of a Creator include a person, an organisation, or a service.
+ * Typically, the name of a Creator should be used to indicate the entity.
+ */
+ String CREATOR = "creator";
+
+ /**
+ * A date associated with an event in the life cycle of the resource.
+ * Typically, Date will be associated with the creation or availability of
+ * the resource. Recommended best practice for encoding the date value is
+ * defined in a profile of ISO 8601 [W3CDTF] and follows the YYYY-MM-DD
+ * format.
+ */
+ String DATE = "date";
+
+ /**
+ * An account of the content of the resource. Description may include
+ * but is not limited to: an abstract, table of contents, reference to
+ * a graphical representation of content or a free-text account of
+ * the content.
+ */
+ String DESCRIPTION = "description";
+
+ /**
+ * A language of the intellectual content of the resource. Recommended
+ * best practice is to use RFC 3066 [RFC3066], which, in conjunction
+ * with ISO 639 [ISO639], defines two- and three-letter primary language
+ * tags with optional subtags. Examples include "en" or "eng" for English,
+ * "akk" for Akkadian, and "en-GB" for English used in the United Kingdom.
+ */
+ String LANGUAGE = "language";
+
+ /**
+ * An entity responsible for making the resource available. Examples of
+ * a Publisher include a person, an organisation, or a service. Typically,
+ * the name of a Publisher should be used to indicate the entity.
+ */
+ String PUBLISHER = "publisher";
+
+ /**
+ * A reference to a related resource. Recommended best practice is to
+ * reference the resource by means of a string or number conforming to
+ * a formal identification system.
+ */
+ String RELATION = "relation";
+
+ /**
+ * Information about rights held in and over the resource. Typically,
+ * a Rights element will contain a rights management statement for
+ * the resource, or reference a service providing such information.
+ * Rights information often encompasses Intellectual Property Rights
+ * (IPR), Copyright, and various Property Rights. If the Rights element
+ * is absent, no assumptions can be made about the status of these and
+ * other rights with respect to the resource.
+ */
+ String RIGHTS = "rights";
+
+ /**
+ * A reference to a resource from which the present resource is derived.
+ * The present resource may be derived from the Source resource in whole
+ * or in part. Recommended best practice is to reference the resource by
+ * means of a string or number conforming to a formal identification
+ * system.
+ */
+ String SOURCE = "source";
+
+ /**
+ * The topic of the content of the resource. Typically, a Subject will
+ * be expressed as keywords, key phrases or classification codes that
+ * describe a topic of the resource. Recommended best practice is to
+ * select a value from a controlled vocabulary or formal classification
+ * scheme.
+ */
+ String SUBJECT = "subject";
+
+ /**
+ * A name given to the resource. Typically, a Title will be a name by
+ * which the resource is formally known.
+ */
+ String TITLE = "title";
+
+ /**
+ * The nature or genre of the content of the resource. Type includes terms
+ * describing general categories, functions, genres, or aggregation levels
+ * for content. Recommended best practice is to select a value from a
+ * controlled vocabulary (for example, the DCMI Type Vocabulary
+ * [DCMITYPE]). To describe the physical or digital manifestation of
+ * the resource, use the Format element.
+ */
+ String TYPE = "type";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/HttpHeaders.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/HttpHeaders.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/HttpHeaders.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/HttpHeaders.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -21,27 +21,25 @@
*
* @see <a href="http://rfc-ref.org/RFC-TEXTS/2616/">Hypertext Transfer
Protocol --
* HTTP/1.1 (RFC 2616)</a>
- *
- *
*/
public interface HttpHeaders {
- public final static String CONTENT_ENCODING = "Content-Encoding";
+ String CONTENT_ENCODING = "Content-Encoding";
- public final static String CONTENT_LANGUAGE = "Content-Language";
+ String CONTENT_LANGUAGE = "Content-Language";
- public final static String CONTENT_LENGTH = "Content-Length";
+ String CONTENT_LENGTH = "Content-Length";
- public final static String CONTENT_LOCATION = "Content-Location";
+ String CONTENT_LOCATION = "Content-Location";
- public static final String CONTENT_DISPOSITION = "Content-Disposition";
+ String CONTENT_DISPOSITION = "Content-Disposition";
- public final static String CONTENT_MD5 = "Content-MD5";
+ String CONTENT_MD5 = "Content-MD5";
- public final static String CONTENT_TYPE = "Content-Type";
+ String CONTENT_TYPE = "Content-Type";
- public final static String LAST_MODIFIED = "Last-Modified";
+ String LAST_MODIFIED = "Last-Modified";
- public final static String LOCATION = "Location";
+ String LOCATION = "Location";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/MSOffice.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/MSOffice.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/MSOffice.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/MSOffice.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -21,60 +21,60 @@
*/
public interface MSOffice {
- public static final String KEYWORDS = "Keywords";
+ String KEYWORDS = "Keywords";
+
+ String COMMENTS = "Comments";
+
+ String LAST_AUTHOR = "Last-Author";
+
+ String APPLICATION_NAME = "Application-Name";
+
+ String CHARACTER_COUNT = "Character Count";
+
+ String LAST_PRINTED = "Last-Printed";
+
+ String LAST_SAVED = "Last-Save-Date";
+
+ String PAGE_COUNT = "Page-Count";
+
+ String REVISION_NUMBER = "Revision-Number";
+
+ String WORD_COUNT = "Word-Count";
+
+ String TEMPLATE = "Template";
+
+ String AUTHOR = "Author";
+
+ String TOTAL_TIME = "Total-Time";
- public static final String COMMENTS = "Comments";
+ String SLIDE_COUNT = "Slide-Count";
- public static final String LAST_AUTHOR = "Last-Author";
+ String PRESENTATION_FORMAT = "Presentation-Format";
- public static final String APPLICATION_NAME = "Application-Name";
+ String PARAGRAPH_COUNT = "Paragraph-Count";
- public static final String CHARACTER_COUNT = "Character Count";
+ String NOTES = "Notes";
- public static final String LAST_PRINTED = "Last-Printed";
+ String MANAGER = "Manager";
- public static final String LAST_SAVED = "Last-Save-Date";
+ String LINE_COUNT = "Line-Count";
- public static final String PAGE_COUNT = "Page-Count";
+ String CHARACTER_COUNT_WITH_SPACES = "Character-Count-With-Spaces";
- public static final String REVISION_NUMBER = "Revision-Number";
+ String APPLICATION_VERSION = "Application-Version";
- public static final String WORD_COUNT = "Word-Count";
+ String VERSION = "Version";
- public static final String TEMPLATE = "Template";
+ String CONTENT_STATUS = "Content-Status";
- public static final String AUTHOR = "Author";
-
- public static final String TOTAL_TIME = "Total-Time";
-
- public static final String SLIDE_COUNT = "Slide-Count";
-
- public static final String PRESENTATION_FORMAT = "Presentation-Format";
-
- public static final String PARAGRAPH_COUNT = "Paragraph-Count";
-
- public static final String NOTES = "Notes";
-
- public static final String MANAGER = "Manager";
-
- public static final String LINE_COUNT = "Line-Count";
-
- public static final String CHARACTER_COUNT_WITH_SPACES =
"Character-Count-With-Spaces";
-
- public static final String APPLICATION_VERSION = "Application-Version";
-
- public static final String VERSION = "Version";
-
- public static final String CONTENT_STATUS = "Content-Status";
-
- public static final String CATEGORY = "Category";
+ String CATEGORY = "Category";
- public static final String COMPANY = "Company";
+ String COMPANY = "Company";
- public static final String SECURITY = "Security";
+ String SECURITY = "Security";
- public static final String EDIT_TIME = "Edit-Time";
+ String EDIT_TIME = "Edit-Time";
- public static final String CREATION_DATE = "Creation-Date";
+ String CREATION_DATE = "Creation-Date";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Metadata.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Metadata.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Metadata.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/Metadata.java
Thu Aug 6 15:39:15 2009
@@ -16,7 +16,6 @@
*/
package org.apache.tika.metadata;
-// JDK imports
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
@@ -24,193 +23,191 @@
/**
* A multi-valued metadata container.
- *
- *
- *
*/
public class Metadata implements CreativeCommons, DublinCore, HttpHeaders,
- MSOffice, TikaMetadataKeys, TikaMimeKeys {
+ MSOffice, TikaMetadataKeys, TikaMimeKeys {
+ /**
+ * A map of all metadata attributes.
+ */
+ private Map<String, String[]> metadata = null;
+
+ /**
+ * Constructs a new, empty metadata.
+ */
+ public Metadata() {
+ metadata = new HashMap<String, String[]>();
+ }
+
+ /**
+ * Returns true if named value is multivalued.
+ *
+ * @param name
+ * name of metadata
+ * @return true is named value is multivalued, false if single value or
null
+ */
+ public boolean isMultiValued(final String name) {
+ return metadata.get(name) != null && metadata.get(name).length > 1;
+ }
+
+ /**
+ * Returns an array of the names contained in the metadata.
+ *
+ * @return Metadata names
+ */
+ public String[] names() {
+ return metadata.keySet().toArray(new String[metadata.keySet().size()]);
+ }
+
+ /**
+ * Get the value associated to a metadata name. If many values are
assiociated
+ * to the specified name, then the first one is returned.
+ *
+ * @param name
+ * of the metadata.
+ * @return the value associated to the specified metadata name.
+ */
+ public String get(final String name) {
+ String[] values = metadata.get(name);
+ if (values == null) {
+ return null;
+ } else {
+ return values[0];
+ }
+ }
+
+ /**
+ * Get the values associated to a metadata name.
+ *
+ * @param name
+ * of the metadata.
+ * @return the values associated to a metadata name.
+ */
+ public String[] getValues(final String name) {
+ return _getValues(name);
+ }
+
+ private String[] _getValues(final String name) {
+ String[] values = metadata.get(name);
+ if (values == null) {
+ values = new String[0];
+ }
+ return values;
+ }
+
+ /**
+ * Add a metadata name/value mapping. Add the specified value to the list
of
+ * values associated to the specified metadata name.
+ *
+ * @param name
+ * the metadata name.
+ * @param value
+ * the metadata value.
+ */
+ public void add(final String name, final String value) {
+ String[] values = metadata.get(name);
+ if (values == null) {
+ set(name, value);
+ } else {
+ String[] newValues = new String[values.length + 1];
+ System.arraycopy(values, 0, newValues, 0, values.length);
+ newValues[newValues.length - 1] = value;
+ metadata.put(name, newValues);
+ }
+ }
+
+ /**
+ * Copy All key-value pairs from properties.
+ *
+ * @param properties
+ * properties to copy from
+ */
+ @SuppressWarnings("unchecked")
+ public void setAll(Properties properties) {
+ Enumeration<String> names =
+ (Enumeration<String>) properties.propertyNames();
+ while (names.hasMoreElements()) {
+ String name = names.nextElement();
+ metadata.put(name, new String[] { properties.getProperty(name) });
+ }
+ }
- /**
- * A map of all metadata attributes.
- */
- private Map<String, String[]> metadata = null;
-
- /**
- * Constructs a new, empty metadata.
- */
- public Metadata() {
- metadata = new HashMap<String, String[]>();
- }
-
- /**
- * Returns true if named value is multivalued.
- *
- * @param name
- * name of metadata
- * @return true is named value is multivalued, false if single value or null
- */
- public boolean isMultiValued(final String name) {
- return metadata.get(name) != null && metadata.get(name).length > 1;
- }
-
- /**
- * Returns an array of the names contained in the metadata.
- *
- * @return Metadata names
- */
- public String[] names() {
- return metadata.keySet().toArray(new String[metadata.keySet().size()]);
- }
-
- /**
- * Get the value associated to a metadata name. If many values are
assiociated
- * to the specified name, then the first one is returned.
- *
- * @param name
- * of the metadata.
- * @return the value associated to the specified metadata name.
- */
- public String get(final String name) {
- String[] values = metadata.get(name);
- if (values == null) {
- return null;
- } else {
- return values[0];
- }
- }
-
- /**
- * Get the values associated to a metadata name.
- *
- * @param name
- * of the metadata.
- * @return the values associated to a metadata name.
- */
- public String[] getValues(final String name) {
- return _getValues(name);
- }
-
- private String[] _getValues(final String name) {
- String[] values = metadata.get(name);
- if (values == null) {
- values = new String[0];
- }
- return values;
- }
-
- /**
- * Add a metadata name/value mapping. Add the specified value to the list of
- * values associated to the specified metadata name.
- *
- * @param name
- * the metadata name.
- * @param value
- * the metadata value.
- */
- public void add(final String name, final String value) {
- String[] values = metadata.get(name);
- if (values == null) {
- set(name, value);
- } else {
- String[] newValues = new String[values.length + 1];
- System.arraycopy(values, 0, newValues, 0, values.length);
- newValues[newValues.length - 1] = value;
- metadata.put(name, newValues);
- }
- }
-
- /**
- * Copy All key-value pairs from properties.
- *
- * @param properties
- * properties to copy from
- */
- public void setAll(Properties properties) {
- Enumeration names = properties.propertyNames();
- while (names.hasMoreElements()) {
- String name = (String) names.nextElement();
- metadata.put(name, new String[] { properties.getProperty(name) });
- }
- }
-
- /**
- * Set metadata name/value. Associate the specified value to the specified
- * metadata name. If some previous values were associated to this name, they
- * are removed.
- *
- * @param name
- * the metadata name.
- * @param value
- * the metadata value.
- */
- public void set(String name, String value) {
- metadata.put(name, new String[] { value });
- }
-
- /**
- * Remove a metadata and all its associated values.
- *
- * @param name
- * metadata name to remove
- */
- public void remove(String name) {
- metadata.remove(name);
- }
-
- /**
- * Returns the number of metadata names in this metadata.
- *
- * @return number of metadata names
- */
- public int size() {
- return metadata.size();
- }
-
- public boolean equals(Object o) {
-
- if (o == null) {
- return false;
- }
-
- Metadata other = null;
- try {
- other = (Metadata) o;
- } catch (ClassCastException cce) {
- return false;
- }
-
- if (other.size() != size()) {
- return false;
- }
-
- String[] names = names();
- for (int i = 0; i < names.length; i++) {
- String[] otherValues = other._getValues(names[i]);
- String[] thisValues = _getValues(names[i]);
- if (otherValues.length != thisValues.length) {
- return false;
- }
- for (int j = 0; j < otherValues.length; j++) {
- if (!otherValues[j].equals(thisValues[j])) {
- return false;
- }
- }
- }
- return true;
- }
-
- public String toString() {
- StringBuffer buf = new StringBuffer();
- String[] names = names();
- for (int i = 0; i < names.length; i++) {
- String[] values = _getValues(names[i]);
- for (int j = 0; j < values.length; j++) {
- buf.append(names[i]).append("=").append(values[j]).append(" ");
- }
+ /**
+ * Set metadata name/value. Associate the specified value to the specified
+ * metadata name. If some previous values were associated to this name,
they
+ * are removed.
+ *
+ * @param name
+ * the metadata name.
+ * @param value
+ * the metadata value.
+ */
+ public void set(String name, String value) {
+ metadata.put(name, new String[] { value });
+ }
+
+ /**
+ * Remove a metadata and all its associated values.
+ *
+ * @param name
+ * metadata name to remove
+ */
+ public void remove(String name) {
+ metadata.remove(name);
+ }
+
+ /**
+ * Returns the number of metadata names in this metadata.
+ *
+ * @return number of metadata names
+ */
+ public int size() {
+ return metadata.size();
+ }
+
+ public boolean equals(Object o) {
+
+ if (o == null) {
+ return false;
+ }
+
+ Metadata other = null;
+ try {
+ other = (Metadata) o;
+ } catch (ClassCastException cce) {
+ return false;
+ }
+
+ if (other.size() != size()) {
+ return false;
+ }
+
+ String[] names = names();
+ for (int i = 0; i < names.length; i++) {
+ String[] otherValues = other._getValues(names[i]);
+ String[] thisValues = _getValues(names[i]);
+ if (otherValues.length != thisValues.length) {
+ return false;
+ }
+ for (int j = 0; j < otherValues.length; j++) {
+ if (!otherValues[j].equals(thisValues[j])) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public String toString() {
+ StringBuffer buf = new StringBuffer();
+ String[] names = names();
+ for (int i = 0; i < names.length; i++) {
+ String[] values = _getValues(names[i]);
+ for (int j = 0; j < values.length; j++) {
+ buf.append(names[i]).append("=").append(values[j]).append(" ");
+ }
+ }
+ return buf.toString();
}
- return buf.toString();
- }
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMetadataKeys.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMetadataKeys.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMetadataKeys.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMetadataKeys.java
Thu Aug 6 15:39:15 2009
@@ -21,6 +21,6 @@
*/
public interface TikaMetadataKeys {
- public static final String RESOURCE_NAME_KEY = "resourceName";
-
+ String RESOURCE_NAME_KEY = "resourceName";
+
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMimeKeys.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMimeKeys.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMimeKeys.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/metadata/TikaMimeKeys.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -14,16 +14,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.tika.metadata;
/**
* A collection of Tika metadata keys used in Mime Type resolution
- *
*/
public interface TikaMimeKeys {
- public static final String TIKA_MIME_FILE = "tika.mime.file";
+ String TIKA_MIME_FILE = "tika.mime.file";
+
+ String MIME_TYPE_MAGIC = "mime.type.magic";
- public static final String MIME_TYPE_MAGIC = "mime.type.magic";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Clause.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Clause.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
--- lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Clause.java
(original)
+++ lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Clause.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -18,54 +18,44 @@
/**
* Defines a clause to be evaluated.
- *
- *
*/
interface Clause {
- /** A clause that is always true. */
- final static Clause TRUE = new True();
-
- /** A clause that is always false. */
- final static Clause FALSE = new False();
-
/**
* Evaluates this clause with the specified chunk of data.
*/
- public boolean eval(byte[] data);
+ boolean eval(byte[] data);
/**
* Returns the size of this clause. The size of a clause is the number of
* chars it is composed of.
*/
- public int size();
+ int size();
- final static class False implements Clause {
+ /** A clause that is always true. */
+ Clause TRUE = new Clause() {
public boolean eval(byte[] data) {
- return false;
+ return true;
}
-
public int size() {
return 0;
}
-
public String toString() {
- return "FALSE";
+ return "TRUE";
}
- }
+ };
- final static class True implements Clause {
+ /** A clause that is always false. */
+ Clause FALSE = new Clause() {
public boolean eval(byte[] data) {
- return true;
+ return false;
}
-
public int size() {
return 0;
}
-
public String toString() {
- return "TRUE";
+ return "FALSE";
}
- }
+ };
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/MimeTypesReaderMetKeys.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/MimeTypesReaderMetKeys.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/MimeTypesReaderMetKeys.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/MimeTypesReaderMetKeys.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -14,55 +14,53 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.tika.mime;
/**
- *
* Met Keys used by the {...@link MimeTypesReader}.
*/
public interface MimeTypesReaderMetKeys {
- public static final String MIME_INFO_TAG = "mime-info";
+ String MIME_INFO_TAG = "mime-info";
- public static final String MIME_TYPE_TAG = "mime-type";
+ String MIME_TYPE_TAG = "mime-type";
- public static final String MIME_TYPE_TYPE_ATTR = "type";
+ String MIME_TYPE_TYPE_ATTR = "type";
- public static final String COMMENT_TAG = "_comment";
+ String COMMENT_TAG = "_comment";
- public static final String GLOB_TAG = "glob";
+ String GLOB_TAG = "glob";
- public static final String ISREGEX_ATTR = "isregex";
+ String ISREGEX_ATTR = "isregex";
- public static final String PATTERN_ATTR = "pattern";
+ String PATTERN_ATTR = "pattern";
- public static final String MAGIC_TAG = "magic";
+ String MAGIC_TAG = "magic";
- public static final String ALIAS_TAG = "alias";
+ String ALIAS_TAG = "alias";
- public static final String ALIAS_TYPE_ATTR = "type";
+ String ALIAS_TYPE_ATTR = "type";
- public static final String ROOT_XML_TAG = "root-XML";
+ String ROOT_XML_TAG = "root-XML";
- public static final String SUB_CLASS_OF_TAG = "sub-class-of";
+ String SUB_CLASS_OF_TAG = "sub-class-of";
- public static final String SUB_CLASS_TYPE_ATTR = "type";
+ String SUB_CLASS_TYPE_ATTR = "type";
- public static final String MAGIC_PRIORITY_ATTR = "priority";
+ String MAGIC_PRIORITY_ATTR = "priority";
- public static final String MATCH_TAG = "match";
+ String MATCH_TAG = "match";
- public static final String MATCH_OFFSET_ATTR = "offset";
+ String MATCH_OFFSET_ATTR = "offset";
- public static final String MATCH_TYPE_ATTR = "type";
+ String MATCH_TYPE_ATTR = "type";
- public static final String MATCH_VALUE_ATTR = "value";
+ String MATCH_VALUE_ATTR = "value";
- public static final String MATCH_MASK_ATTR = "mask";
+ String MATCH_MASK_ATTR = "mask";
- public static final String NS_URI_ATTR = "namespaceURI";
+ String NS_URI_ATTR = "namespaceURI";
- public static final String LOCAL_NAME_ATTR = "localName";
+ String LOCAL_NAME_ATTR = "localName";
}
Modified:
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Operator.java
URL:
http://svn.apache.org/viewvc/lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Operator.java?rev=801678&r1=801677&r2=801678&view=diff
==============================================================================
---
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Operator.java
(original)
+++
lucene/tika/trunk/tika-core/src/main/java/org/apache/tika/mime/Operator.java
Thu Aug 6 15:39:15 2009
@@ -1,4 +1,4 @@
-/**
+/*
* 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.
@@ -18,17 +18,9 @@
/**
* Defines a Boolean Binary Operator.
- *
- *
*/
interface Operator {
- /** The OR Boolean operator */
- final static Operator OR = new Or();
-
- /** The AND Boolean operator */
- final static Operator AND = new And();
-
/**
* Evaluates the specified bolean operands.
*
@@ -41,29 +33,24 @@
*/
boolean eval(boolean o1, boolean o2);
- /**
- * Defines the Boolean Binary Operator AND.
- */
- final static class And implements Operator {
+ /** The AND Boolean operator */
+ Operator AND = new Operator() {
public boolean eval(boolean o1, boolean o2) {
return o1 && o2;
}
-
public String toString() {
return "AND";
}
- }
+ };
- /**
- * Defines the Boolean Binary Operator OR.
- */
- final static class Or implements Operator {
+ /** The OR Boolean operator */
+ Operator OR = new Operator() {
public boolean eval(boolean o1, boolean o2) {
return o1 || o2;
}
-
public String toString() {
return "OR";
}
- }
+ };
+
}