@nicoruti nicoruti released this Mar 7, 2014 · 1036 commits to master since this release

Assets 3

With release 1.1.0, there comes a new set of features and improvements:

  • Support sharing of files among one or multiple users (individual read / write permissions possible)
  • New process framework speeding up the execution of the operations and enhancing the stability
  • More advanced configuration and extension of the library possible
  • Optimized model, removed unneeded objects in the DHT
  • Per-file encryption instead of per-chunk encryption (less key generation)
  • Caching of foreign public keys
  • Many bug fixes
  • Extended javadoc

The interfaces to create a node have slightly changed, allowing a more detailed peer configuration. Here's an example how to create a master and a 'normal' peer:

// master peer configuration
INetworkConfiguration masterConfig = NetworkConfiguration.create("masterID");
// node peer configuration with bootstrap address
INetworkConfiguration nodeConfig = NetworkConfiguration.create("nodeID", InetAddress.getByName(""));
// default file configuration
IFileConfiguration defaultFileConfig = FileConfiguration.createDefault();
IH2HNode master = H2HNode.createNode(masterConfig, defaultFileConfig);
IH2HNode node = H2HNode.createNode(nodeConfig, defaultFileConfig);

Here's an example how to interact with the node:

UserCredentials userCredentials = new UserCredentials("user@hive2hive.com", "password", "1234");
// perform operations on the user management
IUserManager userManager = node.getUserManager();
IProcessComponent registerProcess = userManager.register(userCredentials);
// pause & resume the process
// attach a listener that are called when finished
registerProcess.attachListener(new IProcessComponentListener() {
    public void onSucceeded() {
        System.out.println("Successfully registered");
    public void onFinished() {
        // ignore
    public void onFailed(RollbackReason reason) {
        System.out.println("Failed! Reason: " + reason.getHint());

After a login, the file management can be used:

// for the login, the root folder must be specified
File root = new File(H2HConstants.DEFAULT_ROOT_PATH);
userManager.login(userCredentials, root.toPath());
// add a file
IFileManager fileManager = node.getFileManager();
IProcessComponent addProcess = fileManager.add(new File(root, "demo-file"));