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 different implementors of this API.
24 *
25 * @author Peter Ansell p_ansell@yahoo.com
26 */
27 public interface ExtractorRegistry {
28
29 /**
30 * Registers an {@link ExtractorFactory}.
31 *
32 * @param factory
33 * an {@link ExtractorFactory} to register.
34 *
35 * @throws IllegalArgumentException
36 * if trying to register a {@link ExtractorFactory} that already 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 *
47 * @return The {@link ExtractorFactory} associated to the provided name
48 *
49 * @throws IllegalArgumentException
50 * If there is not an {@link ExtractorFactory} associated to the provided name.
51 */
52 ExtractorFactory<?> getFactory(String name);
53
54 /**
55 * @return An {@link ExtractorGroup} with all the registered {@link Extractor}.
56 */
57 ExtractorGroup getExtractorGroup();
58
59 /**
60 * Returns an {@link ExtractorGroup} containing the {@link ExtractorFactory} mathing the names provided as input.
61 *
62 * @param names
63 * A {@link java.util.List} containing the names of the desired {@link ExtractorFactory}.
64 *
65 * @return the extraction group.
66 */
67 ExtractorGroup getExtractorGroup(List<String> names);
68
69 /**
70 *
71 * @param name
72 * The name of the {@link ExtractorFactory}
73 *
74 * @return <code>true</code> if is there a {@link ExtractorFactory} associated to the provided name.
75 */
76 boolean isRegisteredName(String name);
77
78 /**
79 * Returns the names of all registered extractors, sorted alphabetically.
80 *
81 * @return an alphabetically sorted {@link java.util.List}
82 */
83 List<String> getAllNames();
84
85 void unregister(String name);
86
87 }