axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hemap...@apache.org
Subject svn commit: r149507 - in webservices/axis/trunk/java/dev/scratch/prototype2: maven.xml src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java
Date Wed, 02 Feb 2005 10:31:37 GMT
Author: hemapani
Date: Wed Feb  2 02:31:35 2005
New Revision: 149507

URL: http://svn.apache.org/viewcvs?view=rev&rev=149507
Log:
update the sample1 to use the hash code instead 

Modified:
    webservices/axis/trunk/java/dev/scratch/prototype2/maven.xml
    webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java
    webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/maven.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/maven.xml?view=diff&r1=149506&r2=149507
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/maven.xml (original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/maven.xml Wed Feb  2 02:31:35 2005
@@ -41,7 +41,9 @@
 		    <include name="axis2*.jar"/>
 		  </lib>  
 		</war>
-
-
+    </goal>
+    
+    <goal name="samples">
+    		<ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="src/samples/sample1"/>
     </goal>
  </project>

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java?view=diff&r1=149506&r2=149507
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/java/org/apache/axis/encoding/SimpleTypeEncodingUtils.java
Wed Feb  2 02:31:35 2005
@@ -32,6 +32,14 @@
         
 		try{
 			int event = xpp.next();
+			while(XMLStreamConstants.START_ELEMENT != event && XMLStreamConstants.END_ELEMENT
!= event){
+				event = xpp.next();
+			}
+			if(XMLStreamConstants.END_ELEMENT == event){
+				return null;
+			}
+
+			event = xpp.next();
 			while(true){
 				if(XMLStreamConstants.START_ELEMENT == event){
 					objs.add(encoder.deSerialize(xpp));

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java?view=diff&r1=149506&r2=149507
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoProvider.java
Wed Feb  2 02:31:35 2005
@@ -8,6 +8,7 @@
 
 import java.lang.reflect.Method;
 
+import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.axis.context.MessageContext;
@@ -32,28 +33,45 @@
 		throws AxisFault {
 		Class[] parms = method.getParameterTypes();
 		Object[] objs = new Object[parms.length];
-
-		for (int i = 0; i < parms.length; i++) {
-			if (int.class.equals(parms[i])) {
-				objs[i] =
-					new Integer(SimpleTypeEncodingUtils.deserializeInt(xpp));
-			} else if (String.class.equals(parms[i])) {
-				objs[i] = SimpleTypeEncodingUtils.deserializeString(xpp);
-			} else if (String[].class.equals(parms[i])) {
-				objs[i] = SimpleTypeEncodingUtils.deserializeStringArray(xpp);
-			} else if (EchoStruct.class.equals(parms[i])) {
-				Encoder en = new EchoStructEncoder(null);
-				objs[i] = en.deSerialize(xpp);
-			} else if (EchoStruct[].class.equals(parms[i])) {
-				objs[i] =
-					SimpleTypeEncodingUtils.deserializeArray(
-						xpp,
-						new EchoStructEncoder(null));
+		
+		try {
+			int event = xpp.next();
+			while (XMLStreamConstants.START_ELEMENT != event
+				&& XMLStreamConstants.END_ELEMENT != event) {
+				event = xpp.next();
+			}
+			if (XMLStreamConstants.END_ELEMENT == event) {
+				return null;
 			} else {
-				throw new UnsupportedOperationException("Only int,String and String[] is supported yet");
+				for (int i = 0; i < parms.length; i++) {
+					if (int.class.equals(parms[i])) {
+						objs[i] =
+							new Integer(
+								SimpleTypeEncodingUtils.deserializeInt(xpp));
+					} else if (String.class.equals(parms[i])) {
+						objs[i] =
+							SimpleTypeEncodingUtils.deserializeString(xpp);
+					} else if (String[].class.equals(parms[i])) {
+						objs[i] =
+							SimpleTypeEncodingUtils.deserializeStringArray(xpp);
+					} else if (EchoStruct.class.equals(parms[i])) {
+						Encoder en = new EchoStructEncoder(null);
+						objs[i] = en.deSerialize(xpp);
+					} else if (EchoStruct[].class.equals(parms[i])) {
+						objs[i] =
+							SimpleTypeEncodingUtils.deserializeArray(
+								xpp,
+								new EchoStructEncoder(null));
+					} else {
+						throw new UnsupportedOperationException("Only int,String and String[] is supported
yet");
+					}
+				}
+				return objs;
+
 			}
+		} catch (Exception e) {
+			throw new AxisFault("Exception",e);
 		}
-		return objs;
 	}
 
 	public MessageContext invoke(MessageContext msgContext) throws AxisFault {

Modified: webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java?view=diff&r1=149506&r2=149507
==============================================================================
--- webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java
(original)
+++ webservices/axis/trunk/java/dev/scratch/prototype2/src/samples/sample1/src/org/apache/axis/sample/echo/EchoStructEncoder.java
Wed Feb  2 02:31:35 2005
@@ -20,51 +20,99 @@
 import org.apache.axis.om.OutObject;
 import org.xml.sax.ContentHandler;
 
-public class EchoStructEncoder implements OutObject,Encoder{
+public class EchoStructEncoder implements OutObject, Encoder {
+
+	private static final int VALUE1 = -823812896;
+	private static final int VALUE2 = -823812895;
+	private static final int VALUE3 = -823812894;
+	private static final int VALUE4 = -823812893;
+	private static final int VALUE5 = -823812892;
+	private static final int VALUE6 = -823812891;
+	private static final int VALUE7 = -823812890;
+	private static final int VALUE8 = -823812889;
+	private static final int VALUE9 = -823812888;
+	private static final int VALUE10 = 231604048;
+	private static final int VALUE11 = 231604049;
+	private static final int VALUE12 = 231604050;
+	private static final int VALUE13 = 231604051;
+
 	private ContentHandler contentHandler;
 	private EchoStruct struct;
-	
-	public EchoStructEncoder(EchoStruct struct){
+
+	public EchoStructEncoder(EchoStruct struct) {
 		this.struct = struct;
 	}
-	
-	public Object deSerialize(XMLStreamReader xpp)throws AxisFault{
+
+	public Object deSerialize(XMLStreamReader xpp) throws AxisFault {
 		EchoStruct struct = new EchoStruct();
-        
-		try{
+
+		try {
 			int event = xpp.next();
-			while(true){
-				if(XMLStreamConstants.START_ELEMENT == event){
-					if("value1".equals(xpp.getLocalName())){
-						struct.setValue1(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value2".equals(xpp.getLocalName())){
-						struct.setValue2(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value3".equals(xpp.getLocalName())){
-						struct.setValue3(SimpleTypeEncodingUtils.deserializeInt(xpp));
-					}else if("value4".equals(xpp.getLocalName())){
-						struct.setValue4(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value5".equals(xpp.getLocalName())){
-						struct.setValue5(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value6".equals(xpp.getLocalName())){
-						struct.setValue6(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value7".equals(xpp.getLocalName())){
-						struct.setValue7(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value8".equals(xpp.getLocalName())){
-						struct.setValue8(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value9".equals(xpp.getLocalName())){
-						struct.setValue9(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value10".equals(xpp.getLocalName())){
-						struct.setValue10(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value11".equals(xpp.getLocalName())){
-						struct.setValue11(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value12".equals(xpp.getLocalName())){
-						struct.setValue12(SimpleTypeEncodingUtils.deserializeString(xpp));
-					}else if("value13".equals(xpp.getLocalName())){
-						struct.setValue13(SimpleTypeEncodingUtils.deserializeString(xpp));
+			while (true) {
+				if (XMLStreamConstants.START_ELEMENT == event) {
+					String localName = xpp.getLocalName();
+					int nameCode = localName.hashCode();
+					switch (nameCode) {
+						case VALUE1 :
+							struct.setValue1(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE2 :
+							struct.setValue2(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE3 :
+							struct.setValue3(
+								SimpleTypeEncodingUtils.deserializeInt(xpp));
+							break;
+						case VALUE4 :
+							struct.setValue4(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE5 :
+							struct.setValue5(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE6 :
+							struct.setValue6(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE7 :
+							struct.setValue7(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE8 :
+							struct.setValue8(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE9 :
+							struct.setValue9(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE10 :
+							struct.setValue10(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE11 :
+							struct.setValue11(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE12 :
+							struct.setValue12(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+							break;
+						case VALUE13 :
+							struct.setValue13(
+								SimpleTypeEncodingUtils.deserializeString(xpp));
+						break;
+						default:
+							throw new AxisFault("Unknown elemnt "+ localName);
 					}
-				}if(XMLStreamConstants.END_ELEMENT == event){
+				}
+				if (XMLStreamConstants.END_ELEMENT == event) {
 					break;
-				}if(XMLStreamConstants.END_DOCUMENT == event){
+				}
+				if (XMLStreamConstants.END_DOCUMENT == event) {
 					throw new AxisFault("premature and of file");
 				}
 				event = xpp.next();
@@ -76,124 +124,238 @@
 		}
 
 	}
-	
-	public void serialize(XMLStreamWriter writer)throws IOException, XMLStreamException{
+
+	public void serialize(XMLStreamWriter writer)
+		throws IOException, XMLStreamException {
 		writer.writeStartElement("value1");
-		
+
 		writer.writeEndElement();
 	}
 
-
-	public void startBuilding(ContentHandler contentHandler) throws OMException {
-		if(contentHandler == null){
+	public void startBuilding(ContentHandler contentHandler)
+		throws OMException {
+		if (contentHandler == null) {
 			throw new OMException("Please set the content Handler");
 		}
 		try {
 			contentHandler.startPrefixMapping("s", "http://axis.apache.org");
 			String value = "value1";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value1",null);
-			String strVal =  struct.getValue1();
-			char[] str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value1",
+				null);
+			String strVal = struct.getValue1();
+			char[] str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value1");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value1");
 
 			value = "value2";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value2",null);
-			strVal =  struct.getValue2();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value2",
+				null);
+			strVal = struct.getValue2();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value2");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value2");
 
 			value = "value3";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value3",null);
-			int intVal  = struct.getValue3();
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value3",
+				null);
+			int intVal = struct.getValue3();
 			str = String.valueOf(intVal).toCharArray();
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value3");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value3");
 
 			value = "value4";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value4",null);
-			strVal =  struct.getValue4();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value4",
+				null);
+			strVal = struct.getValue4();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value4");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value4");
 
 			value = "value5";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value5",null);
-			strVal =  struct.getValue5();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value5",
+				null);
+			strVal = struct.getValue5();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value5");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value5");
 
 			value = "value6";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value6",null);
-			strVal =  struct.getValue6();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value6",
+				null);
+			strVal = struct.getValue6();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value6");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value6");
 
 			value = "value7";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value7",null);
-			strVal =  struct.getValue7();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value7",
+				null);
+			strVal = struct.getValue7();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value7");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value7");
 
 			value = "value8";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value8",null);
-			strVal =  struct.getValue8();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value8",
+				null);
+			strVal = struct.getValue8();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value8");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value8");
 
 			value = "value9";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value9",null);
-			strVal =  struct.getValue9();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value9",
+				null);
+			strVal = struct.getValue9();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value9");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value9");
 
 			value = "value10";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value10",null);
-			strVal =  struct.getValue10();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value10",
+				null);
+			strVal = struct.getValue10();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value10");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value10");
 
 			value = "value11";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value11",null);
-			strVal =  struct.getValue11();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value11",
+				null);
+			strVal = struct.getValue11();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value11");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value11");
 
 			value = "value12";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value12",null);
-			strVal =  struct.getValue12();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value12",
+				null);
+			strVal = struct.getValue12();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value12");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value12");
 
 			value = "value13";
-			contentHandler.startElement("http://axis.apache.org",value,"s:value13",null);
-			strVal =  struct.getValue13();
-			str = ((strVal ==null)?new char[]{}: strVal.toCharArray());
+			contentHandler.startElement(
+				"http://axis.apache.org",
+				value,
+				"s:value13",
+				null);
+			strVal = struct.getValue13();
+			str = ((strVal == null) ? new char[] {
+			}
+			: strVal.toCharArray());
 			contentHandler.characters(str, 0, str.length);
-			contentHandler.endElement("http://axis.apache.org",value,"s:value13");
+			contentHandler.endElement(
+				"http://axis.apache.org",
+				value,
+				"s:value13");
 
 		} catch (Exception e) {
 			throw new OMException(e);
 		}
 
-		
-		
 	}
 
 	/* (non-Javadoc)
 	 * @see org.apache.axis.encoding.Encoder#setObject(java.lang.Object)
 	 */
 	public void setObject(Object obj) {
-		this.struct = (EchoStruct)obj;
+		this.struct = (EchoStruct) obj;
 
 	}
 



Mime
View raw message