2  * ============LICENSE_START=======================================================
 
   4  * ================================================================================
 
   5  * Copyright (C) 2017 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.openecomp.policy.drools.controller.internal;
 
  23 import java.util.ArrayList;
 
  24 import java.util.HashMap;
 
  25 import java.util.List;
 
  28 import org.openecomp.policy.drools.controller.DroolsController;
 
  29 import org.openecomp.policy.drools.core.PolicyContainer;
 
  30 import org.openecomp.policy.drools.event.comm.TopicSink;
 
  31 import org.openecomp.policy.drools.protocol.coders.TopicCoderFilterConfiguration;
 
  34  * no-op Drools Controller
 
  36 public class NullDroolsController implements DroolsController {
 
  42         public boolean start() throws IllegalStateException {
 
  50         public boolean stop() throws IllegalStateException {
 
  58         public void shutdown() throws IllegalStateException {
 
  66         public void halt() throws IllegalStateException {
 
  74         public boolean isAlive() {
 
  82         public boolean lock() {
 
  90         public boolean unlock() {
 
  98         public boolean isLocked() {
 
 106         public String getGroupId() {
 
 114         public String getArtifactId() {
 
 115                 return NO_ARTIFACT_ID;
 
 122         public String getVersion() {
 
 130         public List<String> getSessionNames() {
 
 131                 return new ArrayList<String>();
 
 138         public List<String> getCanonicalSessionNames() {
 
 139                 return new ArrayList<String>();
 
 146         public boolean offer(String topic, String event) {
 
 154         public boolean deliver(TopicSink sink, Object event)
 
 155                         throws IllegalArgumentException, IllegalStateException, UnsupportedOperationException {
 
 156                 throw new IllegalStateException(this.getClass().getCanonicalName() + " invoked");
 
 163         public Object[] getRecentSourceEvents() {
 
 164                 return new String[0];
 
 171         public PolicyContainer getContainer() {
 
 179         public String[] getRecentSinkEvents() {
 
 180                 return new String[0];
 
 187         public boolean ownsCoder(Class<? extends Object> coderClass, int modelHash) throws IllegalStateException {
 
 188                 throw new IllegalStateException(this.getClass().getCanonicalName() + " invoked");
 
 195         public Class<?> fetchModelClass(String className) throws IllegalArgumentException {
 
 196                 throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked");
 
 203         public boolean isBrained() {
 
 211         public String toString() {
 
 212                 StringBuilder builder = new StringBuilder();
 
 213                 builder.append("NullDroolsController []");
 
 214                 return builder.toString();
 
 221         public void updateToVersion(String newGroupId, String newArtifactId, String newVersion,
 
 222                         List<TopicCoderFilterConfiguration> decoderConfigurations,
 
 223                         List<TopicCoderFilterConfiguration> encoderConfigurations)
 
 224                         throws IllegalArgumentException, LinkageError, Exception {
 
 225                 throw new IllegalArgumentException(this.getClass().getCanonicalName() + " invoked");
 
 232         public Map<String, Integer> factClassNames(String sessionName) 
 
 233                    throws IllegalArgumentException {
 
 234                 return new HashMap<String,Integer>();
 
 241         public long factCount(String sessionName) throws IllegalArgumentException {
 
 249         public List<Object> facts(String sessionName, String className, boolean delete) {
 
 250                 return new ArrayList<Object>();
 
 257         public List<Object> factQuery(String sessionName, String queryName, 
 
 258                                               String queriedEntity, 
 
 259                                               boolean delete, Object... queryParams) {
 
 260                 return new ArrayList<Object>();