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

org.commonjava.indy.subsys.kafka.conf.LogKafkaConfig Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (C) 2011-2023 Red Hat, Inc. (https://github.com/Commonjava/indy)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.commonjava.indy.subsys.kafka.conf;

import org.commonjava.indy.conf.IndyConfigInfo;
import org.commonjava.propulsor.config.ConfigurationException;
import org.commonjava.propulsor.config.annotation.SectionName;
import org.commonjava.propulsor.config.section.MapSectionListener;

import javax.enterprise.context.ApplicationScoped;
import java.io.File;
import java.io.InputStream;

@Deprecated
@SectionName( "log-kafka" )
@ApplicationScoped
public class LogKafkaConfig extends MapSectionListener
        implements IndyConfigInfo
{

    private static final boolean DEFAULT_ENABLED = false;

    private Boolean enabled;

    public LogKafkaConfig()
    {
    }

    public boolean isEnabled()
    {
        return enabled == null ? DEFAULT_ENABLED : enabled;
    }

    @Override
    public void sectionComplete(String name) throws ConfigurationException
    {
        String s = getConfiguration().get( "enabled" );
        if ( s != null)
        {
            this.enabled = Boolean.parseBoolean( s );
        }
    }

    @Override
    public String getDefaultConfigFileName()
    {
        return new File( IndyConfigInfo.CONF_INCLUDES_DIR, "log-kafka.conf" ).getPath();
    }

    @Override
    public InputStream getDefaultConfig()
    {
        return Thread.currentThread().getContextClassLoader().getResourceAsStream( "default-log-kafka.conf" );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy