X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-clustering-commons%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fcommon%2Factor%2FFileAkkaConfigurationReader.java;h=7951f5d3cc887113adaf8d5120e96415af251087;hb=3bdf1493c0ce4218a1a3e26cdf7c5c4af1d2aeeb;hp=1e3adf9d391051ef2173de187004c3c6edaa6e40;hpb=6e76bb44514ea79524f46ff283ea0d0d4ad8c7f8;p=controller.git diff --git a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java index 1e3adf9d39..7951f5d3cc 100644 --- a/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java +++ b/opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/common/actor/FileAkkaConfigurationReader.java @@ -5,28 +5,49 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.cluster.common.actor; -import com.google.common.base.Preconditions; +import static com.google.common.base.Preconditions.checkState; + import com.typesafe.config.Config; import com.typesafe.config.ConfigFactory; import java.io.File; +import javax.inject.Singleton; +import org.kohsuke.MetaInfServices; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +@Component(immediate = true) +@MetaInfServices +@Singleton public class FileAkkaConfigurationReader implements AkkaConfigurationReader { + private static final Logger LOG = LoggerFactory.getLogger(FileAkkaConfigurationReader.class); private static final String CUSTOM_AKKA_CONF_PATH = "./configuration/initial/akka.conf"; private static final String FACTORY_AKKA_CONF_PATH = "./configuration/factory/akka.conf"; @Override public Config read() { File customConfigFile = new File(CUSTOM_AKKA_CONF_PATH); - Preconditions.checkState(customConfigFile.exists(), "%s is missing", customConfigFile); + checkState(customConfigFile.exists(), "%s is missing", customConfigFile); File factoryConfigFile = new File(FACTORY_AKKA_CONF_PATH); - if(factoryConfigFile.exists()) { + if (factoryConfigFile.exists()) { return ConfigFactory.parseFile(customConfigFile).withFallback(ConfigFactory.parseFile(factoryConfigFile)); } return ConfigFactory.parseFile(customConfigFile); } + + @Activate + void activate() { + LOG.info("File-based Akka configuration reader enabled"); + } + + @Deactivate + void deactivate() { + LOG.info("File-based Akka configuration reader disabled"); + } }