Skip to content

Commit

Permalink
Updated to 1.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcsparker committed Nov 27, 2021
1 parent ed0cdf8 commit 874e2a0
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 431 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ These controllers were designed to be _flexible_ and _fast_.
```bash
> cd nifi-sqllookup-bundle
> mvn package
> cp ./nifi-sqllookup-services-nar/target/nifi-sqllookup-services-nar-1.12.0.nar /NIFI_INSTALL/lib/
> cp ./nifi-sqllookup-services-api-nar/target/nifi-sqllookup-services-api-nar-1.12.0.nar /NIFI_INSTALL/lib/
> cp ./nifi-sqllookup-services-nar/target/nifi-sqllookup-services-nar-1.15.0.nar /NIFI_INSTALL/lib/
> cp ./nifi-sqllookup-services-api-nar/target/nifi-sqllookup-services-api-nar-1.15.0.nar /NIFI_INSTALL/lib/
```

- Start NiFi
Expand Down
2 changes: 1 addition & 1 deletion nifi-sqllookup-services-api-nar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.mrcsparker</groupId>
<artifactId>nifi-sqllookup-services-bundle</artifactId>
<version>1.12.0</version>
<version>1.15.0</version>
</parent>

<artifactId>nifi-sqllookup-services-api-nar</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions nifi-sqllookup-services-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<parent>
<groupId>com.mrcsparker</groupId>
<artifactId>nifi-sqllookup-services-bundle</artifactId>
<version>1.12.0</version>
<version>1.15.0</version>
</parent>

<artifactId>nifi-sqllookup-services-api</artifactId>
Expand All @@ -38,7 +38,7 @@
<dependency>
<groupId>org.apache.nifi</groupId>
<artifactId>nifi-lookup-service-api</artifactId>
<version>1.12.0</version>
<version>1.15.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion nifi-sqllookup-services-nar/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<parent>
<groupId>com.mrcsparker</groupId>
<artifactId>nifi-sqllookup-services-bundle</artifactId>
<version>1.12.0</version>
<version>1.15.0</version>
</parent>

<artifactId>nifi-sqllookup-services-nar</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion nifi-sqllookup-services/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>com.mrcsparker</groupId>
<artifactId>nifi-sqllookup-services-bundle</artifactId>
<version>1.12.0</version>
<version>1.15.0</version>
</parent>

<artifactId>nifi-sqllookup-services</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract class AbstractSQLLookupService<T> extends AbstractControllerService imp
.description("SQL Query")
.required(true)
.addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
.expressionLanguageSupported(ExpressionLanguageScope.VARIABLE_REGISTRY)
.build();

static final PropertyDescriptor QUERY_TIMEOUT =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,18 @@ public Class<?> getValueType() {
@OnEnabled
public void onEnabled(final ConfigurationContext context) throws InitializationException {
setDefaultValues(context);
this.lookupValue = context.getProperty(LOOKUP_VALUE_COLUMN).getValue();

if (cachingLibrary.equals("Caffeine")) {
cache = new CaffeineAdapter<>(cacheSize);
} else if (cachingLibrary.equals("Cache2k")) {
cache = new Cache2kAdapter<>(cacheSize, String.class);
} else {
cache = new GuavaAdapter<>(cacheSize);
lookupValue = context.getProperty(LOOKUP_VALUE_COLUMN).getValue();

switch (cachingLibrary) {
case "Caffeine":
cache = new CaffeineAdapter<>(cacheSize);
break;
case "Cache2k":
cache = new Cache2kAdapter<>(cacheSize, String.class);
break;
default:
cache = new GuavaAdapter<>(cacheSize);
break;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package com.mrcsparker.nifi.sqllookup;

import com.mrcsparker.nifi.sqllookup.cache.Cache2kAdapter;
import com.mrcsparker.nifi.sqllookup.cache.CaffeineAdapter;
import com.mrcsparker.nifi.sqllookup.cache.GuavaAdapter;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.nifi.annotation.documentation.CapabilityDescription;
import org.apache.nifi.annotation.documentation.Tags;
Expand Down Expand Up @@ -156,7 +156,7 @@ private Optional<Record> jdbcDatabaseLookup(Map<String, Object> coordinates) thr

try (ResultSet resultSet = preparedStatement.getResultSet()) {
final RecordSchema schema = new SimpleRecordSchema(new ArrayList<>());
try (SQLResultSetRecordSet resultSetRecordSet = new SQLResultSetRecordSet(resultSet, schema)) {
try (ResultSetRecordSet resultSetRecordSet = new ResultSetRecordSet(resultSet, schema)) {
return Optional.of(resultSetRecordSet.next());
}
}
Expand Down Expand Up @@ -191,12 +191,12 @@ protected Optional<Record> cacheLookup(Map<String, Object> coordinates) throws L
@OnEnabled
public void onEnabled(final ConfigurationContext context) {
setDefaultValues(context);
this.useJDBCTypes = context.getProperty(USE_JDBC_TYPES).asBoolean();
useJDBCTypes = context.getProperty(USE_JDBC_TYPES).asBoolean();

if (cachingLibrary.equals("Caffeine")) {
if ("Caffeine".equals(cachingLibrary)) {
cache = new CaffeineAdapter<>(cacheSize);
} else {
cache = new Cache2kAdapter<>(cacheSize, Record.class);
cache = new GuavaAdapter<>(cacheSize);
}
}
}
Loading

0 comments on commit 874e2a0

Please sign in to comment.