Dynamic Reconfiguration in OW2 FraSCAti (Programmatically)

88 Views Asked by At

I am interested in the dynamic reconfiguration capabilities of OW2 FraSCAti. (e.g Starting/Stopping of SCA Components). So far, I can see that there are two ways to achieve this.

1- By using FraSCAti FScript, as the following:

FraSCAtiFScript> $root
#<scacomponent: reconfig>

FraSCAtiFScript> stop($root)
FraSCAtiFScript> state($root)
STOPPED

FraSCAtiFScript> start($root)
FraSCAtiFScript> state($root)
STARTED 

2- By using FraSCAti Explorer GUI, for example, stopping a component as the following:

enter image description here

But I would like to perform these reconfigurations programmatically, by having an access to the API. Is there an example for doing this?

Source: http://frascati.ow2.org/doc/1.4/ch09s02.html#d95e926

1

There are 1 best solutions below

0
On

You could use the Remote API. From the example:

Reconfigure with FraSCAti FScript

import org.ow2.frascati.remote.introspection.resources.Node;

Collection<Node> result;

System.out.println("Before reconfiguration:");
result = reconfiguration.eval("$domain/scadescendant::services;");
System.out.println(result);

reconfiguration.eval("set-state($domain/scadescendant::services, \"STOPPED\");");

System.out.println("After reconfiguration:");
result = reconfiguration.eval("$domain/scadescendant::services;");
System.out.println(result);

Query with FraSCAti FScript

import org.ow2.frascati.remote.introspection.resources.Node;

Collection<Node> result = reconfiguration.eval( 
    "$domain/scadescendant::component-factory/scaservice::*;"
);

System.out.println(result);