Skip to content

Commit

Permalink
Markdown format improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
jake-at-work committed Aug 29, 2018
1 parent 34ec001 commit 1c349b5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 53 deletions.
16 changes: 9 additions & 7 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@ Set the JAVA\_HOME environment variable. For example:
| OSX | ``export JAVA_HOME=`/usr/libexec/java_home -v 1.8`` |
| Windows | ``set JAVA_HOME="C:\Program Files\Java\jdk1.8.0_121"`` |

Download the project source from the Releases page at [Apache Geode]
(http://geode.apache.org/releases/), and unpack the source code.
Download the project source from the Releases page at
[Apache Geode](http://geode.apache.org/releases/), and unpack the source code.

Within the directory containing the unpacked source code, run the gradle build:

$ ./gradlew build
```console
$ ./gradlew build
```

Once the build completes, the project files will be installed at
`geode-assembly/build/install/apache-geode`. The distribution archives will be
created in `geode-assembly/build/distributions/`.

Verify the installation by invoking the `gfsh` shell command to print version
information:

$ ./geode-assembly/build/install/apache-geode/bin/gfsh version
v1.1.0
```console
$ ./geode-assembly/build/install/apache-geode/bin/gfsh version
v1.1.0
```

Note: on Windows invoke the `gfsh.bat` script to print the version string.
99 changes: 53 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ can load dependencies from [Maven
Central](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.geode%22).

Maven
```
```xml
<dependencies>
<dependency>
<groupId>org.apache.geode</groupId>
Expand All @@ -57,7 +57,7 @@ Maven
```

Gradle
```
```groovy
dependencies {
compile "org.apache.geode:geode-core:$VERSION"
}
Expand Down Expand Up @@ -117,69 +117,76 @@ instructions on how to build the project.

Geode requires installation of JDK version 1.8. After installing Apache Geode,
start a locator and server:

$ gfsh
gfsh> start locator
gfsh> start server
```console
$ gfsh
gfsh> start locator
gfsh> start server
```

Create a region:

gfsh> create region --name=hello --type=REPLICATE
```console
gfsh> create region --name=hello --type=REPLICATE
```

Write a client application (this example uses a [Gradle](https://gradle.org)
build script):

_build.gradle_
```groovy
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'java'
apply plugin: 'application'

mainClassName = 'HelloWorld'
mainClassName = 'HelloWorld'
repositories { mavenCentral() }
dependencies {
compile 'org.apache.geode:geode-core:1.4.0'
runtime 'org.slf4j:slf4j-log4j12:1.7.24'
}
repositories { mavenCentral() }
dependencies {
compile 'org.apache.geode:geode-core:1.4.0'
runtime 'org.slf4j:slf4j-log4j12:1.7.24'
}
```

_src/main/java/HelloWorld.java_

import java.util.Map;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.*;

public class HelloWorld {
public static void main(String[] args) throws Exception {
ClientCache cache = new ClientCacheFactory()
.addPoolLocator("localhost", 10334)
.create();
Region<String, String> region = cache
.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create("hello");

region.put("1", "Hello");
region.put("2", "World");

for (Map.Entry<String, String> entry : region.entrySet()) {
System.out.format("key = %s, value = %s\n", entry.getKey(), entry.getValue());
}
cache.close();
}
```java
import java.util.Map;
import org.apache.geode.cache.Region;
import org.apache.geode.cache.client.*;

public class HelloWorld {
public static void main(String[] args) throws Exception {
ClientCache cache = new ClientCacheFactory()
.addPoolLocator("localhost", 10334)
.create();
Region<String, String> region = cache
.<String, String>createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
.create("hello");

region.put("1", "Hello");
region.put("2", "World");

for (Map.Entry<String, String> entry : region.entrySet()) {
System.out.format("key = %s, value = %s\n", entry.getKey(), entry.getValue());
}
cache.close();
}
}
```

Build and run the `HelloWorld` example:

$ gradle run
```console
$ gradle run
```

The application will connect to the running cluster, create a local cache, put
some data in the cache, and print the cached data to the console:

key = 1, value = Hello
key = 2, value = World
```console
key = 1, value = Hello
key = 2, value = World
```

Finally, shutdown the Geode server and locator:

$ gfsh> shutdown --include-locators=true
```console
gfsh> shutdown --include-locators=true
```

For more information see the [Geode
Examples](https://github.com/apache/geode-examples) repository or the
Expand Down

0 comments on commit 1c349b5

Please sign in to comment.