All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.vertx.up.extension.pointer.PluginRegion Maven / Gradle / Ivy

There is a newer version: 0.9.0
Show newest version
package io.vertx.up.extension.pointer;

import io.vertx.core.Future;
import io.vertx.ext.web.RoutingContext;
import io.vertx.up.commune.Envelop;
import io.vertx.up.extension.PlugRegion;
import io.vertx.up.fn.Fn;
import io.vertx.up.util.Ut;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

class PluginRegion {
    /*
     * Plugin for Region
     */
    private static final String REGION = "region";
    private static final ConcurrentMap POOL_PLUGIN = new ConcurrentHashMap<>();

    static Future before(final RoutingContext context, final Envelop envelop) {
        return Plugin.mountPlugin(REGION, envelop, (auditCls, config) -> {
            /*
             * Data Region Before: Request
             */
            final PlugRegion region = Fn.poolThread(POOL_PLUGIN, () -> Ut.instance(auditCls), auditCls.getName());
            return region.bind(config).before(context, envelop);
        });
    }

    static Future after(final RoutingContext context, final Envelop envelop) {
        return Plugin.mountPlugin(REGION, envelop, (auditCls, config) -> {
            /*
             * Data Region After: Response
             */
            final PlugRegion region = Fn.poolThread(POOL_PLUGIN, () -> Ut.instance(auditCls), auditCls.getName());
            return region.bind(config).after(context, envelop);
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy