1 package org.codehaus.xfire.plexus.xmlbeans;
2
3 import org.codehaus.plexus.configuration.PlexusConfiguration;
4 import org.codehaus.xfire.handler.SoapHandler;
5 import org.codehaus.xfire.plexus.PlexusXFireComponent;
6 import org.codehaus.xfire.plexus.config.Configurator;
7 import org.codehaus.xfire.plexus.java.PlexusJavaService;
8 import org.codehaus.xfire.service.Service;
9 import org.codehaus.xfire.service.ServiceRegistry;
10 import org.codehaus.xfire.xmlbeans.XMLBeansServiceHandler;
11
12 /***
13 * Configures java services for plexus.
14 *
15 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
16 * @since Sep 20, 2004
17 */
18 public class XMLBeansConfigurator
19 extends PlexusXFireComponent
20 implements Configurator
21 {
22 final public static String SERVICE_TYPE = "xmlbeans";
23
24 /***
25 * @see org.codehaus.xfire.plexus.config.Configurator#getServiceType()
26 */
27 public String getServiceType()
28 {
29 return SERVICE_TYPE;
30 }
31
32 /***
33 * @see org.codehaus.xfire.plexus.config.Configurator#createService(org.codehaus.plexus.configuration.PlexusConfiguration)
34 */
35 public Service createService( PlexusConfiguration config ) throws Exception
36 {
37 PlexusJavaService s = new PlexusJavaService();
38 s.service(getServiceLocator());
39 s.configure(config);
40
41 XMLBeansServiceHandler handler = new XMLBeansServiceHandler();
42 SoapHandler sHandler = new SoapHandler(handler);
43 s.setServiceHandler(sHandler);
44
45 ServiceRegistry reg = (ServiceRegistry) getServiceLocator().lookup(ServiceRegistry.ROLE);
46 reg.register(s);
47
48 return s;
49 }
50 }