~ubuntu-branches/debian/squeeze/axis/squeeze

« back to all changes in this revision

Viewing changes to src/org/apache/axis/schema/SchemaVersion2001.java

  • Committer: Bazaar Package Importer
  • Author(s): Vladimír Lapáček
  • Date: 2006-09-06 22:31:39 UTC
  • Revision ID: james.westby@ubuntu.com-20060906223139-l7m5edxeositeppl
Tags: upstream-1.4
Import upstream version 1.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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;
 
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 QNAME_NIL = new QName(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 getNilQName() {
 
48
        return QNAME_NIL;
 
49
    }
 
50
 
 
51
    /**
 
52
     * The XSI URI
 
53
     * @return the XSI URI
 
54
     */
 
55
    public String getXsiURI() {
 
56
        return Constants.URI_2001_SCHEMA_XSI;
 
57
    }
 
58
 
 
59
    /**
 
60
     * The XSD URI
 
61
     * @return the XSD URI
 
62
     */
 
63
    public String 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.class,
 
74
                    Constants.XSD_DATETIME,
 
75
                   new CalendarSerializerFactory(java.util.Date.class,
 
76
                                             Constants.XSD_DATETIME),
 
77
                   new CalendarDeserializerFactory(java.util.Date.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.class,
 
84
                    Constants.XSD_DATETIME,
 
85
                   new CalendarSerializerFactory(java.util.Calendar.class,
 
86
                                             Constants.XSD_DATETIME),
 
87
                   new CalendarDeserializerFactory(java.util.Calendar.class,
 
88
                                               Constants.XSD_DATETIME)
 
89
                   );
 
90
        
 
91
    }
 
92
}