<commit_before>ddth-zookeeper
==============

DDTH's ZooKeeper Libraries and Utilities: simplify ZooKeeper's usage.

Project home:
[https://github.com/DDTH/ddth-zookeeper](https://github.com/DDTH/ddth-zookeeper)

For OSGi environment, see [ddth-osgizookeeper](https://github.com/DDTH/ddth-osgizookeeper).


## License ##

See LICENSE.txt for details. Copyright (c) 2014 <NAME>.

Third party libraries are distributed under their own licenses.


## Installation #

Latest release version: `0.1.1`. See [RELEASE-NOTES.md](RELEASE-NOTES.md).

Maven dependency:

```xml
<dependency>
	<groupId>com.github.ddth</groupId>
	<artifactId>ddth-zookeeper</artifactId>
	<version>0.1.1</version>
</dependency>
```


## Usage ##

```java
// create and initialize a new ZooKeeperClient client
ZooKeeperClient zkClient = new ZooKeeperClient("localhost:2181");
String path;
boolean status;
String data;

// create a new node, recursively
path = "/parent/child/grandchild1";
status = zkClient.createNode(path); //false is returned if node already exists

// create a new node, with initial data
path = "/parent/child/grandchild2";
data = "grandchild2 - content";
status = zkClient.createNode(path, data);

// read node's data
path = "/parent/child/grandchild2";
data = zkClient.getData(path); //returns  "grandchild2 - content";

// write data to node, fails if node does not exist!
path = "/parent/child/grandchild1";
zkClient.setData(path, "demo");
data = zkClient.getData(path); //returns "demo"
<commit_msg>Update doc<commit_after>ddth-zookeeper
==============

DDTH's ZooKeeper Libraries and Utilities: simplify ZooKeeper's usage.

Project home:
[https://github.com/DDTH/ddth-zookeeper](https://github.com/DDTH/ddth-zookeeper)

For OSGi environment, see [ddth-osgizookeeper](https://github.com/DDTH/ddth-osgizookeeper).


## License ##

See LICENSE.txt for details. Copyright (c) 2014 <NAME>.

Third party libraries are distributed under their own licenses.


## Installation #

Latest release version: `0.1.1`. See [RELEASE-NOTES.md](RELEASE-NOTES.md).

Maven dependency:

```xml
<dependency>
	<groupId>com.github.ddth</groupId>
	<artifactId>ddth-zookeeper</artifactId>
	<version>0.1.1</version>
</dependency>
```


## Usage ##

```java
// create and initialize a new ZooKeeperClient client
ZooKeeperClient zkClient = new ZooKeeperClient("localhost:2181");
zkClient.init(); //don't forget to initialize the client

String path;
boolean status;
String data;

// create a new node, recursively
path = "/parent/child/grandchild1";
status = zkClient.createNode(path); //false is returned if node already exists

// create a new node, with initial data
path = "/parent/child/grandchild2";
data = "grandchild2 - content";
status = zkClient.createNode(path, data);

// read node's data
path = "/parent/child/grandchild2";
data = zkClient.getData(path); //returns  "grandchild2 - content";

// write data to node, fails if node does not exist!
path = "/parent/child/grandchild1";
zkClient.setData(path, "demo");
data = zkClient.getData(path); //returns "demo"

{'fraction_non_alphanumeric': 0.14840408028956895, 'fraction_numerical': 0.013162224415926292, 'mean_word_length': 4.834932821497121, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6357874', 'n_tokens_mistral': 1060, 'n_tokens_neox': 980, 'n_words': 264}