head	1.5;
access;
symbols;
locks; strict;
comment	@# @;


1.5
date	2001.07.30.17.56.58;	author dlr;	state Exp;
branches;
next	1.4;

1.4
date	2001.07.27.21.33.54;	author susank;	state Exp;
branches;
next	1.3;

1.3
date	2001.06.28.02.19.45;	author elicia;	state Exp;
branches;
next	1.2;

1.2
date	2001.06.13.03.11.23;	author dlr;	state Exp;
branches;
next	1.1;

1.1
date	2001.06.13.02.38.31;	author dlr;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Made web root a hook method.
@
text
@/* ================================================================
 * Copyright (c) 2000-2001 CollabNet.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 * 
 * 1. Redistributions of source code must retain the above copyright
 * notice, this list of conditions and the following disclaimer.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * 
 * 3. The end-user documentation included with the redistribution, if
 * any, must include the following acknowlegement: "This product includes
 * software developed by CollabNet (http://www.collab.net/)."
 * Alternately, this acknowlegement may appear in the software itself, if
 * and wherever such third-party acknowlegements normally appear.
 * 
 * 4. The hosted project names must not be used to endorse or promote
 * products derived from this software without prior written
 * permission. For written permission, please contact info@@collab.net.
 * 
 * 5. Products derived from this software may not use the "Tigris" name
 * nor may "Tigris" appear in their names without prior written
 * permission of CollabNet.
 * 
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL COLLAB.NET OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ====================================================================
 * 
 * This software consists of voluntary contributions made by many
 * individuals on behalf of CollabNet.
 */

package org.tigris.helm.tool;

import java.io.File;

import org.apache.turbine.util.Log;

/**
 * Determines whether or not a hypertext document exists.
 *
 * @@author <a href="mailto:dlr@@collab.net">Daniel Rall</a>
 */
public abstract class ServletHtdoc
{
    private static final boolean DEBUG = false;

    private String documentRoot;

    /**
     * Creates a new instance for the provided document root.
     */
    protected ServletHtdoc(String documentRoot)
    {
        this.documentRoot = documentRoot;
    }

    /**
     * Returns whether the file for the supplied servlet is available.
     */
    public Boolean available(String servletName)
    {
        return (getHtdocFile(servletName).exists() ?
                Boolean.TRUE : Boolean.FALSE);
    }

    /**
     * Returns the template path to the file for the specified servlet.
     *
     * @@param servletName The servlet to get a file path for.
     * @@param             A file path.
     */
    public String getPath(String servletName)
    {
        return (getWebRoot() + File.separatorChar + servletName +
                getServletNamePostfix());
    }

    /**
     * Returns the file name snippet to append to the end of the
     * servlet name that a htdoc may be associated with.
     *
     * @@return Part of a htdoc name.
     */
    protected abstract String getServletNamePostfix();

    /**
     * Returns the path snippet which connects from document root to
     * specific web directory which contains served content.
     */
    protected abstract String getWebRoot();

    /**
     * Returns a {@@link java.io.File} object corresponding to the
     * absolute path to the file associated with the supplied
     * servlet name.
     */
    private final File getHtdocFile(String servletName)
    {
        String fileName = documentRoot + File.separatorChar +
            getPath(servletName);
        if (DEBUG)
        {
            Log.debug("ServletHtdoc: File name for '" + servletName +
                      "' is '" + fileName + '\'');
        }
        return new File(fileName);
    }
}
@


1.4
log
@changing help stickies into included velocity files.  Changed the directory where they live to www/www/includes (from www/www/docs) and their extension to .vm (from .html)
Issue number:
Obtained from:
Submitted by:
Reviewed by:
@
text
@a59 2
    protected String WEBROOT = "www/www/includes";

d89 1
a89 1
        return (WEBROOT + File.separatorChar + servletName +
d100 6
@


1.3
log
@moved the Tasks documents to /htodc/look/www/master, so changed these to point to that directory.
@
text
@d60 1
a60 1
    protected String WEBROOT = "www/www/docs";
@


1.2
log
@Renamed file retrieval method appropriately for this class.
@
text
@d60 1
a60 1
    protected static final String WEBSITE_DOCS = "www/www/docs";
d75 1
a75 1
     * Returns whether help for the supplied servlet is available.
d84 1
a84 1
     * Returns the template path to the help file for the specified servlet.
d86 2
a87 2
     * @@param servletName The servlet to get a help file path for.
     * @@param             A help file path.
d91 1
a91 1
        return (WEBSITE_DOCS + File.separatorChar + servletName +
d105 1
a105 1
     * absolute path to the help file associated with the supplied
@


1.1
log
@Introduced ServletHtdoc abstract base class to remove code duplicated between ServletHelp and ServletTaskBar, leveraging the OO features of the Java language.
@
text
@d79 1
a79 1
        return (getTaskBarFile(servletName).exists() ?
d108 1
a108 1
    private final File getTaskBarFile(String servletName)
@

