KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > wsdl > xml > WsdlFactoryImpl


1 package org.jbpm.bpel.wsdl.xml;
2
3 import javax.wsdl.Definition;
4 import javax.wsdl.extensions.ExtensionRegistry;
5 import javax.wsdl.xml.WSDLReader;
6
7 import org.jbpm.bpel.wsdl.impl.DefinitionImpl;
8 import org.jbpm.bpel.wsdl.impl.PartnerLinkTypeImpl;
9 import org.jbpm.bpel.wsdl.impl.PropertyAliasImpl;
10 import org.jbpm.bpel.wsdl.impl.PropertyImpl;
11
12 /**
13  * BPEL-specific implementation of the WSDL factory.
14  * @author Alejandro Guízar
15  * @version $Revision: 1.1 $ $Date: 2005/06/04 00:08:20 $
16  */

17 public class WsdlFactoryImpl extends com.ibm.wsdl.factory.WSDLFactoryImpl {
18
19   /**
20    * Creates a {@link Definition} instance.
21    * @return a newly created definition
22    */

23   public Definition newDefinition() {
24     Definition def = new DefinitionImpl();
25     ExtensionRegistry extReg = newPopulatedExtensionRegistry();
26
27     def.setExtensionRegistry(extReg);
28
29     return def;
30   }
31   
32   /**
33    * Creates a {@link WSDLReader} instance, with an extension registry as
34    * returned by the {@link #newPopulatedExtensionRegistry()} method.
35    * @return a newly created reader
36    */

37   public WSDLReader newWSDLReader() {
38     WSDLReader reader = super.newWSDLReader();
39     reader.setFactoryImplName(getClass().getName());
40     reader.setExtensionRegistry(newPopulatedExtensionRegistry());
41     reader.setFeature("javax.wsdl.verbose", false);
42     return reader;
43   }
44
45   /**
46    * Create an {@link ExtensionRegistry} instance with pre-registered
47    * serializers/deserializers, and Java extensionTypes mapped, for the SOAP,
48    * HTTP, MIME, Partner Link Type and Message Property extensions.
49    * @return a newly created extension registry
50    */

51   public ExtensionRegistry newPopulatedExtensionRegistry() {
52     ExtensionRegistry registry = super.newPopulatedExtensionRegistry();
53
54     // partner link type
55
PartnerLinkTypeSerializer plinkTypeSerializer = new PartnerLinkTypeSerializer();
56     registry.registerDeserializer(Definition.class,
57       WsdlConstants.Q_PARTNER_LINK_TYPE, plinkTypeSerializer);
58     registry.registerSerializer(Definition.class,
59       WsdlConstants.Q_PARTNER_LINK_TYPE, plinkTypeSerializer);
60     registry.mapExtensionTypes(Definition.class,
61       WsdlConstants.Q_PARTNER_LINK_TYPE, PartnerLinkTypeImpl.class);
62
63     // property
64
PropertySerializer propertySerializer = new PropertySerializer();
65     registry.registerDeserializer(Definition.class,
66       WsdlConstants.Q_PROPERTY, propertySerializer);
67     registry.registerSerializer(Definition.class,
68       WsdlConstants.Q_PROPERTY, propertySerializer);
69     registry.mapExtensionTypes(Definition.class,
70       WsdlConstants.Q_PROPERTY, PropertyImpl.class);
71
72     // property alias
73
PropertyAliasSerializer aliasSerializer = new PropertyAliasSerializer();
74     registry.registerDeserializer(Definition.class,
75       WsdlConstants.Q_PROPERTY_ALIAS, aliasSerializer);
76     registry.registerSerializer(Definition.class,
77       WsdlConstants.Q_PROPERTY_ALIAS, aliasSerializer);
78     registry.mapExtensionTypes(Definition.class,
79       WsdlConstants.Q_PROPERTY_ALIAS, PropertyAliasImpl.class);
80
81     return registry;
82   }
83 }
84
Popular Tags