1 package org.codehaus.xfire.plexus.config;
2
3 import java.lang.reflect.Constructor;
4
5 import org.codehaus.plexus.configuration.PlexusConfiguration;
6 import org.codehaus.xfire.annotations.AnnotationServiceFactory;
7 import org.codehaus.xfire.annotations.WebAnnotations;
8 import org.codehaus.xfire.annotations.commons.CommonsWebAttributes;
9 import org.codehaus.xfire.service.binding.BindingProvider;
10 import org.codehaus.xfire.service.binding.ObjectServiceFactory;
11 import org.codehaus.xfire.transport.TransportManager;
12
13 public class AnnotationServiceConfigurator
14 extends ObjectServiceConfigurator
15 {
16
17 public ObjectServiceFactory getServiceFactory(PlexusConfiguration config)
18 throws Exception
19 {
20 Class annotsClz = null;
21 Class clz = null;
22 String annots = config.getChild("annotations").getValue();
23 String factoryClass = config.getChild("serviceFactory").getValue();
24
25 if (annots == null)
26 {
27 annotsClz = CommonsWebAttributes.class;
28 }
29 else
30 {
31 annotsClz = loadClass(annots);
32 }
33
34 if (factoryClass == null)
35 {
36 clz = AnnotationServiceFactory.class;
37 }
38 else
39 {
40 clz = loadClass(factoryClass);
41 }
42
43 Constructor con =
44 clz.getConstructor( new Class[] {WebAnnotations.class, TransportManager.class, BindingProvider.class} );
45
46 return (ObjectServiceFactory)
47 con.newInstance(new Object[] {annotsClz.newInstance(),
48 getXFire().getTransportManager(),
49 getBindingProvider(config) });
50 }
51 }