Skip to content
This repository has been archived by the owner on Feb 9, 2021. It is now read-only.

Commit

Permalink
ENTESB-4090 - fuse/switchyard integration fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Rietveld committed Nov 2, 2015
1 parent b124846 commit 619c222
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Expand Up @@ -15,21 +15,17 @@

import java.net.MalformedURLException;
import java.net.URL;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.Properties;
import java.util.Set;

import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.drools.core.command.runtime.BatchExecutionCommandImpl;
import org.kie.api.runtime.manager.RuntimeEngine;
import org.kie.remote.client.api.RemoteJmsRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRestRuntimeEngineBuilder;
import org.kie.remote.client.api.RemoteRuntimeEngineBuilder;
import org.kie.remote.client.jaxb.AcceptedClientCommands;
import org.kie.services.client.api.RemoteRuntimeEngineFactory;
import org.kie.services.client.api.command.RemoteConfiguration;
import org.kie.services.client.api.command.RemoteRuntimeEngine;
Expand All @@ -48,15 +44,6 @@
*/
public class RemoteConfigurationBuilder extends KnowledgeBuilder {

private static Set<Class<?>> acceptedCommands = new HashSet<Class<?>>();
static {
Access<Set<Class<?>>> access = new FieldAccess<Set<Class<?>>>(AcceptedClientCommands.class, "acceptedCommands");
acceptedCommands.addAll(access.read(null));
acceptedCommands.add(BatchExecutionCommandImpl.class);
acceptedCommands = Collections.unmodifiableSet(acceptedCommands);
access.write(null, acceptedCommands);
}

private final RemoteConfiguration _remoteConfiguration;

/**
Expand Down Expand Up @@ -203,7 +190,6 @@ private void configRemote(RemoteRuntimeEngineBuilder<?, ?> builder, RemoteModel
builder.addExtraJaxbClasses(clazzes.toArray(new Class<?>[cs]));
}
}
builder.addExtraJaxbClasses(acceptedCommands.toArray(new Class<?>[acceptedCommands.size()]));
}

/**
Expand Down
Expand Up @@ -148,6 +148,9 @@ public void handleOperation(Exchange exchange, KnowledgeOperation operation) thr
switch (operationType) {
case EXECUTE: {
KnowledgeRuntimeEngine runtime = getPerRequestRuntimeEngine();
if( runtime.isRemote() ) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
//sessionIdentifier = runtime.getSessionIdentifier();
setGlobals(inputMessage, operation, runtime, false);
try {
Expand Down Expand Up @@ -183,6 +186,9 @@ public void handleOperation(Exchange exchange, KnowledgeOperation operation) thr
case INSERT:
case FIRE_ALL_RULES: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if( runtime.isRemote() ) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireAllRules(inputMessage, operation);
Expand All @@ -207,6 +213,9 @@ public void handleOperation(Exchange exchange, KnowledgeOperation operation) thr
}
case FIRE_UNTIL_HALT: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if( runtime.isRemote() ) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireUntilHalt(inputMessage, exchange, operation);
Expand Down

0 comments on commit 619c222

Please sign in to comment.