summaryrefslogtreecommitdiffstats
path: root/controlloop/templates/template.demo.clc
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/templates/template.demo.clc')
-rw-r--r--controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl27
1 files changed, 23 insertions, 4 deletions
diff --git a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
index f2584c063..1d8e6c511 100644
--- a/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
+++ b/controlloop/templates/template.demo.clc/src/main/resources/__closedLoopControlName__.drl
@@ -45,6 +45,7 @@ import org.onap.policy.appclcm.LcmCommonHeader;
import org.onap.policy.vfc.VfcRequest;
import org.onap.policy.vfc.VfcResponse;
import org.onap.policy.vfc.VfcManager;
+import org.onap.policy.so.SoManager;
import org.onap.policy.so.SoRequest;
import org.onap.policy.so.SoResponseWrapper;
import org.onap.policy.guard.PolicyGuard;
@@ -584,14 +585,32 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
if(request instanceof SoRequest) {
// Call SO. The response will be inserted into memory once it's received
- SoActorServiceProvider.sendRequest($event.getRequestId().toString(), drools.getWorkingMemory(),
- request);
- }
+ class mySoCallback implements SoManager.SoCallback {
+ public void onSoResponseWrapper(SoResponseWrapper wrapper) {
+ drools.getWorkingMemory().insert(wrapper);
+ }
+ }
+ SoActorServiceProvider.sendRequest($event.getRequestId().toString(),
+ new mySoCallback(),
+ request,
+ PolicyEngine.manager.getEnvironmentProperty("so.url"),
+ PolicyEngine.manager.getEnvironmentProperty("so.username"),
+ PolicyEngine.manager.getEnvironmentProperty("so.password")); }
break;
case "VFC":
if (request instanceof VfcRequest) {
// Start VFC thread
- Thread t = new Thread(new VfcManager(drools.getWorkingMemory(), (VfcRequest)request));
+ class myVfcCallback implements VfcManager.VfcCallback {
+ public void onResponse(VfcResponse responseError) {
+ drools.getWorkingMemory().insert(responseError);
+ }
+ };
+ // Start VFC thread
+ Thread t = new Thread(new VfcManager(new myVfcCallback(),
+ (VfcRequest)request,
+ PolicyEngine.manager.getEnvironmentProperty("vfc.url"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.username"),
+ PolicyEngine.manager.getEnvironmentProperty("vfc.password")));
t.start();
}
break;