<commit_before># Using the global configuration model

WSO2 Carbon 5 introduces a new configuration deployment model, which allows products to maintain all the server configurations in one configuration file. This global configuration file is named `deployment.yaml` and is stored in the `<PRODUCT_HOME>/conf` directory of your product pack. The below diagram illustrates the high-level picture of the configuration model.

![screen shot 2016-12-22 at 6 34 00 pm](https://cloud.githubusercontent.com/assets/21237558/21426531/60a7c61a-c875-11e6-8a8d-1a2fff9762ff.png)

By default, the following minimal configuration elements are specified in the `deployment.yaml` file of a Carbon product.

```
 # Carbon Configuration Parameters
wso2.carbon:
   # value to uniquely identify a server
 id: carbon-kernel
   # server name
 name: WSO2 Carbon Kernel
   # ports used by this server
 ports:
     # port offset
   offset: 0
   ```

> Note the following changes introduced in Carbon Kernel 5.2.0:
 * The new `deployment.yaml` file contains all the Carbon runtime configurations and it replaces the `carbon.yaml` file that existed previously.
 * Three new annotations are introduced (Configuration, Element, Ignore) for configuration bean classes. Read below for details.
 * A new annotation processor is introduced (ConfigurationProcessor) for discovering configuration bean classes in the component.
 * Maven plugin (ConfigDocumentMojo) to create the configuration file by reading the configuration bean classes. Read below for details.
 * An OSGI service (ConfigProvider) to provide the relevant object for the given bean class. Read below for details.

## Step 1: Adding configurations to a Carbon component

When you develop a Carbon component, you do not need to bundle separate configuration files with the feature. Instead, the required user configurations should be defined as one or more Java beans annotated with the following three annotations:

 * `org.wso2.carbon.kernel.annotations.Configuration`: This is a class-level annotation, which corresponds to a configuration bean to be used by a component.
 * `org.wso2.carbon.kernel.annotations.Element`: This is a field-level annotation, which corresponds to a field of the class.
 * `org.wso2.carbon.kernel.annotations.Ignore`: This is a field-level annotation, which specifies that the field needs to be ignored when the configuration is generated.
 
If you have the Java beans defined accordingly, a configuration document will be generated when you build your component feature.

See the following example:

```
@Configuration(namespace = "wso2.carbon", description = "Carbon Configuration Parameters")<commit_msg>Update UpdatingConfigurations.md<commit_after># Using the global configuration model

WSO2 Carbon 5 introduces a new configuration deployment model, which allows products to maintain all the server configurations in one configuration file. This global configuration file is named `deployment.yaml` and is stored in the `<PRODUCT_HOME>/conf` directory of your product pack. The below diagram illustrates the high-level picture of the configuration model.

![screen shot 2016-12-22 at 6 34 00 pm](https://cloud.githubusercontent.com/assets/21237558/21426531/60a7c61a-c875-11e6-8a8d-1a2fff9762ff.png)

By default, the following minimal configuration elements are specified in the `deployment.yaml` file of a Carbon product.

```
 # Carbon Configuration Parameters
wso2.carbon:
   # value to uniquely identify a server
 id: carbon-kernel
   # server name
 name: WSO2 Carbon Kernel
   # ports used by this server
 ports:
     # port offset
   offset: 0
   ```

> Note the following changes introduced in this Kernel version:
 * The new `deployment.yaml` file contains all the Carbon runtime configurations and it replaces the `carbon.yaml` file that existed previously.
 * Three new annotations are introduced (Configuration, Element, Ignore) for configuration bean classes. Read below for details.
 * A new annotation processor is introduced (ConfigurationProcessor) for discovering configuration bean classes in the component.
 * Maven plugin (ConfigDocumentMojo) to create the configuration file by reading the configuration bean classes. Read below for details.
 * An OSGI service (ConfigProvider) to provide the relevant object for the given bean class. Read below for details.

## Step 1: Adding configurations to a Carbon component

When you develop a Carbon component, you do not need to bundle separate configuration files with the feature. Instead, the required user configurations should be defined as one or more Java beans annotated with the following three annotations:

 * `org.wso2.carbon.kernel.annotations.Configuration`: This is a class-level annotation, which corresponds to a configuration bean to be used by a component.
 * `org.wso2.carbon.kernel.annotations.Element`: This is a field-level annotation, which corresponds to a field of the class.
 * `org.wso2.carbon.kernel.annotations.Ignore`: This is a field-level annotation, which specifies that the field needs to be ignored when the configuration is generated.
 
If you have the Java beans defined accordingly, a configuration document will be generated when you build your component feature.

See the following example:

```
@Configuration(namespace = "wso2.carbon", description = "Carbon Configuration Parameters")
{'fraction_non_alphanumeric': 0.057286807240156744, 'fraction_numerical': 0.022205635379735026, 'mean_word_length': 4.85792349726776, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5002763', 'n_tokens_mistral': 1375, 'n_tokens_neox': 1240, 'n_words': 666}