com.silverwrist.dynamo.RequestType.java Source code

Java tutorial

Introduction

Here is the source code for com.silverwrist.dynamo.RequestType.java

Source

/*
 * 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) 2002-03 Eric J. Bowersox/Silverwrist Design Studios.  All Rights Reserved.
 * 
 * Contributor(s): 
 */
package com.silverwrist.dynamo;

import java.util.*;
import org.apache.commons.lang.enum.*;

/**
 * A type-safe enumerated type that indicates the type of a {@link com.silverwrist.dynamo.iface.Request Request}
 * that comes in from the framework.  It is also used to indicate the type of a
 * {@link com.silverwrist.dynamo.iface.SessionInfo SessionInfo} object.
 *
 * @author Eric J. Bowersox &lt;erbo@silcom.com&gt;
 * @version X
 */
public final class RequestType extends Enum
{
  /*--------------------------------------------------------------------------------
   * The actual enumeration values
   *--------------------------------------------------------------------------------
   */

  /**
   * A "null" request type, only used to label certain sessions.
   *
   * @see com.silverwrist.dynamo.util.NullSessionInfo
   */
  public static final RequestType _NULL        = new RequestType("_NULL");

  /**
   * This <CODE>RequestType</CODE> is used to label the {@link com.silverwrist.dynamo.iface.Request Request} passed
   * along with the event that is fired when the application starts up.
   *
   * @see com.silverwrist.dynamo.event.ApplicationEvent
   */
  public static final RequestType _APPLICATION = new RequestType("_APPLICATION");

  /**
   * This <CODE>RequestType</CODE> is used to label the {@link com.silverwrist.dynamo.iface.Request Request} passed
   * along with the event that is fired when a new session is created.
   *
   * @see com.silverwrist.dynamo.event.SessionInfoEvent
   */
  public static final RequestType _SESSION     = new RequestType("_SESSION");

  /**
   * Designates a {@link com.silverwrist.dynamo.iface.Request Request} or
   * {@link com.silverwrist.dynamo.iface.SessionInfo SessionInfo} associated with standard HTTP requests.
   */
  public static final RequestType HTTP         = new RequestType("HTTP");

  /**
   * Designates a {@link com.silverwrist.dynamo.iface.Request Request} or
   * {@link com.silverwrist.dynamo.iface.SessionInfo SessionInfo} associated with XML-RPC requests, usually
   * transmitted over HTTP.
   */
  public static final RequestType XMLRPC       = new RequestType("XMLRPC");

  /*--------------------------------------------------------------------------------
   * Constructor
   *--------------------------------------------------------------------------------
   */

  /**
   * Internal constructor which creates a new element of this enumerated type.
   *
   * @param name The name of the <CODE>RequestType</CODE> to be created.
   */
  private RequestType(String name)
  {
    super(name);

  } // end constructor

  /*--------------------------------------------------------------------------------
   * Standard static method implementations
   *--------------------------------------------------------------------------------
   */

  /**
   * Gets a <CODE>RequestType</CODE> by name.
   *
   * @param name The name of the <CODE>RequestType</CODE> to get; may be <CODE>null</CODE>.
   * @return The <CODE>RequestType</CODE> object, or <CODE>null</CODE> if the <CODE>RequestType</CODE> does not exist.
   */
  public static RequestType getEnum(String name)
  {
    return (RequestType)getEnum(RequestType.class,name);

  } // end getEnum

  /**
   * Gets the <CODE>Map</CODE> of <CODE>RequestType</CODE> objects by name.
   *
   * @return The <CODE>RequestType</CODE> object <CODE>Map</CODE>.
   */
  public static Map getEnumMap()
  {
    return getEnumMap(RequestType.class);

  } // end getEnumMap

  /**
   * Gets the <CODE>List</CODE> of <CODE>RequestType</CODE> objects, in the order in which the objects are listed
   * in the code above.
   *
   * @return The <CODE>RequestType</CODE> object <CODE>List</CODE>.
   */
  public static List getEnumList()
  {
    return getEnumList(RequestType.class);

  } // end getEnumList

  /**
   * Gets an iterator over all <CODE>RequestType</CODE> objects, in the order in which the objects are listed
   * in the code above.
   *
   * @return The <CODE>RequestType</CODE> object iterator.
   */
  public static Iterator iterator()
  {
    return iterator(RequestType.class);

  } // end iterator

} // end class RequestType