HelloWorld

The sources of this example are available at github.com/kevoree/samples

1
git clone git@github.com:kevoree/samples.git

  In order to get started you need Java 8+ and Maven

Once you have cloned the project, you can install it locally:

1
2
cd samples/java/helloworld
mvn install

You are now ready to start your first Kevoree Java runtime:

1
mvn kev:run

Now you should be able to see something like this in your console:

1
2
3
Hello World!
00:01 INFO: Model deployed successfully (468ms)
00:01 INFO: Bootstrap succeed

Code example of a Java component:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 *
 * Created by leiko on 12/2/16.
 */
@ComponentType(version = 1)
public class HelloWorld {

    @Start
    public void start() {
        System.out.println("Hello World!");
    }

    @Stop
    public void stop() {
        System.out.println("Bye World!");
    }
}

The sources of this example are available at github.com/kevoree/samples

1
git clone git@github.com:kevoree/samples.git

  In order to get started you need NodeJS

  Kevoree must be used with npm 4.x.y in development mode (ie. npm i -g npm@^4)
npm@^5 is not yet handled by Kevoree for dev mode

Once you have cloned the project, you need to install the dependencies:

1
2
cd samples/js/helloworld
npm i

You are now ready to start your first Kevoree JavaScript runtime in development mode:

1
npm start

Now you should be able to see something like this in your console:

1
2
17:30:17 HelloWorld      Hello World!
17:30:17 Core            Model deployed successfully: 5 adaptations (119ms)

The HelloWorld component is just printing “Hello world!” when the component starts, and “Bye world!” when it stops:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const AbstractComponent = require('kevoree-entities/lib/AbstractComponent');

const HelloWorld = AbstractComponent.extend({
  toString: 'HelloWorld',
  tdef_version: 1,

  start(done) {
    this.log.info('Hello world!');
    done();
  },

  stop(done) {
    this.log.info('Bye world!');
    done();
  }
});