2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.drools.controller.internal;
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.List;
28 import org.onap.policy.common.endpoints.event.comm.TopicSink;
29 import org.onap.policy.drools.controller.DroolsController;
30 import org.onap.policy.drools.core.PolicyContainer;
31 import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration;
34 * no-op Drools Controller.
36 public class NullDroolsController implements DroolsController {
39 public boolean start() {
44 public boolean stop() {
49 public void shutdown() {
59 public boolean isAlive() {
64 public boolean lock() {
69 public boolean unlock() {
74 public boolean isLocked() {
79 public String getGroupId() {
84 public String getArtifactId() {
85 return NO_ARTIFACT_ID;
89 public String getVersion() {
94 public List<String> getSessionNames() {
95 return new ArrayList<>();
99 public List<String> getCanonicalSessionNames() {
100 return new ArrayList<>();
104 public boolean offer(String topic, String event) {
109 public boolean deliver(TopicSink sink, Object event) {
110 throw new IllegalStateException(makeInvokeMsg());
114 public Object[] getRecentSourceEvents() {
115 return new String[0];
119 public PolicyContainer getContainer() {
124 public String[] getRecentSinkEvents() {
125 return new String[0];
129 public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) {
130 throw new IllegalStateException(makeInvokeMsg());
134 public Class<?> fetchModelClass(String className) {
135 throw new IllegalArgumentException(makeInvokeMsg());
139 public boolean isBrained() {
144 public String toString() {
145 StringBuilder builder = new StringBuilder();
146 builder.append("NullDroolsController []");
147 return builder.toString();
151 public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
152 List<TopicCoderFilterConfiguration> decoderConfigurations,
153 List<TopicCoderFilterConfiguration> encoderConfigurations)
154 throws LinkageError {
155 throw new IllegalArgumentException(makeInvokeMsg());
159 public Map<String, Integer> factClassNames(String sessionName) {
160 return new HashMap<>();
164 public long factCount(String sessionName) {
169 public List<Object> facts(String sessionName, String className, boolean delete) {
170 return new ArrayList<>();
174 public List<Object> factQuery(String sessionName, String queryName,
175 String queriedEntity,
176 boolean delete, Object... queryParams) {
177 return new ArrayList<>();
180 private String makeInvokeMsg() {
181 return this.getClass().getCanonicalName() + " invoked";