blob: eecff9ecddc978803909c1fb5062515225b32f54 [file] [log] [blame] [view]
Andrew Browne96c16d2015-02-21 15:44:42 -08001# jndn-utils
2
3This project is a collection of tools to simplify synchronous and asynchronous data transfer over the NDN network. It relies on the [NDN Protocol](https://named-data.net) and its associated [client library](https://github.com/named-data/jndn).
4
5## Install
6With Maven, add the following to your POM:
7```
8<dependency>
9 <groupId>com.intel.jndn.utils</groupId>
10 <artifactId>jndn-utils</artifactId>
11 <version>RELEASE</version> <!-- or a specific version -->
12</dependency>
13```
14
andrewsbrown13b11c52015-07-02 14:23:15 -070015## Build
16
17To build, run `mvn install` in the cloned directory. Additionally, you may want
18to run integration tests by running the `nfd-integration-tests` profile with
19a running NFD instance (see [pom.xml](https://github.com/01org/jndn-utils/blob/master/pom.xml) for more details);
20
Andrew Browne96c16d2015-02-21 15:44:42 -080021## Use
andrewsbrown13b11c52015-07-02 14:23:15 -070022
23This library provides `Client`, `Server` and `Repository` interfaces. These
24are implemented in their respective `impl` packages and require Java 8.
25
26Use a `SimpleClient` or `AdvancedClient` (provides segmentation, retries, and streaming)
27 to retrieve data from the network. For example:
Andrew Browne96c16d2015-02-21 15:44:42 -080028```
andrewsbrown7fff8672015-04-07 09:24:17 -070029// retrieve a single Data packet synchronously, will block until complete
andrewsbrown13b11c52015-07-02 14:23:15 -070030Data singleData = SimpleClient.getDefault().getSync(face, name);
andrewsbrown7fff8672015-04-07 09:24:17 -070031
andrewsbrown13b11c52015-07-02 14:23:15 -070032// retrieve segmented Data packets (i.e. with a last Component containing a segment number and a valid FinalBlockId) by name
33CompletableFuture<Data> segmentedData = AdvancedClient.getDefault().getAsync(face, name);
andrewsbrown20ccfdd2015-04-07 09:34:31 -070034```
andrewsbrown7fff8672015-04-07 09:24:17 -070035
andrewsbrown20ccfdd2015-04-07 09:34:31 -070036Use `SimpleServer` or `SegmentedServer` to serve data on the network. For example:
37```
andrewsbrown7fff8672015-04-07 09:24:17 -070038// segment and serve Data packet under a specific prefix
39RepositoryServer server = new SegmentedServer(face, prefix);
40server.serve(largeDataPacket); // call face.processEvents() in an event loop
41
andrewsbrown20ccfdd2015-04-07 09:34:31 -070042// add signatures; this pipeline stage will sign each Data packet prior to being encoded for transport
andrewsbrown7fff8672015-04-07 09:24:17 -070043server.addPipelineStage(new SigningStage(keyChain, signingCertificateName));
Andrew Browne96c16d2015-02-21 15:44:42 -080044```
45
andrewsbrown13b11c52015-07-02 14:23:15 -070046For the full API, see the [Javadoc](http://01org.github.io/jndn-utils/).
47
48## Logging
49
50`jndn-utils` uses Java's default logging utilities (see http://docs.oracle.com/javase/7/docs/api/java/util/logging/package-summary.html). Most messages are logged with the FINER or FINEST status; one way to change this is to add a `logging.properties` file in the classpath with the following lines:
51```
52handlers=java.util.logging.ConsoleHandler
53.level=FINEST
54java.util.logging.ConsoleHandler.level=FINEST
55```
andrewsbrown7fff8672015-04-07 09:24:17 -070056
Andrew Browne96c16d2015-02-21 15:44:42 -080057## License
andrewsbrown13b11c52015-07-02 14:23:15 -070058Copyright &copy; 2015, Intel Corporation.
andrewsbrown4feb2da2015-03-03 16:05:29 -080059
60This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU Lesser General Public License, version 3, as published by the Free Software Foundation.
61
62This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the [GNU Lesser General Public License](https://github.com/01org/jndn-utils/blob/master/LICENSE) for more details.