diff options
author | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-27 15:25:35 +0000 |
---|---|---|
committer | fmoga <fmoga@13f79535-47bb-0310-9956-ffa450edef68> | 2010-07-27 15:25:35 +0000 |
commit | 016a6884321fb431d865ebe4ceeae443e3026d10 (patch) | |
tree | 062258392c46eb2e8a183adffe4587b215fb634a /sca-java-2.x/contrib/samples/stock-comet-jquery/src/main/java/org/apache/tuscany/sample/comet/StockServiceImpl.java | |
parent | 06d8b66db04c6469c36fa552322c2054675d8038 (diff) |
- Added sources for stock-comet-jquery sample
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@979748 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/contrib/samples/stock-comet-jquery/src/main/java/org/apache/tuscany/sample/comet/StockServiceImpl.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sca-java-2.x/contrib/samples/stock-comet-jquery/src/main/java/org/apache/tuscany/sample/comet/StockServiceImpl.java b/sca-java-2.x/contrib/samples/stock-comet-jquery/src/main/java/org/apache/tuscany/sample/comet/StockServiceImpl.java new file mode 100644 index 0000000000..dc1d4a4c92 --- /dev/null +++ b/sca-java-2.x/contrib/samples/stock-comet-jquery/src/main/java/org/apache/tuscany/sample/comet/StockServiceImpl.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.tuscany.sample.comet; + +import java.text.DecimalFormat; +import java.util.Date; +import java.util.Random; + +public class StockServiceImpl implements StockService { + + public static final int MAX_VALUE = 1000; + private Random random = new Random(new Date().getTime()); + + @Override + public String getSymbol() { + return "ASF"; + } + + @Override + public Double getValue() { + Double value = Math.abs(random.nextDouble() * random.nextInt(MAX_VALUE)); + return Double.valueOf(new DecimalFormat("#.##").format(value)); + } + +} |