You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2001/09/23 10:08:05 UTC

cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket BaseStockQuote.java JetspeedStockQuoteService.java SOAPResponseHandler.java StockQuote.java StockQuoteArrayHandler.java StockQuoteHandler.java StockQuoteService.java

taylor      01/09/23 01:08:05

  Added:       src/java/org/apache/jetspeed/webservices/finance/stockmarket
                        BaseStockQuote.java JetspeedStockQuoteService.java
                        SOAPResponseHandler.java StockQuote.java
                        StockQuoteArrayHandler.java StockQuoteHandler.java
                        StockQuoteService.java
  Log:
  stockquoteservice soap/client implementation. this isnt complete, but its a working example of using a web service via soap
  still todo:
    1) portlet customization
    2) wml template
    3) impl. quoteByUser(), storing quotes portfolios on webservice server by user
    4) refactor and make more generic, possibly replace my barebones soap client with something like apache soap
  
  Revision  Changes    Path
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/BaseStockQuote.java
  
  Index: BaseStockQuote.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  /**
      BaseStockQuote implements StockQuote, 
      holding the information for one company's quote.
          
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: BaseStockQuote.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public class BaseStockQuote implements StockQuote
  {
      String price = "";
      String name = "";
      String symbol = "";
      String time = "";
      String date = "";
      String high = "";
      String volume = "";
      String change = "";
      String opening = "";
      String low = "";
  
      public void setPrice(String v) 
      {
          price = v;
      }
  
      public String getPrice() 
      {
          return price;
      }
  
      public void setName(String v) 
      {
          name = v;
      }
  
      public String getName() 
      {
          return name;
      }
  
      public void setSymbol(String v) 
      {
          symbol = v;
      }
  
      public String getSymbol() 
      {
          return symbol;
      }
  
      public void setTime(String v)
      {
          time = v;
      }
  
      public String getTime() 
      {
          return time;
      }
  
      public void setDate(String v) 
      {
          date = v;
      }
  
      public String getDate() 
      {
          return date;
      }
  
      public void setHigh(String v) 
      {
          high = v;
      }
  
      public String getHigh() // subliminal
      {
          return high;
      }
  
      public void setVolume(String v) 
      {
          volume = v;
      }
  
      public String getVolume() 
      {
          return volume;
      }
  
      public void setChange(String v) 
      {
          change = v;
      }
  
      public String getChange() 
      {
          return change;
      }
  
      public void setOpening(String v) 
      {
          opening = v;
      }
  
      public String getOpening() 
      {
          return opening;
      }
  
      public void setLow(String v) 
      {
          low = v;
      }
  
      public String getLow() 
      {
          return low;
      }
  
      public String toString() 
      {
          return toXML();
      }
  
      public String toXML() 
      {
          StringBuffer buffer = new StringBuffer();
          buffer.append("        <Price>");
          buffer.append(price);
          buffer.append("</Price>\n");
          buffer.append("        <Name>");
          buffer.append(name);
          buffer.append("</Name>\n");
          buffer.append("        <Symbol>");
          buffer.append(symbol);
          buffer.append("</Symbol>\n");
          buffer.append("        <Time>");
          buffer.append(time);
          buffer.append("</Time>\n");
          buffer.append("        <Date>");
          buffer.append(date);
          buffer.append("</Date>\n");
          buffer.append("        <High>");
          buffer.append(high);
          buffer.append("</High>\n");
          buffer.append("        <Volume>");
          buffer.append(volume);
          buffer.append("</Volume>\n");
          buffer.append("        <Change>");
          buffer.append(change);
          buffer.append("</Change>\n");
          buffer.append("        <Low>");
          buffer.append(low);
          buffer.append("</Low>\n");
          return buffer.toString();
      }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/JetspeedStockQuoteService.java
  
  Index: JetspeedStockQuoteService.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  import java.io.InputStream;
  import java.io.OutputStream;
  import java.io.PrintStream;
  import java.io.ByteArrayOutputStream;
  import java.io.ByteArrayInputStream;
  
  import java.net.URL;
  import java.net.HttpURLConnection;
  import java.rmi.RemoteException;
  import org.xml.sax.helpers.XMLFilterImpl;
  import org.xml.sax.InputSource;
  
  import org.apache.turbine.services.Service;
  import org.apache.turbine.services.TurbineBaseService;
  
  /**
      Implements StockQuoteService,
      providing a web service for getting stock quotes.
          
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: JetspeedStockQuoteService.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public class JetspeedStockQuoteService extends TurbineBaseService implements StockQuoteService
  {
      boolean debugIO = false;
      PrintStream debugOutputStream = System.out;
  
      // basic SOAP envelope
      private static final String BASE_SOAP_ENVELOPE =
          "<?xml version=\"1.0\"?>\n" +
          "<SOAP-ENV:Envelope " +
          "\n     xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"" +
          "\n     xmlns:xsd1=\"urn:DataQuoteService\"" +
          "\n     xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"" +
          "\n     xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
          "\n     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
          "  <SOAP-ENV:Body>\n";
      private static final String END_SOAP_ENVELOPE = 
          "  </SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n";
      private final static String SOAP_ENCODING = " SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n";
                                                    
      // SOAP Service definitions
      private static final String SERVICE_END_POINT =        
       "http://www.bluesunrise.com:8082/webservices/container/BlueSunriseFinance/BlueSunriseFinanceService/BlueSunriseFinancePort/";
  
      private static final String WSDL_SERVICE_NAMESPACE = "urn:QuoteService";
      private static final String SOAP_METHOD_QUOTE = WSDL_SERVICE_NAMESPACE + "/quote";
      private static final String SOAP_METHOD_FULLQUOTE = WSDL_SERVICE_NAMESPACE + "/fullQuote";
      private static final String SOAP_METHOD_FULLQUOTES = WSDL_SERVICE_NAMESPACE + "/fullQuotes";
  
      private String soapEndPoint = SERVICE_END_POINT;
  
      // results
      private static final String QUOTE_RESULT = "quoteResult";
      private static final String FULL_QUOTE_RESULT = "fullQuoteResult";
      private static final String FULL_QUOTES_RESULT = "fullQuotesResult";
      private static final String DEFAULT_RETURN = "return";
  
  
      /**
          Get an array of quote records, given a username.
  
          @param username The name of the user to look up the stock quotes by.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] quotesByUser( String username )
              throws RemoteException
      {
          // TODO: implement - this will be the default method to use by the StockQuote portlet
          return null;
      }
  
  
      /**
          Get an array of quote records, given a rolename.
  
          @param rolename The name of the role to look up the stock quotes by.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] quotesByRole( String rolename )
              throws RemoteException
      {
          // TODO: implement 
          return null;
      }
  
  
  
      /**
          Get a single stock quote, given a symbol return the current price.
  
          @param symbol The stock symbol.
          @return String The current price.
        */
      public String quote( String symbol )
              throws RemoteException
      {
          StringBuffer envelope = new StringBuffer(BASE_SOAP_ENVELOPE);        
          envelope.append("    <m1:quote xmlns:m1=\"urn:QuoteService\"" );
          envelope.append(SOAP_ENCODING);
          envelope.append("      <symbol xsi:type=\"xsd:string\">");
          envelope.append(symbol);
          envelope.append("</symbol>\n");
          envelope.append("    </m1:quote>\n");        
          envelope.append(END_SOAP_ENVELOPE);
  
          SOAPResponseHandler handler = new SOAPResponseHandler(WSDL_SERVICE_NAMESPACE, 
                                                                QUOTE_RESULT, 
                                                                DEFAULT_RETURN);
  
          doSOAPRequest(SOAP_METHOD_QUOTE, envelope, handler);
  
          if (handler.isFault()) {
             throw new RemoteException(handler.getFaultContent());
          }
  
          try 
          {
              String resultString = handler.getResult();
              if (resultString == null) 
                  throw new RemoteException("Could not find return in soap response");
              return resultString;
  
          } catch (Exception e) {
              throw new RemoteException("Error generating result.",e);
          } 
      }
  
      /**
          Get a single stock quote record, given a symbol return a StockQuote object.
  
          @param symbol The stock symbol.
          @return StockQuote A full stock quote record.
        */
      public StockQuote fullQuote( String symbol )
              throws RemoteException
      {
          StringBuffer envelope = new StringBuffer(BASE_SOAP_ENVELOPE);        
          envelope.append("    <m1:fullQuote xmlns:m1=\"urn:QuoteService\"" );
          envelope.append(SOAP_ENCODING);
          envelope.append("      <symbol xsi:type=\"xsd:string\">");
          envelope.append(symbol);
          envelope.append("</symbol>\n");
          envelope.append("    </m1:fullQuote>\n");
          envelope.append(END_SOAP_ENVELOPE);
  
  
          SOAPResponseHandler handler = new SOAPResponseHandler(WSDL_SERVICE_NAMESPACE, 
                                                                FULL_QUOTE_RESULT,
                                                                DEFAULT_RETURN); 
  
  
  
          StockQuoteHandler quoteHandler = new StockQuoteHandler();
          handler.setResultHandler(quoteHandler);
  
          doSOAPRequest(SOAP_METHOD_FULLQUOTE, envelope, handler);
          if (handler.isFault()) {
             throw new RemoteException(handler.getFaultContent());
          }
          try {
              return quoteHandler.getResult();
          } catch (Exception e) {
              throw new RemoteException("Error generating result.",e);
          } 
  
      }
  
      /**
          Get an array of quote records, given a array of stock symbols.
  
          @param symbols[] The array of stock symbols.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] fullQuotes( String [] symbols )
              throws RemoteException
      {
          if (symbols.length < 1)
              throw new RemoteException("Invalid symbols[] parameter");
  
          StringBuffer envelope = new StringBuffer(BASE_SOAP_ENVELOPE);        
          envelope.append("    <m1:fullQuotes xmlns:m1=\"urn:QuoteService\"" );
          envelope.append(SOAP_ENCODING);
          envelope.append(
            "      <symbols xsi:type=\"SOAP-ENC:Array\" SOAP-ENC:arrayType=\"xsd:string["+ symbols.length + "]\">\n");
  
          for (int ix = 0; ix < symbols.length; ix++) 
          {
              envelope.append("        <item xsi:type=\"xsd:string\">");
              envelope.append(symbols[ix]);
              envelope.append("</item>\n");
          }
          envelope.append("      ");
          envelope.append("</symbols>\n");                
          envelope.append("    </m1:fullQuotes>\n");
          envelope.append(END_SOAP_ENVELOPE);
  
          SOAPResponseHandler handler = new SOAPResponseHandler(WSDL_SERVICE_NAMESPACE, 
                                                                FULL_QUOTES_RESULT,
                                                                DEFAULT_RETURN); 
  
  
          StockQuoteArrayHandler quoteHandler = new StockQuoteArrayHandler();
          handler.setResultHandler(quoteHandler);
  
          doSOAPRequest(SOAP_METHOD_FULLQUOTES, envelope, handler);
          if (handler.isFault()) {
             throw new RemoteException(handler.getFaultContent());
          }
          try {
              return quoteHandler.getResult();
          } catch (Exception e) {
              throw new RemoteException("Error generating result.",e);
          } 
  
      }
  
      /**
          Set the name of the web service used by this service to retrieve stock quotes.
  
          @param service The name of the web service.
        */
      public void setWebService( String service )
      {
          this.soapEndPoint = service;
      }
  
      /**
          Get the name of the web service used by this service to retrieve stock quotes.
  
          @return String The name of the web service.
        */
      public String getWebService()
      {
          return soapEndPoint;
      }
  
  
      /**
          make a SOAP Request to the web service.
  
       */      
      private void doSOAPRequest(String soapAction, StringBuffer envelope, XMLFilterImpl handler) 
          throws RemoteException 
      {
          try {
              if (debugIO) {
                  debugOutputStream.println("SOAPURL: "+soapEndPoint);
                  debugOutputStream.println("SoapAction: "+soapAction);
                  debugOutputStream.println("SoapEnvelope:");
                  debugOutputStream.println(envelope.toString());
              }
  
              URL url = new URL(soapEndPoint);
              HttpURLConnection connect = (HttpURLConnection)url.openConnection();
              connect.setDoOutput(true);
              byte bytes[] = envelope.toString().getBytes();
              connect.setRequestProperty("SOAPAction","\""+soapAction+"\"");
              connect.setRequestProperty("content-type","text/xml");
              connect.setRequestProperty("content-length",""+bytes.length);
  
              OutputStream out = connect.getOutputStream();
              out.write(bytes);
              out.flush();
  
              int rc = connect.getResponseCode();
              InputStream stream = null;
              if (rc == HttpURLConnection.HTTP_OK) {
                  stream = connect.getInputStream();
              } else if (rc == HttpURLConnection.HTTP_INTERNAL_ERROR) {
                  stream = connect.getErrorStream();
              }
              if (stream != null) {
                  if (debugIO) {
                      ByteArrayOutputStream bout = new ByteArrayOutputStream();
                      int bt = stream.read();
                      while (bt != -1) {
                          bout.write(bt);
                          bt = stream.read();
                      }
                      debugOutputStream.println("Response:");
                      debugOutputStream.println(new String(bout.toByteArray()));
                      stream.close();
                      stream = new ByteArrayInputStream(bout.toByteArray());
                  }
                  String contentType = connect.getContentType();
                  if (contentType.indexOf("text/xml") == -1) {
                      throw new RemoteException("Content-type not text/xml.  Instead, found "+contentType);
                  }
                  org.apache.xerces.parsers.SAXParser xmlreader = new org.apache.xerces.parsers.SAXParser();
                  // TODO TODO
                  // uncomment this block and comment out the above line to use a generic parser
                  //SAXParserFactory factory = SAXParserFactory.newInstance();
                  //factory.setNamespaceAware(true);
                  //SAXParser saxparser = factory.newSAXParser();
                  //XMLReader xmlreader = saxparser.getXMLReader();
                  handler.setParent(xmlreader);
                  xmlreader.setContentHandler(handler);
                  xmlreader.parse(new InputSource(stream));
                  stream.close();
              } else {
                  throw new RemoteException("Communication error: "+rc+" "+connect.getResponseMessage());
              }
          } catch (RemoteException rex) {
              throw rex;
          } catch (Exception ex) {
              throw new RemoteException("Error doing soap stuff",ex);
          }
      }
  
  
      ///////////////////////////////////////////////////////////////////////////
  
      /**
        usage: 
           
            java JetspeedStockQuoteService [option] method [params]
  
            method:           parameter:       description:
            ----------------------------------------------------------------------
              quote             symbol       get the price for the given symbol  
              quotes            symbols..    get the prices for 1..n symbols 
              fullQuote         symbol       get a stock quote record for the given symbol
              fullQuotes        symbols...   1..n symbols to look up multiple stock quote records
  
  
            options:
            --------
              -debug            print to stdout the SOAP request and response packets
  
            Examples:
               java JetspeedStockQuoteService quote IBM
               java JetspeedStockQuoteService quotes IONA CSCO NOK ADSK
               java JetspeedStockQuoteService -debug fullQuote DST
               java JetspeedStockQuoteService fullQuotes SUNW MSFT ORCL
  
  
  
       **/
      public static void main (String args[]) {
           try {
               JetspeedStockQuoteService service = new JetspeedStockQuoteService();
  
               if (args.length == 0) {
                   return;
               }
  
               int index = 0;
               // any options
               if (args[index].startsWith("-"))
               {
                  if ("-debug".equals(args[0])) 
                  {
                      service.debugIO = true;
                      index++;
                  }
               }
               if (index >= args.length)
                  return;
  
               if ("quote".equals(args[index]))
               {
                  index++;
                  if (index >= args.length)
                      return;
                  System.out.println( service.quote(args[index]) );
               }
               else if ("quotes".equals(args[index]))
               {
                  // NOT YET IMPLEMENTED
               }
               else if ("fullQuote".equals(args[index]))
               {
                  index++;
                  if (index >= args.length)
                      return;
                  System.out.println( service.fullQuote(args[index]));
               }
               else if ("fullQuotes".equals(args[index]))
               {
                  index++;
                  String[] symbols = new String[args.length - index];
                  for (int ix = 0 ; ix < symbols.length; ix++)
                  {
                      symbols[ix] = args[index];
                      index++;
                  }
                  StockQuote[] stocks = service.fullQuotes( symbols );
                  for (int ix = 0; ix < stocks.length; ix++)
                      System.out.println( stocks[ix] );
               }
           } catch (Exception ex) {
               ex.printStackTrace();
           }
       }
  
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/SOAPResponseHandler.java
  
  Index: SOAPResponseHandler.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  import org.xml.sax.helpers.XMLFilterImpl;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.*;
  import javax.xml.parsers.*;
  
  
  class SOAPResponseHandler extends XMLFilterImpl 
  {
      String outputNameSpace = null;
      String outputElementName = null;
      String outputPartElementName = null;
  
      public SOAPResponseHandler(String ns, String en, String pen) {
          outputNameSpace = ns;
          outputElementName = en;
          outputPartElementName = pen;
      }
  
      boolean inSoapEnv = false;
      boolean inSoapBody = false;
      boolean inOperation = false;
      boolean inResult = false;
      boolean debugParse = false;
  
      StringBuffer resultBuffer = null;
      XMLFilterImpl resultHandler = null;
      int resultElementStack = 0;
  
      boolean wasFault = false;
      boolean inFault = false;
      boolean inFaultString = false;
      StringBuffer faultContent = null;
  
      public void setContentHandler(ContentHandler handler) {
          ((XMLReader)getParent()).setContentHandler(handler);
      }
  
      public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
          String uriName = uri+":"+localName;
          if ("http://schemas.xmlsoap.org/soap/envelope/:Fault".equals(uriName)) {
              if (debugParse) System.out.println("Found Fault");
              inFault = true;
          } else if (inFault && "faultstring".equals(localName)) {
              if (debugParse) System.out.println("Found Fault String");
              inFaultString = true;
              faultContent = new StringBuffer();
          } else if ("http://schemas.xmlsoap.org/soap/envelope/:Envelope".equals(uriName)) {
              if (debugParse) System.out.println("Found Envelope");
              inSoapEnv = true;
          } else if (inSoapEnv && "http://schemas.xmlsoap.org/soap/envelope/:Body".equals(uriName)) {
              if (debugParse) System.out.println("Found Body");
              inSoapBody = true;
          } else if (inSoapBody && (outputNameSpace+":"+outputElementName).equals(uriName)) {
              if (debugParse) System.out.println("Found operation: "+localName);
              inOperation = true;
          } else if (inOperation && outputPartElementName.equals(localName)) {
              if (attributes.getValue("href") != null) throw new SAXNotSupportedException("href attributes not supported");
              if (debugParse) System.out.println("Found Part: "+localName);
              if (resultHandler != null) {
                  resultHandler.setParent(this);
                  getParent().setContentHandler(resultHandler);
              } else {
                  resultBuffer = new StringBuffer();
              }
              inResult = true;
          } else if (!inFault) {
              if (debugParse) System.out.println("Found Unknown Element: <"+qName+">    ns:"+uri);
              inResult = false;
              inSoapEnv = false;
              inSoapBody = false;
          }
      }
  
      public void endElement(String uri, String localName, String qName) throws SAXException {
          if (inResult && outputPartElementName.equals(localName)) {
              inResult = false;
          } else if ("http://schemas.xmlsoap.org/soap/envelope/:Fault".equals(uri+":"+localName)) {
              wasFault = true;
              inFault = false;
          } else if (inFault && "faultstring".equals(localName)) {
              inFaultString = false;
          }
      }
  
      public void characters(char[] ch, int start, int length) throws SAXException {
          if (inResult) {
              resultBuffer.append(new String(ch,start,length));
          }
          if (inFault) faultContent.append(new String(ch,start,length));
      }
      public String getResult() {
          if (resultBuffer == null) return null;
          return resultBuffer.toString();
      }
      public void setResultHandler(XMLFilterImpl handler) {
          resultHandler = handler;
      }
      public boolean isFault() {
          return wasFault;
      }
      public String getFaultContent() {
          if (faultContent == null) return "";
          return faultContent.toString();
      }
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuote.java
  
  Index: StockQuote.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  
  /**
      StockQuote holds the information for one company's quote.
          
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: StockQuote.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public interface StockQuote
  {
      String getName();
  
      void setName( String s );
  
      String getSymbol();
  
      void setSymbol( String s );
  
      String getPrice();
  
      void setPrice( String s );
  
      String getDate();
  
      void setDate( String s );
  
      String getTime();
  
      void setTime( String s );
  
      String getChange();
      
      void setChange( String s );
  
      String getOpening();
      
      void setOpening( String s );
  
      String getHigh();  // subliminal
  
      void setHigh( String s );
  
      String getLow();
  
      void setLow( String s );
  
      String getVolume();
  
      void setVolume( String s );
  
  }
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteArrayHandler.java
  
  Index: StockQuoteArrayHandler.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  import org.xml.sax.helpers.XMLFilterImpl;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.*;
  import javax.xml.parsers.*;
  
  /**
      SAX-based XML event handler (filter). Works with org.xml.sax.XMLReader to filter
      standard SAX events. This class maps the XML represention of a stock array into a java classes.
  
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: StockQuoteArrayHandler.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public class StockQuoteArrayHandler extends XMLFilterImpl
  {
      StockQuote[] array = new BaseStockQuote[0];
      StockQuoteHandler currentVal = null;
      boolean inElement;
  
      public void startElement(String uri, String localName, String qName, Attributes attributes) 
          throws SAXException 
      {
          if (attributes.getValue("href") != null) 
              throw new SAXNotSupportedException("href attributes not supported");
          inElement = true;
          currentVal = new StockQuoteHandler();
          currentVal.setParent(this);
          setContentHandler(currentVal);
      }
  
      public void endElement(String uri, String localName, String qName) 
          throws SAXException 
      {
          if (inElement) 
          {
              inElement = false;
              StockQuote theVal = currentVal.getResult();
              StockQuote[] newar = new BaseStockQuote[array.length+1];
              System.arraycopy(array,0,newar,0,array.length);
              newar[array.length] = theVal;
              array = newar;
          } else 
          {
              ContentHandler handler = (ContentHandler)getParent();
              getParent().setContentHandler(handler);
              handler.endElement(uri,localName,qName);
          }
      }
  
      public void characters(char[] ch, int start, int length) throws SAXException 
      {
      }
  
      public StockQuote[] getResult() 
      {
          return array;
      }
  
      public void setContentHandler(ContentHandler handler) 
      {
          ((XMLReader)getParent()).setContentHandler(handler);
      }
  
  }
  
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteHandler.java
  
  Index: StockQuoteHandler.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  import org.xml.sax.helpers.XMLFilterImpl;
  import org.xml.sax.ContentHandler;
  import org.xml.sax.*;
  import javax.xml.parsers.*;
  
  /**
      SAX-based XML event handler (filter). Works with org.xml.sax.XMLReader to filter
      standard SAX events. This class maps the XML represention of a stock into a java class.
  
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: StockQuoteHandler.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public class StockQuoteHandler extends XMLFilterImpl
  {
      StringBuffer resultBuffer = null;
      StockQuote result = null;
      XMLFilterImpl handler = null;
  
      public void startElement(String uri, String localName, String qName, Attributes attributes) 
          throws SAXException 
      {
          if (attributes.getValue("href") != null) 
              throw new SAXNotSupportedException("href attributes not supported");
          if (localName.equals("Price")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Name")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Symbol")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Time")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Date")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("High")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Volume")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Change")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Opening")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else             if (localName.equals("Low")) {
              if (result == null) result = new BaseStockQuote();
              resultBuffer = new StringBuffer();
          } else {
              throw new SAXException("Unexpected element "+localName);
          }
      }
  
      public void endElement(String uri, String localName, String qName) throws SAXException {
          if (localName.equals("Price")) {
              result.setPrice(resultBuffer.toString());
          } else if (localName.equals("Name")) {
              result.setName(resultBuffer.toString());
          } else if (localName.equals("Symbol")) {
              result.setSymbol(resultBuffer.toString());
          } else if (localName.equals("Time")) {
              result.setTime(resultBuffer.toString());
          } else if (localName.equals("Date")) {
              result.setDate(resultBuffer.toString());
          } else if (localName.equals("High")) {
              result.setHigh(resultBuffer.toString());
          } else if (localName.equals("Volume")) {
              result.setVolume(resultBuffer.toString());
          } else if (localName.equals("Change")) {
              result.setChange(resultBuffer.toString());
          } else if (localName.equals("Opening")) {
              result.setOpening(resultBuffer.toString());
          } else if (localName.equals("Low")) {
              result.setLow(resultBuffer.toString());
          } else {
              ContentHandler handler = (ContentHandler)getParent();
              getParent().setContentHandler(handler);
              handler.endElement(uri,localName,qName);
          }
      }
  
      public void characters(char[] ch, int start, int length) throws SAXException {
          if (resultBuffer != null) resultBuffer.append(new String(ch,start,length));
      }
      public void setContentHandler(ContentHandler handler) {
          ((XMLReader)getParent()).setContentHandler(handler);
      }
      public StockQuote getResult() {
          return result;
      }
  }
  
  
  
  1.1                  jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteService.java
  
  Index: StockQuoteService.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2000-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 acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *     "Apache Jetspeed" 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" or
   *    "Apache Jetspeed", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * 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.jetspeed.webservices.finance.stockmarket;
  
  import org.apache.turbine.services.Service;
  import java.rmi.RemoteException;
  
  /**
      StockQuoteService provides a web service for getting stock quotes.
          
      @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
      @version $Id: StockQuoteService.java,v 1.1 2001/09/23 08:08:05 taylor Exp $
  */
  
  public interface StockQuoteService extends Service
  {
      /** The name of this service */
      public String SERVICE_NAME = "StockQuoteService";
  
  
      /**
          Get a single stock quote, given a symbol return the current price.
  
          @param symbol The stock symbol.
          @return String The current price.
        */
      public String quote( String symbol ) 
          throws RemoteException;
  
      /**
          Get a single stock quote record, given a symbol return a StockQuote object.
  
          @param symbol The stock symbol.
          @return StockQuote A full stock quote record.
        */
  
      public StockQuote fullQuote( String symbol )
              throws RemoteException;
  
      /**
          Get an array of quote records, given a array of stock symbols.
  
          @param symbols[] The array of stock symbols.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] fullQuotes( String [] symbol )
              throws RemoteException;
  
      /**
          Get an array of quote records, given a username.
  
          @param username The name of the user to look up the stock quotes by.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] quotesByUser( String username )
              throws RemoteException;
  
      /**
          Get an array of quote records, given a rolename.
  
          @param rolename The name of the role to look up the stock quotes by.
          @return StockQuote[] An array of full stock quotes for each stock symbol.
        */
      public StockQuote[] quotesByRole( String rolename )
              throws RemoteException;
  
      /**
          Set the name of the web service used by this service to retrieve stock quotes.
  
          @param service The name of the web service.
        */
      public void setWebService( String service );
  
      /**
          Get the name of the web service used by this service to retrieve stock quotes.
  
          @return String The name of the web service.
        */
      public String getWebService();
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jetspeed-dev-help@jakarta.apache.org