Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.




Making objects configurable

The network configuration subsystem can be used to configure arbitrary network objects. For an object to be configurable through this subsystem, you must implement the components described in in Components. Some things to note are:

  • SubjectFactory implementations belong in SubjectFactories. While you may want to use an existing factory for your subject of choice, you may want to implement a new SubjectFactory in addition to an existing one if a different key/creation technique is required for a subject.

  • ConfigFactory must be registered with the NetworkConfigManager. Adding a ConfigFactory to BasicNetworkConfigs will cause it to be registered when the subsystem starts up. Alternatively, you may manually invoke NetworkConfigManager.registerConfigFactory() from the application:

    Code Block
    // in the application:
    @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
    protected NetworkConfigRegistry registry;
    private ConfigFactory configFactory =
            new ConfigFactory(SubjectFactories.FOO_SUBJECT_FACTORY, FooConfig.class, "foo") {
        public FooConfig createConfig() {
            return new FooConfig();
    public void register() {
  • ConfigOperators enforce an order of precedence on information depending on their source. As a general rule, the configs supplied by this subsystem override information supplied by providers.

Using the service from applications

As with other services, the two primary ways that an application can use the network configuration subsystem are: