KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > content > metadata > MetadataExtracter


1 /*
2  * Copyright (C) 2005 Jesper Steen Møller
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.content.metadata;
18
19 import java.io.Serializable JavaDoc;
20 import java.util.Map JavaDoc;
21
22 import org.alfresco.service.cmr.repository.ContentIOException;
23 import org.alfresco.service.cmr.repository.ContentReader;
24 import org.alfresco.service.namespace.QName;
25
26 /**
27  *
28  * @author Jesper Steen Møller
29  */

30 public interface MetadataExtracter
31 {
32     /**
33      * Provides the approximate accuracy with which this extracter can extract
34      * metadata for the mimetype.
35      * <p>
36      *
37      * @param sourceMimetype the source mimetype
38      * @return Returns a score 0.0 to 1.0. 0.0 indicates that the extraction
39      * cannot be performed at all. 1.0 indicates that the extraction can
40      * be performed perfectly.
41      */

42     public double getReliability(String JavaDoc sourceMimetype);
43
44     /**
45      * Provides an estimate, usually a worst case guess, of how long an
46      * extraction will take.
47      * <p>
48      * This method is used to determine, up front, which of a set of equally
49      * reliant transformers will be used for a specific extraction.
50      *
51      * @return Returns the approximate number of milliseconds per transformation
52      */

53     public long getExtractionTime();
54
55     /**
56      * Extracts the metadata from the content provided by the reader and source
57      * mimetype to the supplied map.
58      * <p>
59      * The extraction viability can be determined by an up front call to
60      * {@link #getReliability(String)}.
61      * <p>
62      * The source mimetype <b>must</b> be available on the
63      * {@link org.alfresco.service.cmr.repository.ContentAccessor#getMimetype()} method
64      * of the reader.
65      *
66      * @param reader the source of the content
67      * @param destination the destination of the extraction
68      * @throws ContentIOException if an IO exception occurs
69      */

70     public void extract(ContentReader reader, Map JavaDoc<QName, Serializable JavaDoc> destination) throws ContentIOException;
71
72 }
73
Popular Tags