Skip to content

Commit

Permalink
Cassandra: Compatibility with IO-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
artembilan committed Jun 25, 2015
1 parent 8f45e1c commit 5c136e4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion spring-integration-cassandra/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'

dependencies {
springIoVersions "io.spring.platform:platform-versions:${platformVersion}@properties"
springIoVersions "io.spring.platform:platform-bom:${platformVersion}@properties"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.springframework.expression.TypeLocator;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.expression.spel.support.StandardTypeLocator;
import org.springframework.integration.expression.ExpressionUtils;
import org.springframework.integration.expression.IntegrationEvaluationContextAware;
import org.springframework.integration.handler.AbstractReplyProducingMessageHandler;
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
Expand All @@ -47,8 +48,7 @@
* @author Artem Bilan
*/
@SuppressWarnings("unchecked")
public class CassandraMessageHandler<T> extends AbstractReplyProducingMessageHandler
implements IntegrationEvaluationContextAware {
public class CassandraMessageHandler<T> extends AbstractReplyProducingMessageHandler {

private final Map<String, Expression> parameterExpressions = new HashMap<>();

Expand Down Expand Up @@ -153,21 +153,22 @@ public void setStatementProcessor(MessageProcessor<Statement> statementProcessor
}

@Override
public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) {
TypeLocator typeLocator = evaluationContext.getTypeLocator();
public String getComponentType() {
return "cassandra:outbound-" + (this.producesReply ? "gateway" : "channel-adapter");
}

@Override
protected void doInit() {
super.doInit();

this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
TypeLocator typeLocator = this.evaluationContext.getTypeLocator();
if (typeLocator instanceof StandardTypeLocator) {
/*
* Register the Cassandra Query DSL package so they don't need a FQCN for QueryBuilder, for example.
*/
((StandardTypeLocator) typeLocator).registerImport("com.datastax.driver.core.querybuilder");
}
this.evaluationContext = evaluationContext;
}


@Override
public String getComponentType() {
return "cassandra:outbound-" + (this.producesReply ? "gateway" : "channel-adapter");
}

@Override
Expand Down

0 comments on commit 5c136e4

Please sign in to comment.