View Javadoc
1   /*
2    * Copyright 2012-2021 CodeLibs Project and the Others.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13   * either express or implied. See the License for the specific language
14   * governing permissions and limitations under the License.
15   */
16  package org.codelibs.fess.ingest;
17  
18  import java.util.Map;
19  
20  import org.codelibs.fess.crawler.entity.AccessResult;
21  import org.codelibs.fess.crawler.entity.ResponseData;
22  import org.codelibs.fess.crawler.entity.ResultData;
23  import org.codelibs.fess.util.ComponentUtil;
24  
25  public abstract class Ingester {
26  
27      protected int priority = 99;
28  
29      public int getPriority() {
30          return priority;
31      }
32  
33      public void setPriority(final int priority) {
34          this.priority = priority;
35      }
36  
37      public void register() {
38          ComponentUtil.getIngestFactory().add(this);
39      }
40  
41      // web/file
42      public ResultData process(final ResultData target, final ResponseData responseData) {
43          return target;
44      }
45  
46      // web/file
47      public Map<String, Object> process(final Map<String, Object> target, final AccessResult<String> accessResult) {
48          return process(target);
49      }
50  
51      // datastore
52      public Map<String, Object> process(final Map<String, Object> target, final Map<String, String> params) {
53          return process(target);
54      }
55  
56      protected Map<String, Object> process(final Map<String, Object> target) {
57          return target;
58      }
59  
60  }