1 package org.apache.maven.continuum.management.util;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import java.io.IOException;
23
24 import org.codehaus.plexus.spring.PlexusXmlBeanDefinitionReader;
25 import org.springframework.beans.BeansException;
26 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
27 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
28 import org.springframework.beans.factory.xml.ResourceEntityResolver;
29 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
30 import org.springframework.context.ApplicationContext;
31 import org.springframework.context.support.FileSystemXmlApplicationContext;
32
33 public class PlexusFileSystemXmlApplicationContext
34 extends FileSystemXmlApplicationContext
35 {
36 private static PlexusApplicationContextDelegate delegate = new PlexusApplicationContextDelegate();
37
38 public PlexusFileSystemXmlApplicationContext( String configLocation )
39 {
40 super( configLocation );
41 }
42
43 public PlexusFileSystemXmlApplicationContext( String[] configLocations )
44 {
45 super( configLocations );
46 }
47
48 public PlexusFileSystemXmlApplicationContext( String[] configLocations, ApplicationContext parent )
49 {
50 super( configLocations, parent );
51 }
52
53 public PlexusFileSystemXmlApplicationContext( String[] configLocations, boolean refresh )
54 {
55 super( configLocations, refresh );
56 }
57
58 public PlexusFileSystemXmlApplicationContext( String[] configLocations, boolean refresh, ApplicationContext parent )
59 {
60 super( configLocations, refresh, parent );
61 }
62
63
64
65
66
67
68 protected void loadBeanDefinitions( XmlBeanDefinitionReader reader )
69 throws BeansException, IOException
70 {
71 delegate.loadBeanDefinitions( reader );
72 super.loadBeanDefinitions( reader );
73 }
74
75
76
77
78
79
80
81
82 protected void loadBeanDefinitions( DefaultListableBeanFactory beanFactory ) throws IOException {
83
84 XmlBeanDefinitionReader beanDefinitionReader = new PlexusXmlBeanDefinitionReader( beanFactory );
85
86
87
88 beanDefinitionReader.setResourceLoader( this );
89 beanDefinitionReader.setEntityResolver( new ResourceEntityResolver( this ) );
90
91
92
93 initBeanDefinitionReader( beanDefinitionReader );
94 loadBeanDefinitions( beanDefinitionReader );
95 }
96
97
98
99
100
101
102 protected void postProcessBeanFactory( ConfigurableListableBeanFactory beanFactory )
103 {
104 delegate.postProcessBeanFactory( beanFactory, this );
105 }
106
107
108
109
110
111
112 protected void doClose()
113 {
114 delegate.doClose();
115 super.doClose();
116 }
117 }