1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.configuration.internal;
20
21 import javax.inject.Named;
22 import javax.inject.Singleton;
23
24 import org.codehaus.plexus.classworlds.realm.ClassRealm;
25 import org.codehaus.plexus.component.configurator.BasicComponentConfigurator;
26 import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
27 import org.codehaus.plexus.component.configurator.ConfigurationListener;
28 import org.codehaus.plexus.component.configurator.converters.special.ClassRealmConverter;
29 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
30 import org.codehaus.plexus.configuration.PlexusConfiguration;
31
32
33
34
35
36 @Singleton
37 @Named("enhanced")
38 public class EnhancedComponentConfigurator extends BasicComponentConfigurator {
39
40 public EnhancedComponentConfigurator() {
41 converterLookup = new EnhancedConverterLookup();
42 }
43
44 @Override
45 public void configureComponent(
46 final Object component,
47 final PlexusConfiguration configuration,
48 final ExpressionEvaluator evaluator,
49 final ClassRealm realm,
50 final ConfigurationListener listener)
51 throws ComponentConfigurationException {
52 try {
53 ClassRealmConverter.pushContextRealm(realm);
54
55 this.configureComponent(component, configuration, evaluator, (ClassLoader) realm, listener);
56 } finally {
57 ClassRealmConverter.popContextRealm();
58 }
59 }
60
61 public void configureComponent(
62 Object component,
63 PlexusConfiguration configuration,
64 ExpressionEvaluator evaluator,
65 ClassLoader loader,
66 ConfigurationListener listener)
67 throws ComponentConfigurationException {
68 new EnhancedConfigurationConverter()
69 .processConfiguration(
70 converterLookup,
71 component,
72 loader,
73 configuration,
74 evaluator,
75 listener);
76 }
77 }