2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2018 Ericsson. All rights reserved.
4 * ================================================================================
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.apex.service.engine.engdep;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.List;
27 import org.apache.commons.lang3.NotImplementedException;
28 import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
29 import org.onap.policy.apex.model.basicmodel.concepts.AxArtifactKey;
30 import org.onap.policy.apex.model.enginemodel.concepts.AxEngineState;
31 import org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel;
32 import org.onap.policy.apex.service.engine.runtime.ApexEventListener;
33 import org.onap.policy.apex.service.engine.runtime.EngineService;
34 import org.onap.policy.apex.service.engine.runtime.EngineServiceEventInterface;
37 * A dummy engine service class.
39 public class DummyEngineService implements EngineService {
41 private AxArtifactKey startEngineKey;
42 private AxArtifactKey stopEngineKey;
43 private long periodicPeriod;
44 private AxArtifactKey statusKey;
45 private AxArtifactKey runtimeInfoKey;
46 private int modelKeyGetCalled;
47 private AxArtifactKey updateModelKey;
52 * @see org.onap.policy.apex.service.engine.runtime.EngineService#registerActionListener(java.lang.String,
53 * org.onap.policy.apex.service.engine.runtime.ApexEventListener)
56 public void registerActionListener(String listenerName, ApexEventListener listener) {
57 throw new NotImplementedException("Not implemented on dummy class");
63 * @see org.onap.policy.apex.service.engine.runtime.EngineService#deregisterActionListener(java.lang.String)
66 public void deregisterActionListener(String listenerName) {
67 throw new NotImplementedException("Not implemented on dummy class");
73 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getEngineServiceEventInterface()
76 public EngineServiceEventInterface getEngineServiceEventInterface() {
77 throw new NotImplementedException("Not implemented on dummy class");
83 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getKey()
86 public AxArtifactKey getKey() {
87 return new AxArtifactKey("DummyEngineService:0.0.1");
93 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getEngineKeys()
96 public Collection<AxArtifactKey> getEngineKeys() {
97 List<AxArtifactKey> keys = new ArrayList<>();
98 keys.add(new AxArtifactKey("DummyEngineService:0.0.1"));
105 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getApexModelKey()
108 public AxArtifactKey getApexModelKey() {
111 return new AxArtifactKey("DummyApexModelKey:0.0.1");
117 * @see org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex.model.basicmodel.
118 * concepts.AxArtifactKey, java.lang.String, boolean)
121 public void updateModel(AxArtifactKey engineServiceKey, String apexModelString, boolean forceFlag)
122 throws ApexException {
123 updateModelKey = engineServiceKey;
129 * @see org.onap.policy.apex.service.engine.runtime.EngineService#updateModel(org.onap.policy.apex.model.basicmodel.
130 * concepts.AxArtifactKey, org.onap.policy.apex.model.policymodel.concepts.AxPolicyModel, boolean)
133 public void updateModel(AxArtifactKey engineServiceKey, AxPolicyModel apexModel, boolean forceFlag)
134 throws ApexException {
135 throw new NotImplementedException("Not implemented on dummy class");
141 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getState()
144 public AxEngineState getState() {
145 throw new NotImplementedException("Not implemented on dummy class");
151 * @see org.onap.policy.apex.service.engine.runtime.EngineService#startAll()
154 public void startAll() throws ApexException {
155 throw new NotImplementedException("Not implemented on dummy class");
162 * org.onap.policy.apex.service.engine.runtime.EngineService#start(org.onap.policy.apex.model.basicmodel.concepts.
166 public void start(AxArtifactKey engineKey) throws ApexException {
167 startEngineKey = engineKey;
173 * @see org.onap.policy.apex.service.engine.runtime.EngineService#stop()
176 public void stop() throws ApexException {
183 * org.onap.policy.apex.service.engine.runtime.EngineService#stop(org.onap.policy.apex.model.basicmodel.concepts.
187 public void stop(AxArtifactKey engineKey) throws ApexException {
188 stopEngineKey = engineKey;
194 * @see org.onap.policy.apex.service.engine.runtime.EngineService#clear()
197 public void clear() throws ApexException {
198 throw new NotImplementedException("Not implemented on dummy class");
205 * org.onap.policy.apex.service.engine.runtime.EngineService#clear(org.onap.policy.apex.model.basicmodel.concepts.
209 public void clear(AxArtifactKey engineKey) throws ApexException {
210 throw new NotImplementedException("Not implemented on dummy class");
216 * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStarted()
219 public boolean isStarted() {
220 throw new NotImplementedException("Not implemented on dummy class");
226 * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStarted(org.onap.policy.apex.model.basicmodel.
227 * concepts.AxArtifactKey)
230 public boolean isStarted(AxArtifactKey engineKey) {
231 throw new NotImplementedException("Not implemented on dummy class");
237 * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStopped()
240 public boolean isStopped() {
241 throw new NotImplementedException("Not implemented on dummy class");
247 * @see org.onap.policy.apex.service.engine.runtime.EngineService#isStopped(org.onap.policy.apex.model.basicmodel.
248 * concepts.AxArtifactKey)
251 public boolean isStopped(AxArtifactKey engineKey) {
252 throw new NotImplementedException("Not implemented on dummy class");
258 * @see org.onap.policy.apex.service.engine.runtime.EngineService#startPeriodicEvents(long)
261 public void startPeriodicEvents(long period) throws ApexException {
262 periodicPeriod = period;
268 * @see org.onap.policy.apex.service.engine.runtime.EngineService#stopPeriodicEvents()
271 public void stopPeriodicEvents() throws ApexException {
278 * @see org.onap.policy.apex.service.engine.runtime.EngineService#getStatus(org.onap.policy.apex.model.basicmodel.
279 * concepts.AxArtifactKey)
282 public String getStatus(AxArtifactKey engineKey) throws ApexException {
283 statusKey = engineKey;
291 * org.onap.policy.apex.service.engine.runtime.EngineService#getRuntimeInfo(org.onap.policy.apex.model.basicmodel.
292 * concepts.AxArtifactKey)
295 public String getRuntimeInfo(AxArtifactKey engineKey) throws ApexException {
296 runtimeInfoKey = engineKey;
297 return "The Runtime Info";
300 public AxArtifactKey getStartEngineKey() {
301 return startEngineKey;
304 public AxArtifactKey getStopEngineKey() {
305 return stopEngineKey;
308 public long getPeriodicPeriod() {
309 return periodicPeriod;
312 public AxArtifactKey getStatusKey() {
316 public AxArtifactKey getRuntimeInfoKey() {
317 return runtimeInfoKey;
320 public int getModelKeyGetCalled() {
321 return modelKeyGetCalled;
324 public AxArtifactKey getUpdateModelKey() {
325 return updateModelKey;