1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18 package org.apache.any23.extractor;
19
20 import java.util.List;
21
22 /**
23 * An interface to the enable a registry for extractors to be implemented by
24 * different implementors of this API.
25 *
26 * @author Peter Ansell p_ansell@yahoo.com
27 */
28 public interface ExtractorRegistry {
29
30 /**
31 * Registers an {@link ExtractorFactory}.
32 *
33 * @param factory
34 * @throws IllegalArgumentException
35 * if trying to register a {@link ExtractorFactory} that already
36 * exists in the registry.
37 */
38 void register(ExtractorFactory<?> factory);
39
40 /**
41 *
42 * Retrieves a {@link ExtractorFactory} given its name
43 *
44 * @param name
45 * The name of the desired factory
46 * @return The {@link ExtractorFactory} associated to the provided name
47 * @throws IllegalArgumentException
48 * If there is not an {@link ExtractorFactory} associated to the
49 * provided name.
50 */
51 ExtractorFactory<?> getFactory(String name);
52
53 /**
54 * @return An {@link ExtractorGroup} with all the registered
55 * {@link Extractor}.
56 */
57 ExtractorGroup getExtractorGroup();
58
59 /**
60 * Returns an {@link ExtractorGroup} containing the {@link ExtractorFactory}
61 * mathing the names provided as input.
62 *
63 * @param names
64 * A {@link java.util.List} containing the names of the desired
65 * {@link ExtractorFactory}.
66 * @return the extraction group.
67 */
68 ExtractorGroup getExtractorGroup(List<String> names);
69
70 /**
71 *
72 * @param name
73 * The name of the {@link ExtractorFactory}
74 * @return <code>true</code> if is there a {@link ExtractorFactory}
75 * associated to the provided name.
76 */
77 boolean isRegisteredName(String name);
78
79 /**
80 * Returns the names of all registered extractors, sorted alphabetically.
81 */
82 List<String> getAllNames();
83
84 }