001 /*
002 * IOHandler.java
003 * Copyright (c) 1998-2008, The University of Sheffield.
004 *
005 * This code is from the GATE project (http://gate.ac.uk/) and is free
006 * software licenced under the GNU General Public License version 3. It is
007 * distributed without any warranty. For more details see COPYING.txt in the
008 * top level directory (or at http://gatewiki.sf.net/COPYING.txt).
009 *
010 * Hamish Cunningham, 23rd May 2006
011 */
012
013 package gate.yam;
014
015 import java.io.*;
016 import java.net.*;
017 import org.springframework.core.io.*;
018 import org.springframework.context.support.*;
019
020 /**
021 * This interface is used by the YAM parser to initialise IO streams. It is
022 * provided in order to allow API users to supply IO management if needed.
023 * @author Hamish Cunningham
024 */
025 public interface IOHandler
026 {
027 /** Get a reader from a path. */
028 public Reader getReader(String path) throws IOException;
029
030 /** Check a path for existence. Relative paths adjusted with sourceDir. */
031 public boolean exists(String path);
032
033 /** Get a reader from a path relative to the context path. */
034 public Reader getReaderInContext(String path) throws IOException;
035
036 /** Check a path for existence relative to the context path. */
037 public boolean existsInContext(String path);
038
039 /** Set the source directory file. */
040 public void setSourceDir(File sourceDir);
041
042 /**
043 * Get the path in which to check for existence of relative links.
044 */
045 public String getContextPath();
046
047 /**
048 * Set the path in which to check for existence of relative links.
049 * @param contextPath the path to search in.
050 */
051 public void setContextPath(String contextPath);
052
053 /**
054 * Get the URL which non-existent links will be pointed at (which presumably
055 * is the "create new page" URL for the parent wiki).
056 */
057 public String getCreatePageUrl();
058
059 /**
060 * Set the URL which non-existent links will be pointed at (which presumably
061 * is the "create new page" URL for the parent wiki).
062 * @param createPageUrl the link to point to.
063 */
064 public void setCreatePageUrl(String createPageUrl);
065
066 /**
067 * Set the URL which non-existent links will be pointed at (which presumably
068 * is the "create new page" URL for the parent wiki).
069 * @param createPageUrl the link to point to.
070 */
071 public void setCreatePageUrl(UrlResource createPageUrl);
072
073 /**
074 * Get the URL within which citation keys will be resolved.
075 * @see #setBibPageUrl(UrlResource)
076 */
077 public UrlResource getBibPageUrl();
078
079 /**
080 * Set the URL within which citation keys will be resolved. The URL will be
081 * for a bibliography. Citation keys reference a part of this URL, an
082 * individual bibliographic entry. Citation keys will form the final fragment
083 * of this URL, and will be prefixed, as defined by the
084 * {@link #setBibAnchorPrefix(String) setBibAnchorPrefix} method
085 * @param bibPageUrl the URL of the bibliogrpahy.
086 */
087 public void setBibPageUrl(UrlResource bibPageUrl);
088
089 /**
090 * Set the prefix added to citation keys, when forming a reference to a
091 * bibiography file entry
092 * @see #setBibPageUrl(UrlResource)
093 * @param bibAnchorPrefix The prefix added to citation keys.
094 */
095 public void setBibAnchorPrefix(String bibAnchorPrefix);
096
097 /**
098 * Get the prefix added to citation keys, when forming a reference to a
099 * bibiography file entry
100 * @see #setBibPageUrl(UrlResource)
101 */
102 public String getBibAnchorPrefix();
103
104 } // IOHandler
|