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

com.aliyun.Context Maven / Gradle / Ivy

package com.aliyun;

import com.aliyun.bean.config.ToolkitPackageConfig;
import com.aliyun.bean.config.ToolkitCreateConfig;
import com.aliyun.bean.common.ToolkitProfile;
import com.aliyun.bean.config.ToolkitDeployConfig;
import com.aliyuncs.DefaultAcsClient;
import org.apache.maven.plugin.logging.Log;
import org.apache.maven.project.MavenProject;

/**
 * Global context.
 * Please think twice before you add a new variable here.
 */
public class Context {
    private static ToolkitCreateConfig toolkitCreateConfig;
    private static ToolkitDeployConfig toolkitDeployConfig;
    private static ToolkitPackageConfig toolkitPackageConfig;
    private static ToolkitProfile toolkitProfileConfig;
    private static DefaultAcsClient acsClient;
    private static Log logger;
    private static MavenProject project;

    public static ToolkitPackageConfig getToolkitPackageConfig() {
        return toolkitPackageConfig;
    }

    public static void setToolkitPackageConfig(ToolkitPackageConfig toolkitPackageConfig) {
        Context.toolkitPackageConfig = toolkitPackageConfig;
    }

    public static ToolkitDeployConfig getToolkitDeployConfig() {
        return toolkitDeployConfig;
    }

    public static void setToolkitDeployConfig(ToolkitDeployConfig toolkitDeployConfig) {
        Context.toolkitDeployConfig = toolkitDeployConfig;
    }

    public static MavenProject getProject() {
        return project;
    }

    public static void setProject(MavenProject project) {
        Context.project = project;
    }

    public static ToolkitProfile getToolkitProfileConfig() {
        return toolkitProfileConfig;
    }

    public static void setToolkitProfileConfig(ToolkitProfile toolkitProfileConfig) {
        Context.toolkitProfileConfig = toolkitProfileConfig;
    }

    public static ToolkitCreateConfig getToolkitCreateConfig() {
        return toolkitCreateConfig;
    }

    public static void setToolkitCreateConfig(ToolkitCreateConfig toolkitCreateConfig) {
        Context.toolkitCreateConfig = toolkitCreateConfig;
    }

    public static DefaultAcsClient getAcsClient() {
        return acsClient;
    }

    public static void setAcsClient(DefaultAcsClient acsClient) {
        Context.acsClient = acsClient;
    }

    public static Log getLogger() {
        if (logger != null) {
            return logger;
        }

        return new Log() {
            @Override public boolean isDebugEnabled() {
                return false;
            }

            @Override public void debug(CharSequence content) {

            }

            @Override public void debug(CharSequence content, Throwable error) {

            }

            @Override public void debug(Throwable error) {

            }

            @Override public boolean isInfoEnabled() {
                return false;
            }

            @Override public void info(CharSequence content) {

            }

            @Override public void info(CharSequence content, Throwable error) {

            }

            @Override public void info(Throwable error) {

            }

            @Override public boolean isWarnEnabled() {
                return false;
            }

            @Override public void warn(CharSequence content) {

            }

            @Override public void warn(CharSequence content, Throwable error) {

            }

            @Override public void warn(Throwable error) {

            }

            @Override public boolean isErrorEnabled() {
                return false;
            }

            @Override public void error(CharSequence content) {

            }

            @Override public void error(CharSequence content, Throwable error) {

            }

            @Override public void error(Throwable error) {

            }
        };
    }

    public static void setLogger(Log logger) {
        Context.logger = logger;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy