/*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * (the "License"); you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
 * 
 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific
 * language governing rights and limitations under the License.
 * 
 * The Original Code is the Venice Web Communities System.
 * 
 * The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
 * for Silverwrist Design Studios.  Portions created by Eric J. Bowersox are
 * Copyright (C) 2001-02 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.venice.htmlcheck;

import java.util.*;
import com.silverwrist.venice.htmlcheck.impl.HTMLCheckerConfigImpl;

public class HTMLCheckerCreator
{
  /*--------------------------------------------------------------------------------
   * Static data members
   *--------------------------------------------------------------------------------
   */

  private static final Map LABELS;

  /*--------------------------------------------------------------------------------
   * External static operations
   *--------------------------------------------------------------------------------
   */

  public static HTMLCheckerConfig create()
  {
    return HTMLCheckerConfigImpl.createHTMLCheckerConfig();

  } // end create

  public static int convertTagSetLabel(String label)
  {
    if (label==null)
      return -1;
    Integer foo = (Integer)(LABELS.get(label.trim().toLowerCase()));
    return ((foo==null) ? -1 : foo.intValue());

  } // end convertTagSetLabel

  /*--------------------------------------------------------------------------------
   * Static initializer
   *--------------------------------------------------------------------------------
   */

  static
  { // build up the Labels map
    HashMap tmp = new HashMap();

    Integer val = new Integer(HTMLTagSets.INLINE_FORMAT);
    tmp.put("inline",val);
    tmp.put("inline-format",val);

    val = new Integer(HTMLTagSets.ANCHOR);
    tmp.put("anchor",val);
    tmp.put("a",val);

    val = new Integer(HTMLTagSets.BLOCK_FORMAT);
    tmp.put("block",val);
    tmp.put("block-format",val);

    val = new Integer(HTMLTagSets.ACTIVE_CONTENT);
    tmp.put("active",val);
    tmp.put("active-content",val);
    tmp.put("object",val);
    tmp.put("embed",val);
    tmp.put("applet",val);
    tmp.put("script",val);

    val = new Integer(HTMLTagSets.IMAGE_MAPS);
    tmp.put("imagemap",val);
    tmp.put("map",val);

    val = new Integer(HTMLTagSets.DOC_FORMAT);
    tmp.put("doc",val);
    tmp.put("doc-format",val);
    tmp.put("document",val);
    tmp.put("document-format",val);

    val = new Integer(HTMLTagSets.FONT_FORMAT);
    tmp.put("font",val);
    tmp.put("font-format",val);

    val = new Integer(HTMLTagSets.FORMS);
    tmp.put("form",val);
    tmp.put("forms",val);

    val = new Integer(HTMLTagSets.TABLES);
    tmp.put("table",val);
    tmp.put("tables",val);

    val = new Integer(HTMLTagSets.CHANGE_MARKUP);
    tmp.put("change",val);
    tmp.put("change-markup",val);
    tmp.put("delta",val);

    val = new Integer(HTMLTagSets.FRAMES);
    tmp.put("frame",val);
    tmp.put("frames",val);

    val = new Integer(HTMLTagSets.IMAGES);
    tmp.put("image",val);
    tmp.put("images",val);
    tmp.put("img",val);

    val = new Integer(HTMLTagSets.PREFORMAT);
    tmp.put("preformat",val);
    tmp.put("pre",val);

    val = new Integer(HTMLTagSets.NSCP_INLINE_FORMAT);
    tmp.put("inline.nscp",val);
    tmp.put("inline-format.nscp",val);

    val = new Integer(HTMLTagSets.NSCP_LAYERS);
    tmp.put("layer.nscp",val);
    tmp.put("layers.nscp",val);

    val = new Integer(HTMLTagSets.NSCP_FORMS);
    tmp.put("form.nscp",val);
    tmp.put("forms.nscp",val);

    val = new Integer(HTMLTagSets.NSCP_BLOCK_FORMAT);
    tmp.put("block.nscp",val);
    tmp.put("block-format.nscp",val);

    val = new Integer(HTMLTagSets.NSCP_SERVER);
    tmp.put("server.nscp",val);

    val = new Integer(HTMLTagSets.MSFT_DOC_FORMAT);
    tmp.put("doc.msft",val);
    tmp.put("doc-format.msft",val);
    tmp.put("document.msft",val);
    tmp.put("document-format.msft",val);

    val = new Integer(HTMLTagSets.MSFT_INLINE_FORMAT);
    tmp.put("inline.msft",val);
    tmp.put("inline-format.msft",val);

    val = new Integer(HTMLTagSets.MSFT_BLOCK_FORMAT);
    tmp.put("block.msft",val);
    tmp.put("block-format.msft",val);

    val = new Integer(HTMLTagSets.MSFT_ACTIVE_CONTENT);
    tmp.put("active.msft",val);
    tmp.put("active-content.msft",val);

    val = new Integer(HTMLTagSets.SERVER_PAGE);
    tmp.put("server",val);
    tmp.put("asp",val);
    tmp.put("jsp",val);

    val = new Integer(HTMLTagSets.JAVA_SERVER);
    tmp.put("server.java",val);
    tmp.put("jsp.component",val);

    val = new Integer(HTMLTagSets.COMMENT);
    tmp.put("comment",val);

    LABELS = Collections.unmodifiableMap(tmp);

  } // end static initializer

} // end HTMLCheckerCreator
