AircraftNetwork
module publish the aircrafts
service, which contain a list of aircrafts from the network. For example, it could be the aircrafts seen by the AWACSRadar
module publish another aircrafts
service, which contain a list of aircrafts seen by the Radaraircrafts
. We could for example consider the following architecture:aircrafts
service represent different data, and may even not contain the same data contentaircrafts
services, so they will still keep their name, but they will live in two different namespaces:<services> <namespace uri="http://aircrafts.com" > <subscribe name="aircrafts" > <data name="aircrafts" type="aircraftsArray" /> </subscribe> </namespace> </services>The
http://aircrafts.com:aircrafts
service key can be checked with:public class myModule { private NamespaceKey AIRCRAFTS = NamespaceKey.createKey("http://aircrafts.com", "aircrafts"); public void subscribe(ServiceInstance service) { NamespaceKey key = service.getKey(); if (key.equals(AIRCRAFTS)) { .. do something with the aircrafts } } }
public class myModule { private ServiceInstance acService = null; public void init(Module module) { NamespaceKey aircraftsKey = NamespaceKey.createKey("http://aircrafts.com", "aircrafts"); acService = module.getService(aircraftsKey); // could also be module.getService(http://aircrafts.com", "aircrafts") } public void start() { ... // populate the aircrafts service acService.invoke(); } }
aircrafts
service:<services> <namespace uri="http://aircrafts.com" > <publish name="aircrafts" > <data name="aircrafts" type="aircraftsArray" /> </publish> </namespace> <namespace uri="http://radar.com" > <publish name="aircrafts" > <data name="aircrafts" type="aircraftsArray" /> </publish> </namespace> </services>
aircraftsArray
type names, so we should also declare our two types in separate namespaces:<services> <namespace uri="http://aircrafts.com" > <structType name="aircraft" > ... </structType> <arrayType name="aircraftsArray" type="aircraft" /> </namespace> <namespace uri="http://radar.com" > <structType name="aircraft" > ... </structType> <arrayType name="aircraftsArray" type="aircraft" /> </namespace> </services>
<module name="AircraftSystem" > <interfaces> <subscribe service="aircrafts" uri="http://aircrafts.com" /> <subscribe service="aircrafts" uri="http://radar.com" /> </interfaces> </module>
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence