You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ch...@apache.org on 2006/09/27 06:07:41 UTC

svn commit: r450306 - /webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html

Author: chatra
Date: Tue Sep 26 21:07:41 2006
New Revision: 450306

URL: http://svn.apache.org/viewvc?view=rev&rev=450306
Log:
minor improvement

Modified:
    webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html

Modified: webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html?view=diff&rev=450306&r1=450305&r2=450306
==============================================================================
--- webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html (original)
+++ webservices/axis2/trunk/java/xdocs/1_1/adb/adb-advanced.html Tue Sep 26 21:07:41 2006
@@ -5,92 +5,99 @@
 </head>
 
 <body lang="en">
-<h1>Advanced Axis2 Databinding Framework features</h1>
+<h1>Advanced Axis2 Databinding Framework Features</h1>
 
-<p>The aim of this section is provide an insight into the newly added 
- advanced features of ADB.</p>
+<p>The aim of this section is provide an insight into the newly added
+advanced features of ADB.</p>
 
 <h2>Content</h2>
 <ul>
-  <li><a href="#typeSupport">xsi:type Support</a></li>
+  <li><a href="#typeSupport">xsi:type Support</a></li>
   <li><a href="#helper">Helpergen Mode</a></li>
   <li><a href="#more">More Stuff on ADB?</a></li>
 </ul>
 
 <h2><a name="typeSupport">xsi:type Support</a></h2>
-<p>This is implemented by adding a extension maping class. The code that calls the extension mapper is generated inside the
-deserialization method of the beans and gets active when the xsi:type attribute is present. The following
-code fragment shows how the generated type mapper looks like</p>
-<pre>
- public static java.lang.Object getTypeObject(
-java.lang.String namespaceURI, java.lang.String typeName,
-javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
-if ("http://new.webservice.namespace/types".equals(namespaceURI) &&
-		"derivedType2".equals(typeName)) {
-	return namespace.webservice._new.types.DerivedType2Helper.parse(reader);
-} 
-
-......
-
-	return namespace.webservice._new.types.BaseTypeHelper.parse(reader);
-} else if ("http://new.webservice.namespace/types".equals(namespaceURI) &&
-		"derivedType1".equals(typeName)) {
-	return namespace.webservice._new.types.DerivedType1Helper.parse(reader);
-}
-
-throw new java.lang.RuntimeException("Unsupported type " +
-	namespaceURI + " " + typeName);
-
-}
-</pre>
-<p>Inside every deserialize method, the extension mapper gets called when a xsi:type
-attribute is encountered <strong>and</strong> that type is not the type that is being parsed </p>
-<p>The following code fragment shows how the ADB deserialize method calls the mapper class</p>
-<pre>
-if (reader.getAttributeValue(
-			"http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
-	java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
-			"type");
-	if (fullTypeName != null) {
-		java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
-		nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
-		java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
-		if (!"derivedType2".equals(type)) {
-			//find namespace for the prefix
-			java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
-			<strong>return (DerivedType2) namespace.webservice._new.types.ExtensionMapper.getTypeObject(nsUri,
-				type, reader);</strong>
-		}
-	}
-}
-</pre>
-<p>This should make the xsi:type based deserialization possible and should result in proper xsi:type based
-serializations at runtime</p>
-<p>This is automatically done but the package name for the mapper class can be controlled by using the <strong>mp</strong>
-flag (with a preceding -E)</p>
-<pre>
- WSDL2Code -uri .... -Emp org.example.web.map
-</pre>
-<p>When the mapping package is not specified it is derived from the targetnamespace of the first schema that is
-encountered</p>
-<h2><a name="helper">Helper mode</a></h2>
-<p>Helper mode is a fairly new feature. In the helper mode, the beans are plain Java beans and all the 
-deserialization/serialization code is moved to a helper class. For example the simple schema mentioned in 
-the ADB-howto document will yield four classes for the two that has been previously seen</p>
+
+<p>This is implemented by adding a extension maping class. The code that
+calls the extension mapper is generated inside the deserialization method of
+the beans and gets active when the xsi:type attribute is present. The
+following code fragment shows how the generated type mapper looks like</p>
+<pre> public static java.lang.Object getTypeObject(
+java.lang.String namespaceURI, java.lang.String typeName,
+javax.xml.stream.XMLStreamReader reader) throws java.lang.Exception {
+if ("http://new.webservice.namespace/types".equals(namespaceURI) &amp;&amp;                 "derivedType2".equals(typeName)) {
+        return namespace.webservice._new.types.DerivedType2Helper.parse(reader);
+} 
+
+......
+
+        return namespace.webservice._new.types.BaseTypeHelper.parse(reader);
+} else if ("http://new.webservice.namespace/types".equals(namespaceURI) &amp;&amp;                 "derivedType1".equals(typeName)) {
+        return namespace.webservice._new.types.DerivedType1Helper.parse(reader);
+}
+
+throw new java.lang.RuntimeException("Unsupported type " +
+        namespaceURI + " " + typeName);
+
+}</pre>
+
+<p>Inside every deserialize method, the extension mapper gets called when a
+xsi:type attribute is encountered <strong>and</strong> that type is not the
+type that is being parsed</p>
+
+<p>The following code fragment shows how the ADB deserialize method calls the
+mapper class</p>
+<pre>if (reader.getAttributeValue(
+                        "http://www.w3.org/2001/XMLSchema-instance", "type") != null) {
+        java.lang.String fullTypeName = reader.getAttributeValue("http://www.w3.org/2001/XMLSchema-instance",
+                        "type");
+        if (fullTypeName != null) {
+                java.lang.String nsPrefix = fullTypeName.substring(0,fullTypeName.indexOf(":"));
+                nsPrefix = (nsPrefix == null) ? "" : nsPrefix;
+                java.lang.String type = fullTypeName.substring(fullTypeName.indexOf(":") + 1);
+                if (!"derivedType2".equals(type)) {
+                        //find namespace for the prefix
+                        java.lang.String nsUri = reader.getNamespaceContext().getNamespaceURI(nsPrefix);
+                        <strong>return (DerivedType2) namespace.webservice._new.types.ExtensionMapper.getTypeObject(nsUri,
+                                type, reader);</strong>
+                }
+        }
+}</pre>
+
+<p>This should make the xsi:type based deserialization possible and should
+result in proper xsi:type based serializations at runtime</p>
+
+<p>This is automatically done but the package name for the mapper class can
+be controlled by using the <strong>mp</strong> flag (with a preceding -E)</p>
+<pre> WSDL2Code -uri .... -Emp org.example.web.map</pre>
+
+<p>When the mapping package is not specified it is derived from the
+targetnamespace of the first schema that is encountered</p>
+
+<h2><a name="helper">Helper mode</a></h2>
+
+<p>Helper mode is a fairly new feature. In the helper mode, the beans are
+plain Java beans and all the deserialization/serialization code is moved to a
+helper class. For example the simple schema mentioned in the ADB-howto
+document will yield four classes for the two that has been previously seen</p>
 <ol>
-  <li>MyElement.java</li>
+  <li>MyElement.java</li>
   <li>MyElementHelper.java</li>
-  <li>SOAPStruct.java</li>
+  <li>SOAPStruct.java</li>
   <li>SOAPStructHelper.java</li>
-</ol>
-<p>The helpers basically contain all the code that went into the ADBBeans. Hence the beans in the helper mode are 
-pretty much readable than the rest. Also note that the helper mode is available only if you are in the unpacked mode.
-The code generator by default does not expand the classes</p>
-<p>Helper mode can be switched on by the <strong>h</strong> flag (Passed with a -E infront to indicate that it is an 
-extra switch undertood by ADB). Also the <strong>-u</strong> flag should be present to indicate the unpacking</p>
-<pre>
- WSDL2Code -uri .... -u -Eh
-</pre>
+</ol>
+
+<p>The helpers basically contain all the code that went into the ADBBeans.
+Hence the beans in the helper mode are pretty much readable than the rest.
+Also note that the helper mode is available only if you are in the unpacked
+mode. The code generator by default does not expand the classes</p>
+
+<p>Helper mode can be switched on by the <strong>h</strong> flag (Passed with
+a -E infront to indicate that it is an extra switch undertood by ADB). Also
+the <strong>-u</strong> flag should be present to indicate the unpacking</p>
+<pre> WSDL2Code -uri .... -u -Eh</pre>
+
 <h2><a name="more">More Stuff on ADB?</a></h2>
 <ul>
   <li><a href="adb-tweaking.html">Tweaking the ADB Code Generator</a>-
@@ -100,6 +107,6 @@
     explains how the ADB schema compiler was attached to the Axis2
   framework</li>
 </ul>
-<hr/>
+<hr>
 </body>
 </html>



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org