001/*
002 * Copyright (c) 2024. The BifroMQ Authors. All Rights Reserved.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *    http://www.apache.org/licenses/LICENSE-2.0
008 * Unless required by applicable law or agreed to in writing,
009 * software distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and limitations under the License.
012 */
013
014package com.baidu.bifromq.plugin;
015
016import java.nio.file.Path;
017import lombok.Getter;
018import lombok.ToString;
019import org.pf4j.PluginDescriptor;
020
021/**
022 * The descriptor of BifroMQPlugin passed by BifroMQPluginManager during plugin initialization.
023 */
024@Getter
025@ToString
026public class BifroMQPluginDescriptor {
027    private final PluginDescriptor descriptor;
028    private final Path pluginRoot;
029    private final ClassLoader pluginClassLoader;
030    private final boolean isDevelopment;
031
032    /**
033     * Constructor of BifroMQPluginContext.
034     *
035     * @param descriptor    the descriptor of the plugin
036     * @param pluginRoot    the root path of the plugin
037     * @param classLoader   the plugin specific classloader
038     * @param isDevelopment the runtime mode
039     */
040    public BifroMQPluginDescriptor(PluginDescriptor descriptor,
041                                   Path pluginRoot,
042                                   ClassLoader classLoader,
043                                   boolean isDevelopment) {
044        this.descriptor = descriptor;
045        this.pluginRoot = pluginRoot;
046        this.pluginClassLoader = classLoader;
047        this.isDevelopment = isDevelopment;
048    }
049}