struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From craig...@apache.org
Subject cvs commit: jakarta-struts/src/share/org/apache/struts/config ActionConfig.java ApplicationConfig.java DataSourceConfig.java FormBeanConfig.java ForwardConfig.java
Date Wed, 26 Dec 2001 19:16:25 GMT
craigmcc    01/12/26 11:16:25

  Added:       src/share/org/apache/struts/config ActionConfig.java
                        ApplicationConfig.java DataSourceConfig.java
                        FormBeanConfig.java ForwardConfig.java
  Log:
  Initial crack at a set of classes to represent all of the static configuration
  information in a "struts-config.xml" file.  It is based on the ideas espoused
  in Ted Husted's "ContextHelper" class, but is factored in a slightly different
  way.  See the upcoming discussion on STRUTS-DEV about how these classes can be
  used to solve the "multiple controllers in one web application" requirement.
  
  As an extra Christmas present to Struts folks, the updated design will also
  implement the new "role-based actions" feature.
  
  Revision  Changes    Path
  1.1                  jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java
  
  Index: ActionConfig.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ActionConfig.java,v
1.1 2001/12/26 19:16:25 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/26 19:16:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.config;
  
  
  import java.util.ArrayList;
  import javax.servlet.http.HttpServletRequest;
  import org.apache.commons.collections.FastHashMap;
  
  
  /**
   * <p>A JavaBean representing the configuration information of an
   * <code>&lt;action&gt;</code> element from a Struts application
   * configuration file.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/26 19:16:25 $
   * @since Struts 1.1
   */
  
  public class ActionConfig {
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The set of local forward configurations for this action, if any,
       * keyed by the <code>name</code> property.
       */
      protected FastHashMap forwards = new FastHashMap();
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The request-scope or session-scope attribute name under which our
       * form bean is accessed, if it is different from the form bean's
       * specified <code>name</code>.
       */
      protected String attribute = null;
  
      public String getAttribute() {
          return (this.attribute);
      }
  
      public void setAttribute(String attribute) {
          this.attribute = attribute;
      }
  
  
      /**
       * Context-relative path of the web application resource that will process
       * this request via RequestDispatcher.forward(), instead of instantiating
       * and calling the <code>Action</code> class specified by "type".
       * Exactly one of <code>forward</code>, <code>include</code>,
or
       * <code>type</code> must be specified.
       */
      protected String forward = null;
  
      public String getForward() {
          return (this.forward);
      }
  
      public void setForward(String forward) {
          this.forward = forward;
      }
  
  
      /**
       * Context-relative path of the web application resource that will process
       * this request via RequestDispatcher.include(), instead of instantiating
       * and calling the <code>Action</code> class specified by "type".
       * Exactly one of <code>forward</code>, <code>include</code>,
or
       * <code>type</code> must be specified.
       */
      protected String include = null;
  
      public String getInclude() {
          return (this.include);
      }
  
      public void setInclude(String include) {
          this.include = include;
      }
  
  
      /**
       * Context-relative path of the input form to which control should be
       * returned if a validation error is encountered.  Required if "name"
       * is specified and the input bean returns validation errors.
       */
      protected String input = null;
  
      public String getInput() {
          return (this.input);
      }
  
      public void setInput(String input) {
          this.input = input;
      }
  
  
      /**
       * Fully qualified Java class name of the
       * <code>MultipartRequestHandler</code> implementation class used to
       * process multi-part request data for this Action.
       */
      protected String multipartClass = null;
  
      public String getMultipartClass() {
          return (this.multipartClass);
      }
  
      public void setMultipartClass(String multipartClass) {
          this.multipartClass = multipartClass;
      }
  
  
      /**
       * Name of the form bean, if any, associated with this Action.
       */
      protected String name = null;
  
      public String getName() {
          return (this.name);
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
  
      /**
       * Context-relative path of the submitted request, starting with a
       * slash ("/") character, and omitting any filename extension if
       * extension mapping is being used.
       */
      protected String path = null;
  
      public String getPath() {
          return (this.path);
      }
  
      public void setPath(String path) {
          this.path = path;
      }
  
  
      /**
       * General purpose configuration parameter that can be used to pass
       * extra iunformation to the Action instance selected by this Action.
       * Struts does not itself use this value in any way.
       */
      protected String parameter = null;
  
      public String getParameter() {
          return (this.parameter);
      }
  
      public void setParameter(String parameter) {
          this.parameter = parameter;
      }
  
  
      /**
       * Prefix used to match request parameter names to form ben property
       * names, if any.
       */
      protected String prefix = null;
  
      public String getPrefix() {
          return (this.prefix);
      }
  
      public void setPrefix(String prefix) {
          this.prefix = prefix;
      }
  
  
      /**
       * Comma-delimited list of security role names allowed to request
       * this Action.
       */
      protected String roles = null;
  
      public String getRoles() {
          return (this.roles);
      }
  
      public void setRoles(String roles) {
          this.roles = roles;
          if (roles == null) {
              roleNames = new String[0];
              return;
          }
          ArrayList list = new ArrayList();
          while (true) {
              int comma = roles.indexOf(',');
              if (comma < 0)
                  break;
              list.add(roles.substring(1, comma).trim());
              roles = roles.substring(comma + 1);
          }
          roles = roles.trim();
          if (roles.length() > 0)
              list.add(roles);
          roleNames = (String[]) list.toArray(new String[list.size()]);
      }
  
  
      /**
       * The set of security role names used to authorize access to this
       * Action, as an array for faster access.
       */
      protected String[] roleNames = new String[0];
  
      public String[] getRoleNames() {
          return (this.roleNames);
      }
  
  
      /**
       * Identifier of the scope ("request" or "session") within which
       * our form bean is accessed, if any.
       */
      protected String scope = "session";
  
      public String getScope() {
          return (this.scope);
      }
  
      public void setScope(String scope) {
          this.scope = scope;
      }
  
  
      /**
       * Suffix used to match request parameter names to form bean property
       * names, if any.
       */
      protected String suffix = null;
  
      public String getSuffix() {
          return (this.suffix);
      }
  
      public void setSuffix(String suffix) {
          this.suffix = suffix;
      }
  
  
      /**
       * Fully qualified Java class name of the <code>Action</code> class
       * to be used to process requests for this mapping if the
       * <code>forward</code> and <code>include</code> properties
are not set.
       * Exactly one of <code>forward</code>, <code>include</code>,
or
       * <code>type</code> must be specified.
       */
      protected String type = null;
  
      public String getType() {
          return (this.type);
      }
  
      public void setType(String type) {
          this.type = type;
      }
  
  
      /**
       * Should this Action be configured as the default one for this
       * application?
       */
      protected boolean unknown = false;
  
      public boolean getUnknown() {
          return (this.unknown);
      }
  
      public void setUnknown(boolean unknown) {
          this.unknown = unknown;
      }
  
      /**
       * Should the <code>validate()</code> method of the form bean associated
       * with this action be called?
       */
      protected boolean validate = true;
  
      public boolean getValidate() {
          return (this.validate);
      }
  
      public void setValidate(boolean validate) {
          this.validate = validate;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Add a new <code>ForwardConfig</code> object to the set of global
       * forwards associated with this application.
       *
       * @param config The new configuration object to be added
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void addForwardConfig(ForwardConfig config) {
  
          forwards.put(config.getName(), config);
  
      }
  
  
      /**
       * Return the forward configuration for the specified key, if any;
       * otherwise return <code>null</code>.
       *
       * @param name Name of the forward configuration to return
       */
      public ForwardConfig findForwardConfig(String name) {
  
          return ((ForwardConfig) forwards.get(name));
  
      }
  
  
      /**
       * Return the form bean configurations for this application.  If there
       * are none, a zero-length array is returned.
       */
      public ForwardConfig[] findForwardConfigs() {
  
          ForwardConfig results[] = new ForwardConfig[forwards.size()];
          return ((ForwardConfig[]) forwards.values().toArray(results));
  
      }
  
  
      /**
       * Remove the forward configuration for the specified key.
       *
       * @param config ForwardConfig instance to be removed
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void removeForwardConfig(ForwardConfig config) {
  
          forwards.remove(config.getName());
  
      }
  
  
      /**
       * Return a String representation of this object.
       */
      public String toString() {
  
          StringBuffer sb = new StringBuffer("ActionConfig[");
          sb.append("path=");
          sb.append(path);
          if (attribute != null) {
              sb.append(",attribute=");
              sb.append(attribute);
          }
          if (forward != null) {
              sb.append(",forward=");
              sb.append(forward);
          }
          if (include != null) {
              sb.append(",include=");
              sb.append(include);
          }
          if (input != null) {
              sb.append(",input=");
              sb.append(input);
          }
          if (multipartClass != null) {
              sb.append(",multipartClass=");
              sb.append(multipartClass);
          }
          if (name != null) {
              sb.append(",name=");
              sb.append(name);
          }
          if (parameter != null) {
              sb.append(",parameter=");
              sb.append(parameter);
          }
          if (prefix != null) {
              sb.append(",prefix=");
              sb.append(prefix);
          }
          if (roles != null) {
              sb.append(",roles=");
              sb.append(roles);
          }
          if (scope != null) {
              sb.append(",scope=");
              sb.append(scope);
          }
          if (suffix != null) {
              sb.append(",suffix=");
              sb.append(suffix);
          }
          if (type != null) {
              sb.append(",type=");
              sb.append(type);
          }
          return (sb.toString());
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java
  
  Index: ApplicationConfig.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ApplicationConfig.java,v
1.1 2001/12/26 19:16:25 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/26 19:16:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.config;
  
  
  import org.apache.commons.collections.FastHashMap;
  import org.apache.struts.action.ActionServlet;
   
  
  
  /**
   * <p>The collection of static configuration information that describes a
   * Struts-based application or sub-application.  Multiple sub-applications
   * are identified by a <em>prefix</em> at the beginning of the context
   * relative portion of the request URI.  If no application prefix can be
   * matched, the default configuration (with a prefix equal to a zero-length
   * string) is selected, which is elegantly backwards compatible with the
   * previous Struts behavior that only supported one application.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/26 19:16:25 $
   * @since Struts 1.1
   */
  
  public class ApplicationConfig {
  
  
      // ----------------------------------------------------------- Constructors
  
  
      /**
       * Construct an ApplicationConfig object according to the specified
       * parameter values.
       *
       * @param prefix Context-relative URI prefix for this application
       * @param servlet ActionServlet that is managing this application
       */
      public ApplicationConfig(String prefix, ActionServlet servlet) {
  
          super();
          this.prefix = prefix;
          this.servlet = servlet;
  
      }
  
  
      // ----------------------------------------------------- Instance Variables
  
  
      /**
       * The set of action configurations for this application, if any,
       * keyed by the <code>path</code> property.
       */
      protected FastHashMap actions = new FastHashMap();
  
  
      /**
       * The set of JDBC data source configurations for this
       * application, if any, keyed by the <code>key</code> property.
       */
      protected FastHashMap dataSources = new FastHashMap();
  
  
      /**
       * The set of form bean configurations for this application, if any,
       * keyed by the <code>name</code> property.
       */
      protected FastHashMap formBeans = new FastHashMap();
  
  
      /**
       * The set of global forward configurations for this application, if any,
       * keyed by the <code>name</code> property.
       */
      protected FastHashMap forwards = new FastHashMap();
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * Has this application been completely configured yet?  Once this flag
       * has been set, any attempt to modify the configuration will return an
       * IllegalStateException.
       */
      protected boolean configured = false;
  
      public boolean getConfigured() {
          return (this.configured);
      }
  
  
      /**
       * The prefix of the context-relative portion of the request URI, used to
       * select this configuration versus others supported by the controller
       * servlet.  A configuration with a prefix of a zero-length String is the
       * default configuration for this web application.
       */
      protected String prefix = null;
  
      public String getPrefix() {
          return (this.prefix);
      }
  
  
      /**
       * The <code>ActionServlet</code> instance that is managing this
       * application.
       */
      protected ActionServlet servlet = null;
  
      public ActionServlet getServlet() {
          return (this.servlet);
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Add a new <code>ActionConfig</code> object to the set associated
       * with this application.
       *
       * @param config The new configuration object to be added
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void addActionConfig(ActionConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          actions.put(config.getPath(), config);
  
      }
  
  
      /**
       * Add a new <code>DataSourceConfig</code> object to the set associated
       * with this application.
       *
       * @param config The new configuration object to be added
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void addDataSourceConfig(DataSourceConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          dataSources.put(config.getKey(), config);
  
      }
  
  
      /**
       * Add a new <code>FormBeanConfig</code> object to the set associated
       * with this application.
       *
       * @param config The new configuration object to be added
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void addFormBeanConfig(FormBeanConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          formBeans.put(config.getName(), config);
  
      }
  
  
      /**
       * Add a new <code>ForwardConfig</code> object to the set of global
       * forwards associated with this application.
       *
       * @param config The new configuration object to be added
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void addForwardConfig(ForwardConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          forwards.put(config.getName(), config);
  
      }
  
  
      /**
       * Return the action configuration for the specified path, if any;
       * otherwise return <code>null</code>.
       *
       * @param path Path of the action configuration to return
       */
      public ActionConfig findActionConfig(String path) {
  
          return ((ActionConfig) actions.get(path));
  
      }
  
  
      /**
       * Return the action configurations for this application.  If there are
       * none, a zero-length array is returned.
       */
      public ActionConfig[] findActionConfigs() {
  
          ActionConfig results[] = new ActionConfig[actions.size()];
          return ((ActionConfig[]) actions.values().toArray(results));
  
      }
  
  
      /**
       * Return the data source configuration for the specified key, if any;
       * otherwise return <code>null</code>.
       *
       * @param key Key of the data source configuration to return
       */
      public DataSourceConfig findDataSourceConfig(String key) {
  
          return ((DataSourceConfig) dataSources.get(key));
  
      }
  
  
      /**
       * Return the data source configurations for this application.  If there
       * are none, a zero-length array is returned.
       */
      public DataSourceConfig[] findDataSourceConfigs() {
  
          DataSourceConfig results[] = new DataSourceConfig[dataSources.size()];
          return ((DataSourceConfig[]) dataSources.values().toArray(results));
  
      }
  
  
      /**
       * Return the form bean configuration for the specified key, if any;
       * otherwise return <code>null</code>.
       *
       * @param name Name of the form bean configuration to return
       */
      public FormBeanConfig findFormBeanConfig(String name) {
  
          return ((FormBeanConfig) formBeans.get(name));
  
      }
  
  
      /**
       * Return the form bean configurations for this application.  If there
       * are none, a zero-length array is returned.
       */
      public FormBeanConfig[] findFormBeanConfigs() {
  
          FormBeanConfig results[] = new FormBeanConfig[formBeans.size()];
          return ((FormBeanConfig[]) formBeans.values().toArray(results));
  
      }
  
  
      /**
       * Return the forward configuration for the specified key, if any;
       * otherwise return <code>null</code>.
       *
       * @param name Name of the forward configuration to return
       */
      public ForwardConfig findForwardConfig(String name) {
  
          return ((ForwardConfig) forwards.get(name));
  
      }
  
  
      /**
       * Return the form bean configurations for this application.  If there
       * are none, a zero-length array is returned.
       */
      public ForwardConfig[] findForwardConfigs() {
  
          ForwardConfig results[] = new ForwardConfig[forwards.size()];
          return ((ForwardConfig[]) forwards.values().toArray(results));
  
      }
  
  
      /**
       * Freeze the configuration of this application.  After this method
       * returns, any attempt to modify the configuration will return
       * an IllegalStateException.
       */
      public void freeze() {
  
          this.configured = true;
  
      }
  
  
      /**
       * Remove the data source configuration for the specified key.
       *
       * @param config DataSourceConfig instance to be removed
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void removeDataSourceConfig(DataSourceConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          dataSources.remove(config.getKey());
  
      }
  
  
      /**
       * Remove the form bean configuration for the specified key.
       *
       * @param config FormBeanConfig instance to be removed
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void removeFormBeanConfig(FormBeanConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          formBeans.remove(config.getName());
  
      }
  
  
      /**
       * Remove the forward configuration for the specified key.
       *
       * @param config ForwardConfig instance to be removed
       *
       * @exception IllegalStateException if this application configuration
       *  has been frozen
       */
      public void removeForwardConfig(ForwardConfig config) {
  
          if (configured)
              throw new IllegalStateException("Configuration is frozen");
          forwards.remove(config.getName());
  
      }
  
  
      // -------------------------------------------------------- Package Methods
  
  
      // ------------------------------------------------------ Protected Methods
  
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java
  
  Index: DataSourceConfig.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/DataSourceConfig.java,v
1.1 2001/12/26 19:16:25 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/26 19:16:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.config;
  
  
  import org.apache.struts.action.Action;
  
  
  /**
   * <p>A JavaBean representing the configuration information of a
   * <code>&lt;data-source&gt;</code> element from a Struts application
   * configuration file.</p>
   *
   * <p><strong>WARNING</strong> - The properties of this configuration
bean
   * are recognized by the default data source implementation, but some or all
   * of them may be ignored by custom data source implementations.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/26 19:16:25 $
   * @since Struts 1.1
   */
  
  public class DataSourceConfig {
  
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The default auto-commit state for newly created connections.
       */
      protected boolean autoCommit = true;
  
      public boolean getAutoCommit() {
          return (this.autoCommit);
      }
  
      public void setAutoCommit(boolean autoCommit) {
          this.autoCommit = autoCommit;
      }
  
  
      /**
       * The description of this data source.
       */
      protected String description = null;
  
      public String getDescription() {
          return (this.description);
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
  
      /**
       * The fully qualified Java class name of the JDBC driver to be used.
       */
      protected String driverClass = null;
  
      public String getDriverClass() {
          return (this.driverClass);
      }
  
      public void setDriverClass(String driverClass) {
          this.driverClass = driverClass;
      }
  
  
      /**
       * The servlet context attribute key under which this data source
       * is stored and made available.
       */
      protected String key = Action.DATA_SOURCE_KEY;
  
      public String getKey() {
          return (this.key);
      }
  
      public void setKey(String key) {
          this.key = key;
      }
  
  
      /**
       * The maximum number of seconds to wait for a connection to be created
       * or returned, or zero for no timeout.
       */
      protected int loginTimeout = 0;
  
      public int getLoginTimeout() {
          return (this.loginTimeout);
      }
  
      public void setLoginTimeout(int loginTimeout) {
          this.loginTimeout = loginTimeout;
      }
  
  
      /**
       * The maximum number of connections to be created, or zero for no limit.
       */
      protected int maxCount = 0;
  
      public int getMaxCount() {
          return (this.maxCount);
      }
  
      public void setMaxCount(int maxCount) {
          this.maxCount = maxCount;
      }
  
  
      /**
       * The minimum number of connections to be created, or zero for no limit.
       */
      protected int minCount = 0;
  
      public int getMinCount() {
          return (this.minCount);
      }
  
      public void setMinCount(int minCount) {
          this.minCount = minCount;
      }
  
  
      /**
       * The database password to use when connecting.
       */
      protected String password = null;
  
      public String getPassword() {
          return (this.password);
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
  
      /**
       * The default read-only state for newly created connections.
       */
      protected boolean readOnly = false;
  
      public boolean getReadOnly() {
          return (this.readOnly);
      }
  
      public void setReadOnly(boolean readOnly) {
          this.readOnly = readOnly;
      }
  
  
      /**
       * The JDBC URL of the database to connect to.
       */
      protected String url = null;
  
      public String getUrl() {
          return (this.url);
      }
  
      public void setUrl(String url) {
          this.url = url;
      }
  
  
      /**
       * The database username to use when connecting.
       */
      protected String user = null;
  
      public String getUser() {
          return (this.user);
      }
  
      public void setUser(String user) {
          this.user = user;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
      /**
       * Return a String representation of this object.
       */
      public String toString() {
  
          StringBuffer sb = new StringBuffer("DataSourceConfig[");
          sb.append("autoCommit=");
          sb.append(this.autoCommit);
          if (this.description != null) {
              sb.append(",description=");
              sb.append(this.description);
          }
          sb.append(",driverClass=");
          sb.append(this.driverClass);
          if (this.loginTimeout != 0) {
              sb.append(",loginTimeout=");
              sb.append(this.loginTimeout);
          }
          if (this.maxCount != 0) {
              sb.append(",maxCount=");
              sb.append(this.maxCount);
          }
          if (this.minCount != 0) {
              sb.append(",minCount=");
              sb.append(this.minCount);
          }
          sb.append("password=");
          sb.append(this.password);
          sb.append(",readOnly=");
          sb.append(this.readOnly);
          sb.append(",url=");
          sb.append(this.url);
          sb.append(",user=");
          sb.append(this.user);
          sb.append("]");
          return (sb.toString());
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java
  
  Index: FormBeanConfig.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/FormBeanConfig.java,v
1.1 2001/12/26 19:16:25 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/26 19:16:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.config;
  
  
  import java.io.Serializable;
  
  
  /**
   * <p>A JavaBean representing the configuration information of a
   * <code>&lt;form-bean&gt;</code> element in a Struts application
   * configuration file.<p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/26 19:16:25 $
   * @since Struts 1.1
   */
  
  public class FormBeanConfig {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The unique identifier of this form bean, which is used to reference this
       * bean in <code>ActionMapping</code> instances as well as for the name
of
       * the request or session attribute under which the corresponding form bean
       * instance is created or accessed.
       */
      protected String name = null;
  
      public String getName() {
          return (this.name);
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
  
      /**
       * The fully qualified Java class name of the implementation class
       * to be used or generated.
       */
      protected String type = null;
  
      public String getType() {
          return (this.type);
      }
  
      public void setType(String type) {
          this.type = type;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return a String representation of this object.
       */
      public String toString() {
  
          StringBuffer sb = new StringBuffer("FormBeanConfig[");
          sb.append("name=");
          sb.append(this.name);
          sb.append(",type=");
          sb.append(this.type);
          sb.append("]");
          return (sb.toString());
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java
  
  Index: ForwardConfig.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ForwardConfig.java,v
1.1 2001/12/26 19:16:25 craigmcc Exp $
   * $Revision: 1.1 $
   * $Date: 2001/12/26 19:16:25 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2002 The Apache Software Foundation.  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 the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowlegement may appear in the software itself,
   *    if and wherever such third-party acknowlegements normally appear.
   *
   * 4. The names "The Jakarta Project", "Struts", and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache"
   *    nor may "Apache" appear in their names without prior written
   *    permission of the Apache Group.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   */
  
  
  package org.apache.struts.config;
  
  
  /**
   * <p>A JavaBean representing the configuration information of a
   * <code>&lt;forward&gt;</code> element from a Struts application
   * configuration file.</p>
   *
   * @author Craig R. McClanahan
   * @version $Revision: 1.1 $ $Date: 2001/12/26 19:16:25 $
   * @since Struts 1.1
   */
  
  public class ForwardConfig {
  
  
      // ------------------------------------------------------------- Properties
  
  
      /**
       * The unique identifier of this forward, which is used to reference it
       * in <code>Action</code> classes.
       */
      protected String name = null;
  
      public String getName() {
          return (this.name);
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
  
      /**
       * The context-relative path (starting with a "/") of the resource that
       * is mapped by this forward.
       */
      protected String path = null;
  
      public String getPath() {
          return (this.path);
      }
  
      public void setPath(String path) {
          this.path = path;
      }
  
  
      /**
       * Should a redirect be used to transfer control to the specified path?
       */
      protected boolean redirect = false;
  
      public boolean getRedirect() {
          return (this.redirect);
      }
  
      public void setRedirect(boolean redirect) {
          this.redirect = redirect;
      }
  
  
      // --------------------------------------------------------- Public Methods
  
  
      /**
       * Return a String representation of this object.
       */
      public String toString() {
  
          StringBuffer sb = new StringBuffer("ForwardConfig[");
          sb.append("name=");
          sb.append(this.name);
          sb.append(",path=");
          sb.append(this.path);
          sb.append(",redirect=");
          sb.append(this.redirect);
          sb.append("]");
          return (sb.toString());
  
      }
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:struts-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-dev-help@jakarta.apache.org>


Mime
View raw message