Return-Path:
X-Original-To: apmail-geode-commits-archive@minotaur.apache.org
Delivered-To: apmail-geode-commits-archive@minotaur.apache.org
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by minotaur.apache.org (Postfix) with SMTP id 48A0E19121
for ;
Thu, 21 Apr 2016 17:17:17 +0000 (UTC)
Received: (qmail 33603 invoked by uid 500); 21 Apr 2016 17:17:17 -0000
Delivered-To: apmail-geode-commits-archive@geode.apache.org
Received: (qmail 33565 invoked by uid 500); 21 Apr 2016 17:17:17 -0000
Mailing-List: contact commits-help@geode.incubator.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@geode.incubator.apache.org
Delivered-To: mailing list commits@geode.incubator.apache.org
Received: (qmail 33477 invoked by uid 99); 21 Apr 2016 17:17:17 -0000
Received: from pnap-us-west-generic-nat.apache.org (HELO
spamd4-us-west.apache.org) (209.188.14.142)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2016 17:17:17 +0000
Received: from localhost (localhost [127.0.0.1])
by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org)
with ESMTP id 78527C05EF
for ; Thu, 21 Apr 2016 17:17:16 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org
X-Spam-Flag: NO
X-Spam-Score: -3.221
X-Spam-Level:
X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31
tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1,
RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
RP_MATCHES_RCVD=-0.001] autolearn=disabled
Received: from mx1-lw-eu.apache.org ([10.40.0.8])
by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new,
port 10024)
with ESMTP id jQDQThRpjkLP for ;
Thu, 21 Apr 2016 17:16:41 +0000 (UTC)
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP
id 90A4C5FAC3
for ;
Thu, 21 Apr 2016 17:16:38 +0000 (UTC)
Received: (qmail 29724 invoked by uid 99); 21 Apr 2016 17:16:37 -0000
Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org)
(140.211.11.23)
by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Apr 2016 17:16:37 +0000
Received: by git1-us-west.apache.org (ASF Mail Server at
git1-us-west.apache.org, from userid 33)
id B5B9ADFB7C; Thu, 21 Apr 2016 17:16:37 +0000 (UTC)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: jinmeiliao@apache.org
To: commits@geode.incubator.apache.org
Date: Thu, 21 Apr 2016 17:17:23 -0000
Message-Id: <71988c9f5f2c44d6b750ab08337690ed@git.apache.org>
In-Reply-To:
References:
X-Mailer: ASF-Git Admin Mailer
Subject: [48/50] [abbrv] incubator-geode git commit: GEODE-1244: Package,
directory, project and file rename for geode-spark-connector
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ff914bd9/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/JavaApiIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/JavaApiIntegrationTest.java b/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/JavaApiIntegrationTest.java
deleted file mode 100644
index bb75c7a..0000000
--- a/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/JavaApiIntegrationTest.java
+++ /dev/null
@@ -1,424 +0,0 @@
-/*
- * 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 ittest.io.pivotal.gemfire.spark.connector;
-
-import com.gemstone.gemfire.cache.Region;
-import io.pivotal.gemfire.spark.connector.GemFireConnection;
-import io.pivotal.gemfire.spark.connector.GemFireConnectionConf;
-import io.pivotal.gemfire.spark.connector.GemFireConnectionConf$;
-import io.pivotal.gemfire.spark.connector.internal.DefaultGemFireConnectionManager$;
-import io.pivotal.gemfire.spark.connector.javaapi.GemFireJavaRegionRDD;
-import ittest.io.pivotal.gemfire.spark.connector.testkit.GemFireCluster$;
-import ittest.io.pivotal.gemfire.spark.connector.testkit.IOUtils;
-import org.apache.spark.SparkConf;
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.JavaRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.Function;
-import org.apache.spark.api.java.function.PairFunction;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.scalatest.junit.JUnitSuite;
-import io.pivotal.gemfire.spark.connector.package$;
-import scala.Tuple2;
-import scala.Option;
-import scala.Some;
-
-import java.util.*;
-
-import static io.pivotal.gemfire.spark.connector.javaapi.GemFireJavaUtil.RDDSaveBatchSizePropKey;
-import static io.pivotal.gemfire.spark.connector.javaapi.GemFireJavaUtil.javaFunctions;
-import static org.junit.Assert.*;
-
-public class JavaApiIntegrationTest extends JUnitSuite {
-
- static JavaSparkContext jsc = null;
- static GemFireConnectionConf connConf = null;
-
- static int numServers = 2;
- static int numObjects = 1000;
- static String regionPath = "pr_str_int_region";
-
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
- // start gemfire cluster, and spark context
- Properties settings = new Properties();
- settings.setProperty("cache-xml-file", "src/it/resources/test-retrieve-regions.xml");
- settings.setProperty("num-of-servers", Integer.toString(numServers));
- int locatorPort = GemFireCluster$.MODULE$.start(settings);
-
- // start spark context in local mode
- Properties props = new Properties();
- props.put("log4j.logger.org.apache.spark", "INFO");
- props.put("log4j.logger.io.pivotal.gemfire.spark.connector","DEBUG");
- IOUtils.configTestLog4j("ERROR", props);
- SparkConf conf = new SparkConf()
- .setAppName("RetrieveRegionIntegrationTest")
- .setMaster("local[2]")
- .set(package$.MODULE$.GemFireLocatorPropKey(), "localhost:"+ locatorPort);
- // sc = new SparkContext(conf);
- jsc = new JavaSparkContext(conf);
- connConf = GemFireConnectionConf.apply(jsc.getConf());
- }
-
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- // stop connection, spark context, and gemfire cluster
- DefaultGemFireConnectionManager$.MODULE$.closeConnection(GemFireConnectionConf$.MODULE$.apply(jsc.getConf()));
- jsc.stop();
- GemFireCluster$.MODULE$.stop();
- }
-
- // --------------------------------------------------------------------------------------------
- // utility methods
- // --------------------------------------------------------------------------------------------
-
- private void matchMapAndPairList(Map map, List> list) {
- assertTrue("size mismatch \nmap: " + map.toString() + "\nlist: " + list.toString(), map.size() == list.size());
- for (Tuple2 p : list) {
- assertTrue("value mismatch: k=" + p._1() + " v1=" + p._2() + " v2=" + map.get(p._1()),
- p._2().equals(map.get(p._1())));
- }
- }
-
- private Region prepareStrIntRegion(String regionPath, int start, int stop) {
- HashMap entriesMap = new HashMap<>();
- for (int i = start; i < stop; i ++) {
- entriesMap.put("k_" + i, i);
- }
-
- GemFireConnection conn = connConf.getConnection();
- Region region = conn.getRegionProxy(regionPath);
- region.removeAll(region.keySetOnServer());
- region.putAll(entriesMap);
- return region;
- }
-
- private JavaPairRDD prepareStrIntJavaPairRDD(int start, int stop) {
- List> data = new ArrayList<>();
- for (int i = start; i < stop; i ++) {
- data.add(new Tuple2<>("k_" + i, i));
- }
- return jsc.parallelizePairs(data);
- }
-
- private JavaPairRDD prepareIntIntJavaPairRDD(int start, int stop) {
- List> data = new ArrayList<>();
- for (int i = start; i < stop; i ++) {
- data.add(new Tuple2<>(i, i * 2));
- }
- return jsc.parallelizePairs(data);
- }
-
- private JavaRDD prepareIntJavaRDD(int start, int stop) {
- List data = new ArrayList<>();
- for (int i = start; i < stop; i ++) {
- data.add(i);
- }
- return jsc.parallelize(data);
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaRDD.saveToGemfire
- // --------------------------------------------------------------------------------------------
-
- static class IntToStrIntPairFunction implements PairFunction {
- @Override public Tuple2 call(Integer x) throws Exception {
- return new Tuple2<>("k_" + x, x);
- }
- }
-
- @Test
- public void testRDDSaveToGemfireWithDefaultConnConfAndOpConf() throws Exception {
- verifyRDDSaveToGemfire(true, true);
- }
-
- @Test
- public void testRDDSaveToGemfireWithDefaultConnConf() throws Exception {
- verifyRDDSaveToGemfire(true, false);
- }
-
- @Test
- public void testRDDSaveToGemfireWithConnConfAndOpConf() throws Exception {
- verifyRDDSaveToGemfire(false, true);
- }
-
- @Test
- public void testRDDSaveToGemfireWithConnConf() throws Exception {
- verifyRDDSaveToGemfire(false, false);
- }
-
- public void verifyRDDSaveToGemfire(boolean useDefaultConnConf, boolean useOpConf) throws Exception {
- Region region = prepareStrIntRegion(regionPath, 0, 0); // remove all entries
- JavaRDD rdd1 = prepareIntJavaRDD(0, numObjects);
-
- PairFunction func = new IntToStrIntPairFunction();
- Properties opConf = new Properties();
- opConf.put(RDDSaveBatchSizePropKey, "200");
-
- if (useDefaultConnConf) {
- if (useOpConf)
- javaFunctions(rdd1).saveToGemfire(regionPath, func, opConf);
- else
- javaFunctions(rdd1).saveToGemfire(regionPath, func);
- } else {
- if (useOpConf)
- javaFunctions(rdd1).saveToGemfire(regionPath, func, connConf, opConf);
- else
- javaFunctions(rdd1).saveToGemfire(regionPath, func, connConf);
- }
-
- Set keys = region.keySetOnServer();
- Map map = region.getAll(keys);
-
- List> expectedList = new ArrayList<>();
-
- for (int i = 0; i < numObjects; i ++) {
- expectedList.add(new Tuple2<>("k_" + i, i));
- }
- matchMapAndPairList(map, expectedList);
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaPairRDD.saveToGemfire
- // --------------------------------------------------------------------------------------------
-
- @Test
- public void testPairRDDSaveToGemfireWithDefaultConnConfAndOpConf() throws Exception {
- verifyPairRDDSaveToGemfire(true, true);
- }
-
- @Test
- public void testPairRDDSaveToGemfireWithDefaultConnConf() throws Exception {
- verifyPairRDDSaveToGemfire(true, false);
- }
-
- @Test
- public void testPairRDDSaveToGemfireWithConnConfAndOpConf() throws Exception {
- verifyPairRDDSaveToGemfire(false, true);
- }
-
- @Test
- public void testPairRDDSaveToGemfireWithConnConf() throws Exception {
- verifyPairRDDSaveToGemfire(false, false);
- }
-
- public void verifyPairRDDSaveToGemfire(boolean useDefaultConnConf, boolean useOpConf) throws Exception {
- Region region = prepareStrIntRegion(regionPath, 0, 0); // remove all entries
- JavaPairRDD rdd1 = prepareStrIntJavaPairRDD(0, numObjects);
- Properties opConf = new Properties();
- opConf.put(RDDSaveBatchSizePropKey, "200");
-
- if (useDefaultConnConf) {
- if (useOpConf)
- javaFunctions(rdd1).saveToGemfire(regionPath, opConf);
- else
- javaFunctions(rdd1).saveToGemfire(regionPath);
- } else {
- if (useOpConf)
- javaFunctions(rdd1).saveToGemfire(regionPath, connConf, opConf);
- else
- javaFunctions(rdd1).saveToGemfire(regionPath, connConf);
- }
-
- Set keys = region.keySetOnServer();
- Map map = region.getAll(keys);
-
- List> expectedList = new ArrayList<>();
- for (int i = 0; i < numObjects; i ++) {
- expectedList.add(new Tuple2<>("k_" + i, i));
- }
- matchMapAndPairList(map, expectedList);
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaSparkContext.gemfireRegion and where clause
- // --------------------------------------------------------------------------------------------
-
- @Test
- public void testJavaSparkContextGemfireRegion() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects); // remove all entries
- Properties emptyProps = new Properties();
- GemFireJavaRegionRDD rdd1 = javaFunctions(jsc).gemfireRegion(regionPath);
- GemFireJavaRegionRDD rdd2 = javaFunctions(jsc).gemfireRegion(regionPath, emptyProps);
- GemFireJavaRegionRDD rdd3 = javaFunctions(jsc).gemfireRegion(regionPath, connConf);
- GemFireJavaRegionRDD rdd4 = javaFunctions(jsc).gemfireRegion(regionPath, connConf, emptyProps);
- GemFireJavaRegionRDD rdd5 = rdd1.where("value.intValue() < 50");
-
- HashMap expectedMap = new HashMap<>();
- for (int i = 0; i < numObjects; i ++) {
- expectedMap.put("k_" + i, i);
- }
-
- matchMapAndPairList(expectedMap, rdd1.collect());
- matchMapAndPairList(expectedMap, rdd2.collect());
- matchMapAndPairList(expectedMap, rdd3.collect());
- matchMapAndPairList(expectedMap, rdd4.collect());
-
- HashMap expectedMap2 = new HashMap<>();
- for (int i = 0; i < 50; i ++) {
- expectedMap2.put("k_" + i, i);
- }
-
- matchMapAndPairList(expectedMap2, rdd5.collect());
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaPairRDD.joinGemfireRegion
- // --------------------------------------------------------------------------------------------
-
- @Test
- public void testPairRDDJoinWithSameKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaPairRDD rdd1 = prepareStrIntJavaPairRDD(-5, 10);
-
- JavaPairRDD, Integer> rdd2a = javaFunctions(rdd1).joinGemfireRegion(regionPath);
- JavaPairRDD, Integer> rdd2b = javaFunctions(rdd1).joinGemfireRegion(regionPath, connConf);
- // System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap, Integer> expectedMap = new HashMap<>();
- for (int i = 0; i < 10; i ++) {
- expectedMap.put(new Tuple2<>("k_" + i, i), i);
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
- static class IntIntPairToStrKeyFunction implements Function, String> {
- @Override public String call(Tuple2 pair) throws Exception {
- return "k_" + pair._1();
- }
- }
-
- @Test
- public void testPairRDDJoinWithDiffKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaPairRDD rdd1 = prepareIntIntJavaPairRDD(-5, 10);
- Function, String> func = new IntIntPairToStrKeyFunction();
-
- JavaPairRDD, Integer> rdd2a = javaFunctions(rdd1).joinGemfireRegion(regionPath, func);
- JavaPairRDD, Integer> rdd2b = javaFunctions(rdd1).joinGemfireRegion(regionPath, func, connConf);
- //System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap, Integer> expectedMap = new HashMap<>();
- for (int i = 0; i < 10; i ++) {
- expectedMap.put(new Tuple2<>(i, i * 2), i);
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaPairRDD.outerJoinGemfireRegion
- // --------------------------------------------------------------------------------------------
-
- @Test
- public void testPairRDDOuterJoinWithSameKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaPairRDD rdd1 = prepareStrIntJavaPairRDD(-5, 10);
-
- JavaPairRDD, Option> rdd2a = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath);
- JavaPairRDD, Option> rdd2b = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath, connConf);
- //System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap, Option> expectedMap = new HashMap<>();
- for (int i = -5; i < 10; i ++) {
- if (i < 0)
- expectedMap.put(new Tuple2<>("k_" + i, i), Option.apply((Integer) null));
- else
- expectedMap.put(new Tuple2<>("k_" + i, i), Some.apply(i));
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
- @Test
- public void testPairRDDOuterJoinWithDiffKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaPairRDD rdd1 = prepareIntIntJavaPairRDD(-5, 10);
- Function, String> func = new IntIntPairToStrKeyFunction();
-
- JavaPairRDD, Option> rdd2a = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath, func);
- JavaPairRDD, Option> rdd2b = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath, func, connConf);
- //System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap, Option> expectedMap = new HashMap<>();
- for (int i = -5; i < 10; i ++) {
- if (i < 0)
- expectedMap.put(new Tuple2<>(i, i * 2), Option.apply((Integer) null));
- else
- expectedMap.put(new Tuple2<>(i, i * 2), Some.apply(i));
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaRDD.joinGemfireRegion
- // --------------------------------------------------------------------------------------------
-
- static class IntToStrKeyFunction implements Function {
- @Override public String call(Integer x) throws Exception {
- return "k_" + x;
- }
- }
-
- @Test
- public void testRDDJoinWithSameKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaRDD rdd1 = prepareIntJavaRDD(-5, 10);
-
- Function func = new IntToStrKeyFunction();
- JavaPairRDD rdd2a = javaFunctions(rdd1).joinGemfireRegion(regionPath, func);
- JavaPairRDD rdd2b = javaFunctions(rdd1).joinGemfireRegion(regionPath, func, connConf);
- //System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap expectedMap = new HashMap<>();
- for (int i = 0; i < 10; i ++) {
- expectedMap.put(i, i);
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
- // --------------------------------------------------------------------------------------------
- // JavaRDD.outerJoinGemfireRegion
- // --------------------------------------------------------------------------------------------
-
- @Test
- public void testRDDOuterJoinWithSameKeyType() throws Exception {
- prepareStrIntRegion(regionPath, 0, numObjects);
- JavaRDD rdd1 = prepareIntJavaRDD(-5, 10);
-
- Function func = new IntToStrKeyFunction();
- JavaPairRDD> rdd2a = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath, func);
- JavaPairRDD> rdd2b = javaFunctions(rdd1).outerJoinGemfireRegion(regionPath, func, connConf);
- //System.out.println("=== Result RDD =======\n" + rdd2a.collect() + "\n=========================");
-
- HashMap> expectedMap = new HashMap<>();
- for (int i = -5; i < 10; i ++) {
- if (i < 0)
- expectedMap.put(i, Option.apply((Integer) null));
- else
- expectedMap.put(i, Some.apply(i));
- }
- matchMapAndPairList(expectedMap, rdd2a.collect());
- matchMapAndPairList(expectedMap, rdd2b.collect());
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/ff914bd9/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/Portfolio.java
----------------------------------------------------------------------
diff --git a/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/Portfolio.java b/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/Portfolio.java
deleted file mode 100644
index 5fa03c6..0000000
--- a/geode-spark-connector/gemfire-spark-connector/src/it/java/ittest/io/pivotal/gemfire/spark/connector/Portfolio.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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 ittest.io.pivotal.gemfire.spark.connector;
-
-import java.io.Serializable;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Properties;
-import com.gemstone.gemfire.cache.Declarable;
-
-/**
- * A stock portfolio that consists of multiple {@link Position} objects that
- * represent shares of stock (a "security"). Instances of
- * Portfolio can be stored in a GemFire Region and
- * their contents can be queried using the GemFire query service.
- *
- * This class is Serializable because we want it to be distributed
- * to multiple members of a distributed system. Because this class is
- * Declarable, we can describe instances of it in a GemFire
- * cache.xml file.
- *
- *
- */
-public class Portfolio implements Declarable, Serializable {
-
- private static final long serialVersionUID = 9097335119586059309L;
-
- private int id; /* id is used as the entry key and is stored in the entry */
- private String type;
- private Map positions = new LinkedHashMap();
- private String status;
-
- public Portfolio(Properties props) {
- init(props);
- }
-
- @Override
- public void init(Properties props) {
- this.id = Integer.parseInt(props.getProperty("id"));
- this.type = props.getProperty("type", "type1");
- this.status = props.getProperty("status", "active");
-
- // get the positions. These are stored in the properties object
- // as Positions, not String, so use Hashtable protocol to get at them.
- // the keys are named "positionN", where N is an integer.
- for (Map.Entry