View Javadoc
1   /*
2   Copyright (c) 2011 James Ahlborn
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, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15  */
16  
17  package com.healthmarketscience.jackcess.util;
18  
19  import java.io.File;
20  import java.io.IOException;
21  
22  import com.healthmarketscience.jackcess.Database;
23  import com.healthmarketscience.jackcess.DatabaseBuilder;
24  
25  /**
26   * Resolver for linked databases.
27   *
28   * @author James Ahlborn
29   * @usage _intermediate_class_
30   */
31  public interface LinkResolver 
32  {
33    /**
34     * default link resolver used if none provided
35     * @usage _general_field_
36     */
37    public static final LinkResolver DEFAULT = new LinkResolver() {
38        public Database resolveLinkedDatabase(Database linkerDb,
39                                              String linkeeFileName)
40          throws IOException
41        {
42          return DatabaseBuilder.open(new File(linkeeFileName));
43        }
44      };
45  
46    /**
47     * Returns the appropriate Database instance for the linkeeFileName from the
48     * given linkerDb.
49     */
50    public Database resolveLinkedDatabase(Database linkerDb, String linkeeFileName)
51      throws IOException;
52  }