mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Remove some deprecated methods and classes in the MetadataExtracter hierarchy
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@130493 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -25,56 +25,55 @@
|
||||
*/
|
||||
package org.alfresco.repo.content.metadata;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.StreamAwareContentReaderProxy;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.MalformedNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
|
||||
import org.alfresco.service.namespace.InvalidQNameException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.xmlbeans.impl.xb.xsdschema.All;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.extensions.surf.util.ISO8601DateFormat;
|
||||
import java.io.InputStream;
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.FutureTask;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.alfresco.api.AlfrescoPublicApi;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.StreamAwareContentReaderProxy;
|
||||
import org.alfresco.service.cmr.dictionary.DataTypeDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.DictionaryService;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import org.alfresco.service.cmr.repository.MalformedNodeRefException;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.cmr.repository.datatype.DefaultTypeConverter;
|
||||
import org.alfresco.service.cmr.repository.datatype.TypeConversionException;
|
||||
import org.alfresco.service.namespace.InvalidQNameException;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.extensions.surf.util.ISO8601DateFormat;
|
||||
|
||||
/**
|
||||
* Support class for metadata extracters that support dynamic and config-driven
|
||||
@@ -254,7 +253,8 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @see #setSupportedMimetypes(Collection)
|
||||
*/
|
||||
*/
|
||||
@Override
|
||||
public boolean isSupported(String sourceMimetype)
|
||||
{
|
||||
return supportedMimetypes.contains(sourceMimetype) && isEnabled(sourceMimetype);
|
||||
@@ -265,6 +265,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
*
|
||||
* @see #setSupportedEmbedMimetypes(Collection)
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmbeddingSupported(String sourceMimetype)
|
||||
{
|
||||
if (supportedEmbedMimetypes == null)
|
||||
@@ -295,17 +296,6 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO - This doesn't appear to be used, so should be removed / deprecated / replaced
|
||||
* @return Returns <code>1.0</code> if the mimetype is supported, otherwise <tt>0.0</tt>
|
||||
*
|
||||
* @see #isSupported(String)
|
||||
*/
|
||||
public double getReliability(String mimetype)
|
||||
{
|
||||
return isSupported(mimetype) ? 1.0D : 0.0D;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the policy to use when existing values are encountered. Depending on how the extractor
|
||||
* is called, this may not be relevant, i.e an empty map of existing properties may be passed
|
||||
@@ -1115,12 +1105,6 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public long getExtractionTime()
|
||||
{
|
||||
return 1000L;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the mimetype is supported.
|
||||
*
|
||||
@@ -1162,6 +1146,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final Map<QName, Serializable> extract(ContentReader reader, Map<QName, Serializable> destination)
|
||||
{
|
||||
return extract(reader, this.overwritePolicy, destination, this.mapping);
|
||||
@@ -1170,6 +1155,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final Map<QName, Serializable> extract(
|
||||
ContentReader reader,
|
||||
OverwritePolicy overwritePolicy,
|
||||
@@ -1181,6 +1167,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Map<QName, Serializable> extract(
|
||||
ContentReader reader,
|
||||
OverwritePolicy overwritePolicy,
|
||||
@@ -1304,6 +1291,7 @@ abstract public class AbstractMappingMetadataExtracter implements MetadataExtrac
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public final void embed(
|
||||
Map<QName, Serializable> properties,
|
||||
ContentReader reader,
|
||||
|
@@ -1,360 +0,0 @@
|
||||
/*
|
||||
* #%L
|
||||
* Alfresco Repository
|
||||
* %%
|
||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||
* %%
|
||||
* This file is part of the Alfresco software.
|
||||
* If the software was purchased under a paid Alfresco license, the terms of
|
||||
* the paid license agreement will prevail. Otherwise, the software is
|
||||
* provided under the following open source license terms:
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
* #L%
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2005-2012 Jesper Steen Møller
|
||||
*
|
||||
* This file is part of Alfresco
|
||||
*
|
||||
* Alfresco is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alfresco is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.alfresco.repo.content.metadata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.service.cmr.repository.ContentIOException;
|
||||
import org.alfresco.service.cmr.repository.ContentReader;
|
||||
import org.alfresco.service.cmr.repository.MimetypeService;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
|
||||
/**
|
||||
* Support class for metadata extracters.
|
||||
*
|
||||
* @deprecated Use the {@link org.alfresco.repo.content.metadata.AbstractMappingMetadataExtracter}
|
||||
*
|
||||
* @author Jesper Steen Møller
|
||||
* @author Derek Hulley
|
||||
*/
|
||||
abstract public class AbstractMetadataExtracter implements MetadataExtracter, BeanNameAware
|
||||
{
|
||||
protected static Log logger = LogFactory.getLog(AbstractMetadataExtracter.class);
|
||||
|
||||
private MimetypeService mimetypeService;
|
||||
private MetadataExtracterRegistry registry;
|
||||
private Set<String> supportedMimetypes;
|
||||
private double reliability;
|
||||
private long extractionTime;
|
||||
private String beanName;
|
||||
private Properties properties;
|
||||
private MetadataExtracterConfig metadataExtracterConfig;
|
||||
|
||||
protected AbstractMetadataExtracter(String supportedMimetype, double reliability, long extractionTime)
|
||||
{
|
||||
this.supportedMimetypes = Collections.singleton(supportedMimetype);
|
||||
this.reliability = reliability;
|
||||
this.extractionTime = extractionTime;
|
||||
}
|
||||
|
||||
protected AbstractMetadataExtracter(Set<String> supportedMimetypes, double reliability, long extractionTime)
|
||||
{
|
||||
this.supportedMimetypes = supportedMimetypes;
|
||||
this.reliability = reliability;
|
||||
this.extractionTime = extractionTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the registry to register with
|
||||
*
|
||||
* @param registry a metadata extracter registry
|
||||
*/
|
||||
public void setRegistry(MetadataExtracterRegistry registry)
|
||||
{
|
||||
this.registry = registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper setter of the mimetype service. This is not always required.
|
||||
*
|
||||
* @param mimetypeService MimetypeService
|
||||
*/
|
||||
public void setMimetypeService(MimetypeService mimetypeService)
|
||||
{
|
||||
this.mimetypeService = mimetypeService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanName(String beanName)
|
||||
{
|
||||
this.beanName = beanName;
|
||||
}
|
||||
|
||||
public String getBeanName()
|
||||
{
|
||||
return beanName;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Alfresco global properties.
|
||||
*/
|
||||
public void setProperties(Properties properties)
|
||||
{
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* The metadata extracter config.
|
||||
*/
|
||||
public void setMetadataExtracterConfig(MetadataExtracterConfig metadataExtracterConfig)
|
||||
{
|
||||
this.metadataExtracterConfig = metadataExtracterConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the mimetype helper
|
||||
*/
|
||||
protected MimetypeService getMimetypeService()
|
||||
{
|
||||
return mimetypeService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance of the extracter with the registry.
|
||||
*
|
||||
* @see #setRegistry(MetadataExtracterRegistry)
|
||||
*/
|
||||
public void register()
|
||||
{
|
||||
if (registry == null)
|
||||
{
|
||||
logger.warn("Property 'registry' has not been set. Ignoring auto-registration: \n" +
|
||||
" extracter: " + this);
|
||||
return;
|
||||
}
|
||||
registry.register(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default reliability check that returns the reliability as configured by the contstructor
|
||||
* if the mimetype is in the list of supported mimetypes.
|
||||
*
|
||||
* @param mimetype the mimetype to check
|
||||
*/
|
||||
public double getReliability(String mimetype)
|
||||
{
|
||||
if (supportedMimetypes.contains(mimetype))
|
||||
return reliability;
|
||||
else
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @return Returns <tt>true</tt> if the {@link #getReliability(String) reliability}
|
||||
* is greater than 0
|
||||
*/
|
||||
public boolean isSupported(String mimetype)
|
||||
{
|
||||
double reliability = getReliability(mimetype);
|
||||
return reliability > 0.0 && isEnabled(mimetype);
|
||||
}
|
||||
|
||||
private boolean isEnabled(String mimetype)
|
||||
{
|
||||
return properties == null || mimetypeService == null ||
|
||||
(getBooleanProperty(beanName+".enabled", true) &&
|
||||
getBooleanProperty(beanName+'.'+mimetypeService.getExtension(mimetype)+".enabled", true));
|
||||
}
|
||||
|
||||
private boolean getBooleanProperty(String name, boolean defaultValue)
|
||||
{
|
||||
boolean value = defaultValue;
|
||||
if (properties != null)
|
||||
{
|
||||
String property = properties.getProperty(name);
|
||||
if (property != null)
|
||||
{
|
||||
value = property.trim().equalsIgnoreCase("true");
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
public long getExtractionTime()
|
||||
{
|
||||
return extractionTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the mimetype is supported.
|
||||
*
|
||||
* @param reader the reader to check
|
||||
* @throws AlfrescoRuntimeException if the mimetype is not supported
|
||||
*/
|
||||
protected void checkReliability(ContentReader reader)
|
||||
{
|
||||
String mimetype = reader.getMimetype();
|
||||
if (getReliability(mimetype) <= 0.0)
|
||||
{
|
||||
throw new AlfrescoRuntimeException(
|
||||
"Metadata extracter does not support mimetype: \n" +
|
||||
" reader: " + reader + "\n" +
|
||||
" supported: " + supportedMimetypes + "\n" +
|
||||
" extracter: " + this);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* <p>
|
||||
* A {@code OverwritePolicy.PRAGMATIC} will be applied.
|
||||
*/
|
||||
public Map<QName, Serializable> extract(ContentReader reader, Map<QName, Serializable> destination)
|
||||
{
|
||||
return extract(reader, OverwritePolicy.PRAGMATIC, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param reader
|
||||
* @param overwritePolicy
|
||||
* @param destination
|
||||
*
|
||||
* @see #extract(ContentReader, Map)
|
||||
*/
|
||||
public final Map<QName, Serializable> extract(
|
||||
ContentReader reader,
|
||||
OverwritePolicy overwritePolicy,
|
||||
Map<QName, Serializable> destination) throws ContentIOException
|
||||
{
|
||||
// check the reliability
|
||||
checkReliability(reader);
|
||||
|
||||
Map<QName, Serializable> newProperties = new HashMap<QName, Serializable>(13);
|
||||
try
|
||||
{
|
||||
extractInternal(reader, newProperties);
|
||||
// Apply the overwrite policy
|
||||
Map<QName, Serializable> modifiedProperties = overwritePolicy.applyProperties(newProperties, destination);
|
||||
// done
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Completed metadata extraction: \n" +
|
||||
" reader: " + reader + "\n" +
|
||||
" extracter: " + this);
|
||||
}
|
||||
return modifiedProperties;
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
throw new ContentIOException("Metadata extraction failed: \n" +
|
||||
" reader: " + reader,
|
||||
e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// check that the reader was closed (if used)
|
||||
if (reader.isChannelOpen())
|
||||
{
|
||||
logger.error("Content reader not closed by metadata extracter: \n" +
|
||||
" reader: " + reader + "\n" +
|
||||
" extracter: " + this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @param overwritePolicy ignored
|
||||
* @param propertyMapping ignored
|
||||
*
|
||||
* @see #extract(ContentReader, Map)
|
||||
*/
|
||||
public final Map<QName, Serializable> extract(
|
||||
ContentReader reader,
|
||||
OverwritePolicy overwritePolicy,
|
||||
Map<QName, Serializable> destination,
|
||||
Map<String, Set<QName>> propertyMapping) throws ContentIOException
|
||||
{
|
||||
return extract(reader, destination);
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to provide the necessary extraction logic. Implementations must ensure that the reader
|
||||
* is closed before the method exits.
|
||||
*
|
||||
* @param reader the source of the content
|
||||
* @param destination the property map to fill
|
||||
* @throws Throwable an exception
|
||||
*
|
||||
* @deprecated Consider deriving from the more configurable {@link AbstractMappingMetadataExtracter}
|
||||
*/
|
||||
protected abstract void extractInternal(ContentReader reader, Map<QName, Serializable> destination) throws Throwable;
|
||||
|
||||
/**
|
||||
* Examines a value or string for nulls and adds it to the map (if non-empty)
|
||||
*
|
||||
* @param prop Alfresco's <code>ContentModel.PROP_</code> to set.
|
||||
* @param value Value to set it to
|
||||
* @param destination Map into which to set it
|
||||
* @return true, if set, false otherwise
|
||||
*/
|
||||
protected boolean trimPut(QName prop, Object value, Map<QName, Serializable> destination)
|
||||
{
|
||||
if (value == null)
|
||||
return false;
|
||||
if (value instanceof String)
|
||||
{
|
||||
String svalue = ((String) value).trim();
|
||||
if (svalue.length() > 0)
|
||||
{
|
||||
destination.put(prop, svalue);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (value instanceof Serializable)
|
||||
{
|
||||
destination.put(prop, (Serializable) value);
|
||||
}
|
||||
else
|
||||
{
|
||||
destination.put(prop, value.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@@ -316,16 +316,6 @@ public interface MetadataExtracter extends ContentWorker
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get an estimate of the extracter's reliability on a scale from 0.0 to 1.0.
|
||||
*
|
||||
* @param mimetype the mimetype to check
|
||||
* @return Returns a reliability indicator from 0.0 to 1.0
|
||||
*
|
||||
* @deprecated This method is replaced by {@link #isSupported(String)}
|
||||
*/
|
||||
public double getReliability(String mimetype);
|
||||
|
||||
/**
|
||||
* Determines if the extracter works against the given mimetype.
|
||||
*
|
||||
@@ -334,19 +324,6 @@ public interface MetadataExtracter extends ContentWorker
|
||||
*/
|
||||
public boolean isSupported(String mimetype);
|
||||
|
||||
/**
|
||||
* Provides an estimate, usually a worst case guess, of how long an
|
||||
* extraction will take.
|
||||
* <p>
|
||||
* This method is used to determine, up front, which of a set of equally
|
||||
* reliant transformers will be used for a specific extraction.
|
||||
*
|
||||
* @return Returns the approximate number of milliseconds per transformation
|
||||
*
|
||||
* @deprecated Generally not useful or used. Extraction is normally specifically configured.
|
||||
*/
|
||||
public long getExtractionTime();
|
||||
|
||||
/**
|
||||
* Extracts the metadata values from the content provided by the reader and source
|
||||
* mimetype to the supplied map. The internal mapping and {@link OverwritePolicy overwrite policy}
|
||||
|
@@ -201,16 +201,20 @@ public class MetadataExtracterRegistry
|
||||
return liveExtractor;
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private String getName(MetadataExtracter extractor)
|
||||
{
|
||||
return extractor == null
|
||||
? null
|
||||
: extractor instanceof AbstractMetadataExtracter
|
||||
? ((AbstractMetadataExtracter)extractor).getBeanName()
|
||||
: extractor instanceof AbstractMappingMetadataExtracter
|
||||
? ((AbstractMappingMetadataExtracter)extractor).getBeanName()
|
||||
: extractor.getClass().getSimpleName();
|
||||
{
|
||||
if (extractor == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else if (extractor instanceof AbstractMappingMetadataExtracter)
|
||||
{
|
||||
return ((AbstractMappingMetadataExtracter)extractor).getBeanName();
|
||||
}
|
||||
else
|
||||
{
|
||||
return extractor.getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -218,8 +222,11 @@ public class MetadataExtracterRegistry
|
||||
* @return Returns a set of extractors that will work for the given mimetype
|
||||
*/
|
||||
private List<MetadataExtracter> findBestExtracters(String sourceMimetype)
|
||||
{
|
||||
logger.debug("Finding extractors for " + sourceMimetype);
|
||||
{
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Finding extractors for " + sourceMimetype);
|
||||
}
|
||||
|
||||
List<MetadataExtracter> extractors = new ArrayList<MetadataExtracter>(1);
|
||||
|
||||
@@ -227,14 +234,23 @@ public class MetadataExtracterRegistry
|
||||
{
|
||||
if (!extractor.isSupported(sourceMimetype))
|
||||
{
|
||||
// extraction not achievable
|
||||
logger.debug("Find unsupported: "+getName(extractor));
|
||||
// extraction not achievable
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Find unsupported: "+getName(extractor));
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Find supported: "+getName(extractor));
|
||||
}
|
||||
logger.debug("Find supported: "+getName(extractor));
|
||||
extractors.add(extractor);
|
||||
}
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("Find returning: "+extractors);
|
||||
}
|
||||
logger.debug("Find returning: "+extractors);
|
||||
return extractors;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user