Skip to content

Instantly share code, notes, and snippets.

@ankit-gubrani
Created January 20, 2015 10:32
FactoryConfig Class acts as interface for FactoryConfigConsumerClass
@Component(label = "Factory configuration", immediate = true, enabled = true, metatype = true, description = "This is factory configuration which acts as a interface for allowing user to enter property values",policy = ConfigurationPolicy.REQUIRE, configurationFactory = true)
@Property(name = "dummy.prop", label = "Dummy property", description = "This is just dummy property", value = "Dummy Value")
public class FactoryConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(FactoryConfig.class);
@Activate
public void activate(ComponentContext componentContext) {
Dictionary properties = componentContext.getProperties();
String dummyProperty = PropertiesUtil.toString(properties.get("dummy.prop"), "");
LOGGER.info("Read the dummy property value : " + dummyProperty);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment