SourceForge: xtf/xtf: WEB-INF/src/org/cdlib/xtf/dynaXML/DocLocator.java@549e4167039e
WEB-INF/src/org/cdlib/xtf/dynaXML/DocLocator.java
author mhaye
Wed Aug 24 04:55:32 2005 +0000 (2005-08-24)
changeset 564 549e4167039e
parent 408 86a7cfcfb551
child 1270 da0d89d208e2
permissions -rw-r--r--
Changed static variables in the servlets to instance. This allows multiple servlets to run with separate configurations under the same servlet container.
     1 package org.cdlib.xtf.dynaXML;
     2 
     3 import java.io.IOException;
     4 
     5 import javax.xml.transform.Templates;
     6 
     7 import org.cdlib.xtf.servletBase.TextServlet;
     8 import org.cdlib.xtf.util.StructuredStore;
     9 import org.xml.sax.InputSource;
    10 
    11 /*
    12  * Copyright (c) 2004, Regents of the University of California
    13  * All rights reserved.
    14  * 
    15  * Redistribution and use in source and binary forms, with or without 
    16  * modification, are permitted provided that the following conditions are met:
    17  *
    18  * - Redistributions of source code must retain the above copyright notice, 
    19  *   this list of conditions and the following disclaimer.
    20  * - Redistributions in binary form must reproduce the above copyright notice, 
    21  *   this list of conditions and the following disclaimer in the documentation 
    22  *   and/or other materials provided with the distribution.
    23  * - Neither the name of the University of California nor the names of its
    24  *   contributors may be used to endorse or promote products derived from this 
    25  *   software without specific prior written permission.
    26  *
    27  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
    28  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
    29  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
    30  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
    31  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
    32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
    33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
    34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
    35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
    36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
    37  * POSSIBILITY OF SUCH DAMAGE.
    38  */
    39 
    40 /*
    41  * This file created on Mar 11, 2005 by Martin Haye
    42  */
    43 
    44 /**
    45  * Iterface that locates lazy or normal data streams for dynaXML document
    46  * requests. The default implementation, {@link DefaultDocLocator}, implements
    47  * local file access, but other implementations can be imagined that
    48  * read/write files over the network.
    49  * 
    50  * @author Martin Haye
    51  */
    52 public interface DocLocator 
    53 {
    54     /** 
    55      * Attach this locator to a specific servlet, which can be used to
    56      * provide, among other thigns, path mapping services.
    57      * 
    58      * @param servlet   Servlet to attach to
    59      */
    60     void setServlet( TextServlet servlet );
    61     
    62     /**
    63      * Search for a StructuredStore containing the "lazy" or persistent
    64      * representation of a given document. Index parameters are specified,
    65      * since often the lazy file is stored along with the index. This method
    66      * is called first, and if it returns null, then 
    67      * {@link #getInputSource(String, boolean)} will be called as a fall-back.
    68      * 
    69      * @param sourcePath      Path to the source document
    70      * @param indexConfigPath Path to the index configuration file
    71      * @param indexName       Name of the index being searched
    72      * @param preFilter       Stylesheet to filter the document with
    73      * @param removeDoctypeDecl Set to true to remove DOCTYPE declaration from
    74      *                          the XML document.
    75      * 
    76      * @return                Store containing the tree, or null if none
    77      *                        could be found.
    78      */
    79     StructuredStore getLazyStore( String indexConfigPath,
    80                                   String indexName,
    81                                   String sourcePath,
    82                                   Templates preFilter,
    83                                   boolean removeDoctypeDecl ) 
    84         throws IOException;
    85     
    86 
    87     /**
    88      * Retrieve the data stream for an XML source document. 
    89      * 
    90      * @param sourcePath  Path to the source document
    91      * @param removeDoctypeDecl Set to true to remove DOCTYPE declaration from
    92      *                          the XML document.
    93      * 
    94      * @return            Data stream for the document.
    95      */
    96     InputSource getInputSource( String sourcePath,
    97                                 boolean removeDoctypeDecl ) 
    98         throws IOException;
    99 
   100 } // interface DocLocator