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

com.plugin.development.context.DefaultPluginContext Maven / Gradle / Ivy

There is a newer version: 3.0.0
Show newest version
package com.plugin.development.context;

import com.plugin.development.context.factory.PluginBeanRegistry;
import com.plugin.development.context.factory.PluginComponentBeanRegistry;
import com.plugin.development.context.factory.PluginControllerBeanRegistry;
import com.plugin.development.context.process.PluginConfigProcess;
import com.plugin.development.context.process.PluginPostBeanProcess;
import org.springframework.context.ApplicationContext;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;

/**
 * 默认的插件上下文
 * @author  zhangzhuo
 * @version 1.0
 */
public class DefaultPluginContext implements PluginContext {

    private final ApplicationContext applicationContext;

    private final PluginBeanRegistry componentBeanRegistry;
    private final PluginBeanRegistry> pluginControllerBeanRegistry;

    private final List pluginPostBeanProcess = new ArrayList<>(5);

    public DefaultPluginContext(ApplicationContext applicationContext) {
        this.applicationContext = applicationContext;
        this.componentBeanRegistry = new PluginComponentBeanRegistry(applicationContext);
        this.pluginControllerBeanRegistry = new PluginControllerBeanRegistry(applicationContext);
        initPluginPostBeanProcess();
    }



    @Override
    public ApplicationContext getMainApplicationContext() {
        return applicationContext;
    }

    @Override
    public PluginBeanRegistry getComponentBeanRegistry() {
        return componentBeanRegistry;
    }

    @Override
    public PluginBeanRegistry> getControllerBeanRegistry() {
        return pluginControllerBeanRegistry;
    }

    @Override
    public List getPluginPostBeanProcess() {
        return pluginPostBeanProcess;
    }

    /**
     * 初始化 pluginPostBeanProcess
     */
    private void initPluginPostBeanProcess() {
        PluginConfigProcess pluginConfigProcess = new PluginConfigProcess(applicationContext);
        pluginPostBeanProcess.add(pluginConfigProcess);
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy