You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mirae-dev@ws.apache.org by da...@apache.org on 2005/02/03 13:41:11 UTC
svn commit: r151149 [7/19] - in webservices/mirae/trunk: ./ bin/ bin/linux/
bin/windows/ build/ docs/ docs/images/ docs/images/CVS/ docs/javadoc/
genstub/ genstub/example8/ genstub/lk/ genstub/lk/opensource/
genstub/lk/opensource/wsmobile/ genstub/org/ genstub/org/apache/
genstub/org/apache/mirae/ genstub/org/apache/mirae/builtin/
genstub/org/apache/mirae/builtin/simpletypes/ genstub/uk/ genstub/uk/co/
genstub/uk/co/dsdata/ genstub/uk/co/dsdata/ws/
genstub/uk/co/dsdata/ws/travel/ genstub/uk/co/dsdata/ws/travel/sbg/
genstub/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/
genstub/ws_mobile_point/ lib/ logs/ samples/ samples/documentsamples/
samples/documentsamples/calculator/
samples/documentsamples/calculator/calculator/
samples/documentsamples/calculator/calculator/axis/
samples/documentsamples/calculator/calculator/axis/localhost/
samples/documentsamples/calculator/org/
samples/documentsamples/calculator/org/apache/
samples/documentsamples/calculator/org/apache/mirae/
samples/documentsamples/calculator/org/apache/mirae/builtin/
samples/documentsamples/calculator/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/echo/ samples/documentsamples/echo/org/
samples/documentsamples/echo/org/apache/
samples/documentsamples/echo/org/apache/mirae/
samples/documentsamples/echo/org/apache/mirae/builtin/
samples/documentsamples/echo/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/echo/org/soapinterop/
samples/documentsamples/employee/
samples/documentsamples/employee/jSR172UseCases/
samples/documentsamples/employee/jSR172UseCases/com/
samples/documentsamples/employee/jSR172UseCases/com/sun/
samples/documentsamples/employee/jSR172UseCases/com/sun/www/
samples/documentsamples/employee/org/
samples/documentsamples/employee/org/apache/
samples/documentsamples/employee/org/apache/mirae/
samples/documentsamples/employee/org/apache/mirae/builtin/
samples/documentsamples/employee/org/apache/mirae/builtin/simpletypes/
samples/documentsamples/employee/xsd/
samples/documentsamples/employee/xsd/JSR172AppendixA/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/
samples/documentsamples/employee/xsd/JSR172AppendixA/com/sun/www/
samples/rpcsamples/ samples/rpcsamples/airfarequote/
samples/rpcsamples/airfarequote/org/
samples/rpcsamples/airfarequote/org/apache/
samples/rpcsamples/airfarequote/org/apache/mirae/
samples/rpcsamples/airfarequote/org/apache/mirae/builtin/
samples/rpcsamples/airfarequote/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/airfarequote/uk/ samples/rpcsamples/airfarequote/uk/co/
samples/rpcsamples/airfarequote/uk/co/dsdata/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/
samples/rpcsamples/airfarequote/uk/co/dsdata/ws/travel/sbg/SBGAirFareQuotes/
samples/rpcsamples/calculator/ samples/rpcsamples/calculator/lk/
samples/rpcsamples/calculator/lk/opensource/
samples/rpcsamples/calculator/lk/opensource/wsmobile/
samples/rpcsamples/calculator/org/ samples/rpcsamples/calculator/org/apache/
samples/rpcsamples/calculator/org/apache/mirae/
samples/rpcsamples/calculator/org/apache/mirae/builtin/
samples/rpcsamples/calculator/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/distance/ samples/rpcsamples/distance/org/
samples/rpcsamples/distance/org/apache/
samples/rpcsamples/distance/org/apache/mirae/
samples/rpcsamples/distance/org/apache/mirae/builtin/
samples/rpcsamples/distance/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/distance/wsdl/
samples/rpcsamples/distance/wsdl/DistanceService/
samples/rpcsamples/distance/wsdl/DistanceService/sd/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/
samples/rpcsamples/distance/wsdl/DistanceService/sd/net/xmethods/www/
samples/rpcsamples/point/ samples/rpcsamples/point/org/
samples/rpcsamples/point/org/apache/
samples/rpcsamples/point/org/apache/mirae/
samples/rpcsamples/point/org/apache/mirae/builtin/
samples/rpcsamples/point/org/apache/mirae/builtin/simpletypes/
samples/rpcsamples/point/ws_mobile_point/ samples/rpcsamples/student/
samples/rpcsamples/student/example8/ samples/rpcsamples/student/org/
samples/rpcsamples/student/org/apache/
samples/rpcsamples/student/org/apache/mirae/
samples/rpcsamples/student/org/apache/mirae/builtin/
samples/rpcsamples/student/org/apache/mirae/builtin/simpletypes/ src/
src/mirae/ src/mirae/jaxp/ src/mirae/jaxp/javax/ src/mirae/jaxp/javax/xml/
src/mirae/jaxp/javax/xml/parsers/ src/mirae/jaxp/org/
src/mirae/jaxp/org/apache/ src/mirae/jaxp/org/apache/mirae/
src/mirae/jaxp/org/apache/mirae/j2me/
src/mirae/jaxp/org/apache/mirae/j2me/xml/
src/mirae/jaxp/org/apache/mirae/j2me/xml/sax/ src/mirae/jaxp/org/xml/
src/mirae/jaxp/org/xml/sax/ src/mirae/jaxp/org/xml/sax/helpers/
src/mirae/jaxrpc/ src/mirae/jaxrpc/javax/ src/mirae/jaxrpc/javax/xml/
src/mirae/jaxrpc/javax/xml/namespace/ src/mirae/jaxrpc/javax/xml/rpc/
src/mirae/jaxrpc/org/ src/mirae/jaxrpc/org/apache/
src/mirae/jaxrpc/org/apache/mirae/ src/mirae/jaxrpc/org/apache/mirae/util/
src/mirae/jaxrpc/org/apache/mirae/xml/
src/mirae/jaxrpc/org/apache/mirae/xml/rpc/ src/tools/
src/tools/simpletypes/ src/tools/wsdl2ws_j2me/ src/tools/wsdl2ws_j2me/org/
src/tools/wsdl2ws_j2me/org/apache/ src/tools/wsdl2ws_j2me/org/apache/axis/
src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/
src/tools/wsdl2ws_j2me/org/apache/axis/wsdl/symbolTable/
src/tools/wsdl2ws_j2me/org/apache/mirae/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/doclit/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/info/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/j2me/client/
src/tools/wsdl2ws_j2me/org/apache/mirae/wsdl2ws/rpc/ tests/
tests/functional/ tests/functional/client/
tests/functional/client/SBGGetAirFareQuote-client1/
tests/functional/client/SBGGetAirFareQuote-client2/
tests/functional/client/calculator/ tests/functional/client/point/
tests/functional/client/wst/ tests/functional/wsdl/ tests/unit/
tests/unit/inmessage/ tests/unit/mirae/ tests/unit/outmessage/
tests/unit/wsdl2ws/ wsdl/ wsdltests/ wsdltests/calculator/
wsdltests/calculator/client/ wsdltests/calculator/server/
wsdltests/exceptiontest/ wsdltests/exceptiontest/client/
wsdltests/exceptiontest/server/ wsdltests/interoptestround1/
wsdltests/interoptestround1/client/ wsdltests/interoptestround1/server/
Added: webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Decoder.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Decoder.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Decoder.java (added)
+++ webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Decoder.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,300 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.xml.rpc;
+
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Stack;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.rpc.NamespaceConstants;
+
+
+import org.apache.mirae.util.Constants;
+import org.apache.mirae.util.MIRAEException;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * <code>Decoder</code> Class is extended from DefaultHandler class
+ * The methods of this class are called by the SAX parser frequently
+ * while processing the SOAP message
+ *
+* @author kurinchikumaran(kurinchikumaran@hsenid.lk)
+ *
+ */
+public class Decoder extends DefaultHandler{
+
+ /** Return type */
+ private InOutParameter param;
+
+ /** Return Category (Simple | Complex | Array | DOCLIT) */
+ private int returnCategory=0;
+
+ /** Fault String of the SOAP fault */
+ private String faultString;
+
+ /** Fault Code of the SOAP fault */
+ private String faultCode;
+
+ /** Namespace URI */
+ private String uri;
+
+ /** SOAP Tag Name */
+ private String localName;
+
+ /** SOAP Tag Name */
+ private String qName;
+
+ /** Attribute of the SOAP Tag */
+ private Attributes attributes;
+
+ /** Local name of the Output QName */
+ private String validationCode;
+
+ /** Last tag processed was a start tag */
+ boolean isStart = true;
+
+ /** Fault tag found in the response */
+ boolean faultOccured = false;
+
+ /** Header tag found in the response */
+ boolean processSoapHeader = false;
+
+ /** Body & Envelope tags found in the response */
+ int bodyEnvelope = 0;
+
+ /** Stack for holding tag names */
+ Stack stack;
+
+ /**
+ * This Constructor defines Return type object and Return Category
+ * @param param
+ * @param type
+ * @throws MIRAEException
+ */
+ public Decoder(InOutParameter param,int returnCategory, String validationCode) throws MIRAEException{
+
+ this.param = param;
+ this.returnCategory = returnCategory;
+ this.validationCode = validationCode;
+ stack = new Stack();
+ }
+
+ /**
+ * SAX parser is used here to decode the response
+ * Decoder object is passes as an parameter for the parse method
+ * where the Decoder is an extended class from DefaultHandler class
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ */
+ public void decode(InputStream in) throws ParserConfigurationException, SAXException,IOException {
+
+ SAXParserFactory factory = SAXParserFactory.newInstance();
+ SAXParser parser = factory.newSAXParser();
+ parser.parse(in, this);
+ }
+
+ /**
+ * Receive notification of the start of an element.
+ *
+ * <p>this method is to take specific actions at the beginning
+ * of a document (such as allocating the root node of a tree or
+ * creating an output file).</p>
+ *
+ * @param name The element type name.
+ * @param attributes The specified or defaulted attributes.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.helpers.DefaultHandler#startElement
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+
+ this.uri=uri;
+ this.localName=localName;
+ this.qName=qName;
+ this.attributes=attributes;
+
+ isStart=true;
+ stack.addElement(qName);
+
+ if ( ( qName.toLowerCase().endsWith("envelope") ) || ( qName.toLowerCase().endsWith("body") ) ) {
+ bodyEnvelope++;
+ return;
+ }
+
+ if ( (bodyEnvelope == 1) && ( qName.toLowerCase().endsWith("header") ) ) {
+ processSoapHeader = true;
+ return;
+ }
+
+ if ( processSoapHeader == true ) {
+ String mustUnderstand = attributes.getValue(NamespaceConstants.NSURI_SOAP_ENVELOPE, "mustUnderstand");
+ if ( ( mustUnderstand != null ) && ( mustUnderstand.equals("1") ) ) {
+ throw new SAXException("Unsupported header element with mustUnderstand");
+ }
+ return;
+ }
+
+
+ if (bodyEnvelope != 2) {
+ throw new SAXException("Missing SOAP Body or Envelope");
+ }
+
+ if ( qName.toLowerCase().endsWith("fault") ) {
+ faultOccured=true;
+ return;
+ }
+
+ if ( faultOccured == true ) {
+ return;
+ }
+
+ if ( stack.size() == 3 ) {
+ if ( (validationCode != null) && ( !qName.equals(validationCode) ) ) {
+ throw new SAXException("Unknown tag : "+ qName);
+ }
+ } else if ( ( (returnCategory == Constants.TYPE_SIMPLE) && (stack.size() == 4) )
+ || ( (returnCategory == Constants.TYPE_DOCLIT) && (stack.size() >= 4) )
+ || ( stack.size() >= 5 ) ) {
+ param.startElement(uri,localName,qName,attributes);
+ }
+ }
+
+ /**
+ * Receive notification of character data inside an element.
+ *
+ * <p>this method is to take specific actions for each chunk of character data
+ * (such as adding the data to a node or buffer, or printing it to
+ * a file).</p>
+ *
+ * @param ch The characters.
+ * @param start The start position in the character array.
+ * @param length The number of characters to use from the
+ * character array.
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.helpers.DefaultHandler#characters
+ */
+ public void characters(char[] ch, int start, int length) throws SAXException {
+ String value = new String(ch, start, length);
+ value = value.trim();
+
+ if ( ( isStart == false ) || ( stack.size() <= 2 ) || ( processSoapHeader == true ) ) {
+ return;
+ }
+
+ if ( faultOccured == true ) {
+ if ( qName.toLowerCase().equals("faultcode") ) {
+ faultCode = value;
+ }
+
+ if ( qName.toLowerCase().equals("faultstring") ) {
+ faultString = value;
+ }
+ return;
+ }
+
+ if ( ( (returnCategory == Constants.TYPE_SIMPLE) && (stack.size() == 4) )
+ || ( (returnCategory == Constants.TYPE_DOCLIT) && (stack.size() >= 4) )
+ || ( stack.size() >= 5 ) ) {
+ param.decode(uri,localName,qName,attributes,value);
+ }
+ }
+
+ /**
+ * Receive notification of the end of the document.
+ *
+ * <p>this method is to take specific actions at the end
+ * of a document (such as finalising a tree or closing an output
+ * file).</p>
+ *
+ * @exception org.xml.sax.SAXException Any SAX exception, possibly
+ * wrapping another exception.
+ * @see org.xml.sax.helpers.DefaultHandler#endElement
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ isStart = false;
+
+ if ( !stack.peek().toString().equals(qName) ) {
+ throw new SAXException("Start tag " + stack.peek().toString() + " \ndoesn't match with end tag \n"+ qName);
+ }
+
+ if ( ( bodyEnvelope == 1 ) && ( qName.toLowerCase().endsWith("header") ) ) {
+ processSoapHeader = false;
+ stack.pop();
+ return;
+ }
+
+ if ( ( processSoapHeader == true ) || ( faultOccured == true ) ) {
+ stack.pop();
+ return;
+ }
+
+ if ( qName.toLowerCase().equals("item") ) { //Check for "Item" tag and return if it exists
+ stack.pop();
+ return;
+ }
+
+ if ( returnCategory == Constants.TYPE_ARRAY ) {
+ if( stack.size() >= 5){
+ param.endElement(uri,localName,qName);
+ }
+
+ if(qName.toLowerCase().endsWith("body")){
+ param.createArray();
+ }
+ } else if ( (returnCategory != Constants.TYPE_DOCLIT) && (stack.size() >= 5) ) {
+ param.endElement(uri,localName,qName);
+ }
+
+ stack.pop();
+ if ( !qName.toLowerCase().endsWith("envelope") ) {
+ this.qName=stack.peek().toString();
+ }
+ }
+
+ /**
+ * Return the InOutParameter object as the result object
+ * @return param
+ */
+ public InOutParameter getParam() throws MIRAEException{
+ return param;
+ }
+
+ /**
+ * It is the fault string got from the SOAP fault
+ * @return faultString
+ */
+ public String getFaultString() throws MIRAEException{
+ return faultString;
+ }
+
+ /**
+ * It is the fault code got from the SOAP fault
+ * @return faultCode
+ */
+ public String getFaultCode() throws MIRAEException{
+ return faultCode;
+ }
+
+}
Added: webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Encoder.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Encoder.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Encoder.java (added)
+++ webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/Encoder.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.mirae.xml.rpc;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.rpc.NamespaceConstants;
+
+/**
+ * <code>Encoder</code> This Class has the serialize method to serialize the
+ * SOAP request into the Output Stream.
+ *
+ * @author kurinchikumaran(kurinchikumaran@hsenid.lk)
+ *
+ */
+public class Encoder {
+
+ /**
+ * This method is for serializing SOAP request While serializing the SOAP
+ * body the serialize method of the input parameter are called.
+ *
+ * @throws IOException
+ * @throws Exception
+ */
+ public static void serialize(QName methodName, InputParameterInfo[] inInfo,
+ String style, OutputStream outputStream) throws IOException, Exception {
+
+ StringBuffer buffar = new StringBuffer();
+
+ buffar.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+
+ buffar.append("<" + NamespaceConstants.NSPREFIX_SOAP_ENVELOPE
+ + ":Envelope");
+ buffar.append(" xmlns:" + NamespaceConstants.NSPREFIX_SOAP_ENVELOPE
+ + "=\"" + NamespaceConstants.NSURI_SOAP_ENVELOPE + "\"");
+ buffar.append(" xmlns:" + NamespaceConstants.NSPREFIX_SCHEMA_XSD
+ + "=\"" + NamespaceConstants.NSURI_SCHEMA_XSD + "\"");
+ buffar.append(" xmlns:" + NamespaceConstants.NSPREFIX_SCHEMA_XSI
+ + "=\"" + NamespaceConstants.NSURI_SCHEMA_XSI + "\">\n");
+ buffar.append("<" + NamespaceConstants.NSPREFIX_SOAP_ENVELOPE
+ + ":Body>\n");
+
+ if ( methodName.getNamespaceURI() != null ) {
+ buffar.append("<" + methodName.getLocalPart()
+ + " xmlns:" + NamespaceConstants.NSPREFIX_SOAP_ENCODING + "=\""
+ + NamespaceConstants.NSURI_SOAP_ENCODING
+ + "\" xmlns=\"" + methodName.getNamespaceURI() + "\">\n");
+ } else {
+ buffar.append("<" + methodName.getLocalPart()
+ + " xmlns:"+NamespaceConstants.NSPREFIX_SOAP_ENCODING + "=\""
+ + NamespaceConstants.NSURI_SOAP_ENCODING + "\">\n");
+ }
+
+ for (int i = 0; i < inInfo.length; i++) {
+ inInfo[i].serialize(style, buffar);
+ }
+
+ buffar.append("</" + methodName.getLocalPart() + ">\n");
+ buffar.append("</" + NamespaceConstants.NSPREFIX_SOAP_ENVELOPE
+ + ":Body>\n");
+ buffar.append("</" + NamespaceConstants.NSPREFIX_SOAP_ENVELOPE
+ + ":Envelope>\n");
+
+ byte[] subBuf = buffar.toString().getBytes();
+ outputStream.write(subBuf);
+ buffar.delete(0, buffar.length() - 1);
+ }
+
+}
\ No newline at end of file
Added: webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InOutParameter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InOutParameter.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InOutParameter.java (added)
+++ webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InOutParameter.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,85 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.xml.rpc;
+
+import java.io.IOException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+/**
+ * This type represent a parameters that can used as the Input and Output
+ * Parameters. WSDL2Ws_J2ME tool generate that types of parameters.
+ *
+ * @author kurinchikumaran(kurinchikumaran@hsenid.lk)
+ */
+
+public interface InOutParameter {
+
+ /**
+ * Serialize the input parameter
+ *
+ * @param context
+ * @throws IOException
+ * @throws Exception
+ */
+ public void serialize(StringBuffer context) throws IOException, Exception;
+
+ /**
+ * Deserialize the soap message into the inout parameter object
+ *
+ * @param uri
+ * @param localname
+ * @param qName
+ * @param attributes
+ * @param value
+ * @throws SAXException
+ */
+ public void decode(String uri, String localName, String qName,
+ Attributes attributes, String value) throws SAXException;
+
+ /**
+ * This method is not be used by the inout parameter
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @param attributes
+ * @throws SAXException
+ */
+ public void startElement(String uri, String localName, String qName,
+ Attributes attributes) throws SAXException;
+
+ /**
+ * This method is called when an end tag is found in the soap response
+ *
+ * @param uri
+ * @param localName
+ * @param qName
+ * @throws SAXException
+ */
+ public void endElement(String uri, String localName, String qName)
+ throws SAXException;
+
+ /**
+ * If the inout parameter holds array object, this method is called to
+ * create the array object
+ *
+ * @throws SAXException
+ */
+ public void createArray() throws SAXException;
+}
\ No newline at end of file
Added: webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InputParameterInfo.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InputParameterInfo.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InputParameterInfo.java (added)
+++ webservices/mirae/trunk/src/mirae/jaxrpc/org/apache/mirae/xml/rpc/InputParameterInfo.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,92 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.xml.rpc;
+
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+import org.apache.mirae.util.Constants;
+import org.apache.mirae.util.MIRAEException;
+
+
+/**
+ * <code>InputParameterInfo</code> Input parameters are hold as the instance
+ * of this class.
+ *
+ * @author kurinchikumaran(kurinchikumaran@hsenid.lk)
+ */
+public class InputParameterInfo {
+
+ /** Input parameter */
+ private InOutParameter param;
+
+ /** Name of the input parameter */
+ private String parameterName;
+
+ /** QName of the input parameter */
+ private QName qname;
+
+ /** Style of the SOAP request (RPC | DOCUMENT) */
+ private String style;
+
+ /**
+ * Constructor for initiate the input parameter
+ *
+ * @param parameterName
+ * @param outparam
+ * @param qname
+ * @param parameterMode
+ * @throws MIRAEException
+ */
+ public InputParameterInfo(InOutParameter param, String parameterName,
+ QName qname) throws MIRAEException {
+ this.param = param;
+ this.parameterName = parameterName;
+ this.qname = qname;
+ }
+
+ /**
+ * Method for serialize the details about the input parameter
+ * <p>
+ * Used by RPC only.
+ *
+ * @param style
+ * @param sc
+ * @throws IOException
+ * @throws Exception
+ */
+ public void serialize(String style, StringBuffer sb) throws IOException,
+ Exception {
+
+ if (style == Constants.STYLE_RPC) {
+ if (qname.getNamespaceURI().equals(
+ "http://www.w3.org/2001/XMLSchema"))
+ sb.append("<" + parameterName + " xsi:type=\"xsd:"
+ + qname.getLocalPart() + "\">");
+ else
+ sb.append("<" + parameterName + ">\n");
+
+ param.serialize(sb);
+ sb.append("</" + parameterName + ">\n");
+ } else {
+ param.serialize(sb);
+ }
+ }
+
+}
\ No newline at end of file
Added: webservices/mirae/trunk/src/tools/simpletypes/Base64ByteArrayParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/Base64ByteArrayParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/Base64ByteArrayParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/Base64ByteArrayParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+import com.sun.midp.io.Base64;
+
+public class Base64ByteArrayParam implements InOutParameter {
+ public byte[] param;
+
+ public Base64ByteArrayParam() {
+
+ }
+
+ public Base64ByteArrayParam(Base64ByteArrayParam thisVal) {
+ this.param = thisVal.param;
+ }
+
+ public Base64ByteArrayParam(String value) throws Exception {
+ this.param = (value == null) ? new byte[0] : value.getBytes();
+ }
+
+ public Base64ByteArrayParam(byte[] param) {
+ this.param = param;
+ }
+
+ public String getAsJavaEncodedString() throws IOException {
+ return new String(Base64.decode(new String(param)));
+ }
+
+ public byte[] getAsBase64Encoded() {
+ return this.param;
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException, Exception {
+
+ buffer.append(new String(param));
+
+ }
+
+ /**
+ * @return
+ */
+ public Base64ByteArrayParam getParam() {
+ return this;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ this.param = (value == null) ? new byte[0] : value.getBytes();
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return new String(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/Base64ByteArrayParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/BooleanParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/BooleanParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/BooleanParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/BooleanParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class BooleanParam implements InOutParameter {
+ public boolean param;
+
+ public BooleanParam() {
+ }
+
+ public BooleanParam(String value) throws SAXException {
+ if (value != null)
+ this.param = value.equals("true")?true:false;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ if (value != null)
+ this.param = value.equals("true")?true:false;
+ }
+
+
+
+ public BooleanParam(boolean param) {
+ this.param = param;
+ }
+
+ public BooleanParam(Boolean param) {
+ this.param = param.booleanValue();
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+
+ buffer.append(String.valueOf(param));
+
+ }
+
+ /**
+ * @return
+ */
+ public boolean getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return String.valueOf(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/ByteArrayParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/ByteArrayParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/ByteArrayParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/ByteArrayParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ByteArrayParam implements InOutParameter {
+ public byte[] param;
+
+ public ByteArrayParam() {
+ }
+
+ public ByteArrayParam(String value) throws Exception {
+ this.param = (value != null) ? value.getBytes() : new byte[]{};
+
+ }
+
+ public ByteArrayParam(byte[] param) {
+ this.param = param;
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException, Exception {
+ buffer.append(new String(param));
+ }
+
+ /**
+ * @return
+ */
+ public byte[] getParam() {
+ return this.param;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.param = (value != null) ? value.getBytes() : new byte[]{};
+
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return new String(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/ByteArrayParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/ByteParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/ByteParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/ByteParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/ByteParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ByteParam implements InOutParameter {
+ public byte param;
+
+ public ByteParam() {
+ }
+
+ public ByteParam(String value) {
+ if (value != null)
+ this.param = Byte.parseByte(value);
+ }
+
+ public ByteParam(byte param) {
+ this.param = param;
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException, Exception {
+
+
+ String st = "" + param;
+ buffer.append(st.trim());
+
+ }
+
+ /**
+ * @return
+ */
+ public byte getParam() {
+ return param;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = Byte.parseByte(value);
+
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ String st = "" + param;
+ return st.trim();
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/ByteParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/CharParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/CharParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/CharParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/CharParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class CharParam implements InOutParameter {
+ public char param;
+
+ public CharParam() {
+ }
+
+ public CharParam(String value) throws Exception {
+ if (value != null)
+ this.param = value.charAt(0);
+ }
+
+ public CharParam(char param) {
+ this.param = param;
+ }
+
+ public CharParam(Character param) {
+ this.param = param.charValue();
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = value.charAt(0);
+
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException, Exception{
+
+ buffer.append(new char[]{param}, 1, 1);
+
+ }
+ public char getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/CharParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/DateParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/DateParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/DateParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/DateParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,79 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+
+import java.io.IOException;
+import java.util.Date;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class DateParam implements InOutParameter {
+ private Date param;
+
+ public DateParam() {
+ }
+ public DateParam(String value) {
+ param =new Date(Long.parseLong(value));
+ }
+ public DateParam(long value) {
+ param = new Date(value);
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+
+ buffer.append(param.toString());
+
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ // format should be yyyy-mm-dd
+ param =new Date(Long.parseLong(value));
+
+ }
+ public String toString() {
+ return this.param.toString();
+ }
+ public Date getParam() {
+ return this.param;
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/DayParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/DayParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/DayParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/DayParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,146 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class DayParam implements InOutParameter {
+ private int day;
+ private String timezone = null;
+ private String param;
+
+ public DayParam() {
+ }
+
+ public DayParam(String source) {
+ this.setSource(source);
+ }
+ public DayParam(int day, String timeZone) {
+ this.setDay(day);
+ this.setTimezone(timeZone);
+ }
+ public void setSource(String source) throws NumberFormatException {
+ if (source.length() < 5) {
+ throw new NumberFormatException("wrong format");
+ }
+
+ if (source.charAt(0) != '-' || source.charAt(1) != '-'
+ || source.charAt(2) != '-') {
+ throw new NumberFormatException("wrong format");
+ }
+
+ setValue(Integer.parseInt(source.substring(3, 5)), source.substring(5));
+ }
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.setSource(value);
+ this.param = this.toString();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.wsmobile.encoding.Parameter#serialize(org.apache.axis.encoding.SerializationContext)
+ * @see <a href="http://www.w3.org/TR/xmlschema-2/#gDay">XML Schema 3.2.13
+ * </a>
+ */
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+ public void setDay(int day) {
+ // validate day
+ if (day < 1 || day > 31) {
+ throw new NumberFormatException("wrong format");
+ }
+ this.day = day;
+ }
+
+ public void setTimezone(String timezone) {
+ // validate timezone
+ if (timezone != null && timezone.length() > 0) {
+ // Format [+/-]HH:MM
+ if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) {
+ if (timezone.length() != 6
+ || !Character.isDigit(timezone.charAt(1))
+ || !Character.isDigit(timezone.charAt(2))
+ || timezone.charAt(3) != ':'
+ || !Character.isDigit(timezone.charAt(4))
+ || !Character.isDigit(timezone.charAt(5)))
+ throw new NumberFormatException("badformat");
+
+ } else if (!timezone.equals("Z")) {
+ throw new NumberFormatException("wrong format");
+ }
+ // if we got this far, its good
+ this.timezone = timezone;
+ }
+ }
+
+ public void setValue(int day, String timezone) throws NumberFormatException {
+ setDay(day);
+ setTimezone(timezone);
+ }
+ public String toString() {
+
+ String s = "---" + day;
+
+ // timezone
+ if (timezone != null) {
+ s = s + timezone;
+ }
+ return s;
+ }
+
+ public DayParam getParam() {
+ return this;
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/DayParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/DoubleParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/DoubleParam.java?view=auto&rev=151149
==============================================================================
(empty)
Added: webservices/mirae/trunk/src/tools/simpletypes/FloatParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/FloatParam.java?view=auto&rev=151149
==============================================================================
(empty)
Added: webservices/mirae/trunk/src/tools/simpletypes/HexBinaryParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/HexBinaryParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/HexBinaryParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/HexBinaryParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,247 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class HexBinaryParam implements InOutParameter{
+
+
+ private byte[] param = null;
+
+ public HexBinaryParam() {
+ }
+
+ public HexBinaryParam(HexBinaryParam in) {
+ this.param = in.param;
+ }
+
+ public HexBinaryParam(String string){
+ param = decode(string);
+ }
+
+ public HexBinaryParam(byte[] bytes){
+ param = bytes;
+ }
+ /* (non-Javadoc)
+ * @see org.apache.wsmobile.encoding.InOutParameter#desierialize(org.apache.wsmobile.MessageData)
+ */
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.param=decode(value);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wsmobile.encoding.Parameter#serialize(org.apache.axis.encoding.SerializationContext)
+ */
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+ public byte[] getBytes(){
+ return param;
+ }
+
+
+
+ public static final String ERROR_ODD_NUMBER_OF_DIGITS
+ ="ERROR_ODD_NUMBER_OF_DIGITS";
+ public static final String ERROR_BAD_CHARACTER_IN_HEX_STRING
+ ="ERROR_BAD_CHARACTER_IN_HEX_STRING";
+
+ // Code from Ajp11, from Apache's JServ
+
+ // Table for HEX to DEC byte translation
+ public static final int[] DEC = {
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 00, 01, 02, 03, 04, 05, 06, 07, 8, 9, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ };
+
+ /**
+ * Convert a String of hexadecimal digits into the corresponding
+ * byte array by encoding each two hexadecimal digits as a byte.
+ *
+ * @param digits Hexadecimal digits representation
+ *
+ * @exception IllegalArgumentException if an invalid hexadecimal digit
+ * is found, or the input string contains an odd number of hexadecimal
+ * digits
+ */
+ public static byte[] decode(String digits) {
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ for (int i = 0; i < digits.length(); i += 2) {
+ char c1 = digits.charAt(i);
+ if ((i+1) >= digits.length())
+ throw new IllegalArgumentException
+ (ERROR_ODD_NUMBER_OF_DIGITS);
+ char c2 = digits.charAt(i + 1);
+ byte b = 0;
+ if ((c1 >= '0') && (c1 <= '9'))
+ b += ((c1 - '0') * 16);
+ else if ((c1 >= 'a') && (c1 <= 'f'))
+ b += ((c1 - 'a' + 10) * 16);
+ else if ((c1 >= 'A') && (c1 <= 'F'))
+ b += ((c1 - 'A' + 10) * 16);
+ else
+ throw new IllegalArgumentException
+ (ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ if ((c2 >= '0') && (c2 <= '9'))
+ b += (c2 - '0');
+ else if ((c2 >= 'a') && (c2 <= 'f'))
+ b += (c2 - 'a' + 10);
+ else if ((c2 >= 'A') && (c2 <= 'F'))
+ b += (c2 - 'A' + 10);
+ else
+ throw new IllegalArgumentException
+ (ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ baos.write(b);
+ }
+ return (baos.toByteArray());
+
+ }
+
+
+ /**
+ * Convert a byte array into a printable format containing a
+ * String of hexadecimal digit characters (two per byte).
+ *
+ * @param bytes Byte array representation
+ */
+ public static String encode(byte bytes[]) {
+
+ StringBuffer sb = new StringBuffer(bytes.length * 2);
+ for (int i = 0; i < bytes.length; i++) {
+ sb.append(convertDigit((int) (bytes[i] >> 4)));
+ sb.append(convertDigit((int) (bytes[i] & 0x0f)));
+ }
+ return (sb.toString());
+
+ }
+
+ /**
+ * Convert 4 hex digits to an int, and return the number of converted
+ * bytes.
+ *
+ * @param hex Byte array containing exactly four hexadecimal digits
+ *
+ * @exception IllegalArgumentException if an invalid hexadecimal digit
+ * is included
+ */
+ public static int convert2Int( byte[] hex ) {
+ // Code from Ajp11, from Apache's JServ
+
+ // assert b.length==4
+ // assert valid data
+ int len;
+ if(hex.length < 4 ) return 0;
+ if( DEC[hex[0]]<0 )
+ throw new IllegalArgumentException(ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ len = DEC[hex[0]];
+ len = len << 4;
+ if( DEC[hex[1]]<0 )
+ throw new IllegalArgumentException(ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ len += DEC[hex[1]];
+ len = len << 4;
+ if( DEC[hex[2]]<0 )
+ throw new IllegalArgumentException(ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ len += DEC[hex[2]];
+ len = len << 4;
+ if( DEC[hex[3]]<0 )
+ throw new IllegalArgumentException(ERROR_BAD_CHARACTER_IN_HEX_STRING);
+ len += DEC[hex[3]];
+ return len;
+ }
+
+ /**
+ * [Private] Convert the specified value (0 .. 15) to the corresponding
+ * hexadecimal digit.
+ *
+ * @param value Value to be converted
+ */
+ private static char convertDigit(int value) {
+
+ value &= 0x0f;
+ if (value >= 10)
+ return ((char) (value - 10 + 'a'));
+ else
+ return ((char) (value + '0'));
+
+ }
+ public HexBinaryParam getParam(){
+ return this;
+ }
+ public int getIntParam(){
+ return convert2Int(param);
+ }
+
+
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return encode(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/HexBinaryParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/IntParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/IntParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/IntParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/IntParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,93 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class IntParam implements InOutParameter {
+ private int param;
+
+ public IntParam() {
+ }
+
+ public IntParam(String value) {
+ if (value != null)
+ this.param = Integer.parseInt(value.trim());
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ if (value != null)
+ this.param = Integer.parseInt(value.trim());
+ System.out.println(param);
+ }
+
+ public IntParam(int param) {
+ this.param = param;
+ }
+
+ public IntParam(Integer param) {
+ this.param = param.intValue();
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException,Exception {
+ buffer.append(Integer.toString(param));
+
+ }
+
+ /**
+ * @return
+ */
+ public int getParam() {
+ return param;
+ }
+
+ public String toString() {
+ return Integer.toString(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/LongParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/LongParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/LongParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/LongParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,86 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class LongParam implements InOutParameter {
+ private long param;
+ public LongParam(){}
+ public LongParam(String value) throws Exception {
+ if (value != null)
+ this.param = Long.parseLong(value);
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = Long.parseLong(value);
+
+ }
+
+ public LongParam(long param) {
+ this.param = param;
+ }
+
+ public LongParam(Long param) {
+ this.param = param.longValue();
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+ public long getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return String.valueOf(param);
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/LongParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/MonthDayParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/MonthDayParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/MonthDayParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/MonthDayParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class MonthDayParam implements InOutParameter {
+ private int month;
+ private int day;
+ private String timezone = null;
+ private String param;
+
+ public MonthDayParam() {
+ }
+ /**
+ * Constructs a MonthDay with the given values No timezone is specified
+ */
+
+ public MonthDayParam(int month, int day) throws NumberFormatException {
+ setValue(month, day);
+ }
+
+ /**
+ * Constructs a MonthDay with the given values, including a timezone string
+ * The timezone is validated but not used.
+ */
+ public MonthDayParam(int month, int day, String timezone)
+ throws NumberFormatException {
+ setValue(month, day, timezone);
+ }
+
+ /**
+ * Construct a MonthDay from a String in the format --MM-DD[timezone]
+ */
+ public MonthDayParam(String source) {
+ this.setSource(source);
+ }
+ public void setSource(String source) throws NumberFormatException {
+ if (source.length() < 6) {
+ throw new NumberFormatException("badformat");
+ }
+
+ if (source.charAt(0) != '-' || source.charAt(1) != '-'
+ || source.charAt(4) != '-') {
+ throw new NumberFormatException("badMonthDay00");
+ }
+
+ setValue(Integer.parseInt(source.substring(2, 4)), Integer
+ .parseInt(source.substring(5, 7)), source.substring(7));
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.setSource(value);
+ this.param = this.toString();
+
+ }
+
+ public void setMonth(int month) {
+ // validate month
+ if (month < 1 || month > 12) {
+ throw new NumberFormatException("badformat");
+ }
+ this.month = month;
+ }
+
+ /**
+ * Set the day NOTE: if the month isn't set yet, the day isn't validated
+ */
+ public void setDay(int day) {
+ // validate day
+ if (day < 1 || day > 31) {
+ throw new NumberFormatException("badformat");
+ }
+ // 30 days has September... All the rest have 31 (except Feb!)
+ // NOTE: if month isn't set, we don't validate day.
+ if ((month == 2 && day > 29)
+ || ((month == 9 || month == 4 || month == 6 || month == 11) && day > 30)) {
+ throw new NumberFormatException("badformat");
+ }
+ this.day = day;
+ }
+
+ public void setTimezone(String timezone) {
+ // validate timezone
+ if (timezone != null && timezone.length() > 0) {
+ // Format [+/-]HH:MM
+ if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) {
+ if (timezone.length() != 6
+ || !Character.isDigit(timezone.charAt(1))
+ || !Character.isDigit(timezone.charAt(2))
+ || timezone.charAt(3) != ':'
+ || !Character.isDigit(timezone.charAt(4))
+ || !Character.isDigit(timezone.charAt(5)))
+ throw new NumberFormatException("badformat");
+
+ } else if (!timezone.equals("Z")) {
+ throw new NumberFormatException("badTimezone");
+ }
+ // if we got this far, its good
+ this.timezone = timezone;
+ }
+ }
+
+ public void setValue(int month, int day, String timezone)
+ throws NumberFormatException {
+ setMonth(month);
+ setDay(day);
+ setTimezone(timezone);
+ }
+
+ public void setValue(int month, int day) throws NumberFormatException {
+ setMonth(month);
+ setDay(day);
+ }
+
+ public String toString() {
+
+ String s = "--" + month + "-" + day;
+
+ // timezone
+ if (timezone != null) {
+ s = s + timezone;
+ }
+ return s;
+ }
+
+ public MonthDayParam getParam() {
+ return this;
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/MonthDayParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/MonthParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/MonthParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/MonthParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/MonthParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,164 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class MonthParam implements InOutParameter {
+ private int month;
+ private String timezone = null;
+ private String param;
+
+ public MonthParam() {
+ }
+
+ public MonthParam(int month) throws NumberFormatException {
+ setValue(month);
+ }
+
+ /**
+ * Constructs a Month with the given values, including a timezone string
+ * The timezone is validated but not used.
+ */
+ public MonthParam(int month, String timezone) throws NumberFormatException {
+ setValue(month, timezone);
+ }
+
+ /**
+ * Construct a Month from a String in the format --MM--[timezone]
+ */
+ public MonthParam(String source) {
+ this.setSource(source);
+ }
+
+ public void setSource(String source) throws NumberFormatException {
+ if (source.length() < (6)) {
+ throw new NumberFormatException("wrong format");
+ }
+
+ if (source.charAt(0) != '-'
+ || source.charAt(1) != '-'
+ || source.charAt(4) != '-'
+ || source.charAt(5) != '-') {
+ throw new NumberFormatException("wrong format");
+ }
+
+ setValue(Integer.parseInt(source.substring(2, 4)), source.substring(6));
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wsmobile.encoding.InOutParameter#desierialize(org.apache.wsmobile.MessageData)
+ */
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.setSource(value);
+ this.param = this.toString();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.apache.wsmobile.encoding.Parameter#serialize(org.apache.axis.encoding.SerializationContext)
+ */
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+
+ public void setMonth(int month) {
+ // validate month
+ if (month < 1 || month > 12) {
+ throw new NumberFormatException("wrong format");
+ }
+ this.month = month;
+ }
+
+ public void setTimezone(String timezone) {
+ // validate timezone
+ if (timezone != null && timezone.length() > 0) {
+ // Format [+/-]HH:MM
+ if (timezone.charAt(0) == '+' || (timezone.charAt(0) == '-')) {
+ if (timezone.length() != 6
+ || !Character.isDigit(timezone.charAt(1))
+ || !Character.isDigit(timezone.charAt(2))
+ || timezone.charAt(3) != ':'
+ || !Character.isDigit(timezone.charAt(4))
+ || !Character.isDigit(timezone.charAt(5)))
+ throw new NumberFormatException("wrong format");
+
+ } else if (!timezone.equals("Z")) {
+ throw new NumberFormatException("wrong format");
+ }
+ // if we got this far, its good
+ this.timezone = timezone;
+ }
+ }
+
+ public void setValue(int month, String timezone) throws NumberFormatException {
+ setMonth(month);
+ setTimezone(timezone);
+ }
+
+ public void setValue(int month) throws NumberFormatException {
+ setMonth(month);
+ }
+ public String toString() {
+ // month
+ String s = "--" + month + "--";
+
+ // timezone
+ if (timezone != null) {
+ s = s + timezone;
+ }
+ return s;
+ }
+
+ public MonthParam getParam() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/MonthParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/QNameParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/QNameParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/QNameParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/QNameParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+import javax.xml.namespace.QName;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class QNameParam implements InOutParameter {
+
+ private QName param;
+
+ public QNameParam() {
+ }
+
+ public QNameParam(String localPart) {
+ param = new QName(localPart);
+ }
+ /**
+ * Constructor for the QName.
+ *
+ * @param namespaceURI Namespace URI for the QName
+ * @param localPart Local part of the QName.
+ */
+ public QNameParam(String namespaceURI, String localPart) {
+ param = new QName(namespaceURI, localPart);
+
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ this.param = setSource(value);
+
+ }
+
+ /**
+ * Returns a string representation of this QName
+ *
+ * @return a string representation of the QName
+ */
+ public String toString() {
+ return param.toString();
+
+ }
+
+ public QName setSource(String s) {
+ if ((s == null) || s.equals("")) {
+ throw new IllegalArgumentException("invalid QName literal");
+ }
+
+ if (s.charAt(0) == '{') {
+ int i = s.indexOf('}');
+
+ if (i == -1) {
+ throw new IllegalArgumentException("invalid QName literal");
+ }
+
+ if (i == s.length() - 1) {
+ throw new IllegalArgumentException("invalid QName literal");
+ } else {
+ return new QName(s.substring(1, i), s.substring(i + 1));
+ }
+ } else {
+ return new QName(s);
+ }
+ }
+
+ public QNameParam getParam() {
+ return this;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Propchange: webservices/mirae/trunk/src/tools/simpletypes/QNameParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/ShortParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/ShortParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/ShortParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/ShortParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class ShortParam implements InOutParameter {
+ public short param;
+ public ShortParam() {
+ }
+
+ public ShortParam(String value) throws Exception {
+
+ if (value != null)
+ this.param = Short.parseShort(value);
+ }
+
+ public ShortParam(short param) {
+ this.param = param;
+ }
+
+ public ShortParam(Short param) {
+ this.param = param.shortValue();
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+
+ if (value != null)
+ this.param = Short.parseShort(value);
+
+ }
+
+ public short getParam() {
+ return param;
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException,Exception{
+
+
+ String st = "" + param;
+ buffer.append(st.trim());
+
+ }
+
+ public String toString() {
+ String st = "" + param;
+ return st.trim();
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/ShortParam.java
------------------------------------------------------------------------------
svn:executable = *
Added: webservices/mirae/trunk/src/tools/simpletypes/StringParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/StringParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/StringParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/StringParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,82 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+
+public class StringParam implements InOutParameter {
+ public String param;
+
+ public StringParam() {
+ }
+
+ public StringParam(String param) {
+ this.param = param;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ this.param=value;
+ }
+
+ public void serialize(StringBuffer buffer) throws IOException,Exception {
+
+ buffer.append(param);
+
+ }
+
+ public String getParam() {
+ return param;
+ }
+
+ public String toString() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapBooleanParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapBooleanParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapBooleanParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapBooleanParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapBooleanParam implements InOutParameter {
+ public Boolean param;
+
+ public WrapBooleanParam() {
+ }
+
+ public WrapBooleanParam(String value){
+ if (value != null){
+ boolean tempParam= value.equals("true")?true:false;
+ this.param = new Boolean(tempParam);
+ }
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ if (value != null){
+ boolean tempParam= value.equals("true")?true:false;
+ this.param = new Boolean(tempParam);
+ }
+ }
+
+ public WrapBooleanParam(Boolean param) {
+ this.param = param;
+ }
+
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+
+ buffer.append(String.valueOf(param));
+ }
+
+ /**
+ * @return
+ */
+ public Boolean getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return String.valueOf(param);
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapByteParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapByteParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapByteParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapByteParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,91 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.mirae.builtin.simpletypes;
+
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapByteParam implements InOutParameter {
+ public Byte param;
+
+ public WrapByteParam() {
+ }
+
+ public WrapByteParam(String value){
+ if (value != null)
+ this.param = new Byte(Byte.parseByte(value));
+ }
+
+ public WrapByteParam(Byte param) {
+ this.param = param;
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+
+ buffer.append(Byte.parseByte(param.toString()));
+
+ }
+
+ /**
+ * @return
+ */
+ public Byte getParam() {
+ return param;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ if (value != null)
+ this.param = new Byte(Byte.parseByte(value));
+
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return param.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+}
Added: webservices/mirae/trunk/src/tools/simpletypes/WrapCharParam.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/tools/simpletypes/WrapCharParam.java?view=auto&rev=151149
==============================================================================
--- webservices/mirae/trunk/src/tools/simpletypes/WrapCharParam.java (added)
+++ webservices/mirae/trunk/src/tools/simpletypes/WrapCharParam.java Thu Feb 3 04:39:48 2005
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.mirae.builtin.simpletypes;
+
+import java.io.IOException;
+
+
+import org.apache.mirae.xml.rpc.InOutParameter;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+public class WrapCharParam implements InOutParameter {
+ public Character param;
+
+ public WrapCharParam() {
+ }
+
+ public WrapCharParam(String value) throws Exception {
+ if (value != null)
+ this.param = new Character(value.charAt(0));
+
+ }
+
+ public WrapCharParam(Character param) {
+ this.param = param;
+ }
+
+ public void decode(String uri, String localName, String qName, Attributes attributes, String value)throws SAXException {
+ if (value != null)
+ this.param = new Character(value.charAt(0));
+
+ }
+
+ public void serialize(StringBuffer buffer)throws IOException,Exception {
+ buffer.append(param);
+ }
+
+
+ public Character getParam() {
+ return param;
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
+ */
+ public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#endElement(java.lang.String, java.lang.String, java.lang.String)
+ */
+ public void endElement(String uri, String localName, String qName) throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see j2me.xml.rpc.InOutParameter#createArray()
+ */
+ public void createArray() throws SAXException {
+ // TODO Auto-generated method stub
+
+ }
+
+
+}
\ No newline at end of file
Propchange: webservices/mirae/trunk/src/tools/simpletypes/WrapCharParam.java
------------------------------------------------------------------------------
svn:executable = *