Namespaces

Namespaces are the namespaces for applications in a devel.one instance. They include at least one thread with message queue, a target registry, and a service registry. It is thus also possible to have several instances of an application run in a D1 system, since similar services and targets can be accommodated in parallel in different namespaces.

Addresses

Namespaces have their own ID, the namespace ID (NID). The ID can thus be obtained:

IId getNID();

Namespaces also have an address, the INamespaceAddress. In principle this is a target address without a target ID, or more precisely: The target address is a namespace address with additional TID:

INamespaceAddress getAddress();

If the NID or HID is missing in a receiver address, the system will assume that it is the same IDs as in the sender address. There is also a service method, which completes the addresses:

void completeReceiver(final CEnvelope aEnvelope);

Access to Kernel

Using the namespace, you can easily access the kernel, and vice versa. Namespaces are registered in the NamespaceRegistry, a sub-system of the kernel:

IHid getHID();

IKernel getKernel();

Subsystemes

Targets are registered for namespaces. For this there is the target registry:

ITargetRegistry getTargetRegistry();

Services are also registered for namespaces, in the service registry:

IServiceRegistry getServiceRegistry();

For low level notifications, there is - as in the kernel - the SignalRegistry:

ISignalRegistry getSignalRegistry();

Messages are sent in a subclass, the MessageDispatcher:

IMessageSender getDispatcher();

Namespace Datapool

When you create the namespace, you can force the namespace to have its own data pool. For this we need the following setting:

* Path: namespaces/{NID}
* Key: CConstantsDatapool.KEY_USE_OWN_DATAPOOL (= "OwnDatapool")
* Value: Boolean (True; Default: False)

The data pool (more specifically, the H2 database file) is stored in the configuration directory. The name of the file is: namespace{NID}.mv.db

The data pool of the namespace is obtained by the following method:

IDatapool getDatapool();

Standard Namespaces

The devel.one kernel always runs a namespace SYSTEM. If you want to run services that are for the whole devel.one NODE, you can register these services in this namespace.

Plugins also register other namespaces when they are loaded. This includes, in particular, the namespace TRANSPORT for all communication services, TEST for test frameworks and MONITOR for the tooling user interfaces.

Threads or Message Queues

A namespace has at least one thread with a message queue. The threads / message queues are registered in a MessageQueueRegistry. They are given here:

IMessageQueueRegistry getMessageQueueRegistry();

Target monitors

To monitor the registration and deregistration of specific targets, Kernel and Namespaces provide target monitors:

void registerTargetMonitor(ITargetAddress aTargetAddress,
                           ITargetAddress aObserverAddress) throws CException;

void deregisterTargetMonitor(ITargetAddress aTargetAddress,
                             ITargetAddress aObserverAddress) throws CException;

Clients then receive the messages

  • CRecordNotifyTargetRegistered.ID when the target is registered
  • CRecordNotifyTargetDeregistered.ID when the target is deleted.