diff options
author | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2018-10-04 20:12:40 +0000 |
---|---|---|
committer | Smokowski, Kevin (ks6305) <kevin.smokowski@att.com> | 2018-10-04 20:12:40 +0000 |
commit | 86e489058f5a8f75f0b8fbcbd0a3eca2dbcb4470 (patch) | |
tree | 0810ee935852d90b3ad7f26da1910e3c61fd0726 | |
parent | a68b1d51bdb4b5fb8575b7029b86d2d1abbfdace (diff) |
implement exit node
exit node functions similar to a return statement in most programming languages
Change-Id: I2991590fb700b03a9f3d72ae0bc7b5dd9bb25f74
Issue-ID: CCSDK-611
Signed-off-by: Smokowski, Kevin (ks6305) <kevin.smokowski@att.com>
5 files changed, 500 insertions, 377 deletions
diff --git a/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/ExitNodeException.java b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/ExitNodeException.java new file mode 100755 index 00000000..f119c181 --- /dev/null +++ b/sli/common/src/main/java/org/onap/ccsdk/sli/core/sli/ExitNodeException.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.core.sli; + +public class ExitNodeException extends SvcLogicException { + + /** + * + */ + private static final long serialVersionUID = 1L; + + public ExitNodeException() + { + super(); + } + + public ExitNodeException(String message) + { + super(message); + } + + public ExitNodeException(String message, Throwable t) + { + super(message, t); + } + +} diff --git a/sli/common/src/main/resources/svclogic.xsd b/sli/common/src/main/resources/svclogic.xsd index 2704de88..c9beae83 100755 --- a/sli/common/src/main/resources/svclogic.xsd +++ b/sli/common/src/main/resources/svclogic.xsd @@ -1,334 +1,339 @@ -<?xml version = "1.0" encoding = "UTF-8"?>
-<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.onap.org/sdnc/svclogic" xmlns="http://www.onap.org/sdnc/svclogic">
-
- <xsd:simpleType name="modeType">
- <xsd:restriction base="xsd:string">
- <xsd:enumeration value="sync" />
- <xsd:enumeration value="async" />
- </xsd:restriction>
- </xsd:simpleType>
-
- <xsd:group name="node">
- <xsd:choice>
- <xsd:element ref="block" />
- <xsd:element ref="is-available" />
- <xsd:element ref="exists" />
- <xsd:element ref="reserve" />
- <xsd:element ref="release" />
- <xsd:element ref="allocate" />
- <xsd:element ref="get-resource" />
- <xsd:element ref="configure" />
- <xsd:element ref="return" />
- <xsd:element ref="switch" />
- <xsd:element ref="record" />
- <xsd:element ref="save" />
- <xsd:element ref="for" />
- <xsd:element ref="set" />
- <xsd:element ref="execute" />
- <xsd:element ref="delete" />
- <xsd:element ref="update" />
- <xsd:element ref="call" />
- <xsd:element ref="notify" />
- <xsd:element ref="break" />
- <xsd:element ref="while" />
- </xsd:choice>
- </xsd:group>
-
- <xsd:element name="service-logic">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="method" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="module" use="required" type="xsd:string" />
- <xsd:attribute name="version" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="method">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="rpc" use="required" type="xsd:string" />
- <xsd:attribute name="mode" use="optional" type="modeType" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="block">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="is-available">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="exists">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="outcome">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="ref" use="optional" type="xsd:string" />
- <xsd:attribute name="value" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="reserve">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="select" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="release">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="record">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="allocate">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- <xsd:attribute name="pfx" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="get-resource">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="order-by" use="optional" type="xsd:string" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="configure">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="adaptor" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="required" type="xsd:string" />
- <xsd:attribute name="activate" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
-
- <xsd:element name="parameter">
- <xsd:complexType>
- <xsd:attribute name="name" use="required" type="xsd:string" />
- <xsd:attribute name="value" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
-
- <xsd:element name="return">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="status" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="switch">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="test" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="save">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="force" use="optional" type="xsd:boolean" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="delete">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- <!-- local-only is retired and does not do anything -->
- <xsd:attribute name="local-only" use="optional" type="xsd:string" />
- <!-- pfx is retired and does not do anything -->
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="for">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
- <xsd:attribute name="index" use="required" type="xsd:string" />
- <xsd:attribute name="start" use="required" type="xsd:string" />
- <xsd:attribute name="end" use="required" type="xsd:string" />
- <xsd:attribute name="silentFailure" use="optional" type="xsd:boolean" default="false" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="set">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="only-if-unset" use="optional"
- type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="execute">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="method" use="required" type="xsd:string" />
- <xsd:attribute name="emitsOutcome" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="update">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="required" type="xsd:string" />
- <xsd:attribute name="resource" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <xsd:attribute name="force" use="optional" type="xsd:boolean" />
- <xsd:attribute name="local-only" use="optional" type="xsd:boolean" />
- <xsd:attribute name="pfx" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="call">
- <xsd:complexType>
- <xsd:sequence>
- <!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="module" use="optional" type="xsd:string" />
- <xsd:attribute name="rpc" use="required" type="xsd:string" />
- <xsd:attribute name="version" use="optional" type="xsd:string" />
- <xsd:attribute name="mode" use="required" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="notify">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="plugin" use="optional" type="xsd:string" />
- <xsd:attribute name="resource" use="optional" type="xsd:string" />
- <xsd:attribute name="action" use="required" type="xsd:string" />
- <xsd:attribute name="key" use="optional" type="xsd:string" />
- <!-- force is retired and does not do anything -->
- <xsd:attribute name="force" use="optional" type="xsd:string" />
- </xsd:complexType>
- </xsd:element>
-
- <xsd:element name="break">
- <xsd:complexType />
- </xsd:element>
-
- <xsd:element name="while">
- <xsd:complexType>
- <xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
- </xsd:sequence>
- <xsd:attribute name="test" use="required" type="xsd:string" />
- <xsd:attribute name="do" use="optional" type="xsd:boolean" />
- </xsd:complexType>
- </xsd:element>
-
-</xsd:schema>
+<?xml version = "1.0" encoding = "UTF-8"?> +<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.onap.org/sdnc/svclogic" xmlns="http://www.onap.org/sdnc/svclogic"> + + <xsd:simpleType name="modeType"> + <xsd:restriction base="xsd:string"> + <xsd:enumeration value="sync" /> + <xsd:enumeration value="async" /> + </xsd:restriction> + </xsd:simpleType> + + <xsd:group name="node"> + <xsd:choice> + <xsd:element ref="block" /> + <xsd:element ref="is-available" /> + <xsd:element ref="exists" /> + <xsd:element ref="reserve" /> + <xsd:element ref="release" /> + <xsd:element ref="allocate" /> + <xsd:element ref="get-resource" /> + <xsd:element ref="configure" /> + <xsd:element ref="return" /> + <xsd:element ref="switch" /> + <xsd:element ref="record" /> + <xsd:element ref="save" /> + <xsd:element ref="for" /> + <xsd:element ref="set" /> + <xsd:element ref="execute" /> + <xsd:element ref="delete" /> + <xsd:element ref="update" /> + <xsd:element ref="call" /> + <xsd:element ref="notify" /> + <xsd:element ref="break" /> + <xsd:element ref="while" /> + <xsd:element ref="exit" /> + </xsd:choice> + </xsd:group> + + <xsd:element name="service-logic"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="method" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="module" use="required" type="xsd:string" /> + <xsd:attribute name="version" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="method"> + <xsd:complexType> + <xsd:sequence> + <xsd:group ref="node" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="rpc" use="required" type="xsd:string" /> + <xsd:attribute name="mode" use="optional" type="modeType" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="block"> + <xsd:complexType> + <xsd:sequence> + <xsd:group ref="node" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="atomic" use="optional" type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="is-available"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="exists"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="outcome"> + <xsd:complexType> + <xsd:sequence> + <xsd:group ref="node" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="ref" use="optional" type="xsd:string" /> + <xsd:attribute name="value" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="reserve"> + <xsd:complexType> + <xsd:sequence> + <!-- This node does not actually read from parameters --> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <xsd:attribute name="select" use="optional" type="xsd:string" /> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="release"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="record"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="allocate"> + <xsd:complexType> + <xsd:sequence> + <!-- This node does not actually read from parameters --> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="required" type="xsd:string" /> + <xsd:attribute name="pfx" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="get-resource"> + <xsd:complexType> + <xsd:sequence> + <!-- This node does not actually read from parameters --> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <xsd:attribute name="local-only" use="optional" type="xsd:boolean" /> + <xsd:attribute name="order-by" use="optional" type="xsd:string" /> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + <!-- force is retired and does not do anything --> + <xsd:attribute name="force" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="configure"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="adaptor" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="required" type="xsd:string" /> + <xsd:attribute name="activate" use="optional" type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + + + <xsd:element name="parameter"> + <xsd:complexType> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="value" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + + <xsd:element name="return"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="status" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="switch"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="test" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="save"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <xsd:attribute name="force" use="optional" type="xsd:boolean" /> + <xsd:attribute name="local-only" use="optional" type="xsd:boolean" /> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="delete"> + <xsd:complexType> + <xsd:sequence> + <!-- This node does not actually read from parameters --> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <!-- force is retired and does not do anything --> + <xsd:attribute name="force" use="optional" type="xsd:string" /> + <!-- local-only is retired and does not do anything --> + <xsd:attribute name="local-only" use="optional" type="xsd:string" /> + <!-- pfx is retired and does not do anything --> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="for"> + <xsd:complexType> + <xsd:sequence> + <xsd:group ref="node" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="atomic" use="optional" type="xsd:boolean" /> + <xsd:attribute name="index" use="required" type="xsd:string" /> + <xsd:attribute name="start" use="required" type="xsd:string" /> + <xsd:attribute name="end" use="required" type="xsd:string" /> + <xsd:attribute name="silentFailure" use="optional" type="xsd:boolean" default="false" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="set"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="only-if-unset" use="optional" + type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="execute"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="method" use="required" type="xsd:string" /> + <xsd:attribute name="emitsOutcome" use="optional" type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="update"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="required" type="xsd:string" /> + <xsd:attribute name="resource" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <xsd:attribute name="force" use="optional" type="xsd:boolean" /> + <xsd:attribute name="local-only" use="optional" type="xsd:boolean" /> + <xsd:attribute name="pfx" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="call"> + <xsd:complexType> + <xsd:sequence> + <!-- This node does not actually read from parameters --> + <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" /> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="module" use="optional" type="xsd:string" /> + <xsd:attribute name="rpc" use="required" type="xsd:string" /> + <xsd:attribute name="version" use="optional" type="xsd:string" /> + <xsd:attribute name="mode" use="required" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="notify"> + <xsd:complexType> + <xsd:sequence> + <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="plugin" use="optional" type="xsd:string" /> + <xsd:attribute name="resource" use="optional" type="xsd:string" /> + <xsd:attribute name="action" use="required" type="xsd:string" /> + <xsd:attribute name="key" use="optional" type="xsd:string" /> + <!-- force is retired and does not do anything --> + <xsd:attribute name="force" use="optional" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + + <xsd:element name="break"> + <xsd:complexType /> + </xsd:element> + + <xsd:element name="exit"> + <xsd:complexType /> + </xsd:element> + + <xsd:element name="while"> + <xsd:complexType> + <xsd:sequence> + <xsd:group ref="node" minOccurs="0" maxOccurs="100" /> + </xsd:sequence> + <xsd:attribute name="test" use="required" type="xsd:string" /> + <xsd:attribute name="do" use="optional" type="xsd:boolean" /> + </xsd:complexType> + </xsd:element> + +</xsd:schema> diff --git a/sli/common/src/test/resources/svclogic.xsd b/sli/common/src/test/resources/svclogic.xsd index 2704de88..3e109c7c 100755 --- a/sli/common/src/test/resources/svclogic.xsd +++ b/sli/common/src/test/resources/svclogic.xsd @@ -31,13 +31,14 @@ <xsd:element ref="notify" />
<xsd:element ref="break" />
<xsd:element ref="while" />
+ <xsd:element ref="exit" />
</xsd:choice>
</xsd:group>
<xsd:element name="service-logic">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="method" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="method" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="module" use="required" type="xsd:string" />
<xsd:attribute name="version" use="required" type="xsd:string" />
@@ -47,7 +48,7 @@ <xsd:element name="method">
<xsd:complexType>
<xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="rpc" use="required" type="xsd:string" />
<xsd:attribute name="mode" use="optional" type="modeType" />
@@ -57,7 +58,7 @@ <xsd:element name="block">
<xsd:complexType>
<xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
</xsd:complexType>
@@ -66,7 +67,7 @@ <xsd:element name="is-available">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="pfx" use="optional" type="xsd:string" />
<xsd:attribute name="plugin" use="required" type="xsd:string" />
@@ -78,7 +79,7 @@ <xsd:element name="exists">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="pfx" use="optional" type="xsd:string" />
<xsd:attribute name="plugin" use="required" type="xsd:string" />
@@ -90,7 +91,7 @@ <xsd:element name="outcome">
<xsd:complexType>
<xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="ref" use="optional" type="xsd:string" />
<xsd:attribute name="value" use="required" type="xsd:string" />
@@ -101,8 +102,8 @@ <xsd:complexType>
<xsd:sequence>
<!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -115,7 +116,7 @@ <xsd:element name="release">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -127,8 +128,8 @@ <xsd:element name="record">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
</xsd:complexType>
@@ -138,8 +139,8 @@ <xsd:complexType>
<xsd:sequence>
<!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -152,8 +153,8 @@ <xsd:complexType>
<xsd:sequence>
<!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -169,8 +170,8 @@ <xsd:element name="configure">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="adaptor" use="required" type="xsd:string" />
<xsd:attribute name="key" use="required" type="xsd:string" />
@@ -190,7 +191,7 @@ <xsd:element name="return">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="status" use="optional" type="xsd:string" />
</xsd:complexType>
@@ -199,7 +200,7 @@ <xsd:element name="switch">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="test" use="required" type="xsd:string" />
</xsd:complexType>
@@ -208,8 +209,8 @@ <xsd:element name="save">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -224,8 +225,8 @@ <xsd:complexType>
<xsd:sequence>
<!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -242,7 +243,7 @@ <xsd:element name="for">
<xsd:complexType>
<xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="atomic" use="optional" type="xsd:boolean" />
<xsd:attribute name="index" use="required" type="xsd:string" />
@@ -255,7 +256,7 @@ <xsd:element name="set">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="only-if-unset" use="optional"
type="xsd:boolean" />
@@ -265,8 +266,8 @@ <xsd:element name="execute">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="method" use="required" type="xsd:string" />
@@ -277,8 +278,8 @@ <xsd:element name="update">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="required" type="xsd:string" />
<xsd:attribute name="resource" use="required" type="xsd:string" />
@@ -293,8 +294,8 @@ <xsd:complexType>
<xsd:sequence>
<!-- This node does not actually read from parameters -->
- <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded" />
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="parameter" minOccurs="0" maxOccurs="100" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="module" use="optional" type="xsd:string" />
<xsd:attribute name="rpc" use="required" type="xsd:string" />
@@ -306,7 +307,7 @@ <xsd:element name="notify">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="outcome" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:element ref="outcome" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="plugin" use="optional" type="xsd:string" />
<xsd:attribute name="resource" use="optional" type="xsd:string" />
@@ -321,10 +322,14 @@ <xsd:complexType />
</xsd:element>
+ <xsd:element name="exit">
+ <xsd:complexType />
+ </xsd:element>
+
<xsd:element name="while">
<xsd:complexType>
<xsd:sequence>
- <xsd:group ref="node" minOccurs="0" maxOccurs="unbounded" />
+ <xsd:group ref="node" minOccurs="0" maxOccurs="100" />
</xsd:sequence>
<xsd:attribute name="test" use="required" type="xsd:string" />
<xsd:attribute name="do" use="optional" type="xsd:boolean" />
diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java new file mode 100755 index 00000000..fc667f40 --- /dev/null +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/ExitNodeExecutor.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : CCSDK + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights + * reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.ccsdk.sli.core.sli.provider; + +import org.onap.ccsdk.sli.core.sli.ExitNodeException; +import org.onap.ccsdk.sli.core.sli.SvcLogicContext; +import org.onap.ccsdk.sli.core.sli.SvcLogicException; +import org.onap.ccsdk.sli.core.sli.SvcLogicNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class ExitNodeExecutor extends SvcLogicNodeExecutor { + + private static final Logger LOG = LoggerFactory.getLogger(ExitNodeExecutor.class); + + @Override + public SvcLogicNode execute(SvcLogicService svc, SvcLogicNode node, SvcLogicContext ctx) throws SvcLogicException { + String message = "ExitNodeExecutor encountered exit with nodeId " + node.getNodeId(); + LOG.debug(message); + throw new ExitNodeException(message); + } + +} diff --git a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java index 000c2872..0a286958 100755 --- a/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java +++ b/sli/provider/src/main/java/org/onap/ccsdk/sli/core/sli/provider/SvcLogicServiceImpl.java @@ -26,6 +26,7 @@ import java.util.Map; import java.util.Properties; import org.onap.ccsdk.sli.core.dblib.DbLibService; import org.onap.ccsdk.sli.core.sli.ConfigurationException; +import org.onap.ccsdk.sli.core.sli.ExitNodeException; import org.onap.ccsdk.sli.core.sli.MetricLogger; import org.onap.ccsdk.sli.core.sli.SvcLogicContext; import org.onap.ccsdk.sli.core.sli.SvcLogicDblibStore; @@ -70,7 +71,7 @@ public class SvcLogicServiceImpl implements SvcLogicService { put("update", new UpdateNodeExecutor()); put("break", new BreakNodeExecutor()); put("while", new WhileNodeExecutor()); - + put("exit", new ExitNodeExecutor()); } }; @@ -151,14 +152,17 @@ public class SvcLogicServiceImpl implements SvcLogicService { SvcLogicNode curNode = graph.getRootNode(); LOG.info("About to execute graph {}", graph.toString()); - - while (curNode != null) { - MDC.put("nodeId", curNode.getNodeId() + " (" + curNode.getNodeType() + ")"); - LOG.info("About to execute node # {} ({})", curNode.getNodeId(), curNode.getNodeType()); - - SvcLogicNode nextNode = executeNode(curNode, ctx); - curNode = nextNode; - } + try { + while (curNode != null) { + MDC.put("nodeId", curNode.getNodeId() + " (" + curNode.getNodeType() + ")"); + LOG.info("About to execute node # {} ({})", curNode.getNodeId(), curNode.getNodeType()); + + SvcLogicNode nextNode = executeNode(curNode, ctx); + curNode = nextNode; + } + } catch (ExitNodeException e) { + LOG.debug("SvcLogicServiceImpl caught ExitNodeException"); + } MDC.remove("nodeId"); MDC.remove("currentGraph"); @@ -181,7 +185,28 @@ public class SvcLogicServiceImpl implements SvcLogicService { executor.getClass().getName()); return (executor.execute(this, node, ctx)); } else { - throw new SvcLogicException("Attempted to execute a node of type " + node.getNodeType() + ", but no executor was registered for this type"); + if (LOG.isDebugEnabled()) { + LOG.debug("{} node not implemented", node.getNodeType()); + } + SvcLogicNode nextNode = node.getOutcomeValue("failure"); + if (nextNode != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("about to execute failure branch"); + } + return (nextNode); + } + + nextNode = node.getOutcomeValue("Other"); + if (nextNode != null) { + if (LOG.isDebugEnabled()) { + LOG.debug("about to execute Other branch"); + } + } else { + if (LOG.isDebugEnabled()) { + LOG.debug("no failure or Other branch found"); + } + } + return (nextNode); } } |