portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket JetspeedStockQuoteService.java StockQuoteService.java
Date Mon, 29 Oct 2001 08:56:10 GMT
taylor      01/10/29 00:56:10

  Modified:    src/java/org/apache/jetspeed/webservices/finance/stockmarket
                        JetspeedStockQuoteService.java
                        StockQuoteService.java
  Log:
  Updated Stock services to use two new web methods for customizing personal stock quotes,
storing personal settings on web server.
  
  Revision  Changes    Path
  1.2       +93 -15    jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/JetspeedStockQuoteService.java
  
  Index: JetspeedStockQuoteService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/JetspeedStockQuoteService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JetspeedStockQuoteService.java	2001/09/23 08:08:05	1.1
  +++ JetspeedStockQuoteService.java	2001/10/29 08:56:09	1.2
  @@ -74,7 +74,7 @@
       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 $
  +    @version $Id: JetspeedStockQuoteService.java,v 1.2 2001/10/29 08:56:09 taylor Exp $
   */
   
   public class JetspeedStockQuoteService extends TurbineBaseService implements StockQuoteService
  @@ -104,6 +104,8 @@
       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 static final String SOAP_METHOD_GETSYMBOLS = WSDL_SERVICE_NAMESPACE + "/getSymbols";
  +    private static final String SOAP_METHOD_STORESYMBOLS = WSDL_SERVICE_NAMESPACE + "/storeSymbols";
   
       private String soapEndPoint = SERVICE_END_POINT;
   
  @@ -111,36 +113,112 @@
       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 GETSYMBOLS_RESULT = "getSymbolsResult";
  +    private static final String STORESYMBOLS_RESULT = "storeSymbolsResult";
       private static final String DEFAULT_RETURN = "return";
   
   
       /**
  -        Get an array of quote records, given a username.
  +        Get a comma-delimited list of symbols managed for the given projectName, userName,
password.
   
  -        @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.
  +        @param projectName The project to store the symbols under.
  +        @param userName The name of the user to look up the stock quotes by.
  +        @param password The user's password.
  +        @return String the comma-delimited list of symbols managed for this user.
         */
  -    public StockQuote[] quotesByUser( String username )
  +    public String getSymbols(String projectName, String userName, String password) 
               throws RemoteException
       {
  -        // TODO: implement - this will be the default method to use by the StockQuote portlet
  -        return null;
  -    }
  +        StringBuffer envelope = new StringBuffer(BASE_SOAP_ENVELOPE);        
  +        envelope.append("    <m1:getSymbols xmlns:m1=\"urn:QuoteService\"" );
  +        envelope.append(SOAP_ENCODING);
  +        envelope.append("      <projectName xsi:type=\"xsd:string\">");
  +        envelope.append(projectName);
  +        envelope.append("</projectName>\n");
  +        envelope.append("      <userName xsi:type=\"xsd:string\">");
  +        envelope.append(userName);
  +        envelope.append("</userName>\n");
  +        envelope.append("      <password xsi:type=\"xsd:string\">");
  +        envelope.append(password);
  +        envelope.append("</password>\n");
  +        envelope.append("    </m1:getSymbols>\n");        
  +        envelope.append(END_SOAP_ENVELOPE);
  +
  +        SOAPResponseHandler handler = new SOAPResponseHandler(WSDL_SERVICE_NAMESPACE, 
  +                                                              GETSYMBOLS_RESULT, 
  +                                                              DEFAULT_RETURN);
  +
  +        doSOAPRequest(SOAP_METHOD_GETSYMBOLS, 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 an array of quote records, given a rolename.
  +        Stores the comma-delimited list of symbols managed for the given projectName, userName,
password.
   
  -        @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.
  +        @param projectName The project to store the symbols under.
  +        @param userName The name of the user to look up the stock quotes by.
  +        @param password The user's password.
  +        @return boolean True if success otherwise false.
         */
  -    public StockQuote[] quotesByRole( String rolename )
  +    public boolean storeSymbols(String projectName, String userName, String password, String
symbols)
               throws RemoteException
       {
  -        // TODO: implement 
  -        return null;
  -    }
  +        StringBuffer envelope = new StringBuffer(BASE_SOAP_ENVELOPE);        
  +        envelope.append("    <m1:storeSymbols xmlns:m1=\"urn:QuoteService\"" );
  +        envelope.append(SOAP_ENCODING);
  +        envelope.append("      <projectName xsi:type=\"xsd:string\">");
  +        envelope.append(projectName);
  +        envelope.append("</projectName>\n");
  +        envelope.append("      <userName xsi:type=\"xsd:string\">");
  +        envelope.append(userName);
  +        envelope.append("</userName>\n");
  +        envelope.append("      <password xsi:type=\"xsd:string\">");
  +        envelope.append(password);
  +        envelope.append("</password>\n");
  +        envelope.append("      <symbols xsi:type=\"xsd:string\">");
  +        envelope.append(symbols);
  +        envelope.append("</symbols>\n");
  +
  +        envelope.append("    </m1:storeSymbols>\n");        
  +        envelope.append(END_SOAP_ENVELOPE);
  +
  +        SOAPResponseHandler handler = new SOAPResponseHandler(WSDL_SERVICE_NAMESPACE, 
  +                                                              STORESYMBOLS_RESULT, 
  +                                                              DEFAULT_RETURN);
  +
  +        doSOAPRequest(SOAP_METHOD_STORESYMBOLS, 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 true;
  +
  +        } catch (Exception e) {
  +            throw new RemoteException("Error generating result.",e);
  +        } 
   
  +    }
   
   
       /**
  
  
  
  1.2       +13 -9     jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteService.java
  
  Index: StockQuoteService.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/webservices/finance/stockmarket/StockQuoteService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StockQuoteService.java	2001/09/23 08:08:05	1.1
  +++ StockQuoteService.java	2001/10/29 08:56:09	1.2
  @@ -61,7 +61,7 @@
       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 $
  +    @version $Id: StockQuoteService.java,v 1.2 2001/10/29 08:56:09 taylor Exp $
   */
   
   public interface StockQuoteService extends Service
  @@ -99,21 +99,25 @@
               throws RemoteException;
   
       /**
  -        Get an array of quote records, given a username.
  +        Get a comma-delimited list of symbols managed for the given projectName, userName,
password.
   
  -        @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.
  +        @param projectName The project to store the symbols under.
  +        @param userName The name of the user to look up the stock quotes by.
  +        @param password The user's password.
  +        @return String the comma-delimited list of symbols managed for this user.
         */
  -    public StockQuote[] quotesByUser( String username )
  +     public String getSymbols(String projectName, String userName, String password) 
               throws RemoteException;
   
       /**
  -        Get an array of quote records, given a rolename.
  +        Stores the comma-delimited list of symbols managed for the given projectName, userName,
password.
   
  -        @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.
  +        @param projectName The project to store the symbols under.
  +        @param userName The name of the user to look up the stock quotes by.
  +        @param password The user's password.
  +        @return boolean True if success otherwise false.
         */
  -    public StockQuote[] quotesByRole( String rolename )
  +     public boolean storeSymbols(String projectName, String userName, String password,
String symbols)
               throws RemoteException;
   
       /**
  
  
  

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


Mime
View raw message