Appjangle Documentation

Video Tutorials


Appjangle Introduction

An introduction to Appjangle and the Appjangle IDE.

Appjangle Basics

An introduction into basic concepts of the Appjangle platform.

Java Basics

Walking through the steps of creating a simple Java application.

Batch Processing and Caching

Demonstration batch processing and caching capabilities of the Appjangle engines.

Documentation


The Appjangle documentation provides resources to get started using the Appjangle client libraries and the Appjangle cloud.

Check out the Getting Started guides for Java and JavaScript.

Also head over to the documentation of the Nextweb API on nextweb.io. Most features of Appjangle can be accessed through this API easily and quickly.


There are currently two Getting Started guides available for Appjangle:

Hello, Java!


This section lists all steps required to create a small application that store the text 'Hello, World' in the Appjangle cloud database.

Step 1: Download Client Libraries

First download the latest version of the Appjangle client libraries from this page.

Chose the 'Appjangle Client with Nextweb API'. The Nextweb API is more declarative in nature than the more low-level onedb API and therefore allows in most cases to write more concise code.

If you use Maven in your project, you can also use the provided Maven dependencies to link the library to your project.

Step 2: Link Client Libraries

Create a new project in your favourite IDE. This example will make use of eclipse.

Copy the downloaded .jar file into a your project directory (e.g. 'lib') and add the library to the classpath/ build path.

Step 3: Write App to Upload Data

Create a new class with the name 'Upload'. Add a Java main method to the class as follows:

import io.nextweb.Query;
import io.nextweb.Session;
import io.nextweb.jre.Nextweb;

public class Upload {

    public static void main(String[] args) {
        Session session = Nextweb.createSession();

        Query hello = session.seed().append("Hello, Java!");

        System.out.println("Created:\n"+hello.get());

        session.close().get();
    }

}

Running this application should result in an output such as the following:

Created:
node("http://slicnet.com/seed1/seed1/2/1/2/h/sd/Hello__1", 
  class java.lang.String)
                        

You can now access the created node using the reported URI. For instance, by opening http://slicnet.com/seed1/seed1/2/1/2/h/sd/Hello__1 in a web browser.

Step 4: Learn to Write Awesome Apps on Nextweb.io

Head over to the interactive documentation on Nextweb.io to learn about all features supported by the Nextweb API.

You can also fork the Hello World App on github!


Hello, JavaScript!


This section lists all steps required to create a small application creates the data for a person on the cloud.

Step 1: Create HTML Wrapper

Create a new file app.html on your computer and edit it with your favorite HTML editor. Paste the following content into the file:

<html>
  <body>
    <script src='http://appjangle.com/js/v01/appjangle/appjangle.nocache.js'>
    </script>

    <script>
       window.onAJ = function() {
         // app code
       };
    </script>
  </body>
</html>

Step 2: Write App to Create Data

Replace the text // app code with the following application:

var session = Nextweb.createSession();
var person = session.seed();

person.append("Jane", "./firstName");
person.append("Gold", "./lastName");

person.get(function(person) {
  document.body.innerHTML = '<a href="'+person.uri()+'">data</a>';
});

session.close().get();

Save app.html and close your editor.

Step 3: Run App

Open the file 'app.html' with a web browser such as Google Chrome or Firefox.

A text 'data' should appear. If you click it, you can explore the data created on the cloud.

Step 4: Build Apps Hosted on Our Cloud

Soon you'll be able to develop JS apps on our cloud using the Appjangle IDE.

Here, for instance, is the example app uploaded to our server:

app.html

The core Appjangle libraries are available for these platforms:

Android


Appjangle provides full support for Android applications. All operations of the Nextweb API are available on Android.

Usage

In order to use Appjangle in an Android project, download the Android Client Libraries and place them in your Android project's 'lib' folder or add gradle compile dependency to the respective Maven artifact.

Local Persistence

The Appjangle client libraries come bundled with a plugin, which allows to persist data replicated from the Appjangle cloud in a local SQLite database (AndroidPersistence by zedvoid).

Local persistence of replicated data can be enabled by replacing Nextweb.createSession() with an Android-specific constructor for sessions, AppjangleAndroid.createSession(Context context).

Session session = AppjangleAndroid.
               createSession(getApplicationContext());

The parameter of createSession should conform to the following:

  • getApplicationContext() should return a valid Android Context object.

The created session needs to be closed with session.close(). In addition, when the android application is to be closed, AppjangleAndroid.shutdown() should be called. This will assure that all outstanding writes for the caches are written to disk.


Desktop Java


Appjangle can be used in Desktop Java environments, for instance using Oracles JRE or OpenJDK.

Usage

You can either download the Desktop Java Client libraries and link them directly to your project or add a Maven dependency to the client libraries (find instructions for this on the Downloads page as well).

Local Persistence

The Appjangle client libraries for Desktop Java provide support for creating a local copy of data replicated from the Appjangle cloud. Such a local copy can increase performance for some operations dramaticall, since server round-trips can be omitted.

The currently supported persistence saves nodes as files in a folder when a new Nextweb Session is created in the following way:

Session s = AppjangleJre.createSession();

Creating a session in this way will store nodes replicated from the Appjangle cloud in the directory 'user.home'.

Optionally, a path to a folder can be supplied to the createSession() method as Java Java File object (see createSession(File sharedCacheFolder)).

Session s = AppjangleJre.createSession(new File("/path/to/folder"));

Any replication folder should only be used by only one session at any one time. To delete replicated data, simply clear out the folder on the file system.

JavaScript


Appjangle provides JavaScript libraries with full support for the Nextweb API.

Usage

The JavaScript libraries are hosted on the Appjangle cloud (see Downloads). These libraries can be embedded in any web page.

To create a new Nextweb session, add code such as the following to your HTML page:

window.onAJ = function() {
    var session = AppjangleJs.createSession();
};

Note that the Appjangle JavaScript libaries are loaded in an asynchronous way. Thus, AppjangleJs.createSession() should only be called within a callback function assinged to the global variable window.onAJ.

Check out the Hello, JavaScript page for more information on how to use Appjangle in JavaScript apps.


Icon credits: Movie Icon by Mazenl77, Toybox by Devinatdark, Folder by netalloy