View Javadoc

1   /* This file is part of the project "Hilbert II" - http://www.qedeq.org" target="alexandria_uri">http://www.qedeq.org
2    *
3    * Copyright 2000-2014,  Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU General Public License for more details.
14   */
15  
16  package org.qedeq.kernel.se.common;
17  
18  import java.io.IOException;
19  
20  import org.qedeq.kernel.se.base.module.Specification;
21  
22  /**
23   * An address for a QEDEQ module.
24   *
25   * @author  Michael Meyling
26   */
27  public interface ModuleAddress {
28  
29      /**
30       * Get module address as {@link ModuleContext}. Creates a new object.
31       *
32       * @return  Module address as {@link ModuleContext}.
33       */
34      public ModuleContext createModuleContext();
35  
36      /**
37       * Get address header (including protocol, host, port, user)
38       * but without file path.
39       *
40       * @return address header
41       */
42      public String getHeader();
43  
44      /**
45       * Get address path (without protocol, host, port and file name).
46       *
47       * @return module path
48       */
49      public String getPath();
50  
51      /**
52       * Get module file name.
53       *
54       * @return  Module file name.
55       */
56      public String getFileName();
57  
58      /**
59       * Get name of module (file name without <code>.xml</code>).
60       *
61       * @return  Module name.
62       */
63      public String getName();
64  
65      /**
66       * Get fully qualified URL of module.
67       *
68       * @return  URL for QEDEQ module.
69       */
70      public String getUrl();
71  
72      /**
73       * Was this module address created relatively?
74       *
75       * @return  Relatively created?
76       */
77      public boolean isRelativeAddress();
78  
79      /**
80       * Is this a local QEDEQ file. That means the address starts with <code>file:</code>.
81       *
82       * @return  Is the QEDEQ module a local file?
83       */
84      public boolean isFileAddress();
85  
86  
87      /**
88       * Get all potential module addresses from a module specification.
89       *
90       * TODO mime 20070326: add context information (for error case)
91       *
92       * @param   spec    Here are the (perhaps relative) addresses to
93       *                  another module.
94       * @return  Array of absolute address strings.
95       * @throws  IOException One address is not correctly formed.
96       */
97      public ModuleAddress[] getModulePaths(final Specification spec) throws IOException;
98  
99  }