diff --git a/action/library/build.gradle.kts b/action/library/build.gradle.kts index e3385c6e..4b90b5a7 100644 --- a/action/library/build.gradle.kts +++ b/action/library/build.gradle.kts @@ -37,6 +37,7 @@ dependencies { implementation(group = "io.vertx", name = "vertx-rx-java2") implementation(group = "io.vertx", name = "vertx-circuit-breaker") implementation(group = "io.vertx", name = "vertx-web-client") + implementation(group = "io.vertx", name = "vertx-redis-client") implementation(group = "org.apache.commons", name = "commons-lang3") implementation(group = "com.google.guava", name = "guava") diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/Cache.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/Cache.java similarity index 93% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/Cache.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/Cache.java index 7f876a79..fe7e6f02 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/Cache.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/Cache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; import io.reactivex.Maybe; diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/CacheAction.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/CacheAction.java similarity index 91% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/CacheAction.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/CacheAction.java index d716dd0b..7f45e325 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/CacheAction.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/CacheAction.java @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; +import io.knotx.fragments.action.api.Action; import io.knotx.fragments.api.Fragment; -import io.knotx.fragments.handler.api.Action; -import io.knotx.fragments.handler.api.domain.FragmentContext; -import io.knotx.fragments.handler.api.domain.FragmentResult; +import io.knotx.fragments.api.FragmentContext; +import io.knotx.fragments.api.FragmentResult; import io.knotx.server.api.context.ClientRequest; import io.knotx.server.common.placeholders.PlaceholdersResolver; import io.knotx.server.common.placeholders.SourceDefinitions; @@ -42,7 +42,7 @@ public class CacheAction implements Action { private final Cache cache; - public CacheAction(Action doAction, JsonObject config, + CacheAction(Action doAction, JsonObject config, Cache cache) { this.doAction = doAction; this.config = config; @@ -51,7 +51,8 @@ public CacheAction(Action doAction, JsonObject config, } @Override - public void apply(FragmentContext fragmentContext, Handler> resultHandler) { + public void apply(FragmentContext fragmentContext, + Handler> resultHandler) { String cacheKey = getCacheKey(config, fragmentContext.getClientRequest()); cache.get(cacheKey) .subscribe(cachedValue -> { diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCache.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCache.java similarity index 94% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCache.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCache.java index 910c1994..e3d3dd3f 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCache.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; import io.reactivex.Maybe; @@ -31,7 +31,7 @@ public class InMemoryCache implements Cache { private final com.google.common.cache.Cache cache; - public InMemoryCache(JsonObject config) { + InMemoryCache(JsonObject config) { cache = createCache(config); } diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCacheActionFactory.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCacheActionFactory.java similarity index 87% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCacheActionFactory.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCacheActionFactory.java index 8ca83e78..d1d3a53a 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/InMemoryCacheActionFactory.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/InMemoryCacheActionFactory.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; - -import io.knotx.fragments.handler.api.Action; -import io.knotx.fragments.handler.api.ActionFactory; -import io.knotx.fragments.handler.api.Cacheable; +import io.knotx.fragments.action.api.Action; +import io.knotx.fragments.action.api.ActionFactory; +import io.knotx.fragments.action.api.Cacheable; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCache.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCache.java similarity index 98% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCache.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCache.java index 83c1648e..229634e4 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCache.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCache.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; import io.reactivex.Maybe; import io.vertx.core.Vertx; @@ -111,4 +111,4 @@ private static Object valueToObject(String value) { return value; } } -} \ No newline at end of file +} diff --git a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCacheActionFactory.java b/actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCacheActionFactory.java similarity index 89% rename from handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCacheActionFactory.java rename to actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCacheActionFactory.java index 10495628..5344703e 100644 --- a/handler/core/src/main/java/io/knotx/fragments/handler/action/cache/RedisCacheActionFactory.java +++ b/actions/core/src/main/java/io/knotx/fragments/action/cache/RedisCacheActionFactory.java @@ -13,15 +13,16 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package io.knotx.fragments.handler.action.cache; +package io.knotx.fragments.action.cache; -import io.knotx.fragments.handler.api.Action; -import io.knotx.fragments.handler.api.ActionFactory; +import io.knotx.fragments.action.api.Action; +import io.knotx.fragments.action.api.ActionFactory; import io.vertx.core.Vertx; import io.vertx.core.json.JsonObject; /** - * Action factory for caching fragment payload values on Redis server. Can be initialized with a configuration: + * Action factory for caching fragment payload values on Redis server. Can be initialized with a + * configuration: *
  *   productDetails {
  *     factory = redis-cache
@@ -58,4 +59,4 @@ public String getName() {
   public Action create(String alias, JsonObject config, Vertx vertx, Action doAction) {
     return new CacheAction(doAction, config, new RedisCache(vertx, config));
   }
-}
\ No newline at end of file
+}
diff --git a/task/handler/core/build.gradle.kts b/task/handler/core/build.gradle.kts
index 8fbb7cd4..e08c2320 100644
--- a/task/handler/core/build.gradle.kts
+++ b/task/handler/core/build.gradle.kts
@@ -39,7 +39,6 @@ dependencies {
     implementation(group = "io.vertx", name = "vertx-service-proxy")
     implementation(group = "io.vertx", name = "vertx-rx-java2")
     implementation(group = "io.vertx", name = "vertx-web-client")
-    implementation(group = "io.vertx", name = "vertx-redis-client")
     implementation(group = "org.apache.commons", name = "commons-lang3")
     implementation(group = "com.google.guava", name = "guava")