summaryrefslogtreecommitdiffstats
path: root/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote
diff options
context:
space:
mode:
Diffstat (limited to 'tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote')
-rw-r--r--tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java223
-rw-r--r--tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java29
-rw-r--r--tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java66
-rw-r--r--tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java150
4 files changed, 0 insertions, 468 deletions
diff --git a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java b/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java
deleted file mode 100644
index 627ab7b379..0000000000
--- a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuote.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package bigbank.account.services.stockquote;
-
-public class StockQuote {
-
- private String companyName;
-
- private String symbol;
-
- private String stockQuote;
-
- private String lastUpdated;
-
- private String change;
-
- private String openPrice;
-
- private String dayHighPrice;
-
- private String dayLowPrice;
-
- private String volume;
-
- private String marketCap;
-
- private String yearRange;
-
- private String exDividendDate;
-
- private String dividendYield;
-
- private String dividendPerShare;
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected StockQuote() {
- super();
- }
-
- public String getCompanyName() {
- return companyName;
- }
-
- public void setCompanyName(String newCompanyName) {
- companyName = newCompanyName;
- }
-
- public String getSymbol() {
- return symbol;
- }
-
- public void setSymbol(String newStockTicker) {
- symbol = newStockTicker;
- }
-
- public String getStockQuote() {
- return stockQuote;
- }
-
- public void setStockQuote(String newStockQuote) {
- stockQuote = newStockQuote;
- }
-
- public String getLastUpdated() {
- return lastUpdated;
- }
-
- public void setLastUpdated(String newLastUpdated) {
- lastUpdated = newLastUpdated;
- }
-
- public String getChange() {
- return change;
- }
-
- public void setChange(String newChange) {
- change = newChange;
- }
-
- public String getOpenPrice() {
- return openPrice;
- }
-
- public void setOpenPrice(String newOpenPrice) {
- openPrice = newOpenPrice;
- }
-
- public String getDayHighPrice() {
- return dayHighPrice;
- }
-
- public void setDayHighPrice(String newDayHighPrice) {
- dayHighPrice = newDayHighPrice;
- }
-
- public String getDayLowPrice() {
- return dayLowPrice;
- }
-
- public void setDayLowPrice(String newDayLowPrice) {
- dayLowPrice = newDayLowPrice;
- }
-
- public String getVolume() {
- return volume;
- }
-
- public void setVolume(String newVolume) {
- volume = newVolume;
- }
-
- public String getMarketCap() {
- return marketCap;
- }
-
- public void setMarketCap(String newMarketCap) {
- marketCap = newMarketCap;
- }
-
- public String getYearRange() {
- return yearRange;
- }
-
- public void setYearRange(String newYearRange) {
- yearRange = newYearRange;
- }
-
- public String getExDividendDate() {
- return exDividendDate;
- }
-
- public void setExDividendDate(String newExDividendDate) {
- exDividendDate = newExDividendDate;
- }
-
- public String getDividendYield() {
- return dividendYield;
- }
-
- public void setDividendYield(String newDividendYield) {
- dividendYield = newDividendYield;
- }
-
- public String getDividendPerShare() {
- return dividendPerShare;
- }
-
- public void setDividendPerShare(String newDividendPerShare) {
- dividendPerShare = newDividendPerShare;
- }
-
- public String toString() {
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (companyName: ");
- result.append(companyName);
- result.append(", symbol: ");
- result.append(symbol);
- result.append(", stockQuote: ");
- result.append(stockQuote);
- result.append(", lastUpdated: ");
- result.append(lastUpdated);
- result.append(", change: ");
- result.append(change);
- result.append(", openPrice: ");
- result.append(openPrice);
- result.append(", dayHighPrice: ");
- result.append(dayHighPrice);
- result.append(", dayLowPrice: ");
- result.append(dayLowPrice);
- result.append(", volume: ");
- result.append(volume);
- result.append(", marketCap: ");
- result.append(marketCap);
- result.append(", yearRange: ");
- result.append(yearRange);
- result.append(", exDividendDate: ");
- result.append(exDividendDate);
- result.append(", dividendYield: ");
- result.append(dividendYield);
- result.append(", dividendPerShare: ");
- result.append(dividendPerShare);
- result.append(')');
- return result.toString();
- }
- public StockQuote clone(){
- StockQuote ret = new StockQuote();
- ret.companyName= companyName;
- ret.symbol= symbol;
- ret.stockQuote= stockQuote;
- ret.lastUpdated= lastUpdated;
- ret.change= change;
- ret.openPrice= openPrice;
- ret.dayHighPrice= dayHighPrice;
- ret.dayLowPrice= dayLowPrice;
- ret.volume= volume;
- ret.marketCap= marketCap;
- ret.yearRange= yearRange;
- ret.exDividendDate= exDividendDate;
- ret.dividendYield= dividendYield;
- ret.dividendPerShare= dividendPerShare;
- return ret;
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java b/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java
deleted file mode 100644
index b899d7cbd0..0000000000
--- a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteService.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package bigbank.account.services.stockquote;
-
-import java.rmi.RemoteException;
-import java.util.Map;
-
-/**
- * This is the business interface of the HelloWorld service component.
- */
-public interface StockQuoteService {
-
- public Map<String, StockQuote> getQuotes(String[] symbols) throws RemoteException;
-
-}
diff --git a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java b/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
deleted file mode 100644
index 039abde4bc..0000000000
--- a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteServiceImpl.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package bigbank.account.services.stockquote;
-
-import java.rmi.RemoteException;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Random;
-
-/* Mock StockQuoteService */
-
-public class StockQuoteServiceImpl implements StockQuoteService {
-
- static Random rn = new Random();
-
- static Hashtable<String, StockQuote> stocks = new Hashtable<String, StockQuote>();
-
- public synchronized Map<String, StockQuote> getQuotes(String[] symbols) throws RemoteException {
- Map<String, StockQuote> ret = new Hashtable<String, StockQuote>();
- for (String sym : symbols) {
- sym = sym.toUpperCase();
- if (!ret.containsKey(sym)) {
- StockQuote sq = stocks.get(sym);
- if (sq == null) {
- sq = new StockQuote();
- stocks.put(sym, sq);
- sq.setSymbol(sym);
- sq.setCompanyName(sym + " INC");
- float val = rn.nextFloat() * 97.0F + 3.0F;
- sq.setStockQuote(val + "");
- sq.setDayHighPrice(val + "");
- sq.setDayLowPrice(val + "");
- sq.setOpenPrice(val + "");
- } else {
- float diff = (rn.nextFloat() * 2.0F) - 1;
- float newval = new Float(sq.getStockQuote()) + diff; // auto boxing cool.
- sq.setStockQuote(newval + "");
- float dh = Math.max(newval, new Float(sq.getDayHighPrice()));
- sq.setDayHighPrice(dh + "");
- float dl = Math.min(newval, new Float(sq.getDayLowPrice()));
- sq.setDayLowPrice(dl + "");
-
- }
- ret.put(sym, (StockQuote) sq.clone());
- }
-
- }
-
- return ret;
- }
-
-}
diff --git a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java b/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java
deleted file mode 100644
index f5f481ca1b..0000000000
--- a/tags/java-M1-20060518/java/sampleapps/bigbank/account/src/main/java/bigbank/account/services/stockquote/StockQuoteWebservicexServiceImpl.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/**
- *
- * Copyright 2005 The Apache Software Foundation or its licensors, as applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package bigbank.account.services.stockquote;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Map;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
-import javax.xml.stream.XMLStreamReader;
-
-import net.x.webservice.StockQuoteSoap;
-
-import org.osoa.sca.annotations.Reference;
-import org.osoa.sca.annotations.Scope;
-import org.osoa.sca.annotations.Service;
-
-/**
- * This class implements the Stock quote service component.
- */
-@Service(StockQuoteService.class)
-@Scope("MODULE")
-public class StockQuoteWebservicexServiceImpl implements StockQuoteService {
-
- @Reference
- public StockQuoteSoap stockQuoteService = null; // Injected by the SCA container.
-
- /**
- * @throws RemoteException
- * @see bigbank.account.services.stockquote.StockQuoteService#getQuotes(String[])
- */
- public Map<String, StockQuote> getQuotes(final String[] symbols) throws RemoteException {
- try {
- assert null != stockQuoteService : "stockQuoteService was not set by the SCA runtime!";
- StringBuilder sb = new StringBuilder(5 * symbols.length);
- for (String sym : symbols) {
- if (sb.length() != 0)
- sb.append(' ');
- sb.append(sym);
- }
- String stockdata = stockQuoteService.GetQuote(sb.toString());
-
- InputStream in = new ByteArrayInputStream(stockdata.getBytes());
- XMLInputFactory factory = XMLInputFactory.newInstance();
- XMLStreamReader parser = factory.createXMLStreamReader(in);
- ArrayList<StockQuote> listQuotes = new ArrayList<StockQuote>();
- Hashtable<String, StockQuote> listQuoteHT = new Hashtable<String, StockQuote>();
- MapStock currentStock = null;
- StringBuilder currentText = new StringBuilder(100);
- for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
- String lname;
- switch (event) {
- case XMLStreamConstants.START_ELEMENT:
- if (parser.getLocalName() == "Stock") {
-
- currentStock = new MapStock();
- listQuotes.add(currentStock);
- }
- break;
- case XMLStreamConstants.END_ELEMENT:
- lname = parser.getLocalName();
- String mname = "set" + lname;
- try {
- Method setter = MapStock.class.getMethod(mname, new Class[] { String.class });
- if (setter != null) {
- setter.invoke(currentStock, currentText.toString());
- if (lname.equals("Symbol")) {
- listQuoteHT.put(currentText.toString(), currentStock);
-
- }
- }
- } catch (NoSuchMethodException e) {
-
- }
- // System.err.println(parser.getLocalName() + ":" + currentText.toString());
- currentText.setLength(0);
- break;
- case XMLStreamConstants.CHARACTERS:
- // System.out.print(parser.getText());
- currentText.append(parser.getText());
- break;
- case XMLStreamConstants.CDATA:
- // System.out.print(parser.getText());
- currentText.append(parser.getText());
- break;
- } // end switch
- } // end while
- parser.close();
-
- return listQuoteHT;
- } catch (Exception e) {
- e.printStackTrace();
- throw new RemoteException(e.getClass().getName() + e.getMessage(), e);
- }
- }
-
- public static class MapStock extends StockQuote {
-
- public void setLast(String val) {
- super.setStockQuote(val);
- }
-
- public void setDate(String val) {
- };
-
- public void setTime(String val) {
- };
-
- public void setHigh(String val) {
- super.setDayHighPrice(val);
- }
-
- public void setLow(String val) {
- super.setDayLowPrice(val);
- }
-
- public void setOpen(String val) {
- super.setOpenPrice(val);
- }
-
- public void setMktCap(String val) {
- super.setMarketCap(val);
- }
-
- public void setName(String val) {
- super.setCompanyName(val);
- }
-
- }
-
-}