public static String getResourceName(Metadata metadata, AtomicInteger counter) {
        String objectName = "";
        if (metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY) != null) {
            objectName = metadata.get(TikaCoreProperties.RESOURCE_NAME_KEY);
        } else if (metadata.get(TikaCoreProperties.EMBEDDED_RELATIONSHIP_ID) != null) {
            objectName = metadata.get(TikaCoreProperties.EMBEDDED_RELATIONSHIP_ID);
        } else if (metadata.get(TikaCoreProperties.VERSION_NUMBER) != null) {
            objectName = "version-number-" + metadata.get(TikaCoreProperties.VERSION_NUMBER);
        } else {
            objectName = "embedded-" + counter.incrementAndGet();
        }
        //make sure that there isn't any path info in the objectName
        //some parsers can return paths, not just file names
        objectName = FilenameUtils.getName(objectName);
        return objectName;
    }
@param stream
@param recursiveParserWrapperHandler -- handler must implement
{@link RecursiveParserWrapperHandler}
@param metadata
@param context
@throws IOException
@throws SAXException
@throws TikaException
@throws IllegalStateException if the handler is not a {@link RecursiveParserWrapperHandler}
tika-core/src/main/java/org/apache/tika/parser/RecursiveParserWrapper.java