Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IBeansLoader |
|
| 3.0;3 |
1 | /* | |
2 | * $Id: IBeansLoader.java 19800 2010-09-30 21:31:55Z rossmason $ | |
3 | * ------------------------------------------------------------------------------------- | |
4 | * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com | |
5 | * | |
6 | * The software in this package is published under the terms of the CPAL v1.0 | |
7 | * license, a copy of which has been included with this distribution in the | |
8 | * LICENSE.txt file. | |
9 | */ | |
10 | package org.mule.module.ibeans.config; | |
11 | ||
12 | import org.mule.api.MuleContext; | |
13 | import org.mule.api.MuleRuntimeException; | |
14 | import org.mule.api.config.ConfigurationException; | |
15 | import org.mule.api.context.MuleContextAware; | |
16 | ||
17 | /** | |
18 | * Responsible for discovering and loading available iBeans into the registry. | |
19 | */ | |
20 | 0 | public class IBeansLoader implements MuleContextAware |
21 | { | |
22 | public static final String SCAN_PACKAGES_PROPERTY = "org.mule.scan"; | |
23 | ||
24 | //Note that the space after the comma denotes that the classes path itself should be scanned. I don't know what this is | |
25 | //required when scanning for resources | |
26 | private static final String DEFAULT_BASEPATH = "org.mule, "; | |
27 | ||
28 | public void setMuleContext(MuleContext context) | |
29 | { | |
30 | //Don't like this but without it the user must explicitly configure this builder at start up | |
31 | 0 | String scanPackages = System.getProperty(SCAN_PACKAGES_PROPERTY, DEFAULT_BASEPATH); |
32 | 0 | String[] paths = scanPackages.split(","); |
33 | 0 | IBeanHolderConfigurationBuilder builder = new IBeanHolderConfigurationBuilder(paths); |
34 | try | |
35 | { | |
36 | 0 | builder.configure(context); |
37 | } | |
38 | 0 | catch (ConfigurationException e) |
39 | { | |
40 | 0 | throw new MuleRuntimeException(e); |
41 | 0 | } |
42 | 0 | } |
43 | } |