Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Framework Owner



It is possible to create and control the framework from an external Java application. To be able to do that, you must:

Owner module

Main Article: Owner module

The Owner Module is a unique Module which allows the framework to be created and controlled from an external application. Note that:
  • Only one Owner module can be defined for all the framework
  • If an Owner module is defined, the framework must be called by a framework Owner
  • If the framework is created with a framework Owner, an Owner module must be defined

Example

In the following example, the "module1" module invokes the "service1" service. The "Module2" module is the Owner Module and is notified from the invocation of the service.
frameworkOwner

Application configuration

      <applications>
         <application name="appli1" id="1">
            ...
            <modules>
               <module name="module1" id="1" >
                  <implementation path="..." >
                     ...
                  </implementation>
                  <interfaces>
                     <push service="service1" attach="attach"/>
                  </interfaces>
               </module>
               <ownerModule name="module2" id="2" >
                  <interfaces>
                     <subscribe service="service1"/>>
                  </interfaces>
               </ownerModule>
            </modules>
         </application>
      </applications>

Framework Owner code

The following code implements the FrameworkOwner interface, and only print on the Console the value of a data associated with the Service:
   public class MyOwner implements FrameworkOwner {
     public void subscribe(ServiceInstance service) {
       Data data = service.getData("data1");
       int value = data.getValueAsInt();
       System.out.println(value);
     }
   }

Instanciate and start the framework within the external application

The following code is a complete example which instanciate and start the framework.
      // create the Framework Owner
      MyOwner owner = new MyOwner();
      // create the Framework
      Framework framework = new Framework(owner);
      // setup the Framework, the url points to the framework configuration
      framework.setup(url);
      // start the framework
      framework.start();

See also


Categories: concepts | development

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence