Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
SimpleConfigurationBuilder |
|
| 1.5;1.5 |
1 | /* | |
2 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
3 | * The software in this package is published under the terms of the CPAL v1.0 | |
4 | * license, a copy of which has been included with this distribution in the | |
5 | * LICENSE.txt file. | |
6 | */ | |
7 | package org.mule.config.builders; | |
8 | ||
9 | import org.mule.api.MuleContext; | |
10 | import org.mule.api.config.ConfigurationBuilder; | |
11 | import org.mule.api.registry.Registry; | |
12 | ||
13 | import java.util.Map; | |
14 | ||
15 | /** | |
16 | * This simple ConfgurationBuilder implementation. This is useful for registering any | |
17 | * Map of objects with the {@link Registry} via the {@link ConfigurationBuilder} | |
18 | * interface. This is useful for example for the registration of "startup properties" | |
19 | * which are provided at startup and then used to fill "property placeholders" in | |
20 | * other configuration mechanisms such as XML. | |
21 | */ | |
22 | public class SimpleConfigurationBuilder extends AbstractConfigurationBuilder | |
23 | { | |
24 | ||
25 | protected Map objects; | |
26 | ||
27 | public SimpleConfigurationBuilder(Map objects) | |
28 | 0 | { |
29 | 0 | this.objects = objects; |
30 | 0 | } |
31 | ||
32 | protected void doConfigure(MuleContext muleContext) throws Exception | |
33 | { | |
34 | 0 | if (objects != null && objects.size() > 0) |
35 | { | |
36 | 0 | muleContext.getRegistry().registerObjects(objects); |
37 | } | |
38 | 0 | } |
39 | } |