KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > wsm > axis > AxisHook


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.beehive.wsm.axis;
17
18 import org.apache.axis.constants.Style;
19 import org.apache.axis.constants.Use;
20 import org.apache.axis.description.*;
21 import org.apache.axis.encoding.*;
22 import org.apache.axis.encoding.ser.ArrayDeserializerFactory;
23 import org.apache.axis.encoding.ser.ArraySerializerFactory;
24 import org.apache.axis.encoding.ser.BeanDeserializerFactory;
25 import org.apache.axis.encoding.ser.BeanSerializerFactory;
26 import org.apache.axis.utils.BeanPropertyDescriptor;
27 import org.apache.axis.utils.BeanUtils;
28 import org.apache.axis.utils.JavaUtils;
29 import org.apache.axis.wsdl.fromJava.Namespaces;
30 import org.apache.axis.wsdl.fromJava.Types;
31 import org.apache.beehive.wsm.axis.databinding.SystemTypeLookupService;
32 import org.apache.beehive.wsm.axis.registration.AxisTypeMappingMetaData;
33 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanDeserializerFactory;
34 import org.apache.beehive.wsm.axis.util.encoding.XmlBeanSerializerFactory;
35 import org.apache.beehive.wsm.databinding.BindingLookupService;
36 import org.apache.beehive.wsm.model.BeehiveWsMethodMetadata;
37 import org.apache.beehive.wsm.model.BeehiveWsParameterMetadata;
38 import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
39 import org.apache.beehive.wsm.model.BeehiveWsTypeMetadata;
40 import org.apache.beehive.wsm.util.InvalidTypeMappingException;
41 import org.apache.beehive.wsm.registration.TypeRegistrar;
42 import org.apache.log4j.Logger;
43 import org.apache.xmlbeans.XmlBeans;
44 import org.apache.xmlbeans.XmlObject;
45
46 import javax.jws.WebParam;
47 import javax.jws.soap.SOAPBinding;
48 import javax.wsdl.OperationType;
49 import javax.xml.namespace.QName JavaDoc;
50 import javax.xml.rpc.holders.Holder JavaDoc;
51
52 import java.io.File JavaDoc;
53 import java.lang.reflect.Constructor JavaDoc;
54 import java.lang.reflect.Method JavaDoc;
55 import java.rmi.Remote JavaDoc;
56 import java.util.ArrayList JavaDoc;
57 import java.util.Collection JavaDoc;
58 import java.util.List JavaDoc;
59 import java.util.Map JavaDoc;
60
61 /**
62  * ****************************************************************************
63  *
64  * @author Jonathan Colwell
65  */

66 public class AxisHook {
67     static Logger logger = Logger.getLogger(AxisHook.class);
68
69     public static ServiceDesc createServiceDesc(BeehiveWsTypeMetadata wsm,
70             ClassLoader JavaDoc cl) throws ClassNotFoundException JavaDoc,
71             NoSuchMethodException JavaDoc, InvalidTypeMappingException {
72         JavaServiceDesc sd = new JavaServiceDesc();
73         if (null == cl) {
74             /*
75              * NOTE jcolwell@bea.com 2004-Aug-30 -- if no classloader was
76              * provided, use the one that loaded this Class
77              */

78             cl = AxisHook.class.getClassLoader();
79         }
80         final Class JavaDoc serviceClass = cl.loadClass(wsm.getClassName());
81
82         // Create a list of the allowed methods
83
List JavaDoc<String JavaDoc> allowedMethods = new ArrayList JavaDoc<String JavaDoc>();
84         for (BeehiveWsMethodMetadata meth : wsm.getMethods()) {
85             String JavaDoc method = meth.getJavaMethodName();
86             allowedMethods.add(method);
87         }
88
89         // set the ServiceDesc base information
90
sd.setName(wsm.getWsName());
91         sd.setImplClass(serviceClass);
92         String JavaDoc targetNamespace = wsm.getWsTargetNamespace();
93         sd.setDefaultNamespace(targetNamespace);
94         sd.setAllowedMethods(allowedMethods);
95         configureSoapBinding(sd, wsm.getSoapBinding());
96
97         TypeMappingRegistry tmr = new TypeMappingRegistryImpl(true);
98         TypeMapping tm = tmr
99                 .getOrMakeTypeMapping(sd.getUse() == Use.ENCODED ? "http://schemas.xmlsoap.org/soap/encoding/" //"encoded"
100
: "");
101         sd.setTypeMappingRegistry(tmr);
102         sd.setTypeMapping(tm);
103
104         /*
105          * jongjinchoi@apache.org 2005-Mar-16 -- Use Axis's introspection
106          * feature instead of creating new OperationDesc and ParameterDescs
107          * directly. The introspected OperationDesc and ParameterDescs are
108          * overrided by WSM. When appropriate type mapping registry is set, Axis
109          * fills the ParameterDesc's typeEntry from the preset typemapping
110          * registry, which is required for Axis to work in wrapped/lit mode.
111          */

112         sd.getOperations();
113
114         // Walk the methods
115
for (BeehiveWsMethodMetadata meth : wsm.getMethods()) {
116             String JavaDoc operationName = meth.getWmOperationName();
117             if (null != operationName && 0 < operationName.length()) {
118                 // set the Operations properties
119
OperationDesc od = sd.getOperationByName(meth
120                         .getJavaMethodName());
121                 od.setElementQName(new QName JavaDoc(targetNamespace, operationName));
122                 od.setName(operationName);
123                 od.setSoapAction(meth.getWmAction());
124                 if (meth.isOneWay()) {
125                     od.setMep(OperationType.ONE_WAY);
126                 } else {
127                     String JavaDoc namespace = "" ;
128                     // namespace only should be added for document style, RPC style doesn't need name space for return type.
129
if( wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT) namespace = meth.getWrTargetNamespace();
130                     od.setReturnQName(new QName JavaDoc(namespace,
131                             meth.getWrName()));
132                     final Class JavaDoc returnType = meth.getJavaReturnType();
133                     QName JavaDoc qn = configureTypeMapping(sd, returnType, meth
134                             .getWrTargetNamespace());
135                     od.setReturnType(qn);
136                     od.setReturnClass(returnType);
137                 }
138
139                 // process the parameters
140
int pcnt = 0;
141                 for (BeehiveWsParameterMetadata param : meth.getParams()) {
142                     ParameterDesc pd = od.getParameter(pcnt++);
143                     final Class JavaDoc paramType = param.getJavaType();
144
145                     if (pd.getTypeQName() == null) { // set the typeQName if
146
// it is not set
147
// already.
148
QName JavaDoc typeQName = configureTypeMapping(sd, paramType,
149                                 param.getWpTargetNamespace());
150                         /*
151                          * jongjinchoi@apache.org 2005-Mar-16 -- The typeQName
152                          * from configureTypeMapping() is not dummy. This is
153                          * required to find ArrayDeserializer when the
154                          * document/literal bare array is deserialized.
155                          */

156                         pd.setTypeQName(typeQName);
157                     }
158
159                     // set QName
160
String JavaDoc namespace = "" ;
161                     // namespace only should be added for document style, RPC style doesn't need name space for parameter names.
162
if( wsm.getSoapBinding().getStyle() == SOAPBinding.Style.DOCUMENT) namespace = param.getWpTargetNamespace();
163                     QName JavaDoc paramQName = new QName JavaDoc(namespace,
164                             param.getWpName());
165                     pd.setQName(paramQName);
166
167                     // set Mode
168
final boolean header = param.isWpHeader();
169                     final WebParam.Mode mode = param.getWpMode();
170                     switch (mode) {
171                     case IN:
172                         pd.setMode(ParameterDesc.IN);
173                         pd.setInHeader(header);
174                         pd.setOutHeader(false);
175                         break;
176                     case OUT:
177                         pd.setMode(ParameterDesc.OUT);
178                         pd.setInHeader(false);
179                         pd.setOutHeader(header);
180                         break;
181                     case INOUT:
182                         pd.setMode(ParameterDesc.INOUT);
183                         pd.setInHeader(header);
184                         pd.setOutHeader(header);
185                         break;
186                     default:
187                         throw new IllegalArgumentException JavaDoc(
188                                 "Illegal value for WebParam.Mode: " + mode);
189                     }
190
191                     // set JavaType
192
pd.setJavaType(paramType);
193                 }
194
195                 // set Exceptions
196
Method JavaDoc javaMethod = od.getMethod();
197                 for (Class JavaDoc thrown : javaMethod.getExceptionTypes()) {
198                     FaultDesc fd = od.getFaultByClass(thrown);
199                     if (null == fd) {
200                         logger
201                                 .info("Exception: "
202                                         + thrown.getCanonicalName()
203                                         + " is not picked up by the Axis, only non Remote and Application Specific exceptions are registed in Axis. This is not a fatal error.");
204                         continue;
205                     }
206                     QName JavaDoc qname = configureTypeMapping(sd, thrown, meth
207                             .getWrTargetNamespace());
208                     fd.setXmlType(qname);
209                     fd.setQName(qname);
210                     fd.setComplex(true);
211                 }
212             }
213         }
214         return sd;
215     }
216
217     /**
218      * This method will return a boolean value indicating that Activation is
219      * enabled. Activation requires the DataHandler and the Multipart Classes to
220      * both be found.
221      *
222      * @return boolean indicating that Activation is enabled.
223      */

224     private static boolean isActivationEnabled() {
225         return null != getDataHandlerClass() && null != getMultipartClass();
226     }
227
228     /**
229      * This will return the Class for the DataHandler. This will return null if
230      * the DataHandler is not available.
231      *
232      * @return The DataHandler Class or null if the DataHandler is not found
233      */

234     private static Class JavaDoc getDataHandlerClass() {
235         try {
236             return AxisHook.class.getClassLoader().loadClass(
237                     "javax.activation.DataHandler");
238         } catch (ClassNotFoundException JavaDoc e) {
239             // ignore the class was not found
240
}
241         return null;
242     }
243
244     /**
245      * This will return the Class for the MimeMultipart handler. It will return
246      * null if the MimMultipart class is not available.
247      *
248      * @return The MimeMultipart Class or null if the DataHandler is not found.
249      */

250     private static Class JavaDoc getMultipartClass() {
251         try {
252             return AxisHook.class.getClassLoader().loadClass(
253                     "javax.mail.internet.MimeMultipart");
254         } catch (ClassNotFoundException JavaDoc e) {
255             // ignore the class was not found
256
}
257         return null;
258     }
259
260     private static QName JavaDoc configureTypeMapping(ServiceDesc desc, Class JavaDoc type,
261             String JavaDoc defaultNameSpace) throws InvalidTypeMappingException {
262         try {
263             if (Void.TYPE.equals(type))
264                 return null;
265             
266 // // If type is holder or it is generic holder, strip it to its base type
267
// type = TypeRegistrar.getUnderlyingType(type);
268
//
269
if (AxisTypeMappingMetaData.isBuiltInType(type))
270                 return AxisTypeMappingMetaData.getBuiltInTypeQname(type);
271             
272             if(Holder JavaDoc.class.isAssignableFrom(type )) {
273                 type = TypeRegistrar.getHoldersValueClass(type);
274                 // NOTE: May need to register the holder type also.
275
}
276
277             // if type needs to be registered
278
TypeMapping tm = desc.getTypeMapping();
279             // QName q = tm.getTypeQName(type);
280
// System.out.println("###################################type: "
281
// + type.getCanonicalName() + " qname is: " + q
282
// + " default namesapce: " + defaultNameSpace);
283
// if (null == q || // Not registered
284
// !q.getNamespaceURI().equals(defaultNameSpace)) { // registered
285
// // but not
286
// // in
287
// // current
288
// // namespace
289
// // q = generateQName(type, desc);
290
// q = new QName(defaultNameSpace, Types
291
// .getLocalNameFromFullName(type.getName()));
292
// System.out
293
// .println("CREATE QNAME: #############################type: "
294
// + type.getCanonicalName() + " qname is: " + q);
295
// }
296

297             BindingLookupService lookupService = new SystemTypeLookupService(); // move this to the constructor
298
QName JavaDoc q = lookupService.class2qname(type, defaultNameSpace);
299
300  
301             if (type.isArray()) {
302                 /*
303                  * jongjinchoi@apache.org 2005-Mar-16 -- don't register array
304                  * serializer in document(bare or wrapped)/literal mode.
305                  */

306                 if (!tm.isRegistered(type, q) && desc.getStyle() == Style.RPC
307                         && desc.getUse() == Use.ENCODED) {
308                     tm.register(type, q, new ArraySerializerFactory(type, q),
309                             new ArrayDeserializerFactory());
310                 }
311                 QName JavaDoc qcomp = configureTypeMapping(desc, type
312                         .getComponentType(), defaultNameSpace);
313                 if (desc.getUse() == Use.LITERAL) {
314                     q = qcomp;
315                 }
316             } else if (!tm.isRegistered(type, q)) {
317                  if (XmlObject.class.isAssignableFrom(type)) {
318                     q = XmlBeans.typeForClass(type).getName();
319                     tm.register(type, q, new XmlBeanSerializerFactory(type, q),
320                             new XmlBeanDeserializerFactory(type, q));
321                 }
322                 /*
323                  * NOTE jcolwell@bea.com 2004-Oct-11 -- these datahandler using
324                  * classes are generally already registered but just in case...
325                  */

326                 else if (isActivationEnabled()
327                         && (java.awt.Image JavaDoc.class.isAssignableFrom(type)
328                                 || getMultipartClass().isAssignableFrom(type) || getDataHandlerClass()
329                                 .isAssignableFrom(type))) {
330                     try {
331                         /*
332                          * NOTE jcolwell@bea.com 2004-Oct-08 -- doing reflection
333                          * here in case AXIS was built without attachment
334                          * support.
335                          */

336                         ClassLoader JavaDoc cl = AxisHook.class.getClassLoader();
337                         // Loadclass could have been done in import also, but if
338
// there are no activation.jar then this would
339
// cause error when the class is loaded. To prevent that
340
// we load the class explicitly at this point.
341
// if we had done the "new
342
// org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory"
343
// then the class
344
// would have had dependecies to the org.apache... class
345
// which would not have worked in case activation was
346
// not on the path.
347
Class JavaDoc<SerializerFactory> sfClass = (Class JavaDoc<SerializerFactory>) cl
348                                 .loadClass("org.apache.axis.encoding.ser.JAFDataHandlerSerializerFactory");
349                         Class JavaDoc<DeserializerFactory> dsfClass = (Class JavaDoc<DeserializerFactory>) cl
350                                 .loadClass("org.apache.axis.encoding.ser.JAFDataHandlerDeserializerFactory");
351                         Constructor JavaDoc<SerializerFactory> sfCon = sfClass
352                                 .getConstructor(Class JavaDoc.class, QName JavaDoc.class);
353                         Constructor JavaDoc<DeserializerFactory> dsfCon = dsfClass
354                                 .getConstructor(Class JavaDoc.class, QName JavaDoc.class);
355                         SerializerFactory sf = sfCon.newInstance(type, q);
356                         DeserializerFactory dsf = dsfCon.newInstance(type, q);
357                         tm.register(type, q, sf, dsf);
358                     } catch (Exception JavaDoc e) {
359                         /*
360                          * FIXME jcolwell@bea.com 2004-Oct-08 -- log this
361                          * properly
362                          */

363                         e.printStackTrace();
364                     }
365                 } else if (!Remote JavaDoc.class.isAssignableFrom(type)
366                 /*
367                  * NOTE jcolwell@bea.com 2004-Dec-01 -- java.rmi.Remote is
368                  * prohibited by the jax-rpc spec
369                  *
370                  * NOTE jcolwell@bea.com 2004-Oct-11 -- restricting against
371                  * File, since it doesn't make sense to serialize as a bean. It
372                  * causes an infinite loop as it keeps returning itself from the
373                  * getAbsoluteFile and getCanonicalFile calls
374                  */

375                 && !File JavaDoc.class.isAssignableFrom(type)) {
376                     TypeDesc td = TypeDesc.getTypeDescForClass(type);
377
378                     // if type was registered in a different namespace, then
379
// ignore this and create a new td
380
if (td != null
381                             && !td.getXmlType().getNamespaceURI().equals(
382                                     q.getNamespaceURI())) {
383                         td = null;
384                     }
385                     TypeDesc superTd = null;
386                     BeanPropertyDescriptor[] superPd = null;
387                     // type desc is used for java-xml mapping, make sure the
388
// class and all its super classes have a type desc defined.
389
if (null == td) {
390                         td = new TypeDesc(type); // create type descriptor
391
// for this class --- NOT
392
// its super classes at this
393
// point.
394
// add super class types.
395
Class JavaDoc supa = type.getSuperclass();
396                         if ((supa != null) && (supa != java.lang.Object JavaDoc.class)
397                                 && (supa != java.lang.Exception JavaDoc.class)
398                                 && (supa != java.lang.Throwable JavaDoc.class)
399                                 && (supa != java.rmi.RemoteException JavaDoc.class)
400                                 && (supa != org.apache.axis.AxisFault.class)) {
401                             configureTypeMapping(desc, supa, defaultNameSpace);
402                         }
403                         // check to see if a type mapping was created for the
404
// super class.
405
superTd = TypeDesc.getTypeDescForClass(supa);
406                         if (superTd != null) // super class is a regular java
407
// bean with axis typedesc.
408
{
409                             superPd = superTd.getPropertyDescriptors(); // this
410
// is
411
// mapping
412
// for
413
// all
414
// my
415
// super
416
// classes.
417
}
418                         td.setXmlType(q);
419                         TypeDesc.registerTypeDescForClass(type, td);
420                         // NOTE: this is partially finished td, so more
421
// processing to follow that is why its td is not set to
422
// null as it is
423
// for the case when it is already provided (when td
424
// !=null)
425
} else {
426                         td = null; // we don't need type desc. any more this is
427
// a complete td
428
}
429                     //
430
// // At this all parent bean classes and their properties
431
// // (attributes) have been registered with typedecriptor
432
// and
433
// // type mapping.
434
// // next regidster type for this class.
435
// tm.register(type, q, new BeanSerializerFactory(type, q),
436
// /*
437
// * NOTE jcolwell@bea.com 2004-Oct-11 -- should check that
438
// * the type to deserialize has a default contructor but
439
// with
440
// * this setup there is no way to know if it is used only
441
// in
442
// * serialization.
443
// */
444
// new BeanDeserializerFactory(type, q));
445

446                     // At this all parent bean classes and their properties
447
// (attributes) have been registered with typedecriptor and
448
// type mapping.
449
// next regidster type for this class.
450
tm.register(type, q, new EnhancedBeanSerializerFactory(
451                             type, q, td),
452                     /*
453                      * NOTE jcolwell@bea.com 2004-Oct-11 -- should check that
454                      * the type to deserialize has a default contructor but with
455                      * this setup there is no way to know if it is used only in
456                      * serialization.
457                      */

458                     new EnhancedBeanDeSerializerFactory(type, q, td));
459
460                     // now register the types for this bean properties
461
// (attributes)
462
// Note: we have to consider the case that one of the
463
// properties may be XML bean
464
// or a class that can deal with its own serialization.
465
Map JavaDoc serProps = BeanDeserializerFactory.getProperties(type,
466                             null); // Note this is all of the bean properties
467
for (BeanPropertyDescriptor beanProps : (Collection JavaDoc<BeanPropertyDescriptor>) serProps
468                             .values()) {
469                         Class JavaDoc subType = beanProps.getType();
470                         // make sure the property type is configred with Type
471
// mapping and its serializer information
472
if (!(subType.isPrimitive()
473                                 || subType.getName().startsWith("java.") || subType
474                                 .getName().startsWith("javax."))) {
475                             configureTypeMapping(desc, subType,
476                                     defaultNameSpace); // if this was XML bean
477
// this recursion would
478
// take care of it
479
}
480
481                         if (td != null) { // if I didn't have type descriptor
482
// when I came to this method... I
483
// created partially filled one
484
// above
485
// now need to complete this.
486
String JavaDoc ns = q.getNamespaceURI(); // name space
487
// for the class
488
// if there is
489
// no parent
490
// find proper namespace for this element... we need
491
// to find out whihc class in the hierarchy the
492
// element came from
493
// once you know where the element came form (which
494
// class) then you know the element's name space.
495
if (superTd != null && superPd != null) { // if I
496
// had a
497
// parent,
498
for (int j = 0; j < superPd.length; j++) {
499                                     if (beanProps.getName().equals(
500                                             superPd[j].getName())) {
501                                         ns = superTd.getXmlType()
502                                                 .getNamespaceURI();
503                                         break;
504                                     }
505                                 }
506                             }
507                             FieldDesc fd = new ElementDesc();
508                             fd.setJavaType(subType);
509                             fd.setFieldName(beanProps.getName());
510                             fd.setXmlName(new QName JavaDoc(ns, beanProps.getName()));
511                             // NOTE jcolwell@bea.com 2004-Oct-28 -- might need
512
// to do more to ensure a useful type QName.
513
fd.setXmlType(tm.getTypeQName(subType));
514                             ((ElementDesc) fd).setNillable(true);
515                             // mmerz@apache.com 2005-Mar-09: required since Axis
516
// 1.2RC3 to allow for null values in complex
517
// objects; note that there is no (JSR-181)
518
// annotation that allows configuring this value.
519
td.addFieldDesc(fd);
520                         }
521                     }
522                 } else {
523                     throw new InvalidTypeMappingException("failed to register "
524                             + type.getName()
525                             + " as a valid web service datatype,"
526                             + " consider using a custom type mapping");
527                 }
528             }
529             return q;
530
531         } catch (RuntimeException JavaDoc e) {
532             logger.error("Error in type registeration", e);
533             e.printStackTrace();
534             throw e;
535         }
536     }
537
538     private static QName JavaDoc generateQName(Class JavaDoc type, ServiceDesc desc) {
539         String JavaDoc namespace = Namespaces.makeNamespace(type.getName());
540         if (namespace == null || namespace.endsWith("DefaultNamespace")) {
541             namespace = desc.getDefaultNamespace();
542         }
543         return new QName JavaDoc(namespace, Types.getLocalNameFromFullName(type
544                 .getName()));
545     }
546
547     protected static void configureSoapBinding(ServiceDesc sd,
548             BeehiveWsSOAPBindingInfo sbi) {
549         javax.jws.soap.SOAPBinding.Style style = javax.jws.soap.SOAPBinding.Style.DOCUMENT;
550         javax.jws.soap.SOAPBinding.Use use = javax.jws.soap.SOAPBinding.Use.LITERAL;
551         javax.jws.soap.SOAPBinding.ParameterStyle paramStyle = javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED;
552         if (sbi != null) {
553             style = sbi.getStyle();
554             use = sbi.getUse();
555             paramStyle = sbi.getParameterStyle();
556         }
557         if (style == javax.jws.soap.SOAPBinding.Style.RPC) {
558             sd.setStyle(Style.RPC);
559             if (use == javax.jws.soap.SOAPBinding.Use.ENCODED) {
560                 sd.setUse(Use.ENCODED);
561             } else {
562                 sd.setUse(Use.LITERAL);
563             }
564         } else {
565             /*
566              * since DOCUMENT ENCODED is not valid so force to use LITERAL
567              */

568             sd.setUse(Use.LITERAL);
569
570             // check if this is a wrapped document literal
571
if (paramStyle == javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED) {
572                 sd.setStyle(Style.WRAPPED);
573             } else {
574                 // just regular document style
575
sd.setStyle(Style.DOCUMENT);
576             }
577         }
578     }
579 }
580
581 /*
582  * A TEMP SOLUTION TO BEAN Serialization/Deserialization problem The problem is
583  * that the Axis factories use the types that are defined for a class, so a
584  * given class can't be in multiple name spaces. In this solution the factory
585  * gets the type descriptor in the constructor
586  */

587
588 class EnhancedBeanSerializerFactory extends BeanSerializerFactory {
589     public EnhancedBeanSerializerFactory(Class JavaDoc javaType, QName JavaDoc xmlType,
590             TypeDesc typeDesc) {
591         super(javaType, xmlType);
592
593         this.typeDesc = typeDesc;
594
595         if (typeDesc != null) {
596             propertyDescriptor = typeDesc.getPropertyDescriptors();
597         } else {
598             propertyDescriptor = BeanUtils.getPd(javaType, null);
599         }
600     }
601 }
602
603 class EnhancedBeanDeSerializerFactory extends BeanDeserializerFactory {
604     public EnhancedBeanDeSerializerFactory(Class JavaDoc javaType, QName JavaDoc xmlType,
605             TypeDesc typeDesc) {
606         super(javaType, xmlType);
607
608         this.typeDesc = typeDesc;
609         propertyMap = getProperties(javaType, typeDesc);
610     }
611
612 }
613
Popular Tags