KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > schema > SchemaVersion2001


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
17 package org.apache.axis.schema;
18
19 import org.apache.axis.Constants;
20 import org.apache.axis.encoding.TypeMappingImpl;
21 import org.apache.axis.encoding.ser.CalendarDeserializerFactory;
22 import org.apache.axis.encoding.ser.CalendarSerializerFactory;
23
24 import javax.xml.namespace.QName JavaDoc;
25
26 /**
27  * 2001 Schema characteristics.
28  *
29  * @author Glen Daniels (gdaniels@apache.org)
30  */

31 public class SchemaVersion2001 implements SchemaVersion {
32     public static QName JavaDoc QNAME_NIL = new QName JavaDoc(Constants.URI_2001_SCHEMA_XSI,
33                                               "nil");
34
35     /**
36      * Package-access constructor - access this through SchemaVersion
37      * constants.
38      */

39     SchemaVersion2001() {
40     }
41
42     /**
43      * Get the appropriate QName for the "null"/"nil" attribute for this
44      * Schema version.
45      * @return {http://www.w3.org/2001/XMLSchema-instance}nil
46      */

47     public QName JavaDoc getNilQName() {
48         return QNAME_NIL;
49     }
50
51     /**
52      * The XSI URI
53      * @return the XSI URI
54      */

55     public String JavaDoc getXsiURI() {
56         return Constants.URI_2001_SCHEMA_XSI;
57     }
58
59     /**
60      * The XSD URI
61      * @return the XSD URI
62      */

63     public String JavaDoc getXsdURI() {
64         return Constants.URI_2001_SCHEMA_XSD;
65     }
66
67     /**
68      * Register the schema specific type mappings
69      */

70     public void registerSchemaSpecificTypes(TypeMappingImpl tm) {
71         
72         // This mapping will convert a Java 'Date' type to a dateTime
73
tm.register(java.util.Date JavaDoc.class,
74                     Constants.XSD_DATETIME,
75                    new CalendarSerializerFactory(java.util.Date JavaDoc.class,
76                                              Constants.XSD_DATETIME),
77                    new CalendarDeserializerFactory(java.util.Date JavaDoc.class,
78                                                Constants.XSD_DATETIME)
79                    );
80         
81         // This is the preferred mapping per JAX-RPC.
82
// Last one registered take priority
83
tm.register(java.util.Calendar JavaDoc.class,
84                     Constants.XSD_DATETIME,
85                    new CalendarSerializerFactory(java.util.Calendar JavaDoc.class,
86                                              Constants.XSD_DATETIME),
87                    new CalendarDeserializerFactory(java.util.Calendar JavaDoc.class,
88                                                Constants.XSD_DATETIME)
89                    );
90         
91     }
92 }
93
Popular Tags