commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: jakarta-commons/latka/src/java/org/apache/commons/latka/jelly SuiteTag.java LatkaTagLibrary.java LatkaTag.java
Date Sun, 30 Jun 2002 05:36:19 GMT
dion        2002/06/29 22:36:19

  Added:       latka/src/java/org/apache/commons/latka/jelly SuiteTag.java
                        LatkaTagLibrary.java LatkaTag.java
  Log:
  Infrastructure for Latka tags
  
  Revision  Changes    Path
  1.1                  jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java
  
  Index: SuiteTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/SuiteTag.java,v
1.1 2002/06/30 05:36:19 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/30 05:36:19 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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", "Commons", 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.commons.latka.jelly;
  
  import org.apache.commons.jelly.XMLOutput;
  import org.apache.commons.latka.http.Credentials;
  import org.apache.commons.latka.http.CredentialsImpl;
  import org.apache.commons.latka.http.Proxy;
  
  /**
   * A tag representing a Latka Suite
   * - attributes: host, port, proxyHost, proxyPort, proxyUser, proxyPassword, label, id
   * - holds sessions, requests and messages, proxyCredentials?
   * - what does it do? Execute's the children? Sets them up somehow? Creates credentials
and proxy if needed?
   *
   * @author dion
   * @version $Id: SuiteTag.java,v 1.1 2002/06/30 05:36:19 dion Exp $
   */
  public class SuiteTag extends LatkaTag {
      
      /** default host for requests */
      private String host;
      /** default port for requests */
      private String port;
      /** Proxy details for requests */
      private Proxy proxy = new Proxy();
      
      /**
       * Creates a new instance of SuiteTag
       */
      public SuiteTag() {
      }
      
      /**
       * Perform the tag functionality. In this case, simply evaluate the body
       * after creating credentials, proxy etc from the properties
       */
      public void doTag(XMLOutput xmlOutput) throws Exception {
      }
      
      //--------------------------------------------------------------------------
      // Property accessors/mutators
      //--------------------------------------------------------------------------
    
      /**
       * Tests whether the {@link #getProxy() proxy} is ready for use
       *
       * @return true if the {@link #getProxy() proxy} is configured for use
       */
      public boolean isProxyAvailable() {
          return getProxy() != null && getProxy().getHost() != null 
              && getProxy().getPort() != Proxy.PORT_UNSPECIFIED;
      }
      
      /**
       * Helper method for proxy host property
       *
       * @return the {@link #getProxy() proxy's} host property
       */
      public String getProxyHost() {
          return getProxy().getHost();
      }
      
      /**
       * Helper method for proxy <code>host</code> property
       *
       * @param the {@link #getProxy() proxy's} host property
       */
      public void setProxyHost(String host) {
          getProxy().setHost(host);
      }
      
      /**
       * Helper method for proxy <code>port</code> property
       *
       * @return the {@link #getProxy() proxy's} port property
       */
      public int getProxyPort() {
          return getProxy().getPort();
      }
      
      /**
       * Helper method for proxy <code>port</code> property
       *
       * @param the {@link #getProxy() proxy's} port property
       */
      public void setProxyPort(int port) {
          getProxy().setPort(port);
      }
      
      /**
       * Getter for property host.
       *
       * @return Value of property host.
       */
      public String getHost() {
          return host;
      }
      
      /**
       * Setter for property host.
       *
       * @param host New value of property host.
       */
      public void setHost(String host) {
          this.host = host;
      }
      
      /** Getter for property port.
       * @return Value of property port.
       */
      public String getPort() {
          return port;
      }
      
      /** Setter for property port.
       * @param port New value of property port.
       */
      public void setPort(String port) {
          this.port = port;
      }
      
      /**
       * Getter for property proxy.
       *
       * @return Value of property proxy.
       */
      public Proxy getProxy() {
          return proxy;
      }
      
      /**
       * Setter for property proxy.
       *
       * @param proxy New value of property proxy.
       */
      public void setProxy(Proxy proxy) {
          this.proxy = proxy;
      }
      
  }
  
  
  
  1.1                  jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTagLibrary.java
  
  Index: LatkaTagLibrary.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTagLibrary.java,v
1.1 2002/06/30 05:36:19 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/30 05:36:19 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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", "Commons", 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.commons.latka.jelly;
  
  import org.apache.commons.jelly.TagLibrary;
  
  
  /**
   * The set of jelly tags provided by Latka
   *
   * @author dion
   * @version $Id: LatkaTagLibrary.java,v 1.1 2002/06/30 05:36:19 dion Exp $
   */
  public class LatkaTagLibrary extends TagLibrary {
      
      /** 
       * Creates a new instance of LatkaTagLibrary
       */
      public LatkaTagLibrary() {
          registerTag("suite", SuiteTag.class);
      }
      
  }
  
  
  
  1.1                  jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTag.java
  
  Index: LatkaTag.java
  ===================================================================
  /*
   * $Header: /home/cvs/jakarta-commons/latka/src/java/org/apache/commons/latka/jelly/LatkaTag.java,v
1.1 2002/06/30 05:36:19 dion Exp $
   * $Revision: 1.1 $
   * $Date: 2002/06/30 05:36:19 $
   *
   * ====================================================================
   *
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 1999-2001 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", "Commons", 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.commons.latka.jelly;
  
  import org.apache.commons.jelly.TagSupport;
  import org.apache.commons.jelly.XMLOutput;
  
  /**
   * The base of tags in Latka. Provides the following:
   * <ul>
   *   <li>An id - unique identifier</li>
   *   <li>A label - an optional description</li>
   * </ul>
   *
   * @author dion
   * @version $Id: LatkaTag.java,v 1.1 2002/06/30 05:36:19 dion Exp $
   */
  public abstract class LatkaTag extends TagSupport {
  
      /** unique identifier of the tag */
      private String id;
      /** a descriptive label for the tag */
      private String label;
      
      /**
       * Getter for property id.
       *
       * @return Value of property id.
       */
      public String getId() {
          return id;
      }
      
      /**
       * Setter for property id.
       *
       * @param id New value of property id.
       */
      public void setId(String id) {
          this.id = id;
      }
      
      /**
       * Getter for property label.
       *
       * @return Value of property label.
       */
      public String getLabel() {
          return label;
      }
      
      /**
       * Setter for property label.
       *
       * @param label New value of property label.
       */
      public void setLabel(String label) {
          this.label = label;
      }
      
  }
  
  
  

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


Mime
View raw message