1 package org.codehaus.plexus.spring;
\r
4 * Licensed to the Apache Software Foundation (ASF) under one
\r
5 * or more contributor license agreements. See the NOTICE file
\r
6 * distributed with this work for additional information
\r
7 * regarding copyright ownership. The ASF licenses this file
\r
8 * to you under the Apache License, Version 2.0 (the
\r
9 * "License"); you may not use this file except in compliance
\r
10 * with the License. You may obtain a copy of the License at
\r
12 * http://www.apache.org/licenses/LICENSE-2.0
\r
14 * Unless required by applicable law or agreed to in writing,
\r
15 * software distributed under the License is distributed on an
\r
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
\r
17 * KIND, either express or implied. See the License for the
\r
18 * specific language governing permissions and limitations
\r
19 * under the License.
\r
22 import java.io.IOException;
\r
24 import org.springframework.beans.BeansException;
\r
25 import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
\r
26 import org.springframework.context.ApplicationContext;
\r
27 import org.springframework.context.support.ClassPathXmlApplicationContext;
\r
30 * A custom ClassPathXmlApplicationContext to support plexus
\r
31 * <tr>components.xml</tt> descriptors in Spring, with no changes required
\r
32 * to neither plexus nor spring beans.
\r
34 * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
\r
36 public class PlexusClassPathXmlApplicationContext
\r
37 extends ClassPathXmlApplicationContext
\r
39 public PlexusClassPathXmlApplicationContext( String path, Class clazz )
\r
40 throws BeansException
\r
42 super( path, clazz );
\r
45 public PlexusClassPathXmlApplicationContext( String configLocation )
\r
46 throws BeansException
\r
48 super( configLocation );
\r
51 public PlexusClassPathXmlApplicationContext( String[] configLocations, ApplicationContext parent )
\r
52 throws BeansException
\r
54 super( configLocations, parent );
\r
57 public PlexusClassPathXmlApplicationContext( String[] configLocations, boolean refresh, ApplicationContext parent )
\r
58 throws BeansException
\r
60 super( configLocations, refresh, parent );
\r
63 public PlexusClassPathXmlApplicationContext( String[] configLocations, boolean refresh )
\r
64 throws BeansException
\r
66 super( configLocations, refresh );
\r
69 public PlexusClassPathXmlApplicationContext( String[] paths, Class clazz, ApplicationContext parent )
\r
70 throws BeansException
\r
72 super( paths, clazz, parent );
\r
75 public PlexusClassPathXmlApplicationContext( String[] paths, Class clazz )
\r
76 throws BeansException
\r
78 super( paths, clazz );
\r
81 public PlexusClassPathXmlApplicationContext( String[] configLocations )
\r
82 throws BeansException
\r
84 super( configLocations );
\r
90 * @see org.springframework.context.support.AbstractXmlApplicationContext#loadBeanDefinitions(org.springframework.beans.factory.xml.XmlBeanDefinitionReader)
\r
92 protected void loadBeanDefinitions( XmlBeanDefinitionReader reader )
\r
93 throws BeansException, IOException
\r
95 logger.info( "Registering plexus to spring XML translation" );
\r
96 reader.setDocumentReaderClass( PlexusBeanDefinitionDocumentReader.class );
\r
97 reader.setValidationMode( XmlBeanDefinitionReader.VALIDATION_NONE );
\r
98 super.loadBeanDefinitions( reader );
\r