System Runtime

System Runtime

  • Languages iconRomână
    • ENGLISH
    • Ajutati-ne cu Traducerea
  • SUPPORT
  • GITHUB

›Ghiduri

Introducere

  • What is System Runtime ?
  • System Runtime architecture
  • What is Design First ?
  • Prezentare generală

Ghiduri

  • Quick Start
  • How to install System Runtime
  • Design your model
  • Creează componente
  • Manage your components
  • Bundle your system
  • Extend System Runtime
  • Go deeper

Exemple

  • Un elementar ''hello world''
  • Create-a-bundle
  • Install a bundle client-side
  • Instalează un pachet in HTML
  • Instalează un pachet server-side
  • Package a bundle
  • Create a component
  • Crează tipuri noi
  • Crează o relație unu la unu
  • Crează multe relații unu la unu
  • Navighează prin modele
  • Inheritance between components
  • Listen to a change of state of a component
  • Use System Runtime NoSQL Database
  • Object-Document Mapper in action
  • Use System Runtime core apis
  • Use System Runtime history apis
  • Quick Start example

APIS

  • Component Clasă
  • runtime Component
  • metamodel Component
  • logger Component
  • Component db
  • history Component
  • Colecție Document

Despre

  • Cine este în spatele lui System Runtime?
  • License
Translate

Manage your components

A component is a NoSQL Document

All objects are a component in Runtime:

  • a class is a component,
  • an instance of a class is a component,
  • a behavior is a component,
  • all the core objects of System Runtime (runtime, db, metamodel and admin) are components.

All these components are stores in System Runtime NoSQL DB. In fact, System Runtime acts as an ODM (Object-Document Mapper) to manage your components as NoSQL Documents.

Use System Runtime NoSQL Database

To use System Runtime NoSQL DB, just require db component:

runtime.require('db');

All collections of System Runtime NoSQL DB are the schemas you have created.

const metamodel = runtime.require('metamodel');

// create Person schema
metamodel.schema('Person');

metamodel.create();

// count the number of document in Person collection
runtime.require('db').collections().Person.count();

Find a component

To find the a component with NoSQL DB, you have just to use find method on the related collection:

const metamodel = runtime.require('metamodel');

// create a Person schema
metamodel.schema('Person', {
  'firstName': 'property',
  'lastName': 'property'
});

metamodel.create();

// create a Person component
const Person = runtime.require('Person');
const luke = new Person({
  'firstName': 'Luke',
  'lastName': 'Skywalker'
});

// find the related document
const documents = runtime.require('db').collections().Person.find({ 
  'lastName': 'Skywalker'
});

Create a component

To create a component with NoSQL DB, you have just to use insert method on the related collection:

const metamodel = runtime.require('metamodel');

// create Person schema
metamodel.schema('Person', {
  'firstName': 'property',
  'lastName': 'property'
});

metamodel.create();

// create a Person document
runtime.require('db').collections().Person.insert({
  '_id': 'luke',
  'firstName': 'Luke',
  'lastName': 'Skywalker'
});

// a component has been created
// and you can require it
const luke = runtime.require('luke');

luke.firstName();

Update a component

To update a component with NoSQL DB, you have just to use update method on the related collection:

const metamodel = runtime.require('metamodel');

// create Person schema
metamodel.schema('Person', {
  'firstName': 'property',
  'lastName': 'property'
});

metamodel.create();

// create a Person component
const Person = runtime.require('Person');

const luke = new Person({
  'firstName': 'Luke',
  'lastName': 'Skywalker'
});

// update the related document
runtime.require('db').collections().Person.update(
  {
    '_id': luke.id()
  }, 
  { 
    'lastName': 'Starkiller'
  }
);

// property of the component has changed
luke.lastName();

Delete a component

To update a component with NoSQL DB, you have just to use remove method on the related collection:

const metamodel = runtime.require('metamodel');

// create Person schema
metamodel.schema('Person', {
  'firstName': 'property',
  'lastName': 'property'
});

metamodel.create();

// create a Person component
const Person = runtime.require('Person');

const luke = new Person({
  'firstName': 'Luke',
  'lastName': 'Skywalker'
});

// remove the related document
runtime.require('db').collections().Person.remove({
  '_id': luke.id()
});

// try to use the component
luke.lastName();

System Runtime generates this error:

runtime: trying to get the property 'lastName' on the destroyed component '1238d1105

Conclusion

We saw on this article that:

  • everything is a component in System Runtime,
  • you use System Runtime NoSQL DB to find, create, update or delete a component.

In the next article we will talk about systems.

← Creează componenteBundle your system →
  • A component is a NoSQL Document
  • Use System Runtime NoSQL Database
  • Find a component
  • Create a component
  • Update a component
  • Delete a component
  • Conclusion
System Runtime is distributed under Apache License 2.0 - Copyright © 2024 Erwan Carriou