/*
 * Copyright 2015 dc-square GmbH
 *
 * 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 com.acme.configuration;

import com.google.inject.Inject;
import com.hivemq.spi.config.SystemInformation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.annotation.PostConstruct;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * @author Christian Götz
 */
public class PluginReader {


    private static final Logger log = LoggerFactory.getLogger(PluginReader.class);

    final Properties properties = new Properties();
    private final SystemInformation systemInformation;

    @Inject
    PluginReader(SystemInformation systemInformation) {
        this.systemInformation = systemInformation;
    }

    @PostConstruct
    public void postConstruct()
    {
        final File pluginFolder = systemInformation.getPluginFolder();

        final File pluginFile = new File(pluginFolder, "myPlugin1.properties");

        if (!pluginFile.canRead()) {
            log.error("Could not read the properties file {}", pluginFile.getAbsolutePath());
            return;
        }

        try (InputStream is = new FileInputStream(pluginFile)) {

            log.debug("Reading property file {}", pluginFile.getAbsolutePath());

            properties.load(is);


        } catch (IOException e) {
            log.error("An error occurred while reading the properties file {}", pluginFile.getAbsolutePath(), e);
            return;
        }
    }

    public Properties getProperties() {
        return properties;
    }

}
@@ -1403,22 +1403,22 @@
 al File 
-plugin
+config
 Folder =
@@ -1439,22 +1439,22 @@
 tion.get
-Plugin
+Config
 Folder()
@@ -1475,22 +1475,22 @@
 al File 
-plugin
+config
 File = n
@@ -1497,22 +1497,22 @@
 ew File(
-plugin
+config
 Folder, 
@@ -1520,17 +1520,16 @@
 myPlugin
-1
 .propert
@@ -1549,22 +1549,22 @@
    if (!
-plugin
+config
 File.can
@@ -1628,38 +1628,38 @@
 rties file %7B%7D%22, 
-plugin
+config
 File.getAbsolute
@@ -1748,22 +1748,22 @@
 tStream(
-plugin
+config
 File)) %7B
@@ -1806,38 +1806,38 @@
 perty file %7B%7D%22, 
-plugin
+config
 File.getAbsolute
@@ -1999,14 +1999,14 @@
 %7D%22, 
-plugin
+config
 File
@@ -2029,36 +2029,16 @@
 (), e);%0A
-            return;%0A
         

read properties file from hivemq conf folder instead of plugin folder