KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jibx > runtime > IBindingFactory


1 /*
2 Copyright (c) 2002-2004, Dennis M. Sosnoski.
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8  * Redistributions of source code must retain the above copyright notice, this
9    list of conditions and the following disclaimer.
10  * Redistributions in binary form must reproduce the above copyright notice,
11    this list of conditions and the following disclaimer in the documentation
12    and/or other materials provided with the distribution.
13  * Neither the name of JiBX nor the names of its contributors may be used
14    to endorse or promote products derived from this software without specific
15    prior written permission.
16
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
21 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */

28
29 package org.jibx.runtime;
30
31 /**
32  * Binding factory interface definition. This interface is implemented by
33  * the binding factory class generated by each binding definition.
34  *
35  * @author Dennis M. Sosnoski
36  * @version 1.0
37  */

38
39 public interface IBindingFactory
40 {
41     /** Current binary version number. This is a byte-ordered value, allowing
42      for two levels of major and two levels of minor version. */

43     public static final int CURRENT_VERSION_NUMBER = 0x00000000;
44     
45     /** Current distribution file name. This is filled in by the Ant build
46      process to match the current distribution. */

47     public static final String JavaDoc CURRENT_VERSION_NAME = "jibx-beta3c";
48     
49     /** Mask for portions of version number that effect compatibility. */
50     public static final int COMPATIBLE_VERSION_MASK = 0xFFFF0000;
51     
52     /**
53      * Create marshalling context instance.
54      *
55      * @return created marshalling context instance
56      * @throws JiBXException if error creating context
57      * @throws UnsupportedOperationException if marshalling not supported
58      * by binding
59      */

60      
61     public IMarshallingContext createMarshallingContext()
62         throws JiBXException;
63     
64     /**
65      * Create unmarshalling context instance.
66      *
67      * @return created unmarshalling context instance
68      * @throws JiBXException if error creating context
69      * @throws UnsupportedOperationException if unmarshalling not supported
70      * by binding
71      */

72      
73     public IUnmarshallingContext createUnmarshallingContext()
74         throws JiBXException;
75     
76     /**
77      * Get version number for binding compiler used.
78      *
79      * @return version number of code used to compile binding
80      */

81      
82     public int getCompilerVersion();
83     
84     /**
85      * Get distribution name for binding compiler used.
86      *
87      * @return name of distribution for binding compiler
88      */

89      
90     public String JavaDoc getCompilerDistribution();
91     
92     /**
93      * Get namespaces defined in mapping. The returned array is indexed by the
94      * namespace index number used when marshalling.
95      *
96      * @return array of namespaces defined in binding (<code>null</code> if not
97      * an output binding)
98      */

99      
100     public String JavaDoc[] getNamespaces();
101     
102     /**
103      * Get mapped class names. Returns array of fully-qualified class names,
104      * ordered by index number of the class.
105      *
106      * @return array of class names
107      */

108      
109     public String JavaDoc[] getMappedClasses();
110     
111     /**
112      * Get namespaces of elements corresponding to mapped classes. The returned
113      * array uses the same ordering as the result of the {@link
114      * #getMappedClasses} call. Entries in the array are <code>null</code> if
115      * there is no element for a class or the element is in the default
116      * namespace.
117      *
118      * @return array of element namespaces
119      */

120      
121     public String JavaDoc[] getElementNamespaces();
122     
123     /**
124      * Get names of elements corresponding to mapped classes. The returned array
125      * uses the same ordering as the result of the {@link #getMappedClasses}
126      * call. Entries in the array are <code>null</code> if there is no element
127      * for a class.
128      *
129      * @return array of element names
130      */

131      
132     public String JavaDoc[] getElementNames();
133 }
134
Popular Tags