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

com.fluxtion.compiler.builder.context.EventProcessorContextFactory Maven / Gradle / Ivy

/*
 * Copyright (C) 2019 2024 gregory higgins.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the Server Side Public License, version 1,
 * as published by MongoDB, Inc.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * Server Side License for more details.
 *
 * You should have received a copy of the Server Side Public License
 * along with this program.  If not, see
 * .
 */
package com.fluxtion.compiler.builder.context;

import com.fluxtion.compiler.builder.factory.NodeFactory;
import com.fluxtion.compiler.builder.factory.NodeRegistry;
import com.fluxtion.compiler.generation.GenerationContext;
import com.fluxtion.runtime.EventProcessorContext;
import com.fluxtion.runtime.audit.Auditor;
import com.fluxtion.runtime.node.MutableEventProcessorContext;

import java.util.Map;

/**
 * @author 2024 gregory higgins.
 */
public class EventProcessorContextFactory implements NodeFactory {

    private static MutableEventProcessorContext SINGLETON;

    @Override
    public EventProcessorContext createNode(Map config, NodeRegistry registry) {
        return registry.registerNode(SINGLETON, EventProcessorContext.DEFAULT_NODE_NAME);
    }

    @Override
    public void preSepGeneration(GenerationContext context, Map auditorMap) {
        SINGLETON = new MutableEventProcessorContext();
        context.addOrUseExistingNode(SINGLETON);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy