+ sample updates
This commit is contained in:
@@ -77,12 +77,18 @@ public class CommandProcessor {
|
||||
System.out.println(help);
|
||||
System.out.print("-> ");
|
||||
System.out.flush();
|
||||
try {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
|
||||
|
||||
try {
|
||||
while (threadActive) {
|
||||
if (br.ready()) {
|
||||
System.out.println(process(br.readLine()));
|
||||
try {
|
||||
System.out.println(process(br.readLine()));
|
||||
} catch (Exception ex) {
|
||||
System.out.println("Error executing last command " + ex.getMessage());
|
||||
}
|
||||
|
||||
System.out.print("-> ");
|
||||
System.out.flush();
|
||||
}
|
||||
@@ -107,7 +113,7 @@ public class CommandProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
String process(String line) {
|
||||
String process(final String line) {
|
||||
final Scanner sc = new Scanner(line);
|
||||
|
||||
return template.execute(new GemfireCallback<String>() {
|
||||
@@ -154,9 +160,6 @@ public class CommandProcessor {
|
||||
if ("containsValue".equalsIgnoreCase(command)) {
|
||||
return EMPTY + region.containsValue(arg);
|
||||
}
|
||||
if ("query".equalsIgnoreCase(command)) {
|
||||
return region.query(command).toString();
|
||||
}
|
||||
if ("get".equalsIgnoreCase(command)) {
|
||||
return region.get(arg);
|
||||
}
|
||||
@@ -176,6 +179,12 @@ public class CommandProcessor {
|
||||
return region.put(arg, arg2);
|
||||
}
|
||||
|
||||
// pass the entire string w/o the command
|
||||
if ("query".equalsIgnoreCase(command)) {
|
||||
String query = line.trim().substring(command.length());
|
||||
return region.query(query).toString();
|
||||
}
|
||||
|
||||
sc.close();
|
||||
return "unknown command - run 'help' for available commands";
|
||||
}
|
||||
|
||||
@@ -2,14 +2,20 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:p="http://www.springframework.org/schema/p"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
|
||||
|
||||
<!-- GemFire cache bean -->
|
||||
<bean id="cache" class="org.springframework.data.gemfire.CacheFactoryBean"/>
|
||||
<bean id="cache" class="org.springframework.data.gemfire.CacheFactoryBean">
|
||||
<property name="properties">
|
||||
<util:properties location="cache.properties"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- hello world region -->
|
||||
<!-- since no name is given, the region will be named after the bean -->
|
||||
<bean id="hw-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:dataPolicy="REPLICATE">
|
||||
<bean id="hw-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:dataPolicy="REPLICATE" p:scope="DISTRIBUTED_ACK">
|
||||
<property name="cacheListeners">
|
||||
<bean class="org.springframework.data.gemfire.samples.helloworld.CacheLogger"/>
|
||||
</property>
|
||||
|
||||
@@ -23,6 +23,7 @@ public class BasicTest {
|
||||
|
||||
@Test
|
||||
public void testBasic() throws Exception {
|
||||
Main.main(new String[] {});
|
||||
//Main.main(new String[] {});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user