---
title: "Configuration Admin, Metatype, and Configurator"
chapter: "07"
---

# Configuration Admin, Metatype, and Configurator

Configuration Admin (ConfigAdmin) stores and delivers configuration dictionaries
to managed services and DS components.

## PID and factory PID

A PID identifies one configuration. A factory PID creates many named
configurations and therefore many component instances. Keep PIDs stable like an
API; renaming them breaks operations and upgrades.

## Typed configuration

```java
@ObjectClassDefinition(name = "Charger connector")
public @interface ConnectorConfig {
  String endpoint();
  int timeout_ms() default 3000;
  boolean enabled() default true;
}
```

Metatype annotations describe configuration, types, defaults, labels, and
validation hints. DS can map configuration directly to this interface.

## Update behavior

An update may modify an active component, deactivate/reactivate it, or create a
new factory instance. Understand the component's modified method and whether a
half-applied configuration is possible.

## Configurator

The OSGi Configurator specification defines JSON resources that seed
configurations with ranking and ownership rules. This is useful for immutable
application assembly while still allowing controlled runtime overrides.

## Karaf configuration

Karaf commonly materializes ConfigAdmin data through files under `etc/`, shell
commands, environment/property substitution, or external provisioning.
FileInstall watches changes. Treat configuration files as managed state:
version, secure, back up, and test their update semantics.

## Secrets

ConfigAdmin is not automatically a secret vault. Avoid printing secret values
in Web Console, shell output, logs, support snapshots, or source control.
Resolve short-lived secrets through a dedicated service where feasible.

## Feynman check

Configuration is input to a component, not the component itself. Explain why a
configuration update may make one component disappear and another appear.
