diff options
author | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 23:48:50 +0100 |
---|---|---|
committer | liamfallon <liam.fallon@ericsson.com> | 2018-09-13 23:49:32 +0100 |
commit | cd68fc9bae7d6258f77ff59c1431e4f925f61a4c (patch) | |
tree | 53054a7c8e8738644785039c3a200c6b23d4b3ed /examples | |
parent | 4cfa2e2d98f6877d54da304ef17f096284430908 (diff) |
Address sonar/Checkstyle Issues
Sweep through Apex codebase to fix most ceheckstyle and
straightforward sonar issues.
Issue-ID: POLICY-1034
Change-Id: I149d9a94ad893affc93573e8de5e3304b6bdde2d
Signed-off-by: liamfallon <liam.fallon@ericsson.com>
Diffstat (limited to 'examples')
29 files changed, 721 insertions, 614 deletions
diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java index 376643211..c0003ac68 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelFactory.java @@ -50,6 +50,33 @@ import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; * The Class AADMDomainModelFactory. */ public class AadmDomainModelFactory { + // Recurring string constants + private static final String MATCH = "Match"; + private static final String ESTABLISH = "Establish"; + private static final String DECIDE = "Decide"; + private static final String TASK_SELECTION_LOGIC = "TaskSelectionLogic"; + private static final String DEFAULT_TASK_LOGIC = "DefaultTaskLogic"; + private static final String TASK_LOGIC = "TaskLogic"; + private static final String VERSION = "VERSION"; + private static final String THRESHOLD = "THRESHOLD"; + private static final String PROFILE2 = "PROFILE"; + private static final String BLACKLIST_ON = "BLACKLIST_ON"; + private static final String ACTTASK = "ACTTASK"; + private static final String TCP_ON = "TCP_ON"; + private static final String PROBE_ON = "PROBE_ON"; + private static final String APPLICATION = "APPLICATION"; + private static final String NW_IP = "NW_IP"; + private static final String IMSI_IP = "IMSI_IP"; + private static final String ENODEB_ID = "ENODEB_ID"; + private static final String DEFAULT_SOURCE = "External"; + private static final String DEFAULT_NAMESPACE = "org.onap.policy.apex.examples.aadm.events"; + private static final String JAVA_LANG_INTEGER = "java.lang.Integer"; + private static final String JAVA_LANG_DOUBLE = "java.lang.Double"; + private static final String JAVA_LANG_BOOLEAN = "java.lang.Boolean"; + private static final String JAVA_LANG_STRING = "java.lang.String"; + private static final String JAVA_LANG_LONG = "java.lang.Long"; + private static final String DEFAULT_VERSION = "0.0.1"; + /** * Gets the AADM policy model. * @@ -59,59 +86,61 @@ public class AadmDomainModelFactory { public AxPolicyModel getAadmPolicyModel() { // CHECKSTYLE:ON: checkstyle // Data types for event parameters - final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema ueIpAddress = - new AxContextSchema(new AxArtifactKey("UEIPAddress", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema nwIpAddress = - new AxContextSchema(new AxArtifactKey("NWIPAddress", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema dosFlag = - new AxContextSchema(new AxArtifactKey("DOSFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema roundTripTime = - new AxContextSchema(new AxArtifactKey("RoundTripTime", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema applicationName = - new AxContextSchema(new AxArtifactKey("ApplicationName", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema protocolGroup = - new AxContextSchema(new AxArtifactKey("ProtocolGroup", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema eNodeBId = - new AxContextSchema(new AxArtifactKey("ENodeBID", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema httpHostClass = - new AxContextSchema(new AxArtifactKey("HttpHostClass", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema tcpOnFlag = - new AxContextSchema(new AxArtifactKey("TCPOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema probeOnFlag = - new AxContextSchema(new AxArtifactKey("ProbeOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema blacklistOnFlag = - new AxContextSchema(new AxArtifactKey("BlacklistOnFlag", "0.0.1"), "Java", "java.lang.Boolean"); - final AxContextSchema averageThroughput = - new AxContextSchema(new AxArtifactKey("AverageThroughput", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema serviceRequestCount = - new AxContextSchema(new AxArtifactKey("ServiceRequestCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema attchCount = - new AxContextSchema(new AxArtifactKey("AttachCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema subscriberCount = - new AxContextSchema(new AxArtifactKey("SubscriberCount", "0.0.1"), "Java", "java.lang.Integer"); - final AxContextSchema averageServiceRequest = - new AxContextSchema(new AxArtifactKey("AverageServiceRequest", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema averageAttach = - new AxContextSchema(new AxArtifactKey("AverageAttach", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema actionTask = - new AxContextSchema(new AxArtifactKey("ActionTask", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema version = - new AxContextSchema(new AxArtifactKey("Version", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema profile = - new AxContextSchema(new AxArtifactKey("Profile", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema threshold = - new AxContextSchema(new AxArtifactKey("Threshold", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema triggerSpec = - new AxContextSchema(new AxArtifactKey("TriggerSpec", "0.0.1"), "Java", "java.lang.String"); - final AxContextSchema periodicEventCount = - new AxContextSchema(new AxArtifactKey("PeriodicEventCount", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema periodicDelay = - new AxContextSchema(new AxArtifactKey("PeriodicDelay", "0.0.1"), "Java", "java.lang.Long"); - final AxContextSchema periodicTime = - new AxContextSchema(new AxArtifactKey("PeriodicTime", "0.0.1"), "Java", "java.lang.Long"); - - final AxContextSchemas aadmContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + final AxContextSchema imsi = new AxContextSchema(new AxArtifactKey("IMSI", DEFAULT_VERSION), "Java", + JAVA_LANG_LONG); + final AxContextSchema ueIpAddress = new AxContextSchema(new AxArtifactKey("UEIPAddress", DEFAULT_VERSION), + "Java", JAVA_LANG_STRING); + final AxContextSchema nwIpAddress = new AxContextSchema(new AxArtifactKey("NWIPAddress", DEFAULT_VERSION), + "Java", JAVA_LANG_STRING); + final AxContextSchema dosFlag = new AxContextSchema(new AxArtifactKey("DOSFlag", DEFAULT_VERSION), "Java", + JAVA_LANG_BOOLEAN); + final AxContextSchema roundTripTime = new AxContextSchema(new AxArtifactKey("RoundTripTime", DEFAULT_VERSION), + "Java", JAVA_LANG_LONG); + final AxContextSchema applicationName = new AxContextSchema( + new AxArtifactKey("ApplicationName", DEFAULT_VERSION), "Java", JAVA_LANG_STRING); + final AxContextSchema protocolGroup = new AxContextSchema(new AxArtifactKey("ProtocolGroup", DEFAULT_VERSION), + "Java", JAVA_LANG_STRING); + final AxContextSchema eNodeBId = new AxContextSchema(new AxArtifactKey("ENodeBID", DEFAULT_VERSION), "Java", + JAVA_LANG_LONG); + final AxContextSchema httpHostClass = new AxContextSchema(new AxArtifactKey("HttpHostClass", DEFAULT_VERSION), + "Java", JAVA_LANG_STRING); + final AxContextSchema tcpOnFlag = new AxContextSchema(new AxArtifactKey("TCPOnFlag", DEFAULT_VERSION), "Java", + JAVA_LANG_BOOLEAN); + final AxContextSchema probeOnFlag = new AxContextSchema(new AxArtifactKey("ProbeOnFlag", DEFAULT_VERSION), + "Java", JAVA_LANG_BOOLEAN); + final AxContextSchema blacklistOnFlag = new AxContextSchema( + new AxArtifactKey("BlacklistOnFlag", DEFAULT_VERSION), "Java", JAVA_LANG_BOOLEAN); + final AxContextSchema averageThroughput = new AxContextSchema( + new AxArtifactKey("AverageThroughput", DEFAULT_VERSION), "Java", JAVA_LANG_DOUBLE); + final AxContextSchema serviceRequestCount = new AxContextSchema( + new AxArtifactKey("ServiceRequestCount", DEFAULT_VERSION), "Java", JAVA_LANG_INTEGER); + final AxContextSchema attchCount = new AxContextSchema(new AxArtifactKey("AttachCount", DEFAULT_VERSION), + "Java", JAVA_LANG_INTEGER); + final AxContextSchema subscriberCount = new AxContextSchema( + new AxArtifactKey("SubscriberCount", DEFAULT_VERSION), "Java", JAVA_LANG_INTEGER); + final AxContextSchema averageServiceRequest = new AxContextSchema( + new AxArtifactKey("AverageServiceRequest", DEFAULT_VERSION), "Java", JAVA_LANG_DOUBLE); + final AxContextSchema averageAttach = new AxContextSchema(new AxArtifactKey("AverageAttach", DEFAULT_VERSION), + "Java", JAVA_LANG_DOUBLE); + final AxContextSchema actionTask = new AxContextSchema(new AxArtifactKey("ActionTask", DEFAULT_VERSION), "Java", + JAVA_LANG_STRING); + final AxContextSchema version = new AxContextSchema(new AxArtifactKey("Version", DEFAULT_VERSION), "Java", + JAVA_LANG_STRING); + final AxContextSchema profile = new AxContextSchema(new AxArtifactKey("Profile", DEFAULT_VERSION), "Java", + JAVA_LANG_STRING); + final AxContextSchema threshold = new AxContextSchema(new AxArtifactKey("Threshold", DEFAULT_VERSION), "Java", + JAVA_LANG_LONG); + final AxContextSchema triggerSpec = new AxContextSchema(new AxArtifactKey("TriggerSpec", DEFAULT_VERSION), + "Java", JAVA_LANG_STRING); + final AxContextSchema periodicEventCount = new AxContextSchema( + new AxArtifactKey("PeriodicEventCount", DEFAULT_VERSION), "Java", JAVA_LANG_LONG); + final AxContextSchema periodicDelay = new AxContextSchema(new AxArtifactKey("PeriodicDelay", DEFAULT_VERSION), + "Java", JAVA_LANG_LONG); + final AxContextSchema periodicTime = new AxContextSchema(new AxArtifactKey("PeriodicTime", DEFAULT_VERSION), + "Java", JAVA_LANG_LONG); + + final AxContextSchemas aadmContextSchemas = new AxContextSchemas( + new AxArtifactKey("AADMDatatypes", DEFAULT_VERSION)); aadmContextSchemas.getSchemasMap().put(imsi.getKey(), imsi); aadmContextSchemas.getSchemasMap().put(ueIpAddress.getKey(), ueIpAddress); aadmContextSchemas.getSchemasMap().put(nwIpAddress.getKey(), nwIpAddress); @@ -139,161 +168,165 @@ public class AadmDomainModelFactory { aadmContextSchemas.getSchemasMap().put(periodicDelay.getKey(), periodicDelay); aadmContextSchemas.getSchemasMap().put(periodicTime.getKey(), periodicTime); - final AxEvent aadmEvent = - new AxEvent(new AxArtifactKey("AADMEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - aadmEvent.setSource("External"); + final AxEvent aadmEvent = new AxEvent(new AxArtifactKey("AADMEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + aadmEvent.setSource(DEFAULT_SOURCE); aadmEvent.setTarget("Apex"); aadmEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); - aadmEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); - aadmEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); - aadmEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "IMSI"), imsi.getKey())); + aadmEvent.getParameterMap().put(ENODEB_ID, + new AxField(new AxReferenceKey(aadmEvent.getKey(), ENODEB_ID), eNodeBId.getKey())); + aadmEvent.getParameterMap().put(IMSI_IP, + new AxField(new AxReferenceKey(aadmEvent.getKey(), IMSI_IP), ueIpAddress.getKey())); + aadmEvent.getParameterMap().put(NW_IP, + new AxField(new AxReferenceKey(aadmEvent.getKey(), NW_IP), nwIpAddress.getKey())); aadmEvent.getParameterMap().put("DoS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); - aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX"), roundTripTime.getKey())); - aadmEvent.getParameterMap().put("TCP_UE_SIDE_AVG_THROUGHPUT", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_AVG_THROUGHPUT"), averageThroughput.getKey())); - aadmEvent.getParameterMap().put("APPLICATION", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "APPLICATION"), applicationName.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "DoS"), dosFlag.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_MEDIAN_RTT_TX_TO_RX"), + roundTripTime.getKey())); + aadmEvent.getParameterMap().put("TCP_UE_SIDE_AVG_THROUGHPUT", + new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_UE_SIDE_AVG_THROUGHPUT"), + averageThroughput.getKey())); + aadmEvent.getParameterMap().put(APPLICATION, + new AxField(new AxReferenceKey(aadmEvent.getKey(), APPLICATION), applicationName.getKey())); aadmEvent.getParameterMap().put("protocol_group", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "protocol_group"), protocolGroup.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "protocol_group"), protocolGroup.getKey())); aadmEvent.getParameterMap().put("http_host_class", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "http_host_class"), httpHostClass.getKey())); - aadmEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - aadmEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "http_host_class"), httpHostClass.getKey())); + aadmEvent.getParameterMap().put(PROBE_ON, + new AxField(new AxReferenceKey(aadmEvent.getKey(), PROBE_ON), probeOnFlag.getKey())); + aadmEvent.getParameterMap().put(TCP_ON, + new AxField(new AxReferenceKey(aadmEvent.getKey(), TCP_ON), tcpOnFlag.getKey())); aadmEvent.getParameterMap().put("SGW_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIpAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "SGW_IP_ADDRESS"), nwIpAddress.getKey())); aadmEvent.getParameterMap().put("UE_IP_ADDRESS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIpAddress.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "UE_IP_ADDRESS"), ueIpAddress.getKey())); aadmEvent.getParameterMap().put("SERVICE_REQUEST_COUNT", new AxField( - new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); + new AxReferenceKey(aadmEvent.getKey(), "SERVICE_REQUEST_COUNT"), serviceRequestCount.getKey())); aadmEvent.getParameterMap().put("ATTACH_COUNT", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ATTACH_COUNT"), attchCount.getKey())); - aadmEvent.getParameterMap().put("NUM_SUBSCRIBERS", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "NUM_SUBSCRIBERS"), subscriberCount.getKey())); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "ATTACH_COUNT"), attchCount.getKey())); + aadmEvent.getParameterMap().put("NUM_SUBSCRIBERS", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "NUM_SUBSCRIBERS"), subscriberCount.getKey())); aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_SERVICE_REQUEST", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_SERVICE_REQUEST"), - averageServiceRequest.getKey())); - aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_ATTACH", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_ATTACH"), averageAttach.getKey())); - aadmEvent.getParameterMap().put("ACTTASK", - new AxField(new AxReferenceKey(aadmEvent.getKey(), "ACTTASK"), actionTask.getKey())); - - final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", "0.0.1"), - "org.onap.policy.apex.examples.aadm.events"); + new AxField(new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_SERVICE_REQUEST"), + averageServiceRequest.getKey())); + aadmEvent.getParameterMap().put("AVG_SUBSCRIBER_ATTACH", new AxField( + new AxReferenceKey(aadmEvent.getKey(), "AVG_SUBSCRIBER_ATTACH"), averageAttach.getKey())); + aadmEvent.getParameterMap().put(ACTTASK, + new AxField(new AxReferenceKey(aadmEvent.getKey(), ACTTASK), actionTask.getKey())); + + final AxEvent aadmXStreamActEvent = new AxEvent(new AxArtifactKey("XSTREAM_AADM_ACT_EVENT", DEFAULT_VERSION), + DEFAULT_NAMESPACE); aadmXStreamActEvent.setSource("Apex"); - aadmXStreamActEvent.setTarget("External"); + aadmXStreamActEvent.setTarget(DEFAULT_SOURCE); aadmXStreamActEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); - aadmXStreamActEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); - aadmXStreamActEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); - aadmXStreamActEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); - aadmXStreamActEvent.getParameterMap().put("ACTTASK", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "ACTTASK"), actionTask.getKey())); - aadmXStreamActEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("VERSION", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "VERSION"), version.getKey())); - aadmXStreamActEvent.getParameterMap().put("TRIGGER_SPEC", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "TRIGGER_SPEC"), triggerSpec.getKey())); + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "IMSI"), imsi.getKey())); + aadmXStreamActEvent.getParameterMap().put(IMSI_IP, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), IMSI_IP), ueIpAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put(ENODEB_ID, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), ENODEB_ID), eNodeBId.getKey())); + aadmXStreamActEvent.getParameterMap().put(NW_IP, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), NW_IP), nwIpAddress.getKey())); + aadmXStreamActEvent.getParameterMap().put(ACTTASK, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), ACTTASK), actionTask.getKey())); + aadmXStreamActEvent.getParameterMap().put(PROBE_ON, new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), PROBE_ON), probeOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put(TCP_ON, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), TCP_ON), tcpOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put(VERSION, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), VERSION), version.getKey())); + aadmXStreamActEvent.getParameterMap().put("TRIGGER_SPEC", new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), "TRIGGER_SPEC"), triggerSpec.getKey())); aadmXStreamActEvent.getParameterMap().put("MAJ_MIN_MAINT_VERSION", new AxField( - new AxReferenceKey(aadmXStreamActEvent.getKey(), "MAJ_MIN_MAINT_VERSION"), version.getKey())); - aadmXStreamActEvent.getParameterMap().put("BLACKLIST_ON", new AxField( - new AxReferenceKey(aadmXStreamActEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - aadmXStreamActEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "PROFILE"), profile.getKey())); - aadmXStreamActEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), "THRESHOLD"), threshold.getKey())); - - final AxEvent vMmeEvent = - new AxEvent(new AxArtifactKey("VMMEEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - vMmeEvent.setSource("External"); + new AxReferenceKey(aadmXStreamActEvent.getKey(), "MAJ_MIN_MAINT_VERSION"), version.getKey())); + aadmXStreamActEvent.getParameterMap().put(BLACKLIST_ON, new AxField( + new AxReferenceKey(aadmXStreamActEvent.getKey(), BLACKLIST_ON), blacklistOnFlag.getKey())); + aadmXStreamActEvent.getParameterMap().put(PROFILE2, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), PROFILE2), profile.getKey())); + aadmXStreamActEvent.getParameterMap().put(THRESHOLD, + new AxField(new AxReferenceKey(aadmXStreamActEvent.getKey(), THRESHOLD), threshold.getKey())); + + final AxEvent vMmeEvent = new AxEvent(new AxArtifactKey("VMMEEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + vMmeEvent.setSource(DEFAULT_SOURCE); vMmeEvent.setTarget("Apex"); vMmeEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI"), imsi.getKey())); - vMmeEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); - vMmeEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); - vMmeEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); - vMmeEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "PROFILE"), profile.getKey())); - vMmeEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(vMmeEvent.getKey(), "THRESHOLD"), threshold.getKey())); - - final AxEvent sapcEvent = - new AxEvent(new AxArtifactKey("SAPCEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); - sapcEvent.setSource("External"); + new AxField(new AxReferenceKey(vMmeEvent.getKey(), "IMSI"), imsi.getKey())); + vMmeEvent.getParameterMap().put(ENODEB_ID, + new AxField(new AxReferenceKey(vMmeEvent.getKey(), ENODEB_ID), eNodeBId.getKey())); + vMmeEvent.getParameterMap().put(IMSI_IP, + new AxField(new AxReferenceKey(vMmeEvent.getKey(), IMSI_IP), ueIpAddress.getKey())); + vMmeEvent.getParameterMap().put(NW_IP, + new AxField(new AxReferenceKey(vMmeEvent.getKey(), NW_IP), nwIpAddress.getKey())); + vMmeEvent.getParameterMap().put(PROFILE2, + new AxField(new AxReferenceKey(vMmeEvent.getKey(), PROFILE2), profile.getKey())); + vMmeEvent.getParameterMap().put(THRESHOLD, + new AxField(new AxReferenceKey(vMmeEvent.getKey(), THRESHOLD), threshold.getKey())); + + final AxEvent sapcEvent = new AxEvent(new AxArtifactKey("SAPCEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + sapcEvent.setSource(DEFAULT_SOURCE); sapcEvent.setTarget("Apex"); sapcEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); - sapcEvent.getParameterMap().put("ENODEB_ID", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "ENODEB_ID"), eNodeBId.getKey())); - sapcEvent.getParameterMap().put("IMSI_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); - sapcEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); - sapcEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROFILE"), profile.getKey())); - sapcEvent.getParameterMap().put("THRESHOLD", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "THRESHOLD"), threshold.getKey())); - sapcEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - sapcEvent.getParameterMap().put("PROBE_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - sapcEvent.getParameterMap().put("VERSION", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "VERSION"), version.getKey())); - sapcEvent.getParameterMap().put("BLACKLIST_ON", - new AxField(new AxReferenceKey(sapcEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - - final AxEvent sapcBlacklistSubscriberEvent = - new AxEvent(new AxArtifactKey("SAPCBlacklistSubscriberEvent", "0.0.1"), - "org.onap.policy.apex.examples.aadm.events"); + new AxField(new AxReferenceKey(sapcEvent.getKey(), "IMSI"), imsi.getKey())); + sapcEvent.getParameterMap().put(ENODEB_ID, + new AxField(new AxReferenceKey(sapcEvent.getKey(), ENODEB_ID), eNodeBId.getKey())); + sapcEvent.getParameterMap().put(IMSI_IP, + new AxField(new AxReferenceKey(sapcEvent.getKey(), IMSI_IP), ueIpAddress.getKey())); + sapcEvent.getParameterMap().put(NW_IP, + new AxField(new AxReferenceKey(sapcEvent.getKey(), NW_IP), nwIpAddress.getKey())); + sapcEvent.getParameterMap().put(PROFILE2, + new AxField(new AxReferenceKey(sapcEvent.getKey(), PROFILE2), profile.getKey())); + sapcEvent.getParameterMap().put(THRESHOLD, + new AxField(new AxReferenceKey(sapcEvent.getKey(), THRESHOLD), threshold.getKey())); + sapcEvent.getParameterMap().put(TCP_ON, + new AxField(new AxReferenceKey(sapcEvent.getKey(), TCP_ON), tcpOnFlag.getKey())); + sapcEvent.getParameterMap().put(PROBE_ON, + new AxField(new AxReferenceKey(sapcEvent.getKey(), PROBE_ON), probeOnFlag.getKey())); + sapcEvent.getParameterMap().put(VERSION, + new AxField(new AxReferenceKey(sapcEvent.getKey(), VERSION), version.getKey())); + sapcEvent.getParameterMap().put(BLACKLIST_ON, + new AxField(new AxReferenceKey(sapcEvent.getKey(), BLACKLIST_ON), blacklistOnFlag.getKey())); + + final AxEvent sapcBlacklistSubscriberEvent = new AxEvent( + new AxArtifactKey("SAPCBlacklistSubscriberEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); sapcBlacklistSubscriberEvent.setSource("Apex"); - sapcBlacklistSubscriberEvent.setTarget("External"); + sapcBlacklistSubscriberEvent.setTarget(DEFAULT_SOURCE); sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI"), imsi.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("PROFILE", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROFILE"), profile.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("BLACKLIST_ON", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "BLACKLIST_ON"), blacklistOnFlag.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("IMSI_IP", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI_IP"), ueIpAddress.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("NW_IP", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "NW_IP"), nwIpAddress.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("PROBE_ON", new AxField( - new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "PROBE_ON"), probeOnFlag.getKey())); - sapcBlacklistSubscriberEvent.getParameterMap().put("TCP_ON", - new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "TCP_ON"), tcpOnFlag.getKey())); - - final AxEvent periodicEvent = - new AxEvent(new AxArtifactKey("PeriodicEvent", "0.0.1"), "org.onap.policy.apex.examples.aadm.events"); + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), "IMSI"), imsi.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(PROFILE2, new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), PROFILE2), profile.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(BLACKLIST_ON, + new AxField(new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), BLACKLIST_ON), + blacklistOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(IMSI_IP, new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), IMSI_IP), ueIpAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(NW_IP, new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), NW_IP), nwIpAddress.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(PROBE_ON, new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), PROBE_ON), probeOnFlag.getKey())); + sapcBlacklistSubscriberEvent.getParameterMap().put(TCP_ON, new AxField( + new AxReferenceKey(sapcBlacklistSubscriberEvent.getKey(), TCP_ON), tcpOnFlag.getKey())); + + final AxEvent periodicEvent = new AxEvent(new AxArtifactKey("PeriodicEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); periodicEvent.setSource("System"); periodicEvent.setTarget("Apex"); - periodicEvent.getParameterMap().put("PERIODIC_EVENT_COUNT", new AxField( - new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_EVENT_COUNT"), periodicEventCount.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_DELAY", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_DELAY"), periodicDelay.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_FIRST_TIME", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_FIRST_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_EVENT_COUNT", + new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_EVENT_COUNT"), + periodicEventCount.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_DELAY", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_DELAY"), periodicDelay.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_FIRST_TIME", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_FIRST_TIME"), periodicTime.getKey())); periodicEvent.getParameterMap().put("PERIODIC_CURRENT_TIME", new AxField( - new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_CURRENT_TIME"), periodicTime.getKey())); - periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", - new AxField(new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_CURRENT_TIME"), periodicTime.getKey())); + periodicEvent.getParameterMap().put("PERIODIC_LAST_TIME", new AxField( + new AxReferenceKey(periodicEvent.getKey(), "PERIODIC_LAST_TIME"), periodicTime.getKey())); - final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", "0.0.1")); + final AxEvents aadmEvents = new AxEvents(new AxArtifactKey("AADMEvents", DEFAULT_VERSION)); aadmEvents.getEventMap().put(aadmEvent.getKey(), aadmEvent); aadmEvents.getEventMap().put(aadmXStreamActEvent.getKey(), aadmXStreamActEvent); aadmEvents.getEventMap().put(vMmeEvent.getKey(), vMmeEvent); @@ -302,151 +335,155 @@ public class AadmDomainModelFactory { aadmEvents.getEventMap().put(periodicEvent.getKey(), periodicEvent); // Data types for context - final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", "0.0.1"), "Java", - "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); - final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", "0.0.1"), "Java", - "org.onap.policy.apex.examples.aadm.concepts.ImsiStatus"); - final AxContextSchema ipAddressStatus = new AxContextSchema(new AxArtifactKey("IPAddressStatus", "0.0.1"), - "Java", "org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus"); + final AxContextSchema eNodeBStatus = new AxContextSchema(new AxArtifactKey("ENodeBStatus", DEFAULT_VERSION), + "Java", "org.onap.policy.apex.examples.aadm.concepts.ENodeBStatus"); + final AxContextSchema imsiStatus = new AxContextSchema(new AxArtifactKey("IMSIStatus", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.aadm.concepts.ImsiStatus"); + final AxContextSchema ipAddressStatus = new AxContextSchema( + new AxArtifactKey("IPAddressStatus", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.aadm.concepts.IpAddressStatus"); aadmContextSchemas.getSchemasMap().put(eNodeBStatus.getKey(), eNodeBStatus); aadmContextSchemas.getSchemasMap().put(imsiStatus.getKey(), imsiStatus); aadmContextSchemas.getSchemasMap().put(ipAddressStatus.getKey(), ipAddressStatus); // Three context albums for AADM - final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum(new AxArtifactKey("ENodeBStatusAlbum", "0.0.1"), - "APPLICATION", true, eNodeBStatus.getKey()); - final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", "0.0.1"), - "APPLICATION", true, imsiStatus.getKey()); + final AxContextAlbum eNodeBStatusAlbum = new AxContextAlbum( + new AxArtifactKey("ENodeBStatusAlbum", DEFAULT_VERSION), APPLICATION, true, + eNodeBStatus.getKey()); + final AxContextAlbum imsiStatusAlbum = new AxContextAlbum(new AxArtifactKey("IMSIStatusAlbum", DEFAULT_VERSION), + APPLICATION, true, imsiStatus.getKey()); final AxContextAlbum ipAddressStatusAlbum = new AxContextAlbum( - new AxArtifactKey("IPAddressStatusAlbum", "0.0.1"), "APPLICATION", true, ipAddressStatus.getKey()); + new AxArtifactKey("IPAddressStatusAlbum", DEFAULT_VERSION), APPLICATION, true, + ipAddressStatus.getKey()); - final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", "0.0.1")); + final AxContextAlbums aadmAlbums = new AxContextAlbums(new AxArtifactKey("AADMContext", DEFAULT_VERSION)); aadmAlbums.getAlbumsMap().put(eNodeBStatusAlbum.getKey(), eNodeBStatusAlbum); aadmAlbums.getAlbumsMap().put(imsiStatusAlbum.getKey(), imsiStatusAlbum); aadmAlbums.getAlbumsMap().put(ipAddressStatusAlbum.getKey(), ipAddressStatusAlbum); // Tasks - final AxLogicReader logicReader = - new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); + final AxLogicReader logicReader = new PolicyLogicReader() + .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic(null); - final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", "0.0.1")); + final AxTask aadmMatchTask = new AxTask(new AxArtifactKey("AADMMatchTask", DEFAULT_VERSION)); aadmMatchTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmMatchTask.duplicateOutputFields(aadmEvent.getParameterMap()); aadmMatchTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmMatchTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmMatchTask.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); - aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + aadmMatchTask.setTaskLogic(new AxTaskLogic(aadmMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", "0.0.1")); + final AxTask aadmEstablishTask = new AxTask(new AxArtifactKey("AADMEstablishTask", DEFAULT_VERSION)); aadmEstablishTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmEstablishTask.duplicateOutputFields(aadmEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); + aadmEstablishTask.setTaskLogic(new AxTaskLogic(aadmEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", "0.0.1")); + final AxTask aadmDecideTask = new AxTask(new AxArtifactKey("AADMDecideTask", DEFAULT_VERSION)); aadmDecideTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmDecideTask.duplicateOutputFields(aadmEvent.getParameterMap()); - aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + aadmDecideTask.setTaskLogic(new AxTaskLogic(aadmDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); - final AxTask aadmDoSSuggestionActTask = new AxTask(new AxArtifactKey("AADMDoSSuggestionActTask", "0.0.1")); + final AxTask aadmDoSSuggestionActTask = new AxTask( + new AxArtifactKey("AADMDoSSuggestionActTask", DEFAULT_VERSION)); aadmDoSSuggestionActTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmDoSSuggestionActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); aadmDoSSuggestionActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmDoSSuggestionActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); - aadmDoSSuggestionActTask - .setTaskLogic(new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + aadmDoSSuggestionActTask.setTaskLogic( + new AxTaskLogic(aadmDoSSuggestionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", "0.0.1")); + final AxTask aadmNoActTask = new AxTask(new AxArtifactKey("AADMNoActTask", DEFAULT_VERSION)); aadmNoActTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmNoActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); - aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + aadmNoActTask.setTaskLogic(new AxTaskLogic(aadmNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", "0.0.1")); + final AxTask aadmDoSProvenActTask = new AxTask(new AxArtifactKey("AADMDoSProvenActTask", DEFAULT_VERSION)); aadmDoSProvenActTask.duplicateInputFields(aadmEvent.getParameterMap()); aadmDoSProvenActTask.duplicateOutputFields(aadmXStreamActEvent.getParameterMap()); aadmDoSProvenActTask.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmDoSProvenActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmDoSProvenActTask - .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(aadmDoSProvenActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", "0.0.1")); + final AxTask vMmeMatchTask = new AxTask(new AxArtifactKey("VMMEMatchTask", DEFAULT_VERSION)); vMmeMatchTask.duplicateInputFields(vMmeEvent.getParameterMap()); vMmeMatchTask.duplicateOutputFields(vMmeEvent.getParameterMap()); - vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeMatchTask.setTaskLogic(new AxTaskLogic(vMmeMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", "0.0.1")); + final AxTask vMmeEstablishTask = new AxTask(new AxArtifactKey("VMMEEstablishTask", DEFAULT_VERSION)); vMmeEstablishTask.duplicateInputFields(vMmeEvent.getParameterMap()); vMmeEstablishTask.duplicateOutputFields(vMmeEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - vMmeEstablishTask.setTaskLogic(new AxTaskLogic(vMmeEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); + vMmeEstablishTask.setTaskLogic(new AxTaskLogic(vMmeEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", "0.0.1")); + final AxTask vMmeDecideTask = new AxTask(new AxArtifactKey("VMMEDecideTask", DEFAULT_VERSION)); vMmeDecideTask.duplicateInputFields(vMmeEvent.getParameterMap()); vMmeDecideTask.duplicateOutputFields(vMmeEvent.getParameterMap()); - vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeDecideTask.setTaskLogic(new AxTaskLogic(vMmeDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", "0.0.1")); + final AxTask vMmeNoActTask = new AxTask(new AxArtifactKey("VMMENoActTask", DEFAULT_VERSION)); vMmeNoActTask.duplicateInputFields(vMmeEvent.getParameterMap()); vMmeNoActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); - vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeNoActTask.setTaskLogic(new AxTaskLogic(vMmeNoActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", "0.0.1")); + final AxTask vMmeActTask = new AxTask(new AxArtifactKey("VMMEActTask", DEFAULT_VERSION)); vMmeActTask.duplicateInputFields(vMmeEvent.getParameterMap()); vMmeActTask.duplicateOutputFields(vMmeEvent.getParameterMap()); logicReader.setDefaultLogic(null); - vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + vMmeActTask.setTaskLogic(new AxTaskLogic(vMmeActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", "0.0.1")); + final AxTask sapcMatchTask = new AxTask(new AxArtifactKey("SAPCMatchTask", DEFAULT_VERSION)); sapcMatchTask.duplicateInputFields(sapcEvent.getParameterMap()); sapcMatchTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + sapcMatchTask.setTaskLogic(new AxTaskLogic(sapcMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", "0.0.1")); + final AxTask sapcEstablishTask = new AxTask(new AxArtifactKey("SAPCEstablishTask", DEFAULT_VERSION)); sapcEstablishTask.duplicateInputFields(sapcEvent.getParameterMap()); sapcEstablishTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - logicReader.setDefaultLogic("Default_TaskLogic"); - sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); + sapcEstablishTask.setTaskLogic(new AxTaskLogic(sapcEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", "0.0.1")); + final AxTask sapcDecideTask = new AxTask(new AxArtifactKey("SAPCDecideTask", DEFAULT_VERSION)); sapcDecideTask.duplicateInputFields(sapcEvent.getParameterMap()); sapcDecideTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); - sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + sapcDecideTask.setTaskLogic(new AxTaskLogic(sapcDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", "0.0.1")); + final AxTask sapcActTask = new AxTask(new AxArtifactKey("SAPCActTask", DEFAULT_VERSION)); sapcActTask.duplicateInputFields(sapcEvent.getParameterMap()); sapcActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); sapcActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); - sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + sapcActTask.setTaskLogic(new AxTaskLogic(sapcActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - logicReader.setDefaultLogic("Default_TaskLogic"); + logicReader.setDefaultLogic(DEFAULT_TASK_LOGIC); - final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", "0.0.1")); + final AxTask periodicMatchTask = new AxTask(new AxArtifactKey("PeriodicMatchTask", DEFAULT_VERSION)); periodicMatchTask.duplicateInputFields(periodicEvent.getParameterMap()); periodicMatchTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + periodicMatchTask.setTaskLogic(new AxTaskLogic(periodicMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", "0.0.1")); + final AxTask periodicEstablishTask = new AxTask(new AxArtifactKey("PeriodicEstablishTask", DEFAULT_VERSION)); periodicEstablishTask.duplicateInputFields(periodicEvent.getParameterMap()); periodicEstablishTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicEstablishTask - .setTaskLogic(new AxTaskLogic(periodicEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + periodicEstablishTask.setTaskLogic( + new AxTaskLogic(periodicEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", "0.0.1")); + final AxTask periodicDecideTask = new AxTask(new AxArtifactKey("PeriodicDecideTask", DEFAULT_VERSION)); periodicDecideTask.duplicateInputFields(periodicEvent.getParameterMap()); periodicDecideTask.duplicateOutputFields(periodicEvent.getParameterMap()); - periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), "TaskLogic", "MVEL", logicReader)); + periodicDecideTask.setTaskLogic(new AxTaskLogic(periodicDecideTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", "0.0.1")); + final AxTask periodicActTask = new AxTask(new AxArtifactKey("PeriodicActTask", DEFAULT_VERSION)); periodicActTask.duplicateInputFields(periodicEvent.getParameterMap()); periodicActTask.duplicateOutputFields(sapcBlacklistSubscriberEvent.getParameterMap()); periodicActTask.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); logicReader.setDefaultLogic(null); - periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + periodicActTask.setTaskLogic(new AxTaskLogic(periodicActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", "0.0.1")); + final AxTasks aadmTasks = new AxTasks(new AxArtifactKey("AADMTasks", DEFAULT_VERSION)); aadmTasks.getTaskMap().put(aadmMatchTask.getKey(), aadmMatchTask); aadmTasks.getTaskMap().put(aadmEstablishTask.getKey(), aadmEstablishTask); aadmTasks.getTaskMap().put(aadmDecideTask.getKey(), aadmDecideTask); @@ -470,64 +507,65 @@ public class AadmDomainModelFactory { // Policies logicReader.setDefaultLogic(null); - final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", "0.0.1")); + final AxPolicy aadmPolicy = new AxPolicy(new AxArtifactKey("AADMPolicy", DEFAULT_VERSION)); aadmPolicy.setTemplate("MEDA"); final AxState aadmActState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Act")); aadmActState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmAct2Out = - new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), aadmXStreamActEvent.getKey()); + final AxStateOutput aadmAct2Out = new AxStateOutput(aadmActState.getKey(), AxReferenceKey.getNullKey(), + aadmXStreamActEvent.getKey()); aadmActState.getStateOutputs().put(aadmAct2Out.getKey().getLocalName(), aadmAct2Out); aadmActState.getContextAlbumReferences().add(ipAddressStatusAlbum.getKey()); aadmActState.getContextAlbumReferences().add(imsiStatusAlbum.getKey()); aadmActState.getContextAlbumReferences().add(eNodeBStatusAlbum.getKey()); aadmActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + new AxTaskSelectionLogic(aadmActState.getKey(), TASK_SELECTION_LOGIC, "MVEL", logicReader)); aadmActState.setDefaultTask(aadmNoActTask.getKey()); aadmActState.getTaskReferences().put(aadmNoActTask.getKey(), new AxStateTaskReference(aadmActState.getKey(), - aadmNoActTask.getKey(), AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + aadmNoActTask.getKey(), AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); aadmActState.getTaskReferences().put(aadmDoSSuggestionActTask.getKey(), - new AxStateTaskReference(aadmActState.getKey(), aadmDoSSuggestionActTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + new AxStateTaskReference(aadmActState.getKey(), aadmDoSSuggestionActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); aadmActState.getTaskReferences().put(aadmDoSProvenActTask.getKey(), - new AxStateTaskReference(aadmActState.getKey(), aadmDoSProvenActTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); + new AxStateTaskReference(aadmActState.getKey(), aadmDoSProvenActTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmAct2Out.getKey())); - logicReader.setDefaultLogic("Default_TaskSelectionLogic"); + logicReader.setDefaultLogic("DefaultTaskSelectionLogic"); - final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Decide")); + final AxState aadmDecideState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), DECIDE)); aadmDecideState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmDec2Act = - new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), aadmEvent.getKey()); + final AxStateOutput aadmDec2Act = new AxStateOutput(aadmDecideState.getKey(), aadmActState.getKey(), + aadmEvent.getKey()); aadmDecideState.getStateOutputs().put(aadmDec2Act.getKey().getLocalName(), aadmDec2Act); aadmDecideState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmDecideState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + new AxTaskSelectionLogic(aadmDecideState.getKey(), TASK_SELECTION_LOGIC, "MVEL", logicReader)); aadmDecideState.setDefaultTask(aadmDecideTask.getKey()); - aadmDecideState.getTaskReferences().put(aadmDecideTask.getKey(), new AxStateTaskReference( - aadmDecideState.getKey(), aadmDecideTask.getKey(), AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); + aadmDecideState.getTaskReferences().put(aadmDecideTask.getKey(), + new AxStateTaskReference(aadmDecideState.getKey(), aadmDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmDec2Act.getKey())); - final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Establish")); + final AxState aadmEstablishState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), ESTABLISH)); aadmEstablishState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmEst2Dec = - new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), aadmEvent.getKey()); + final AxStateOutput aadmEst2Dec = new AxStateOutput(aadmEstablishState.getKey(), aadmDecideState.getKey(), + aadmEvent.getKey()); aadmEstablishState.getStateOutputs().put(aadmEst2Dec.getKey().getLocalName(), aadmEst2Dec); - aadmEstablishState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + aadmEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic(aadmEstablishState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); aadmEstablishState.setDefaultTask(aadmEstablishTask.getKey()); aadmEstablishState.getTaskReferences().put(aadmEstablishTask.getKey(), - new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); + new AxStateTaskReference(aadmEstablishState.getKey(), aadmEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, aadmEst2Dec.getKey())); - final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), "Match")); + final AxState aadmMatchState = new AxState(new AxReferenceKey(aadmPolicy.getKey(), MATCH)); aadmMatchState.setTrigger(aadmEvent.getKey()); - final AxStateOutput aadmMat2Est = - new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), aadmEvent.getKey()); + final AxStateOutput aadmMat2Est = new AxStateOutput(aadmMatchState.getKey(), aadmEstablishState.getKey(), + aadmEvent.getKey()); aadmMatchState.getStateOutputs().put(aadmMat2Est.getKey().getLocalName(), aadmMat2Est); aadmMatchState.setTaskSelectionLogic( - new AxTaskSelectionLogic(aadmMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + new AxTaskSelectionLogic(aadmMatchState.getKey(), TASK_SELECTION_LOGIC, "MVEL", logicReader)); aadmMatchState.setDefaultTask(aadmMatchTask.getKey()); aadmMatchState.getTaskReferences().put(aadmMatchTask.getKey(), new AxStateTaskReference(aadmMatchState.getKey(), - aadmMatchTask.getKey(), AxStateTaskOutputType.DIRECT, aadmMat2Est.getKey())); + aadmMatchTask.getKey(), AxStateTaskOutputType.DIRECT, aadmMat2Est.getKey())); aadmPolicy.setFirstState(aadmMatchState.getKey().getLocalName()); aadmPolicy.getStateMap().put(aadmMatchState.getKey().getLocalName(), aadmMatchState); @@ -535,47 +573,48 @@ public class AadmDomainModelFactory { aadmPolicy.getStateMap().put(aadmDecideState.getKey().getLocalName(), aadmDecideState); aadmPolicy.getStateMap().put(aadmActState.getKey().getLocalName(), aadmActState); - final AxPolicy vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", "0.0.1")); + final AxPolicy vMmePolicy = new AxPolicy(new AxArtifactKey("VMMEPolicy", DEFAULT_VERSION)); vMmePolicy.setTemplate("MEDA"); final AxState vMmeActState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Act")); vMmeActState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeAct2Out = - new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), vMmeEvent.getKey()); + final AxStateOutput vMmeAct2Out = new AxStateOutput(vMmeActState.getKey(), AxReferenceKey.getNullKey(), + vMmeEvent.getKey()); vMmeActState.getStateOutputs().put(vMmeAct2Out.getKey().getLocalName(), vMmeAct2Out); vMmeActState.setDefaultTask(vMmeActTask.getKey()); vMmeActState.getTaskReferences().put(vMmeActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), - vMmeActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + vMmeActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); vMmeActState.getTaskReferences().put(vMmeNoActTask.getKey(), new AxStateTaskReference(vMmeActState.getKey(), - vMmeNoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); + vMmeNoActTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeAct2Out.getKey())); - final AxState vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Decide")); + final AxState vMmeDecideState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), DECIDE)); vMmeDecideState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeDec2Act = - new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), vMmeEvent.getKey()); + final AxStateOutput vMmeDec2Act = new AxStateOutput(vMmeDecideState.getKey(), vMmeActState.getKey(), + vMmeEvent.getKey()); vMmeDecideState.getStateOutputs().put(vMmeDec2Act.getKey().getLocalName(), vMmeDec2Act); vMmeDecideState.setDefaultTask(vMmeDecideTask.getKey()); - vMmeDecideState.getTaskReferences().put(vMmeDecideTask.getKey(), new AxStateTaskReference( - vMmeDecideState.getKey(), vMmeDecideTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeDec2Act.getKey())); + vMmeDecideState.getTaskReferences().put(vMmeDecideTask.getKey(), + new AxStateTaskReference(vMmeDecideState.getKey(), vMmeDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, vMmeDec2Act.getKey())); - final AxState vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Establish")); + final AxState vMmeEstablishState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), ESTABLISH)); vMmeEstablishState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeEst2Dec = - new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), vMmeEvent.getKey()); + final AxStateOutput vMmeEst2Dec = new AxStateOutput(vMmeEstablishState.getKey(), vMmeDecideState.getKey(), + vMmeEvent.getKey()); vMmeEstablishState.getStateOutputs().put(vMmeEst2Dec.getKey().getLocalName(), vMmeEst2Dec); vMmeEstablishState.setDefaultTask(vMmeEstablishTask.getKey()); vMmeEstablishState.getTaskReferences().put(vMmeEstablishTask.getKey(), - new AxStateTaskReference(vMmeEstablishState.getKey(), vMmeEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, vMmeEst2Dec.getKey())); + new AxStateTaskReference(vMmeEstablishState.getKey(), vMmeEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, vMmeEst2Dec.getKey())); - final AxState vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), "Match")); + final AxState vMmeMatchState = new AxState(new AxReferenceKey(vMmePolicy.getKey(), MATCH)); vMmeMatchState.setTrigger(vMmeEvent.getKey()); - final AxStateOutput vMmeMat2Est = - new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), vMmeEvent.getKey()); + final AxStateOutput vMmeMat2Est = new AxStateOutput(vMmeMatchState.getKey(), vMmeEstablishState.getKey(), + vMmeEvent.getKey()); vMmeMatchState.getStateOutputs().put(vMmeMat2Est.getKey().getLocalName(), vMmeMat2Est); vMmeMatchState.setDefaultTask(vMmeMatchTask.getKey()); vMmeMatchState.getTaskReferences().put(vMmeMatchTask.getKey(), new AxStateTaskReference(vMmeMatchState.getKey(), - vMmeMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeMat2Est.getKey())); + vMmeMatchTask.getKey(), AxStateTaskOutputType.DIRECT, vMmeMat2Est.getKey())); vMmePolicy.setFirstState(vMmeMatchState.getKey().getLocalName()); vMmePolicy.getStateMap().put(vMmeMatchState.getKey().getLocalName(), vMmeMatchState); @@ -583,45 +622,46 @@ public class AadmDomainModelFactory { vMmePolicy.getStateMap().put(vMmeDecideState.getKey().getLocalName(), vMmeDecideState); vMmePolicy.getStateMap().put(vMmeActState.getKey().getLocalName(), vMmeActState); - final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", "0.0.1")); + final AxPolicy sapcPolicy = new AxPolicy(new AxArtifactKey("SAPCPolicy", DEFAULT_VERSION)); sapcPolicy.setTemplate("MEDA"); final AxState sapcActState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Act")); sapcActState.setTrigger(sapcEvent.getKey()); final AxStateOutput sapcAct2Out = new AxStateOutput(sapcActState.getKey(), AxReferenceKey.getNullKey(), - sapcBlacklistSubscriberEvent.getKey()); + sapcBlacklistSubscriberEvent.getKey()); sapcActState.getStateOutputs().put(sapcAct2Out.getKey().getLocalName(), sapcAct2Out); sapcActState.setDefaultTask(sapcActTask.getKey()); sapcActState.getTaskReferences().put(sapcActTask.getKey(), new AxStateTaskReference(sapcActState.getKey(), - sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); + sapcActTask.getKey(), AxStateTaskOutputType.DIRECT, sapcAct2Out.getKey())); - final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Decide")); + final AxState sapcDecideState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), DECIDE)); sapcDecideState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcDec2Act = - new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), sapcEvent.getKey()); + final AxStateOutput sapcDec2Act = new AxStateOutput(sapcDecideState.getKey(), sapcActState.getKey(), + sapcEvent.getKey()); sapcDecideState.getStateOutputs().put(sapcDec2Act.getKey().getLocalName(), sapcDec2Act); sapcDecideState.setDefaultTask(sapcDecideTask.getKey()); - sapcDecideState.getTaskReferences().put(sapcDecideTask.getKey(), new AxStateTaskReference( - sapcDecideState.getKey(), sapcDecideTask.getKey(), AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); + sapcDecideState.getTaskReferences().put(sapcDecideTask.getKey(), + new AxStateTaskReference(sapcDecideState.getKey(), sapcDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, sapcDec2Act.getKey())); - final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Establish")); + final AxState sapcEstablishState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), ESTABLISH)); sapcEstablishState.setTrigger(sapcEvent.getKey()); - final AxStateOutput sapcEst2Dec = - new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), sapcEvent.getKey()); + final AxStateOutput sapcEst2Dec = new AxStateOutput(sapcEstablishState.getKey(), sapcDecideState.getKey(), + sapcEvent.getKey()); sapcEstablishState.getStateOutputs().put(sapcEst2Dec.getKey().getLocalName(), sapcEst2Dec); sapcEstablishState.setDefaultTask(sapcEstablishTask.getKey()); sapcEstablishState.getTaskReferences().put(sapcEstablishTask.getKey(), - new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); + new AxStateTaskReference(sapcEstablishState.getKey(), sapcEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, sapcEst2Dec.getKey())); - final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), "Match")); + final AxState sapcMatchState = new AxState(new AxReferenceKey(sapcPolicy.getKey(), MATCH)); sapcMatchState.setTrigger(aadmXStreamActEvent.getKey()); - final AxStateOutput sapcMat2Est = - new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), sapcEvent.getKey()); + final AxStateOutput sapcMat2Est = new AxStateOutput(sapcMatchState.getKey(), sapcEstablishState.getKey(), + sapcEvent.getKey()); sapcMatchState.getStateOutputs().put(sapcMat2Est.getKey().getLocalName(), sapcMat2Est); sapcMatchState.setDefaultTask(sapcMatchTask.getKey()); sapcMatchState.getTaskReferences().put(sapcMatchTask.getKey(), new AxStateTaskReference(sapcMatchState.getKey(), - sapcMatchTask.getKey(), AxStateTaskOutputType.DIRECT, sapcMat2Est.getKey())); + sapcMatchTask.getKey(), AxStateTaskOutputType.DIRECT, sapcMat2Est.getKey())); sapcPolicy.setFirstState(sapcMatchState.getKey().getLocalName()); sapcPolicy.getStateMap().put(sapcMatchState.getKey().getLocalName(), sapcMatchState); @@ -629,48 +669,48 @@ public class AadmDomainModelFactory { sapcPolicy.getStateMap().put(sapcDecideState.getKey().getLocalName(), sapcDecideState); sapcPolicy.getStateMap().put(sapcActState.getKey().getLocalName(), sapcActState); - final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", "0.0.1")); + final AxPolicy periodicPolicy = new AxPolicy(new AxArtifactKey("PeriodicPolicy", DEFAULT_VERSION)); periodicPolicy.setTemplate("MEDA"); final AxState periodicActState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Act")); periodicActState.setTrigger(periodicEvent.getKey()); final AxStateOutput perAct2Out = new AxStateOutput(periodicActState.getKey(), AxReferenceKey.getNullKey(), - sapcBlacklistSubscriberEvent.getKey()); + sapcBlacklistSubscriberEvent.getKey()); periodicActState.getStateOutputs().put(perAct2Out.getKey().getLocalName(), perAct2Out); periodicActState.setDefaultTask(periodicActTask.getKey()); periodicActState.getTaskReferences().put(periodicActTask.getKey(), - new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), - AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); + new AxStateTaskReference(periodicActState.getKey(), periodicActTask.getKey(), + AxStateTaskOutputType.DIRECT, perAct2Out.getKey())); - final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Decide")); + final AxState periodicDecideState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), DECIDE)); periodicDecideState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perDec2Act = - new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), periodicEvent.getKey()); + final AxStateOutput perDec2Act = new AxStateOutput(periodicDecideState.getKey(), periodicActState.getKey(), + periodicEvent.getKey()); periodicDecideState.getStateOutputs().put(perDec2Act.getKey().getLocalName(), perDec2Act); periodicDecideState.setDefaultTask(periodicDecideTask.getKey()); periodicDecideState.getTaskReferences().put(periodicDecideTask.getKey(), - new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), - AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); + new AxStateTaskReference(periodicDecideState.getKey(), periodicDecideTask.getKey(), + AxStateTaskOutputType.DIRECT, perDec2Act.getKey())); - final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Establish")); + final AxState periodicEstablishState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), ESTABLISH)); periodicEstablishState.setTrigger(periodicEvent.getKey()); final AxStateOutput perEst2Dec = new AxStateOutput(periodicEstablishState.getKey(), - periodicDecideState.getKey(), periodicEvent.getKey()); + periodicDecideState.getKey(), periodicEvent.getKey()); periodicEstablishState.getStateOutputs().put(perEst2Dec.getKey().getLocalName(), perEst2Dec); periodicEstablishState.setDefaultTask(periodicEstablishTask.getKey()); periodicEstablishState.getTaskReferences().put(periodicEstablishTask.getKey(), - new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); + new AxStateTaskReference(periodicEstablishState.getKey(), periodicEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, perEst2Dec.getKey())); - final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), "Match")); + final AxState periodicMatchState = new AxState(new AxReferenceKey(periodicPolicy.getKey(), MATCH)); periodicMatchState.setTrigger(periodicEvent.getKey()); - final AxStateOutput perMat2Est = - new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), periodicEvent.getKey()); + final AxStateOutput perMat2Est = new AxStateOutput(periodicMatchState.getKey(), periodicEstablishState.getKey(), + periodicEvent.getKey()); periodicMatchState.getStateOutputs().put(perMat2Est.getKey().getLocalName(), perMat2Est); periodicMatchState.setDefaultTask(periodicMatchTask.getKey()); periodicMatchState.getTaskReferences().put(periodicMatchTask.getKey(), - new AxStateTaskReference(periodicMatchState.getKey(), periodicMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, perMat2Est.getKey())); + new AxStateTaskReference(periodicMatchState.getKey(), periodicMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, perMat2Est.getKey())); periodicPolicy.setFirstState(periodicMatchState.getKey().getLocalName()); periodicPolicy.getStateMap().put(periodicMatchState.getKey().getLocalName(), periodicMatchState); @@ -678,14 +718,15 @@ public class AadmDomainModelFactory { periodicPolicy.getStateMap().put(periodicDecideState.getKey().getLocalName(), periodicDecideState); periodicPolicy.getStateMap().put(periodicActState.getKey().getLocalName(), periodicActState); - final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", "0.0.1")); + final AxPolicies aadmPolicies = new AxPolicies(new AxArtifactKey("AADMPolicies", DEFAULT_VERSION)); aadmPolicies.getPolicyMap().put(aadmPolicy.getKey(), aadmPolicy); aadmPolicies.getPolicyMap().put(vMmePolicy.getKey(), vMmePolicy); aadmPolicies.getPolicyMap().put(sapcPolicy.getKey(), sapcPolicy); aadmPolicies.getPolicyMap().put(periodicPolicy.getKey(), periodicPolicy); - final AxKeyInformation keyInformation = new AxKeyInformation(new AxArtifactKey("AADMKeyInformation", "0.0.1")); - final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", "0.0.1")); + final AxKeyInformation keyInformation = new AxKeyInformation( + new AxArtifactKey("AADMKeyInformation", DEFAULT_VERSION)); + final AxPolicyModel aadmPolicyModel = new AxPolicyModel(new AxArtifactKey("AADMPolicyModel", DEFAULT_VERSION)); aadmPolicyModel.setPolicies(aadmPolicies); aadmPolicyModel.setEvents(aadmEvents); aadmPolicyModel.setTasks(aadmTasks); diff --git a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java index 5a3afd901..60eee455c 100644 --- a/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java +++ b/examples/examples-aadm/src/main/java/org/onap/policy/apex/examples/aadm/model/AadmDomainModelSaver.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.examples.aadm.model; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; /** * This class saves sample domain models to disk in XML and JSON format. @@ -30,6 +32,9 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class AadmDomainModelSaver { + // Logger for this class + private static final XLogger LOGGER = XLoggerFactory.getXLogger(AadmDomainModelSaver.class); + /** * Private default constructor to prevent subclassing. */ @@ -43,7 +48,7 @@ public final class AadmDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - System.err.println("usage: " + AadmDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + AadmDomainModelSaver.class.getCanonicalName() + " modelDirectory"); return; } diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel index 225a0da4d..225a0da4d 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSProvenActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel index 63ac8d0ba..63ac8d0ba 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMDoSSuggestionActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel index 24ad9bb0a..24ad9bb0a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMMatchTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTaskTaskLogic.mvel index 7107b940b..7107b940b 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMNoActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel index 9c71db50a..9c71db50a 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicy_Act_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/AADMPolicyActTaskSelectionLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/DefaultTaskLogic.mvel index 69146d19c..69146d19c 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/DefaultTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/DefaultTaskSelectionLogic.mvel index 20fe626cd..20fe626cd 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/Default_TaskSelectionLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/DefaultTaskSelectionLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTaskTaskLogic.mvel index 6a2c598b0..6a2c598b0 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/PeriodicActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTaskTaskLogic.mvel index b0c6c3158..b0c6c3158 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTaskTaskLogic.mvel index 1de8b190c..1de8b190c 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/SAPCMatchTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTaskTaskLogic.mvel index db1abdfe9..db1abdfe9 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEActTaskTaskLogic.mvel diff --git a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTaskTaskLogic.mvel index 33dbd4cd0..33dbd4cd0 100644 --- a/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTask_TaskLogic.mvel +++ b/examples/examples-aadm/src/main/resources/org/onap/policy/apex/examples/aadm/model/mvel/VMMEMatchTaskTaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java index f574c74ec..c70c9feb6 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java @@ -120,7 +120,7 @@ public class AnomalyDetection implements Serializable { * * @param anomalyScores the anomaly score values of the algorithm */ - public void setAnomalyScores(final LinkedList<Double> anomalyScores) { + public void setAnomalyScores(final List<Double> anomalyScores) { this.anomalyScores = anomalyScores; } diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java index f2e27725b..d935af5f0 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AutoLearn.java @@ -36,11 +36,6 @@ public class AutoLearn implements Serializable { private List<Long> counts = null; /** - * The Constructor creates an AutoLearn concept. - */ - public AutoLearn() {} - - /** * Checks if the Autolearn instance is initialized. * * @return true, if the Autolearn instance is initialized @@ -55,14 +50,14 @@ public class AutoLearn implements Serializable { * @param size the number of convergent variables to use */ public void init(final int size) { - if (avDiffs == null || avDiffs.size() == 0) { + if (avDiffs == null || avDiffs.isEmpty()) { avDiffs = new ArrayList<>(size); for (int i = 0; i < size; i++) { avDiffs.add(i, Double.NaN); } } - if (counts == null || counts.size() == 0) { + if (counts == null || counts.isEmpty()) { counts = new ArrayList<>(size); for (int i = 0; i < size; i++) { counts.add(i, 0L); diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java index 6b71468d9..d13f93099 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelFactory.java @@ -50,6 +50,19 @@ import org.onap.policy.apex.model.policymodel.handling.PolicyLogicReader; * The Class AdaptiveDomainModelFactory. */ public class AdaptiveDomainModelFactory { + // Recurring string constants + private static final String LAST_MONITORED_VALUE = "LastMonitoredValue"; + private static final String TASK_SELECTION_LOGIC = "TaskSelectionLogic"; + private static final String DEFAULT_STATE_LOGIC = "DefaultState_Logic"; + private static final String TASK_LOGIC = "TaskLogic"; + private static final String DECIDE = "Decide"; + private static final String ESTABLISH = "Establish"; + private static final String MATCH = "Match"; + private static final String EXTERNAL = "External"; + private static final String DEFAULT_NAMESPACE = "org.onap.policy.apex.examples.adaptive.events"; + private static final String ITERATION2 = "Iteration"; + private static final String DEFAULT_VERSION = "0.0.1"; + private static final String MONITORED_VALUE = "MonitoredValue"; /** * Gets the anomaly detection policy model. @@ -60,130 +73,142 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAnomalyDetectionPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = - new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); - final AxContextSchema iteration = - new AxContextSchema(new AxArtifactKey("Iteration", "0.0.1"), "Java", "java.lang.Integer"); + final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + "Java", "java.lang.Double"); + final AxContextSchema iteration = new AxContextSchema(new AxArtifactKey(ITERATION2, DEFAULT_VERSION), "Java", + "java.lang.Integer"); - final AxContextSchemas adContextSchemas = new AxContextSchemas(new AxArtifactKey("AADMDatatypes", "0.0.1")); + final AxContextSchemas adContextSchemas = new AxContextSchemas( + new AxArtifactKey("AADMDatatypes", DEFAULT_VERSION)); adContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); adContextSchemas.getSchemasMap().put(iteration.getKey(), iteration); - final AxEvent anomalyDetectionTriggerEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionTriggerEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionTriggerEvent.setSource("External"); - anomalyDetectionTriggerEvent.setTarget("Match"); - anomalyDetectionTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionTriggerEvent.getParameterMap().put("Iteration", new AxField( - new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionMatchEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionMatchEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionMatchEvent.setSource("Match"); - anomalyDetectionMatchEvent.setTarget("Establish"); - anomalyDetectionMatchEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionMatchEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionEstablishEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionEstablishEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionEstablishEvent.setSource("Establish"); - anomalyDetectionEstablishEvent.setTarget("Decide"); - anomalyDetectionEstablishEvent.getParameterMap().put("MonitoredValue", - new AxField(new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "MonitoredValue"), - monitoredValue.getKey())); - anomalyDetectionEstablishEvent.getParameterMap().put("Iteration", new AxField( - new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionDecideEvent = - new AxEvent(new AxArtifactKey("AnomalyDetectionDecideEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - anomalyDetectionDecideEvent.setSource("Decide"); + final AxEvent anomalyDetectionTriggerEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionTriggerEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionTriggerEvent.setSource(EXTERNAL); + anomalyDetectionTriggerEvent.setTarget(MATCH); + anomalyDetectionTriggerEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionTriggerEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionTriggerEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionMatchEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionMatchEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionMatchEvent.setSource(MATCH); + anomalyDetectionMatchEvent.setTarget(ESTABLISH); + anomalyDetectionMatchEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionMatchEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionMatchEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionEstablishEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionEstablishEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionEstablishEvent.setSource(ESTABLISH); + anomalyDetectionEstablishEvent.setTarget(DECIDE); + anomalyDetectionEstablishEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionEstablishEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionEstablishEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionDecideEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionDecideEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + anomalyDetectionDecideEvent.setSource(DECIDE); anomalyDetectionDecideEvent.setTarget("Act"); - anomalyDetectionDecideEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionDecideEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvent anomalyDetectionActEvent = new AxEvent(new AxArtifactKey("AnomalyDetectionActEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); + anomalyDetectionDecideEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionDecideEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionDecideEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvent anomalyDetectionActEvent = new AxEvent( + new AxArtifactKey("AnomalyDetectionActEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); anomalyDetectionActEvent.setSource("Act"); - anomalyDetectionActEvent.setTarget("External"); - anomalyDetectionActEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(anomalyDetectionActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - anomalyDetectionActEvent.getParameterMap().put("Iteration", - new AxField(new AxReferenceKey(anomalyDetectionActEvent.getKey(), "Iteration"), iteration.getKey())); - - final AxEvents anomalyDetectionEvents = new AxEvents(new AxArtifactKey("AnomalyDetectionEvents", "0.0.1")); + anomalyDetectionActEvent.setTarget(EXTERNAL); + anomalyDetectionActEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(anomalyDetectionActEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + anomalyDetectionActEvent.getParameterMap().put(ITERATION2, new AxField( + new AxReferenceKey(anomalyDetectionActEvent.getKey(), ITERATION2), iteration.getKey())); + + final AxEvents anomalyDetectionEvents = new AxEvents( + new AxArtifactKey("AnomalyDetectionEvents", DEFAULT_VERSION)); anomalyDetectionEvents.getEventMap().put(anomalyDetectionTriggerEvent.getKey(), anomalyDetectionTriggerEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionMatchEvent.getKey(), anomalyDetectionMatchEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionEstablishEvent.getKey(), - anomalyDetectionEstablishEvent); + anomalyDetectionEstablishEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionDecideEvent.getKey(), anomalyDetectionDecideEvent); anomalyDetectionEvents.getEventMap().put(anomalyDetectionActEvent.getKey(), anomalyDetectionActEvent); // Data types for context - final AxContextSchema anomalyDetection = new AxContextSchema(new AxArtifactKey("AnomalyDetection", "0.0.1"), - "Java", "org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection"); + final AxContextSchema anomalyDetection = new AxContextSchema( + new AxArtifactKey("AnomalyDetection", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.adaptive.concepts.AnomalyDetection"); adContextSchemas.getSchemasMap().put(anomalyDetection.getKey(), anomalyDetection); // One context map final AxContextAlbum anomalyDetectionAlbum = new AxContextAlbum( - new AxArtifactKey("AnomalyDetectionAlbum", "0.0.1"), "APPLICATION", true, anomalyDetection.getKey()); - final AxContextAlbums anomalyDetectionAlbums = - new AxContextAlbums(new AxArtifactKey("AnomalyDetectionAlbums", "0.0.1")); + new AxArtifactKey("AnomalyDetectionAlbum", DEFAULT_VERSION), "APPLICATION", true, + anomalyDetection.getKey()); + final AxContextAlbums anomalyDetectionAlbums = new AxContextAlbums( + new AxArtifactKey("AnomalyDetectionAlbums", DEFAULT_VERSION)); anomalyDetectionAlbums.getAlbumsMap().put(anomalyDetectionAlbum.getKey(), anomalyDetectionAlbum); // Tasks - final AxLogicReader logicReader = - new PolicyLogicReader().setLogicPackage(this.getClass().getPackage().getName()) + final AxLogicReader logicReader = new PolicyLogicReader() + .setLogicPackage(this.getClass().getPackage().getName()) .setDefaultLogic("DefaultAnomalyDetectionTask_Logic"); - final AxTask anomalyDetectionMatchTask = new AxTask(new AxArtifactKey("AnomalyDetectionMatchTask", "0.0.1")); + final AxTask anomalyDetectionMatchTask = new AxTask( + new AxArtifactKey("AnomalyDetectionMatchTask", DEFAULT_VERSION)); anomalyDetectionMatchTask.duplicateInputFields(anomalyDetectionTriggerEvent.getParameterMap()); anomalyDetectionMatchTask.duplicateOutputFields(anomalyDetectionMatchEvent.getParameterMap()); - anomalyDetectionMatchTask - .setTaskLogic(new AxTaskLogic(anomalyDetectionMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionMatchTask.setTaskLogic( + new AxTaskLogic(anomalyDetectionMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionEstablishTask = - new AxTask(new AxArtifactKey("AnomalyDetectionEstablishTask", "0.0.1")); + final AxTask anomalyDetectionEstablishTask = new AxTask( + new AxArtifactKey("AnomalyDetectionEstablishTask", DEFAULT_VERSION)); anomalyDetectionEstablishTask.duplicateInputFields(anomalyDetectionMatchEvent.getParameterMap()); anomalyDetectionEstablishTask.duplicateOutputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionEstablishTask.setTaskLogic( - new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + new AxTaskLogic(anomalyDetectionEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask0 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask0", "0.0.1")); + final AxTask anomalyDetectionDecideTask0 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask0", DEFAULT_VERSION)); anomalyDetectionDecideTask0.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask0.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask0 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask0.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask1 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask1", "0.0.1")); + final AxTask anomalyDetectionDecideTask1 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask1", DEFAULT_VERSION)); anomalyDetectionDecideTask1.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask1.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask1 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask1.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionDecideTask2 = - new AxTask(new AxArtifactKey("AnomalyDetectionDecideTask2", "0.0.1")); + final AxTask anomalyDetectionDecideTask2 = new AxTask( + new AxArtifactKey("AnomalyDetectionDecideTask2", DEFAULT_VERSION)); anomalyDetectionDecideTask2.duplicateInputFields(anomalyDetectionEstablishEvent.getParameterMap()); anomalyDetectionDecideTask2.duplicateOutputFields(anomalyDetectionDecideEvent.getParameterMap()); - anomalyDetectionDecideTask2 - .setTaskLogic(new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionDecideTask2.setTaskLogic( + new AxTaskLogic(anomalyDetectionDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask anomalyDetectionActTask = new AxTask(new AxArtifactKey("AnomalyDetectionActTask", "0.0.1")); + final AxTask anomalyDetectionActTask = new AxTask( + new AxArtifactKey("AnomalyDetectionActTask", DEFAULT_VERSION)); anomalyDetectionActTask.duplicateInputFields(anomalyDetectionDecideEvent.getParameterMap()); anomalyDetectionActTask.duplicateOutputFields(anomalyDetectionActEvent.getParameterMap()); - anomalyDetectionActTask - .setTaskLogic(new AxTaskLogic(anomalyDetectionActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + anomalyDetectionActTask.setTaskLogic( + new AxTaskLogic(anomalyDetectionActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", "0.0.1")); + final AxTasks anomalyDetectionTasks = new AxTasks(new AxArtifactKey("AnomalyDetectionTasks", DEFAULT_VERSION)); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionMatchTask.getKey(), anomalyDetectionMatchTask); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionEstablishTask.getKey(), anomalyDetectionEstablishTask); anomalyDetectionTasks.getTaskMap().put(anomalyDetectionDecideTask0.getKey(), anomalyDetectionDecideTask0); @@ -192,92 +217,98 @@ public class AdaptiveDomainModelFactory { anomalyDetectionTasks.getTaskMap().put(anomalyDetectionActTask.getKey(), anomalyDetectionActTask); // Policies - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy anomalyDetectionPolicy = new AxPolicy(new AxArtifactKey("AnomalyDetectionPolicy", "0.0.1")); + final AxPolicy anomalyDetectionPolicy = new AxPolicy( + new AxArtifactKey("AnomalyDetectionPolicy", DEFAULT_VERSION)); anomalyDetectionPolicy.setTemplate("MEDA"); - final AxState anomalyDetectionActState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); + final AxState anomalyDetectionActState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Act")); anomalyDetectionActState.setTrigger(anomalyDetectionDecideEvent.getKey()); final AxStateOutput adAct2Out = new AxStateOutput(anomalyDetectionActState.getKey(), - AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); + AxReferenceKey.getNullKey(), anomalyDetectionActEvent.getKey()); anomalyDetectionActState.getStateOutputs().put(adAct2Out.getKey().getLocalName(), adAct2Out); - anomalyDetectionActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionActState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionActState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionActState.setDefaultTask(anomalyDetectionActTask.getKey()); anomalyDetectionActState.getTaskReferences().put(anomalyDetectionActTask.getKey(), - new AxStateTaskReference(anomalyDetectionActState.getKey(), anomalyDetectionActTask.getKey(), - AxStateTaskOutputType.DIRECT, adAct2Out.getKey())); + new AxStateTaskReference(anomalyDetectionActState.getKey(), anomalyDetectionActTask.getKey(), + AxStateTaskOutputType.DIRECT, adAct2Out.getKey())); logicReader.setDefaultLogic(null); - final AxState anomalyDetectionDecideState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Decide")); + final AxState anomalyDetectionDecideState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), DECIDE)); anomalyDetectionDecideState.setTrigger(anomalyDetectionEstablishEvent.getKey()); final AxStateOutput adDec2Act = new AxStateOutput(anomalyDetectionDecideState.getKey(), - anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); + anomalyDetectionActState.getKey(), anomalyDetectionDecideEvent.getKey()); anomalyDetectionDecideState.getStateOutputs().put(adDec2Act.getKey().getLocalName(), adDec2Act); anomalyDetectionDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionDecideState.getKey(), - "TaskSelectionLogic", "JAVA", logicReader)); + TASK_SELECTION_LOGIC, "JAVA", logicReader)); anomalyDetectionDecideState.setDefaultTask(anomalyDetectionDecideTask0.getKey()); anomalyDetectionDecideState.getContextAlbumReferences().add(anomalyDetectionAlbum.getKey()); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask0.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask0.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask0.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask1.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask1.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask1.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); anomalyDetectionDecideState.getTaskReferences().put(anomalyDetectionDecideTask2.getKey(), - new AxStateTaskReference(anomalyDetectionDecideState.getKey(), anomalyDetectionDecideTask2.getKey(), - AxStateTaskOutputType.DIRECT, adDec2Act.getKey())); + new AxStateTaskReference(anomalyDetectionDecideState.getKey(), + anomalyDetectionDecideTask2.getKey(), AxStateTaskOutputType.DIRECT, + adDec2Act.getKey())); - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState anomalyDetectionEstablishState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Establish")); + final AxState anomalyDetectionEstablishState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), ESTABLISH)); anomalyDetectionEstablishState.setTrigger(anomalyDetectionMatchEvent.getKey()); final AxStateOutput adEst2Dec = new AxStateOutput(anomalyDetectionEstablishState.getKey(), - anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); + anomalyDetectionDecideState.getKey(), anomalyDetectionEstablishEvent.getKey()); anomalyDetectionEstablishState.getStateOutputs().put(adEst2Dec.getKey().getLocalName(), adEst2Dec); anomalyDetectionEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic( - anomalyDetectionEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + anomalyDetectionEstablishState.getKey(), TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionEstablishState.setDefaultTask(anomalyDetectionEstablishTask.getKey()); anomalyDetectionEstablishState.getTaskReferences().put(anomalyDetectionEstablishTask.getKey(), - new AxStateTaskReference(anomalyDetectionEstablishState.getKey(), - anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, adEst2Dec.getKey())); + new AxStateTaskReference(anomalyDetectionEstablishState.getKey(), + anomalyDetectionEstablishTask.getKey(), AxStateTaskOutputType.DIRECT, + adEst2Dec.getKey())); - final AxState anomalyDetectionMatchState = - new AxState(new AxReferenceKey(anomalyDetectionPolicy.getKey(), "Match")); + final AxState anomalyDetectionMatchState = new AxState( + new AxReferenceKey(anomalyDetectionPolicy.getKey(), MATCH)); anomalyDetectionMatchState.setTrigger(anomalyDetectionTriggerEvent.getKey()); final AxStateOutput adMat2Est = new AxStateOutput(anomalyDetectionMatchState.getKey(), - anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); + anomalyDetectionEstablishState.getKey(), anomalyDetectionMatchEvent.getKey()); anomalyDetectionMatchState.getStateOutputs().put(adMat2Est.getKey().getLocalName(), adMat2Est); anomalyDetectionMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(anomalyDetectionMatchState.getKey(), - "TaskSelectionLogic", "MVEL", logicReader)); + TASK_SELECTION_LOGIC, "MVEL", logicReader)); anomalyDetectionMatchState.setDefaultTask(anomalyDetectionMatchTask.getKey()); anomalyDetectionMatchState.getTaskReferences().put(anomalyDetectionMatchTask.getKey(), - new AxStateTaskReference(anomalyDetectionMatchState.getKey(), anomalyDetectionMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, adMat2Est.getKey())); + new AxStateTaskReference(anomalyDetectionMatchState.getKey(), + anomalyDetectionMatchTask.getKey(), AxStateTaskOutputType.DIRECT, + adMat2Est.getKey())); anomalyDetectionPolicy.setFirstState(anomalyDetectionMatchState.getKey().getLocalName()); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionMatchState.getKey().getLocalName(), - anomalyDetectionMatchState); + anomalyDetectionMatchState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionEstablishState.getKey().getLocalName(), - anomalyDetectionEstablishState); + anomalyDetectionEstablishState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionDecideState.getKey().getLocalName(), - anomalyDetectionDecideState); + anomalyDetectionDecideState); anomalyDetectionPolicy.getStateMap().put(anomalyDetectionActState.getKey().getLocalName(), - anomalyDetectionActState); + anomalyDetectionActState); - final AxPolicies anomalyDetectionPolicies = - new AxPolicies(new AxArtifactKey("AnomalyDetectionPolicies", "0.0.1")); + final AxPolicies anomalyDetectionPolicies = new AxPolicies( + new AxArtifactKey("AnomalyDetectionPolicies", DEFAULT_VERSION)); anomalyDetectionPolicies.getPolicyMap().put(anomalyDetectionPolicy.getKey(), anomalyDetectionPolicy); - final AxKeyInformation keyInformation = - new AxKeyInformation(new AxArtifactKey("AnomalyDetectionKeyInformation", "0.0.1")); - final AxPolicyModel anomalyDetectionPolicyModel = - new AxPolicyModel(new AxArtifactKey("AnomalyDetectionPolicyModel", "0.0.1")); + final AxKeyInformation keyInformation = new AxKeyInformation( + new AxArtifactKey("AnomalyDetectionKeyInformation", DEFAULT_VERSION)); + final AxPolicyModel anomalyDetectionPolicyModel = new AxPolicyModel( + new AxArtifactKey("AnomalyDetectionPolicyModel", DEFAULT_VERSION)); anomalyDetectionPolicyModel.setPolicies(anomalyDetectionPolicies); anomalyDetectionPolicyModel.setEvents(anomalyDetectionEvents); anomalyDetectionPolicyModel.setTasks(anomalyDetectionTasks); @@ -302,58 +333,65 @@ public class AdaptiveDomainModelFactory { public AxPolicyModel getAutoLearnPolicyModel() { // CHECKSTYLE:ON: checkstyle:maximumMethodLength // Data types for event parameters - final AxContextSchema monitoredValue = - new AxContextSchema(new AxArtifactKey("MonitoredValue", "0.0.1"), "Java", "java.lang.Double"); + final AxContextSchema monitoredValue = new AxContextSchema(new AxArtifactKey(MONITORED_VALUE, DEFAULT_VERSION), + "Java", "java.lang.Double"); - final AxContextSchemas alContextSchemas = new AxContextSchemas(new AxArtifactKey("ALDatatypes", "0.0.1")); + final AxContextSchemas alContextSchemas = new AxContextSchemas( + new AxArtifactKey("ALDatatypes", DEFAULT_VERSION)); alContextSchemas.getSchemasMap().put(monitoredValue.getKey(), monitoredValue); - final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnTriggerEvent.setSource("External"); - autoLearnTriggerEvent.setTarget("Match"); - autoLearnTriggerEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnTriggerEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnTriggerEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnTriggerEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnMatchEvent.setSource("Match"); - autoLearnMatchEvent.setTarget("Establish"); - autoLearnMatchEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnMatchEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnMatchEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnMatchEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnEstablishEvent = new AxEvent(new AxArtifactKey("AutoLearnEstablishEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnEstablishEvent.setSource("Establish"); - autoLearnEstablishEvent.setTarget("Decide"); - autoLearnEstablishEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnEstablishEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnEstablishEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnEstablishEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); - autoLearnDecideEvent.setSource("Decide"); + final AxEvent autoLearnTriggerEvent = new AxEvent(new AxArtifactKey("AutoLearnTriggerEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnTriggerEvent.setSource(EXTERNAL); + autoLearnTriggerEvent.setTarget(MATCH); + autoLearnTriggerEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnTriggerEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnTriggerEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnTriggerEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnMatchEvent = new AxEvent(new AxArtifactKey("AutoLearnMatchEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnMatchEvent.setSource(MATCH); + autoLearnMatchEvent.setTarget(ESTABLISH); + autoLearnMatchEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnMatchEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnMatchEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnMatchEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnEstablishEvent = new AxEvent( + new AxArtifactKey("AutoLearnEstablishEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnEstablishEvent.setSource(ESTABLISH); + autoLearnEstablishEvent.setTarget(DECIDE); + autoLearnEstablishEvent.getParameterMap().put(MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnEstablishEvent.getKey(), MONITORED_VALUE), + monitoredValue.getKey())); + autoLearnEstablishEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnEstablishEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnDecideEvent = new AxEvent(new AxArtifactKey("AutoLearnDecideEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); + autoLearnDecideEvent.setSource(DECIDE); autoLearnDecideEvent.setTarget("Act"); - autoLearnDecideEvent.getParameterMap().put("MonitoredValue", new AxField( - new AxReferenceKey(autoLearnDecideEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnDecideEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnDecideEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); - - final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", "0.0.1"), - "org.onap.policy.apex.examples.adaptive.events"); + autoLearnDecideEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnDecideEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnDecideEvent.getParameterMap().put(LAST_MONITORED_VALUE, + new AxField(new AxReferenceKey(autoLearnDecideEvent.getKey(), LAST_MONITORED_VALUE), + monitoredValue.getKey())); + + final AxEvent autoLearnActEvent = new AxEvent(new AxArtifactKey("AutoLearnActEvent", DEFAULT_VERSION), + DEFAULT_NAMESPACE); autoLearnActEvent.setSource("Act"); - autoLearnActEvent.setTarget("External"); - autoLearnActEvent.getParameterMap().put("MonitoredValue", - new AxField(new AxReferenceKey(autoLearnActEvent.getKey(), "MonitoredValue"), monitoredValue.getKey())); - autoLearnActEvent.getParameterMap().put("LastMonitoredValue", new AxField( - new AxReferenceKey(autoLearnActEvent.getKey(), "LastMonitoredValue"), monitoredValue.getKey())); + autoLearnActEvent.setTarget(EXTERNAL); + autoLearnActEvent.getParameterMap().put(MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnActEvent.getKey(), MONITORED_VALUE), monitoredValue.getKey())); + autoLearnActEvent.getParameterMap().put(LAST_MONITORED_VALUE, new AxField( + new AxReferenceKey(autoLearnActEvent.getKey(), LAST_MONITORED_VALUE), monitoredValue.getKey())); - final AxEvents autoLearnEvents = new AxEvents(new AxArtifactKey("AutoLearnEvents", "0.0.1")); + final AxEvents autoLearnEvents = new AxEvents(new AxArtifactKey("AutoLearnEvents", DEFAULT_VERSION)); autoLearnEvents.getEventMap().put(autoLearnTriggerEvent.getKey(), autoLearnTriggerEvent); autoLearnEvents.getEventMap().put(autoLearnMatchEvent.getKey(), autoLearnMatchEvent); autoLearnEvents.getEventMap().put(autoLearnEstablishEvent.getKey(), autoLearnEstablishEvent); @@ -361,84 +399,86 @@ public class AdaptiveDomainModelFactory { autoLearnEvents.getEventMap().put(autoLearnActEvent.getKey(), autoLearnActEvent); // Data types for context - final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", "0.0.1"), "Java", - "org.onap.policy.apex.examples.adaptive.concepts.AutoLearn"); + final AxContextSchema autoLearn = new AxContextSchema(new AxArtifactKey("AutoLearn", DEFAULT_VERSION), "Java", + "org.onap.policy.apex.examples.adaptive.concepts.AutoLearn"); alContextSchemas.getSchemasMap().put(autoLearn.getKey(), autoLearn); // One context map - final AxContextAlbum autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", "0.0.1"), - "APPLICATION", true, autoLearn.getKey()); + final AxContextAlbum autoLearnAlbum = new AxContextAlbum(new AxArtifactKey("AutoLearnAlbum", DEFAULT_VERSION), + "APPLICATION", true, autoLearn.getKey()); - final AxContextAlbums autoLearnAlbums = new AxContextAlbums(new AxArtifactKey("AutoLearnContext", "0.0.1")); + final AxContextAlbums autoLearnAlbums = new AxContextAlbums( + new AxArtifactKey("AutoLearnContext", DEFAULT_VERSION)); autoLearnAlbums.getAlbumsMap().put(autoLearnAlbum.getKey(), autoLearnAlbum); // Tasks final AxLogicReader logicReader = new PolicyLogicReader() - .setLogicPackage(this.getClass().getPackage().getName()).setDefaultLogic("DefaultAutoLearnTask_Logic"); + .setLogicPackage(this.getClass().getPackage().getName()) + .setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", "0.0.1")); + final AxTask autoLearnMatchTask = new AxTask(new AxArtifactKey("AutoLearnMatchTask", DEFAULT_VERSION)); autoLearnMatchTask.duplicateInputFields(autoLearnTriggerEvent.getParameterMap()); autoLearnMatchTask.duplicateOutputFields(autoLearnMatchEvent.getParameterMap()); - autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnMatchTask.setTaskLogic(new AxTaskLogic(autoLearnMatchTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", "0.0.1")); + final AxTask autoLearnEstablishTask = new AxTask(new AxArtifactKey("AutoLearnEstablishTask", DEFAULT_VERSION)); autoLearnEstablishTask.duplicateInputFields(autoLearnMatchEvent.getParameterMap()); autoLearnEstablishTask.duplicateOutputFields(autoLearnEstablishEvent.getParameterMap()); - autoLearnEstablishTask - .setTaskLogic(new AxTaskLogic(autoLearnEstablishTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnEstablishTask.setTaskLogic( + new AxTaskLogic(autoLearnEstablishTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic(null); - final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", "0.0.1")); + final AxTask autoLearnDecideTask0 = new AxTask(new AxArtifactKey("AutoLearnDecideTask0", DEFAULT_VERSION)); autoLearnDecideTask0.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask0.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask0 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask0.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", "0.0.1")); + final AxTask autoLearnDecideTask1 = new AxTask(new AxArtifactKey("AutoLearnDecideTask1", DEFAULT_VERSION)); autoLearnDecideTask1.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask1.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask1 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask1.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", "0.0.1")); + final AxTask autoLearnDecideTask2 = new AxTask(new AxArtifactKey("AutoLearnDecideTask2", DEFAULT_VERSION)); autoLearnDecideTask2.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask2.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask2 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask2.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", "0.0.1")); + final AxTask autoLearnDecideTask3 = new AxTask(new AxArtifactKey("AutoLearnDecideTask3", DEFAULT_VERSION)); autoLearnDecideTask3.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask3.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask3 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask3.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", "0.0.1")); + final AxTask autoLearnDecideTask4 = new AxTask(new AxArtifactKey("AutoLearnDecideTask4", DEFAULT_VERSION)); autoLearnDecideTask4.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask4.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask4 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask4.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", "0.0.1")); + final AxTask autoLearnDecideTask5 = new AxTask(new AxArtifactKey("AutoLearnDecideTask5", DEFAULT_VERSION)); autoLearnDecideTask5.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask5.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask5 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask5.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", "0.0.1")); + final AxTask autoLearnDecideTask6 = new AxTask(new AxArtifactKey("AutoLearnDecideTask6", DEFAULT_VERSION)); autoLearnDecideTask6.duplicateInputFields(autoLearnEstablishEvent.getParameterMap()); autoLearnDecideTask6.duplicateOutputFields(autoLearnDecideEvent.getParameterMap()); autoLearnDecideTask6 - .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), "TaskLogic", "MVEL", logicReader)); + .setTaskLogic(new AxTaskLogic(autoLearnDecideTask6.getKey(), TASK_LOGIC, "MVEL", logicReader)); logicReader.setDefaultLogic("DefaultAutoLearnTask_Logic"); - final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", "0.0.1")); + final AxTask autoLearnActTask = new AxTask(new AxArtifactKey("AutoLearnActTask", DEFAULT_VERSION)); autoLearnActTask.duplicateInputFields(autoLearnDecideEvent.getParameterMap()); autoLearnActTask.duplicateOutputFields(autoLearnActEvent.getParameterMap()); - autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), "TaskLogic", "MVEL", logicReader)); + autoLearnActTask.setTaskLogic(new AxTaskLogic(autoLearnActTask.getKey(), TASK_LOGIC, "MVEL", logicReader)); - final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", "0.0.1")); + final AxTasks autoLearnTasks = new AxTasks(new AxArtifactKey("AutoLearnTasks", DEFAULT_VERSION)); autoLearnTasks.getTaskMap().put(autoLearnMatchTask.getKey(), autoLearnMatchTask); autoLearnTasks.getTaskMap().put(autoLearnEstablishTask.getKey(), autoLearnEstablishTask); autoLearnTasks.getTaskMap().put(autoLearnDecideTask0.getKey(), autoLearnDecideTask0); @@ -451,81 +491,81 @@ public class AdaptiveDomainModelFactory { autoLearnTasks.getTaskMap().put(autoLearnActTask.getKey(), autoLearnActTask); // Policies - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", "0.0.1")); + final AxPolicy autoLearnPolicy = new AxPolicy(new AxArtifactKey("AutoLearnPolicy", DEFAULT_VERSION)); autoLearnPolicy.setTemplate("MEDA"); final AxState autoLearnActState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Act")); autoLearnActState.setTrigger(autoLearnDecideEvent.getKey()); - final AxStateOutput alAct2Out = - new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), autoLearnActEvent.getKey()); + final AxStateOutput alAct2Out = new AxStateOutput(autoLearnActState.getKey(), AxReferenceKey.getNullKey(), + autoLearnActEvent.getKey()); autoLearnActState.getStateOutputs().put(alAct2Out.getKey().getLocalName(), alAct2Out); - autoLearnActState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnActState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnActState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnActState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnActState.setDefaultTask(autoLearnActTask.getKey()); autoLearnActState.getTaskReferences().put(autoLearnActTask.getKey(), - new AxStateTaskReference(autoLearnActState.getKey(), autoLearnActTask.getKey(), - AxStateTaskOutputType.DIRECT, alAct2Out.getKey())); + new AxStateTaskReference(autoLearnActState.getKey(), autoLearnActTask.getKey(), + AxStateTaskOutputType.DIRECT, alAct2Out.getKey())); logicReader.setDefaultLogic(null); - final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Decide")); + final AxState autoLearnDecideState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), DECIDE)); autoLearnDecideState.setTrigger(autoLearnEstablishEvent.getKey()); final AxStateOutput alDec2Act = new AxStateOutput(autoLearnDecideState.getKey(), autoLearnActState.getKey(), - autoLearnDecideEvent.getKey()); + autoLearnDecideEvent.getKey()); autoLearnDecideState.getStateOutputs().put(alDec2Act.getKey().getLocalName(), alDec2Act); autoLearnDecideState.getContextAlbumReferences().add(autoLearnAlbum.getKey()); - autoLearnDecideState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnDecideState.getKey(), "TaskSelectionLogic", "JAVA", logicReader)); + autoLearnDecideState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnDecideState.getKey(), + TASK_SELECTION_LOGIC, "JAVA", logicReader)); autoLearnDecideState.setDefaultTask(autoLearnDecideTask0.getKey()); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask0.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask0.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask0.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask1.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask1.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask1.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask2.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask2.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask2.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask3.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask3.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask3.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask4.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask4.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask4.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask5.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask5.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask5.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); autoLearnDecideState.getTaskReferences().put(autoLearnDecideTask6.getKey(), - new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask6.getKey(), - AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); + new AxStateTaskReference(autoLearnDecideState.getKey(), autoLearnDecideTask6.getKey(), + AxStateTaskOutputType.DIRECT, alDec2Act.getKey())); - logicReader.setDefaultLogic("DefaultState_Logic"); + logicReader.setDefaultLogic(DEFAULT_STATE_LOGIC); - final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Establish")); + final AxState autoLearnEstablishState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), ESTABLISH)); autoLearnEstablishState.setTrigger(autoLearnMatchEvent.getKey()); final AxStateOutput alEst2Dec = new AxStateOutput(autoLearnEstablishState.getKey(), - autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); + autoLearnDecideState.getKey(), autoLearnEstablishEvent.getKey()); autoLearnEstablishState.getStateOutputs().put(alEst2Dec.getKey().getLocalName(), alEst2Dec); - autoLearnEstablishState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnEstablishState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnEstablishState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnEstablishState.setDefaultTask(autoLearnEstablishTask.getKey()); autoLearnEstablishState.getTaskReferences().put(autoLearnEstablishTask.getKey(), - new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), - AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); + new AxStateTaskReference(autoLearnEstablishState.getKey(), autoLearnEstablishTask.getKey(), + AxStateTaskOutputType.DIRECT, alEst2Dec.getKey())); - final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), "Match")); + final AxState autoLearnMatchState = new AxState(new AxReferenceKey(autoLearnPolicy.getKey(), MATCH)); autoLearnMatchState.setTrigger(autoLearnTriggerEvent.getKey()); final AxStateOutput alMat2Est = new AxStateOutput(autoLearnMatchState.getKey(), - autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); + autoLearnEstablishState.getKey(), autoLearnMatchEvent.getKey()); autoLearnMatchState.getStateOutputs().put(alMat2Est.getKey().getLocalName(), alMat2Est); - autoLearnMatchState.setTaskSelectionLogic( - new AxTaskSelectionLogic(autoLearnMatchState.getKey(), "TaskSelectionLogic", "MVEL", logicReader)); + autoLearnMatchState.setTaskSelectionLogic(new AxTaskSelectionLogic(autoLearnMatchState.getKey(), + TASK_SELECTION_LOGIC, "MVEL", logicReader)); autoLearnMatchState.setDefaultTask(autoLearnMatchTask.getKey()); autoLearnMatchState.getTaskReferences().put(autoLearnMatchTask.getKey(), - new AxStateTaskReference(autoLearnMatchState.getKey(), autoLearnMatchTask.getKey(), - AxStateTaskOutputType.DIRECT, alMat2Est.getKey())); + new AxStateTaskReference(autoLearnMatchState.getKey(), autoLearnMatchTask.getKey(), + AxStateTaskOutputType.DIRECT, alMat2Est.getKey())); autoLearnPolicy.setFirstState(autoLearnMatchState.getKey().getLocalName()); autoLearnPolicy.getStateMap().put(autoLearnMatchState.getKey().getLocalName(), autoLearnMatchState); @@ -533,13 +573,13 @@ public class AdaptiveDomainModelFactory { autoLearnPolicy.getStateMap().put(autoLearnDecideState.getKey().getLocalName(), autoLearnDecideState); autoLearnPolicy.getStateMap().put(autoLearnActState.getKey().getLocalName(), autoLearnActState); - final AxPolicies autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", "0.0.1")); + final AxPolicies autoLearnPolicies = new AxPolicies(new AxArtifactKey("AutoLearnPolicies", DEFAULT_VERSION)); autoLearnPolicies.getPolicyMap().put(autoLearnPolicy.getKey(), autoLearnPolicy); - final AxKeyInformation keyInformation = - new AxKeyInformation(new AxArtifactKey("AutoLearnKeyInformation", "0.0.1")); - final AxPolicyModel autoLearnPolicyModel = - new AxPolicyModel(new AxArtifactKey("AutoLearnPolicyModel", "0.0.1")); + final AxKeyInformation keyInformation = new AxKeyInformation( + new AxArtifactKey("AutoLearnKeyInformation", DEFAULT_VERSION)); + final AxPolicyModel autoLearnPolicyModel = new AxPolicyModel( + new AxArtifactKey("AutoLearnPolicyModel", DEFAULT_VERSION)); autoLearnPolicyModel.setPolicies(autoLearnPolicies); autoLearnPolicyModel.setEvents(autoLearnEvents); autoLearnPolicyModel.setTasks(autoLearnTasks); diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java index 9c860e3c8..4949edd30 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/AdaptiveDomainModelSaver.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.examples.adaptive.model; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; /** * This class saves sample domain models to disk in XML and JSON format. @@ -30,10 +32,15 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * @author Liam Fallon (liam.fallon@ericsson.com) */ public final class AdaptiveDomainModelSaver { + // Logger for this class + private static final XLogger LOGGER = XLoggerFactory.getXLogger(AdaptiveDomainModelSaver.class); + /** * Private default constructor to prevent subclassing. */ - private AdaptiveDomainModelSaver() {} + private AdaptiveDomainModelSaver() { + // Prevent subclassing + } /** * Write the AADM model to args[0]. @@ -43,21 +50,21 @@ public final class AdaptiveDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - System.err.println("usage: " + AdaptiveDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + AdaptiveDomainModelSaver.class.getCanonicalName() + " modelDirectory"); return; } // Save Anomaly Detection model final AxPolicyModel adPolicyModel = new AdaptiveDomainModelFactory().getAnomalyDetectionPolicyModel(); final ApexModelSaver<AxPolicyModel> adModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, args[0]); + new ApexModelSaver<>(AxPolicyModel.class, adPolicyModel, args[0]); adModelSaver.apexModelWriteJson(); adModelSaver.apexModelWriteXml(); // Save Auto Learn model final AxPolicyModel alPolicyModel = new AdaptiveDomainModelFactory().getAutoLearnPolicyModel(); final ApexModelSaver<AxPolicyModel> alModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, args[0]); + new ApexModelSaver<>(AxPolicyModel.class, alPolicyModel, args[0]); alModelSaver.apexModelWriteJson(); alModelSaver.apexModelWriteXml(); } diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java index 2a654c38e..5ee114e0e 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java @@ -34,13 +34,15 @@ import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.slf4j.Logger; /** - * The Class AnomalyDetectionPolicy_Decide_TaskSelectionLogic. + * The Class AnomalyDetectionPolicyDecideTaskSelectionLogic. */ -// CHECKSTYLE:OFF: checkstyle:className -public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { - // CHECKSTYLE:ON: checkstyle:className - +public class AnomalyDetectionPolicyDecideTaskSelectionLogic { private Logger logger; + + // Recurring string constants + private static final String ANOMALY_DETECTION_ALBUM = "AnomalyDetectionAlbum"; + private static final String ANOMALY_DETECTION = "AnomalyDetection"; + // configuration private static final double ANOMALY_SENSITIVITY = 0.05; private static final int FREQUENCY = 360; @@ -73,8 +75,10 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { public boolean getTask(final TaskSelectionExecutionContext executor) { executionContext = executor; logger = executionContext.logger; - logger.debug(executor.subject.getId()); - logger.debug(executor.inFields.toString()); + String id = executor.subject.getId(); + logger.debug(id); + String inFields = executor.inFields.toString(); + logger.debug(inFields); final double now = (Double) (executor.inFields.get("MonitoredValue")); final Integer iteration = (Integer) (executor.inFields.get("Iteration")); // get the double[forecastedValue, AnomalyScore, AnomalyProbability] @@ -111,18 +115,18 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { */ public double[] forecastingAndAnomaly(final double value) { try { - executionContext.getContextAlbum("AnomalyDetectionAlbum").lockForWriting("AnomalyDetection"); + executionContext.getContextAlbum(ANOMALY_DETECTION_ALBUM).lockForWriting(ANOMALY_DETECTION); } catch (final ApexException e) { logger.error("Failed to acquire write lock on \"AnomalyDetection\" context", e); - return null; + return new double[0]; } // Get the context object AnomalyDetection anomalyDetection = - (AnomalyDetection) executionContext.getContextAlbum("AnomalyDetectionAlbum").get("AnomalyDetection"); + (AnomalyDetection) executionContext.getContextAlbum(ANOMALY_DETECTION_ALBUM).get(ANOMALY_DETECTION); if (anomalyDetection == null) { anomalyDetection = new AnomalyDetection(); - executionContext.getContextAlbum("AnomalyDetectionAlbum").put("AnomalyDetection", anomalyDetection); + executionContext.getContextAlbum(ANOMALY_DETECTION_ALBUM).put(ANOMALY_DETECTION, anomalyDetection); } // Check the lists are initialized @@ -175,10 +179,10 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic { // CHECKSTYLE:ON: checkstyle:magicNumber try { - executionContext.getContextAlbum("AnomalyDetectionAlbum").unlockForWriting("AnomalyDetection"); + executionContext.getContextAlbum(ANOMALY_DETECTION_ALBUM).unlockForWriting(ANOMALY_DETECTION); } catch (final ApexException e) { logger.error("Failed to release write lock on \"AnomalyDetection\" context", e); - return null; + return new double[0]; } return new double[] {forecastedValue, anomalyScore, anomalyProbability}; diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java index 23d4e2486..d60b04c00 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicy_Decide_TaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AutoLearnPolicyDecideTaskSelectionLogic.java @@ -29,11 +29,13 @@ import org.onap.policy.apex.core.engine.executor.context.TaskSelectionExecutionC import org.onap.policy.apex.examples.adaptive.concepts.AutoLearn; /** - * The Class AutoLearnPolicy_Decide_TaskSelectionLogic. + * The Class AutoLearnPolicyDecideTaskSelectionLogic. */ -// CHECKSTYLE:OFF: checkstyle:typeName -public class AutoLearnPolicy_Decide_TaskSelectionLogic { - // CHECKSTYLE:ON: checkstyle:typeName +public class AutoLearnPolicyDecideTaskSelectionLogic { + // Recurring string constants + private static final String AUTO_LEARN_ALBUM = "AutoLearnAlbum"; + private static final String AUTO_LEARN = "AutoLearn"; + private static final Random RAND = new Random(System.currentTimeMillis()); private static final double WANT = 50.0; private int size; @@ -45,20 +47,24 @@ public class AutoLearnPolicy_Decide_TaskSelectionLogic { * @return the task */ public boolean getTask(final TaskSelectionExecutionContext executor) { - executor.logger.debug(executor.subject.getId()); - executor.logger.debug(executor.inFields.toString()); + String idString = executor.subject.getId(); + executor.logger.debug(idString); + + String inFieldsString = executor.inFields.toString(); + executor.logger.debug(inFieldsString); + final List<String> tasks = executor.subject.getTaskNames(); size = tasks.size(); try { - executor.getContextAlbum("AutoLearnAlbum").lockForWriting("AutoLearn"); + executor.getContextAlbum(AUTO_LEARN_ALBUM).lockForWriting(AUTO_LEARN); } catch (final ContextException e) { executor.logger.error("Failed to acquire write lock on \"autoLearn\" context", e); return false; } // Get the context object - AutoLearn autoLearn = (AutoLearn) executor.getContextAlbum("AutoLearnAlbum").get("AutoLearn"); + AutoLearn autoLearn = (AutoLearn) executor.getContextAlbum(AUTO_LEARN_ALBUM).get(AUTO_LEARN); if (autoLearn == null) { autoLearn = new AutoLearn(); } @@ -73,10 +79,10 @@ public class AutoLearnPolicy_Decide_TaskSelectionLogic { final int option = getOption(diff, autoLearn); learn(option, diff, autoLearn); - executor.getContextAlbum("AutoLearnAlbum").put("AutoLearnAlbum", autoLearn); + executor.getContextAlbum(AUTO_LEARN_ALBUM).put(AUTO_LEARN_ALBUM, autoLearn); try { - executor.getContextAlbum("AutoLearnAlbum").unlockForWriting("AutoLearn"); + executor.getContextAlbum(AUTO_LEARN_ALBUM).unlockForWriting(AUTO_LEARN); } catch (final ContextException e) { executor.logger.error("Failed to acquire write lock on \"autoLearn\" context", e); return false; diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0TaskLogic.mvel index 758062b8e..758062b8e 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask0TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1TaskLogic.mvel index 051766045..051766045 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask1TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2TaskLogic.mvel index b787b2153..b787b2153 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask2TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3TaskLogic.mvel index 7fbc8c765..7fbc8c765 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask3TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4TaskLogic.mvel index a0a12d84f..a0a12d84f 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask4TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5TaskLogic.mvel index fc2005fdf..fc2005fdf 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask5TaskLogic.mvel diff --git a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6TaskLogic.mvel index 5eb44839c..5eb44839c 100644 --- a/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6_TaskLogic.mvel +++ b/examples/examples-adaptive/src/main/resources/org/onap/policy/apex/examples/adaptive/model/mvel/AutoLearnDecideTask6TaskLogic.mvel diff --git a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java index 5122390a8..1a18a7e3a 100644 --- a/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java +++ b/examples/examples-myfirstpolicy/src/main/java/org/onap/policy/apex/examples/myfirstpolicy/model/MfpDomainModelSaver.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.examples.myfirstpolicy.model; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; /** * The Class MFPDomainModelSaver. @@ -30,6 +32,8 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * @author John Keeney (john.keeney@ericsson.com) */ public final class MfpDomainModelSaver { + // Get a reference to the logger + private static final XLogger LOGGER = XLoggerFactory.getXLogger(MfpDomainModelSaver.class); /** Private constructor to prevent instantiation. */ private MfpDomainModelSaver() {} @@ -42,7 +46,7 @@ public final class MfpDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 1) { - System.err.println("usage: " + MfpDomainModelSaver.class.getCanonicalName() + " modelDirectory"); + LOGGER.error("usage: " + MfpDomainModelSaver.class.getCanonicalName() + " modelDirectory"); return; } diff --git a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java index 42d3d659b..1d8381acd 100644 --- a/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java +++ b/examples/examples-pcvs/src/main/java/org/onap/policy/apex/examples/pcvs/model/PcvsDomainModelSaver.java @@ -23,6 +23,8 @@ package org.onap.policy.apex.examples.pcvs.model; import org.onap.policy.apex.model.basicmodel.concepts.ApexException; import org.onap.policy.apex.model.basicmodel.handling.ApexModelSaver; import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; +import org.slf4j.ext.XLogger; +import org.slf4j.ext.XLoggerFactory; /** * The Class PcvsDomainModelSaver. @@ -30,9 +32,12 @@ import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel; * @author Sven van der Meer (sven.van.der.meer@ericsson.com) */ public final class PcvsDomainModelSaver { + // Logger for this class + private static final XLogger LOGGER = XLoggerFactory.getXLogger(PcvsDomainModelSaver.class); /** Private constructor to prevent instantiation. */ - private PcvsDomainModelSaver() {} + private PcvsDomainModelSaver() { + } /** * Write all PCVS models to args[0]. @@ -42,14 +47,14 @@ public final class PcvsDomainModelSaver { */ public static void main(final String[] args) throws ApexException { if (args.length != 2) { - System.err.println( - "usage: " + PcvsDomainModelSaver.class.getCanonicalName() + " workingDirectory modelDirectory"); + LOGGER.error("usage: " + PcvsDomainModelSaver.class.getCanonicalName() + + " workingDirectory modelDirectory"); return; } final AxPolicyModel pcvsPolicyModel = new PcvsDomainModelFactory().getPcvsVpnSlaSPolicyModel(args[0]); - final ApexModelSaver<AxPolicyModel> pcvsModelSaver = - new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, args[1] + "vpnsla/"); + final ApexModelSaver<AxPolicyModel> pcvsModelSaver = new ApexModelSaver<>(AxPolicyModel.class, pcvsPolicyModel, + args[1] + "vpnsla/"); pcvsModelSaver.apexModelWriteJson(); pcvsModelSaver.apexModelWriteXml(); |