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 ia...@apache.org on 2005/08/12 12:09:04 UTC

svn commit: r232254 [1/2] - in /webservices/mirae/trunk/src/mirae/ws: ./ java/ java/rmi/ javax/ javax/microedition/ javax/microedition/xml/ javax/microedition/xml/rpc/ javax/xml/ javax/xml/namespace/ javax/xml/rpc/ org/ org/apache/ org/apache/mirae/ or...

Author: ias
Date: Fri Aug 12 03:08:51 2005
New Revision: 232254

URL: http://svn.apache.org/viewcvs?rev=232254&view=rev
Log:
Initial drop of Mirae WS.

Added:
    webservices/mirae/trunk/src/mirae/ws/
    webservices/mirae/trunk/src/mirae/ws/java/
    webservices/mirae/trunk/src/mirae/ws/java/rmi/
    webservices/mirae/trunk/src/mirae/ws/java/rmi/MarshalException.java
    webservices/mirae/trunk/src/mirae/ws/java/rmi/Remote.java
    webservices/mirae/trunk/src/mirae/ws/java/rmi/RemoteException.java
    webservices/mirae/trunk/src/mirae/ws/java/rmi/ServerException.java
    webservices/mirae/trunk/src/mirae/ws/javax/
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/ComplexType.java
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Element.java
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailException.java
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailHandler.java
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Operation.java
    webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Type.java
    webservices/mirae/trunk/src/mirae/ws/javax/xml/
    webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/
    webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/QName.java
    webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/
    webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/JAXRPCException.java
    webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/NamespaceConstants.java
    webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/Stub.java
    webservices/mirae/trunk/src/mirae/ws/org/
    webservices/mirae/trunk/src/mirae/ws/org/apache/
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringReader.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringWriter.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/AsyncHandler.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/Dispatch.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/MailAgent.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/OperationMail.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/OperationStax.java
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/util/
    webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/util/Base64.java

Added: webservices/mirae/trunk/src/mirae/ws/java/rmi/MarshalException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/java/rmi/MarshalException.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/java/rmi/MarshalException.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/java/rmi/MarshalException.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005 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 java.rmi;
+
+/**
+ * A <code>MarshalException</code> is thrown if a
+ * <code>java.io.IOException</code> occurs while marshalling the remote call
+ * header, arguments or return value for a remote method call.  A
+ * <code>MarshalException</code> is also thrown if the receiver does not
+ * support the protocol version of the sender.
+ *
+ * <p>If a <code>MarshalException</code> occurs during a remote method call,
+ * the call may or may not have reached the server.  If the call did reach the
+ * server, parameters may have been deserialized.  A call may not be
+ * retransmitted after a <code>MarshalException</code> and reliably preserve
+ * "at most once" call semantics.
+ * 
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class MarshalException extends RemoteException {
+
+    /**
+     * Constructs a <code>MarshalException</code> with the specified
+     * detail message.
+     *
+     * @param s the detail message
+     */
+    public MarshalException(String s) {
+	super(s);
+    }
+
+    /**
+     * Constructs a <code>MarshalException</code> with the specified
+     * detail message and nested exception.
+     *
+     * @param s the detail message
+     * @param ex the nested exception
+     */
+    public MarshalException(String s, Exception ex) {
+	super(s, ex);
+    }
+}

Added: webservices/mirae/trunk/src/mirae/ws/java/rmi/Remote.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/java/rmi/Remote.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/java/rmi/Remote.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/java/rmi/Remote.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2005 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 java.rmi;
+
+/** 
+ * The <code>Remote</code> interface serves to identify interfaces whose
+ * methods may be invoked from a non-local virtual machine.  Any object that
+ * is a remote object must directly or indirectly implement this interface.
+ * Only those methods specified in a "remote interface", an interface that
+ * extends <code>java.rmi.Remote</code> are available remotely.
+ *
+ * <p>Implementation classes can implement any number of remote interfaces and
+ * can extend other remote implementation classes.  RMI provides some
+ * convenience classes that remote object implementations can extend which
+ * facilitate remote object creation.  These classes are
+ * <code>java.rmi.server.UnicastRemoteObject</code> and
+ * <code>java.rmi.activation.Activatable</code>.
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public interface Remote {}

Added: webservices/mirae/trunk/src/mirae/ws/java/rmi/RemoteException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/java/rmi/RemoteException.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/java/rmi/RemoteException.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/java/rmi/RemoteException.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2005 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 java.rmi;
+
+/**
+ * A <code>RemoteException</code> is the common superclass for a number of
+ * communication-related exceptions that may occur during the execution of a
+ * remote method call.  Each method of a remote interface, an interface that
+ * extends <code>java.rmi.Remote</code>, must list
+ * <code>RemoteException</code> in its throws clause.
+ * 
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class RemoteException extends java.io.IOException {
+
+    /**
+     * Nested Exception to hold wrapped remote exception.
+     */
+    public Throwable detail;
+
+    /**
+     * Constructs a <code>RemoteException</code> with no specified
+     * detail message.
+     */
+    public RemoteException() {}
+
+    /**
+     * Constructs a <code>RemoteException</code> with the specified
+     * detail message.
+     *
+     * @param s the detail message
+     */
+    public RemoteException(String s) {
+	super(s);
+    }
+
+    /**
+     * Constructs a <code>RemoteException</code> with the specified
+     * detail message and nested exception.
+     *
+     * @param s the detail message
+     * @param ex the nested exception
+     */
+    public RemoteException(String s, Throwable ex) {
+	super(s);
+	detail = ex;
+    }
+
+    /**
+     * Returns the detail message, including the message from the nested
+     * exception if there is one.
+     */
+    public String getMessage() {
+	if (detail == null)
+	    return super.getMessage();
+	else
+	    return super.getMessage() +
+		"; nested exception is: \n\t" +
+		detail.toString();
+    }
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/java/rmi/ServerException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/java/rmi/ServerException.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/java/rmi/ServerException.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/java/rmi/ServerException.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2005 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 java.rmi;
+
+/**
+ * A <code>ServerException</code> is thrown as a result of a remote method
+ * invocation when a <code>RemoteException</code> is thrown while processing
+ * the invocation on the server, either while unmarshalling the arguments,
+ * executing the remote method itself, or marshalling the return value.
+ * 
+ * A <code>ServerException</code> instance contains the original
+ * <code>RemoteException</code> that occurred as its cause.
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class ServerException extends RemoteException {
+
+    /**
+     * Constructs a <code>ServerException</code> with the specified
+     * detail message.
+     *
+     * @param s the detail message
+     */
+    public ServerException(String s) {
+	super(s);
+    }
+
+    /**
+     * Constructs a <code>ServerException</code> with the specified
+     * detail message and nested exception.
+     *
+     * @param s the detail message
+     * @param ex the nested exception
+     */
+    public ServerException(String s, Exception ex) {
+	super(s, ex);
+    }
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/ComplexType.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/ComplexType.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/ComplexType.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/ComplexType.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+/**
+ * The class ComplexType is a special Type instance used to represent an xsd:complextype defined in a Web Service's WSDL definition. 
+ * @author Ias (iasandcb@tmax.co.kr)
+ * 
+ */
+public class ComplexType extends Type {
+	
+    /** The set of xsd:element objects which make up this ComplexType */
+	public Element[] elements;
+	
+    /**
+     * Constructs a new ComplexType. This Type subclass will have a value of 8. 
+     */
+	public ComplexType() {
+		super(8);
+	}
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Element.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Element.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Element.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Element.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,109 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The class Element is a special Object used to represent an xsd:element defined in a Web Service's WSDL definition. An element can have the additional properties of being an array, being nillable, and has minOccurs and maxOccurs values. 
+ * @author Ias (iasandcb@tmax.co.kr)
+ * 
+ */
+public class Element extends Type {
+
+    /** The Type of this Element's content. */
+	public final Type contentType;
+    /** True if this element is an array */
+    public final boolean isArray;
+    /** True if this element is nillable */
+    public final boolean isNillable;
+    /** True if this element is optional, that is, its minOccurs is defined as being 0. */
+    public final boolean isOptional;
+    /** The 'minOccurs' attribute of this element. Default value of 1, if this element has no 'minOccurs' attribute. */
+	public final int minOccurs;
+    /** The 'maxOccurs' attribute of this element. Default value of 1, if this element has no 'maxOccurs' attribute. */
+	public final int maxOccurs;
+    /** The QName of this element */
+	public final QName name;
+    /** Constant used to indicate that maxOccurs is unbounded. */
+	public static final int UNBOUNDED = -1;
+	
+    /**
+     * Construct an Element with the given properties. The defaults for the unspecified properties are:
+     * minOccurs = 1
+     * maxOccurs = 1
+     * isOptional = false
+     * isArray = false
+     * isNillable = false
+     * This Type subclass will have a value of 9.  
+     * @param name - the QName of this element
+     * @param type - the Type of this element's content 
+     */
+	public Element(QName name, Type type) {
+		this(name, type, 1, 1, false);
+	}
+
+    /**
+     * Construct an Element with the given properties. This Type subclass will have a value of 9. 
+     * @param name - the QName of this element
+     * @param type - the Type of this element's content 
+     * @param minOccurs - indicates the minimum number of times this element can occur. A value of '0' indicates this element is optional.
+     * @param maxOccurs - indicates the maximum number of times this element can occur. A value > 1 or equal to UNBOUNDED indicates this element is an array.
+     * @param nillable - indicates if this element may have the xsd:nil attribute equal true. 
+     */
+	public Element(QName name, Type type, int minOccurs, int maxOccurs, boolean nillable) {
+		super(9);
+		if (name == null) {
+			throw new IllegalArgumentException("invalid name");
+		} else {
+			this.name = name;
+		}
+		
+		if ((type == null) || (type instanceof Element)) {
+			throw new IllegalArgumentException("invalid type");
+		} else {
+			this.contentType = type;
+		}
+		
+		if ((minOccurs < 0) || ((minOccurs > maxOccurs) && (maxOccurs != UNBOUNDED))) {
+			throw new IllegalArgumentException("invalid minOccurs");
+		} else {
+			this.minOccurs = minOccurs;
+		}
+
+        if (minOccurs == 0) {
+            isOptional = true;
+        } else {
+            isOptional = false;
+        }
+
+        if (maxOccurs == 0) {
+			throw new IllegalArgumentException("invalid maxOccurs");
+		} else {
+			this.maxOccurs = maxOccurs;
+		}
+		
+		if (maxOccurs > 1 || maxOccurs == UNBOUNDED) {
+			isArray = true;
+		} else {
+			isArray = false;
+		}
+
+		this.isNillable = nillable;		
+		
+	}
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailException.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailException.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailException.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The FaultDetailException class is used to return service specific exception detail values, and an associated QName, to a Stub instance. 
+ * This exception class is returned from the runtime implementation as the cause of a JAXRPCException and retrieved via the JAXRPCException.getLinkedCause method.
+ * @author Ias (iasandcb@tmax.co.kr)
+ *  
+ */
+public class FaultDetailException extends Exception {
+    private QName faultDetailName;
+    private Object faultDetail;
+    
+    /**
+     * Constructs a new exception with the specified fault detail and associated fault detail QName. 
+     * @param faultDetail - Object array containing the values for SOAP fault detail. The values are retrieved using the getFaultDetail method
+     * @param faultDetailName - the QName of the SOAP fault detail element
+     */
+    public FaultDetailException(QName faultDetailName, Object faultDetail) {
+        this.faultDetailName = faultDetailName;
+        this.faultDetail = faultDetail;
+    }
+    /**
+     * Returns the fault detail values 
+     * @return the fault detail values for the service specific exception
+     */
+    public Object getFaultDetail() {
+        return faultDetail;
+    }
+
+    /**
+     * Returns the QName of the fault detail element associated with this exception.
+     * @return the QName of the fault detail element
+     */
+    public QName getFaultDetailName() {
+        return faultDetailName;
+    }
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailHandler.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailHandler.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailHandler.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/FaultDetailHandler.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The javax.microedition.xml.rpc.FaultDetailHandler interface is implemented by stubs that handle custom faults.
+ * @author Ias (iasandcb@tmax.co.kr)
+ *  
+ */
+public interface FaultDetailHandler {
+
+    /**
+     * Returns the type description, as an Element for the given SOAP fault faultDetailName, null if there is no mapping.
+     * @param faultDetailName - the QName of the SOAP fault detail element 
+     * @return an Element object describing the type to which faultDetailName is to be mapped, or, null if there is no mapping.
+     */
+	public Element handleFault(QName faultDetailName); 
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Operation.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Operation.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Operation.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Operation.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,132 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+import javax.microedition.xml.rpc.Element;
+import javax.microedition.xml.rpc.FaultDetailHandler;
+import javax.xml.namespace.QName;
+import javax.xml.rpc.JAXRPCException;
+
+/**
+ * The javax.microedition.xml.rpc.Operation class corresponds to a
+ * wsdl:operation defined for a target service endpoint.
+ * 
+ * @author Ias (iasandcb@tmax.co.kr)
+ *  
+ */
+public class Operation {
+	/** Standard property for SOAPAction. Indicates the SOAPAction URI. */
+	public static final java.lang.String SOAPACTION_URI_PROPERTY =
+		"javax.xml.rpc.soap.http.soapaction.uri";
+
+	protected Operation() {
+
+	}
+	/**
+	 * Creates an Operation corresponding to the operation that is being
+	 * performed.
+	 * 
+	 * @param name -
+	 *            the QName of the operation to be invoked.
+	 * @param input -
+	 *            the Element describing the input parameter to this operation.
+	 *            NULL indicates that the operation with zero input message
+	 *            parts is to be executed.
+	 * @param output -
+	 *            the Element describing the return result to this operation.
+	 *            NULL indicates there is no return value.
+	 * @return a new Operation with the given input and output Type
+	 *         characteristics
+	 */
+	public static Operation newInstance(
+		QName name,
+		Element input,
+		Element output) {
+		return newInstance(name, input, output, null);
+	}
+
+	/**
+	 * Creates an Operation corresponding to the operation that is being
+	 * performed. The faultDetailHandler parameter is passed to the runtime and
+	 * used to map custom SOAP faults.
+	 * 
+	 * @param name -
+	 *            the QName of the operation to be invoked.
+	 * @param input -
+	 *            the Element describing the input parameter to this operation.
+	 *            NULL indicates that the operation with zero input message
+	 *            parts is to be executed.
+	 * @param output -
+	 *            the Element describing the return result to this operation.
+	 *            NULL indicates there is no return value.
+	 * @param faultDetailHandler -
+	 *            the FaultDetailHandler to be called to handle custom faults
+	 *            thrown by this Operation.
+	 * @return a new Operation with the given input and output Type
+	 *         characteristics
+	 */
+
+	public static Operation newInstance(
+		QName name,
+		Element input,
+		Element output,
+		FaultDetailHandler faultDetailHandler) {
+		return new org.apache.mirae.ws.OperationStax(name, input, output, faultDetailHandler);
+	}
+
+	/**
+	 * Sets the property name to the value, value.
+	 * 
+	 * @param name -
+	 *            the name of the property to be set
+	 * @param value -
+	 *            the value the property is to be set
+	 * @throws java.lang.IllegalArgumentException -
+	 *             if the property, name, is not recognized by the runtime.
+	 *  
+	 */
+	public void setProperty(String name, String value)
+		throws java.lang.IllegalArgumentException {
+	}
+
+	/**
+	 * Invokes the wsdl:operation defined by this Operation and returns the
+	 * result. The input parameters and return value are encoded such that
+	 * primitive types are mapped to the equivalent object wrapper, for
+	 * example, int is mapped to Integer, byte to Byte. arrays are an Object
+	 * containing the array elements. complex types are represented by an array
+	 * of objects mapped according to the above rules. Any additional elements,
+	 * beyond those described by the description passed to
+	 * Operation.newInstance, are ignored.
+	 * 
+	 * @param inParams -
+	 *            an Object representing the input parameter value(s) to this
+	 *            operation.
+	 * @return a Object representing the output value(s) for this operation.
+	 *         Can be null if this operation returns no value.
+	 * @throws JAXRPCException-
+	 *             if the runtime detects a type mismatch in input parameters
+	 *             or return value. if an error occurs while excuting the
+	 *             operation. Any exception corresponding to the error will be
+	 *             attached, as the cause, to the JAXRPCException and can be
+	 *             retrieved via the method getCause.
+	 */
+	public Object invoke(Object inParams) throws JAXRPCException {
+		return null;
+	}
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Type.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Type.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Type.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/microedition/xml/rpc/Type.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2005 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 javax.microedition.xml.rpc;
+
+/**
+ * The class Type is a type safe enumeration of allowable types that are used to identify simple types defined in a Web Service's WSDL definition. The set of simple types are: 
+ * boolean
+ * byte
+ * short
+ * int
+ * long
+ * float
+ * double
+ * string
+ * 
+ * @author Ias (iasandcb@tmax.co.kr)
+ * 
+ */
+public class Type {
+    /** Type constant identifying boolean parameters. */
+	public static final Type BOOLEAN = new Type(0);
+    /** Type constant identifying byte parameters. */
+	public static final Type BYTE = new Type(1);
+    /** Type constant identifying double parameters. */
+	public static final Type SHORT = new Type(2);
+    /** Type constant identifying float parameters. */
+	public static final Type INT = new Type(3);
+    /** Type constant identifying integer parameters. */
+	public static final Type LONG = new Type(4);
+    /** Type constant identifying long parameters. */
+	public static final Type FLOAT = new Type(5);
+    /** Type constant identifying short parameters. */
+	public static final Type DOUBLE = new Type(6);
+    /** Type constant identifying String parameters. */
+	public static final Type STRING = new Type(7);
+    /** The internal integer "value" of this Type, [0-9]. */
+	public final int value;
+	
+	Type(int value) {
+		this.value = value;
+	}
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/QName.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/QName.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/QName.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/xml/namespace/QName.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,211 @@
+/*
+ * Copyright 2005 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 javax.xml.namespace;
+
+
+/**
+ * <code>QName</code> class represents the value of a qualified name
+ * as specified in <a href="http://www.w3.org/TR/xmlschema-2/#QName">XML
+ * Schema Part2: Datatypes specification</a>.
+ * <p>
+ * The value of a QName contains a <b>namespaceURI</b>, a <b>localPart</b> and a <b>prefix</b>.
+ * The localPart provides the local part of the qualified name. The
+ * namespaceURI is a URI reference identifying the namespace.
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class QName {
+
+    /** Field namespaceURI */
+    private String namespaceURI;
+
+    /** Field localPart */
+    private String localPart;
+
+	/** Field prefix */
+	private String prefix;
+
+    /**
+     * Constructor for the QName.
+     *
+     * @param localPart Local part of the QName
+     */
+    public QName(String localPart) {
+        this("", localPart, "");
+    }
+
+    /**
+     * Constructor for the QName.
+     *
+     * @param namespaceURI Namespace URI for the QName
+     * @param localPart Local part of the QName.
+     */
+    public QName(String namespaceURI, String localPart) {
+		this(namespaceURI, localPart, "");	
+    }
+
+	/**
+	 * Constructor for the QName.
+	 *
+	 * @param namespaceURI Namespace URI for the QName
+	 * @param localPart Local part of the QName.
+	 * @param prefix Prefix of the QName.
+	 */
+	public QName(String namespaceURI, String localPart, String prefix) {
+		this.namespaceURI = (namespaceURI == null)
+							? ""
+							: namespaceURI;
+		if (localPart == null) {
+			throw new IllegalArgumentException("invalid QName local part");
+		} else {
+			this.localPart = localPart;
+		}
+		
+		if (prefix == null) {
+			throw new IllegalArgumentException("invalid QName prefix");
+		} else {
+			this.prefix = prefix;
+		}
+	}
+
+    /**
+     * Gets the Namespace URI for this QName
+     *
+     * @return Namespace URI
+     */
+    public String getNamespaceURI() {
+        return namespaceURI;
+    }
+
+    /**
+     * Gets the Local part for this QName
+     *
+     * @return Local part
+     */
+    public String getLocalPart() {
+        return localPart;
+    }
+
+	/**
+	 * Gets the Prefix for this QName
+	 *
+	 * @return Prefix
+	 */
+	public String getPrefix() {
+		return prefix;
+	}
+
+    /**
+     * Returns a string representation of this QName
+     *
+     * @return  a string representation of the QName
+     */
+    public String toString() {
+
+        return ((namespaceURI.equals(""))
+                ? localPart
+                : '{' + namespaceURI + '}' + localPart);
+    }
+
+    /**
+     * Tests this QName for equality with another object.
+     * <p>
+     * If the given object is not a QName or is null then this method
+     * returns <tt>false</tt>.
+     * <p>
+     * For two QNames to be considered equal requires that both
+     * localPart and namespaceURI must be equal. This method uses
+     * <code>String.equals</code> to check equality of localPart
+     * and namespaceURI. Any class that extends QName is required
+     * to satisfy this equality contract.
+     * <p>
+     * This method satisfies the general contract of the <code>Object.equals</code> method.
+     *
+     * @param obj the reference object with which to compare
+     *
+     * @return <code>true</code> if the given object is identical to this
+     *      QName: <code>false</code> otherwise.
+     */
+    public final boolean equals(Object obj) {
+
+        if (obj == this) {
+            return true;
+        }
+
+        if (!(obj instanceof QName)) {
+            return false;
+        }
+
+      if ((namespaceURI.equals(((QName) obj).namespaceURI))
+              && (localPart.equals(((QName) obj).localPart))) {
+          return true;
+      }
+        return false;
+    }
+
+    /**
+     * Returns a QName holding the value of the specified String.
+     * <p>
+     * The string must be in the form returned by the QName.toString()
+     * method, i.e. "{namespaceURI}localPart", with the "{namespaceURI}"
+     * part being optional.
+     * <p>
+     * This method doesn't do a full validation of the resulting QName.
+     * In particular, it doesn't check that the resulting namespace URI
+     * is a legal URI (per RFC 2396 and RFC 2732), nor that the resulting
+     * local part is a legal NCName per the XML Namespaces specification.
+     *
+     * @param s the string to be parsed
+     * @throws java.lang.IllegalArgumentException If the specified String cannot be parsed as a QName
+     * @return QName corresponding to the given String
+     */
+    public static QName valueOf(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);
+        }
+    }
+
+    /**
+     * Returns a hash code value for this QName object. The hash code
+     * is based on both the localPart and namespaceURI parts of the
+     * QName. This method satisfies the  general contract of the
+     * <code>Object.hashCode</code> method.
+     *
+     * @return a hash code value for this Qname object
+     */
+    public final int hashCode() {
+        return namespaceURI.hashCode() ^ localPart.hashCode();
+    }
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/JAXRPCException.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/JAXRPCException.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/JAXRPCException.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/JAXRPCException.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,89 @@
+/*
+ * Copyright 2005 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 javax.xml.rpc;
+
+/**
+ * The <code>javax.xml.rpc.JAXRPCException</code> is thrown from
+ * the core JAX-RPC APIs to indicate an exception related to the
+ * JAX-RPC runtime mechanisms.
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class JAXRPCException extends RuntimeException {
+
+    /** Field cause */
+    Throwable cause;
+
+    /**
+     * Constructs a new exception with <code>null</code> as its
+     * detail message. The cause is not initialized.
+     */
+    public JAXRPCException() {}
+
+    /**
+     * Constructs a new exception with the specified detail
+     * message.  The cause is not initialized.
+     *
+     * @param message The detail message which is later
+     *            retrieved using the getMessage method
+     */
+    public JAXRPCException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail
+     * message and cause.
+     *
+     * @param message The detail message which is later retrieved
+     *            using the getMessage method
+     * @param cause The cause which is saved for the later
+     *            retrieval throw by the getCause method
+     */
+    public JAXRPCException(String message, Throwable cause) {
+
+        super(message);
+
+        this.cause = cause;
+    }
+
+    /**
+     * Constructs a new JAXRPCException with the specified cause
+     * and a detail message of <tt>(cause==null ? null :
+     * cause.toString())</tt> (which typically contains the
+     * class and detail message of <tt>cause</tt>).
+     *
+     * @param cause The cause which is saved for the later
+     *            retrieval throw by the getCause method.
+     *            (A <tt>null</tt> value is permitted, and
+     *            indicates that the cause is nonexistent or
+     *          unknown.)
+     */
+    public JAXRPCException(Throwable cause) {
+        this.cause = cause;
+    }
+
+    /**
+     * Gets the Linked cause
+     *
+     * @return The cause of this Exception or <code>null</code>
+     *     if the cause is noexistent or unknown
+     */
+    public Throwable getLinkedCause() {
+        return cause;
+    }
+}
\ No newline at end of file

Added: webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/NamespaceConstants.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/NamespaceConstants.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/NamespaceConstants.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/NamespaceConstants.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2005 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 javax.xml.rpc;
+
+/**
+ * Constants used in JAX-RPC for namespace prefixes and URIs
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public class NamespaceConstants {
+
+    /**
+     * Constructor NamespaceConstants
+     */
+    public NamespaceConstants() {}
+
+    /** Namespace prefix for SOAP Envelope */
+    public static final String NSPREFIX_SOAP_ENVELOPE = "soapenv";
+
+    /** Namespace prefix for XML schema XSD */
+    public static final String NSPREFIX_SCHEMA_XSD = "xsd";
+
+    /** Namespace prefix for XML Schema XSI */
+    public static final String NSPREFIX_SCHEMA_XSI = "xsi";
+
+    /** Nameapace URI for SOAP 1.1 Envelope */
+    public static final String NSURI_SOAP_ENVELOPE =
+        "http://schemas.xmlsoap.org/soap/envelope/";
+
+    /** Nameapace URI for SOAP 1.1 Encoding */
+    public static final String NSURI_SOAP_ENCODING =
+        "http://schemas.xmlsoap.org/soap/encoding/";
+
+    /** Nameapace URI for SOAP 1.1 next actor role */
+    public static final String NSURI_SOAP_NEXT_ACTOR =
+        "http://schemas.xmlsoap.org/soap/actor/next";
+
+    /** Namespace URI for XML Schema XSD */
+    public static final String NSURI_SCHEMA_XSD =
+        "http://www.w3.org/2001/XMLSchema";
+
+    /** Namespace URI for XML Schema XSI */
+    public static final String NSURI_SCHEMA_XSI =
+        "http://www.w3.org/2001/XMLSchema-instance";
+}
\ No newline at end of file

Added: webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/Stub.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/Stub.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/javax/xml/rpc/Stub.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,113 @@
+/*
+ * Copyright 2005 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 javax.xml.rpc;
+
+
+/**
+ * The interface <code>javax.xml.rpc.Stub</code> is the common base interface
+ * for the stub classes. All generated stub classes are required to
+ * implement the <code>javax.xml.rpc.Stub</code> interface. An instance
+ * of a stub class represents a client side proxy or stub instance for
+ * the target service endpoint.
+ *
+ * <p>The <code>javax.xml.rpc.Stub</code> interface provides an
+ * extensible property mechanism for the dynamic configuration of
+ * a stub instance.
+ *
+ * @author Ias (iasandcb@tmax.co.kr)
+ */
+public interface Stub {
+
+    // Constants for the standard properties
+
+    /**
+     * Standard property: User name for authentication.
+     * <p>Type: java.lang.String
+     */
+    public static final String USERNAME_PROPERTY = 
+		"javax.xml.rpc.security.auth.username";
+
+    /**
+     * Standard property: Password for authentication.
+     * <p>Type: java.lang.String
+     */
+    public static final String PASSWORD_PROPERTY = 
+		"javax.xml.rpc.security.auth.password";
+
+    /**
+     * Standard property: Target service endpoint address. The
+     * URI scheme for the endpoint address specification must
+     * correspond to the protocol/transport binding for this
+     * stub class.
+     * <p>Type: java.lang.String
+     */
+    public static final String ENDPOINT_ADDRESS_PROPERTY =
+        "javax.xml.rpc.service.endpoint.address";
+
+    /**
+     * Standard property: This boolean property is used by a service
+     * client to indicate whether or not it wants to participate in
+     * a session with a service endpoint. If this property is set to
+     * true, the service client indicates that it wants the session
+     * to be maintained. If set to false, the session is not maintained.
+     * The default value for this property is false.
+     * <p>Type: java.lang.Boolean
+     */
+    public static final String SESSION_MAINTAIN_PROPERTY =
+		"javax.xml.rpc.session.maintain";
+
+    /**
+     * Sets the name and value of a configuration property
+     * for this Stub instance. If the Stub instances contains
+     * a value of the same property, the old value is replaced.
+     * <p>Note that the <code>_setProperty</code> method may not
+     * perform validity check on a configured property value. An
+     * example is the standard property for the target service
+     * endpoint address that is not checked for validity in the
+     * <code>_setProperty</code> method.
+     * In this case, stub configuration errors are detected at
+     * the remote method invocation.
+     *
+     * @param name Name of the configuration property
+     * @param value Value of the property
+     * @throws JAXRPCException <ul>
+     *     <li>If an optional standard property name is
+     *         specified, however this Stub implementation
+     *         class does not support the configuration of
+     *         this property.
+     *     <li>If an invalid or unsupported property name is
+     *         specified or if a value of mismatched property
+     *         type is passed.
+     *     <li>If there is any error in the configuration of
+     *         a valid property.
+     *     </ul>
+     */
+    public void _setProperty(String name, Object value);
+
+    /**
+     * Gets the value of a specific configuration property.
+     *
+     * @param name Name of the property whose value is to be
+     *          retrieved
+     * @return Value of the configuration property
+     * @throws JAXRPCException if an invalid or
+     *     unsupported property name is passed.
+     */
+    public Object _getProperty(String name);
+
+}
+

Added: webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringReader.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringReader.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringReader.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringReader.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,208 @@
+/*
+ * Copyright 2005 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.io;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * A character reader whose source is a string.
+ * 
+ */
+
+public class StringReader extends Reader {
+
+    private String enclosedString;
+
+    private int length;
+
+    private int markPosition = 0;
+
+    private int nextPosition = 0;
+
+    /**
+     * Create a new string reader.
+     * 
+     * @param s
+     *            String providing the character stream.
+     */
+    public StringReader(String s) {
+        this.enclosedString = s;
+        this.length = s.length();
+    }
+
+    private void checkOpen() throws IOException {
+        if (enclosedString == null) {
+            throw new IOException("Stream closed");
+        }
+    }
+
+    /**
+     * Read a single character.
+     * 
+     * @return The character read, or -1 if the end of the stream has been
+     *         reached
+     * 
+     * @exception IOException
+     *                If an I/O error occurs
+     */
+    public int read() throws IOException {
+        synchronized (lock) {
+            checkOpen();
+            if (nextPosition >= length) {
+                return -1;
+            }
+            return enclosedString.charAt(nextPosition++);
+        }
+    }
+
+    /**
+     * Read characters into a portion of an array.
+     * 
+     * @param cbuf
+     *            Destination buffer
+     * @param off
+     *            Offset at which to start writing characters
+     * @param len
+     *            Maximum number of characters to read
+     * 
+     * @return The number of characters read, or -1 if the end of the stream has
+     *         been reached
+     * 
+     * @exception IOException
+     *                If an I/O error occurs
+     */
+    public int read(char cbuf[], int off, int len) throws IOException {
+        synchronized (lock) {
+            checkOpen();
+            if ((off < 0) || (off > cbuf.length) || (len < 0)
+                    || ((off + len) > cbuf.length) || ((off + len) < 0)) {
+                throw new IndexOutOfBoundsException();
+            } else if (len == 0) {
+                return 0;
+            }
+            if (nextPosition >= length) {
+                return -1;
+            }
+            int n = Math.min(length - nextPosition, len);
+            enclosedString.getChars(nextPosition, nextPosition + n, cbuf, off);
+            nextPosition += n;
+            return n;
+        }
+    }
+
+    /**
+     * Skips the specified number of characters in the stream. Returns the
+     * number of characters that were skipped.
+     * 
+     * <p>
+     * The <code>ns</code> parameter may be negative, even though the
+     * <code>skip</code> method of the {@link Reader} superclass throws an
+     * exception in this case. Negative values of <code>ns</code> cause the
+     * stream to skip backwards. Negative return values indicate a skip
+     * backwards. It is not possible to skip backwards past the beginning of the
+     * string.
+     * 
+     * <p>
+     * If the entire string has been read or skipped, then this method has no
+     * effect and always returns 0.
+     * 
+     * @exception IOException
+     *                If an I/O error occurs
+     */
+    public long skip(long ns) throws IOException {
+        synchronized (lock) {
+            checkOpen();
+            if (nextPosition >= length) {
+                return 0;
+            }
+            long nextIncrement = Math.min(length - nextPosition, ns);
+            nextIncrement = Math.max(-nextPosition, nextIncrement);
+            nextPosition += nextIncrement;
+            return nextIncrement;
+        }
+    }
+
+    /**
+     * Tell whether this stream is ready to be read.
+     * 
+     * @return True if the next read() is guaranteed not to block for input
+     * 
+     * @exception IOException
+     *                If the stream is closed
+     */
+    public boolean ready() throws IOException {
+        synchronized (lock) {
+            checkOpen();
+            return true;
+        }
+    }
+
+    /**
+     * Tell whether this stream supports the mark() operation, which it does.
+     */
+    public boolean markSupported() {
+        return true;
+    }
+
+    /**
+     * Mark the present position in the stream. Subsequent calls to reset() will
+     * reposition the stream to this point.
+     * 
+     * @param readAheadLimit
+     *            Limit on the number of characters that may be read while still
+     *            preserving the mark. Because the stream's input comes from a
+     *            string, there is no actual limit, so this argument must not be
+     *            negative, but is otherwise ignored.
+     * 
+     * @exception IllegalArgumentException
+     *                If readAheadLimit is < 0
+     * @exception IOException
+     *                If an I/O error occurs
+     */
+    public void mark(int readAheadLimit) throws IOException {
+        if (readAheadLimit < 0) {
+            throw new IllegalArgumentException("Read-ahead limit < 0");
+        }
+        synchronized (lock) {
+            checkOpen();
+            markPosition = nextPosition;
+        }
+    }
+
+    /**
+     * Reset the stream to the most recent mark, or to the beginning of the
+     * string if it has never been marked.
+     * 
+     * @exception IOException
+     *                If an I/O error occurs
+     */
+    public void reset() throws IOException {
+        synchronized (lock) {
+            checkOpen();
+            nextPosition = markPosition;
+        }
+    }
+
+    /**
+     * Close the stream.
+     */
+    public void close() {
+        enclosedString = null;
+    }
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringWriter.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringWriter.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringWriter.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/io/StringWriter.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,141 @@
+/*
+ * Copyright 2005 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.io;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * A character stream that collects its output in a string buffer, which can
+ * then be used to construct a string.
+ * <p>
+ * Closing a <tt>StringWriter</tt> has no effect. The methods in this class
+ * can be called after the stream has been closed without generating an
+ * <tt>IOException</tt>.
+ * 
+ */
+
+public class StringWriter extends Writer {
+
+    private StringBuffer buffer;
+
+    /**
+     * Create a new string writer using the default initial string-buffer size.
+     */
+    public StringWriter() {
+        buffer = new StringBuffer();
+        lock = buffer;
+    }
+
+    /**
+     * Create a new string writer using the specified initial string-buffer
+     * size.
+     * 
+     * @param initialSize
+     *            The number of <tt>char</tt> values that will fit into this
+     *            buffer before it is automatically expanded
+     * 
+     * @throws IllegalArgumentException
+     *             If <tt>initialSize</tt> is negative
+     */
+    public StringWriter(int initialSize) {
+        if (initialSize < 0) {
+            throw new IllegalArgumentException("Negative buffer size");
+        }
+        buffer = new StringBuffer(initialSize);
+        lock = buffer;
+    }
+
+    /**
+     * Write a single character.
+     */
+    public void write(int c) {
+        buffer.append((char) c);
+    }
+
+    /**
+     * Write a portion of an array of characters.
+     * 
+     * @param cbuf
+     *            Array of characters
+     * @param off
+     *            Offset from which to start writing characters
+     * @param len
+     *            Number of characters to write
+     */
+    public void write(char cbuf[], int off, int len) {
+        if ((off < 0) || (off > cbuf.length) || (len < 0)
+                || ((off + len) > cbuf.length) || ((off + len) < 0)) {
+            throw new IndexOutOfBoundsException();
+        } else if (len == 0) {
+            return;
+        }
+        buffer.append(cbuf, off, len);
+    }
+
+    /**
+     * Write a string.
+     */
+    public void write(String str) {
+        buffer.append(str);
+    }
+
+    /**
+     * Write a portion of a string.
+     * 
+     * @param str
+     *            String to be written
+     * @param off
+     *            Offset from which to start writing characters
+     * @param len
+     *            Number of characters to write
+     */
+    public void write(String str, int off, int len) {
+        buffer.append(str.substring(off, off + len));
+    }
+
+    /**
+     * Return the buffer's current value as a string.
+     */
+    public String toString() {
+        return buffer.toString();
+    }
+
+    /**
+     * Return the string buffer itself.
+     * 
+     * @return StringBuffer holding the current buffer value.
+     */
+    public StringBuffer getBuffer() {
+        return buffer;
+    }
+
+    /**
+     * Flush the stream.
+     */
+    public void flush() {
+    }
+
+    /**
+     * Closing a <tt>StringWriter</tt> has no effect. The methods in this
+     * class can be called after the stream has been closed without generating
+     * an <tt>IOException</tt>.
+     */
+    public void close() throws IOException {
+    }
+
+}

Added: webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/AsyncHandler.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/AsyncHandler.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/AsyncHandler.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/AsyncHandler.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,21 @@
+/*
+ * Copyright 2005 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.ws;
+
+public interface AsyncHandler {
+    public void handleResponse(Object response);
+}

Added: webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/Dispatch.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/Dispatch.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/Dispatch.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/Dispatch.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,124 @@
+/*
+ * Copyright 2005 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.ws;
+
+import java.io.IOException;
+
+import javax.microedition.io.Connector;
+import javax.microedition.io.HttpConnection;
+import javax.xml.rpc.NamespaceConstants;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.mirae.ws.util.Base64;
+
+public class Dispatch {
+    private HttpConnection connection;
+
+    public Dispatch(String endpointUrl, String soapAction) throws IOException {
+        this(endpointUrl, soapAction, null, null);
+    }
+    
+    public Dispatch(String endpointUrl, String soapAction, String username,
+            String password) throws IOException {
+            connection = (HttpConnection) Connector.open(endpointUrl,
+                    Connector.READ_WRITE, true);
+            if (soapAction == null) {
+                // WS-I BP 1.0 R2745
+                soapAction = "";
+            }
+            // WS-I BP 1.0 R2744
+            soapAction = "\"" + soapAction + "\"";
+            connection.setRequestProperty("SOAPAction", soapAction);
+            connection.setRequestProperty("Content-Type", "text/xml");
+            // connection.setRequestProperty("Content-Type",
+            // "application/fastinfoset");
+
+            connection.setRequestProperty("User-Agent", "mirae/1.0");
+            if (username != null) {
+                StringBuffer tmpBuf = new StringBuffer();
+
+                tmpBuf.append(username).append(":").append(
+                        (password == null) ? "" : password);
+                String value = " Basic "
+                        + Base64.encode(tmpBuf.toString().getBytes());
+                connection.setRequestProperty(
+                        OperationStax.HEADER_AUTHORIZATION, value);
+            }
+
+            connection.setRequestMethod(HttpConnection.POST);
+    }
+
+    public XMLStreamWriter getRequestWriter() throws XMLStreamException, IOException {
+        return XMLOutputFactory.newInstance().createXMLStreamWriter(connection.openOutputStream());
+    }
+
+    public void closeConnection() {
+        if (connection != null) {
+            try {
+                connection.close();
+            } catch (IOException e) {
+            }
+            connection = null;
+        }
+        
+    }
+
+    public XMLStreamReader getResponseReader() throws XMLStreamException, IOException {
+        return XMLInputFactory.newInstance()
+        .createXMLStreamReader(connection.openInputStream());
+    }
+    
+    public void writeBeforeBody(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeStartDocument();
+        writer.writeStartElement("v", "Envelope", NamespaceConstants.NSURI_SOAP_ENVELOPE);
+        writer.writeNamespace("i", NamespaceConstants.NSURI_SCHEMA_XSI);
+        writer.writeNamespace("d", NamespaceConstants.NSURI_SCHEMA_XSD);
+        writer.writeNamespace("c", NamespaceConstants.NSURI_SOAP_ENCODING);
+        writer.writeNamespace("v", NamespaceConstants.NSURI_SOAP_ENVELOPE);
+        writer.setPrefix("v", NamespaceConstants.NSURI_SOAP_ENVELOPE);
+        writer.writeStartElement(NamespaceConstants.NSURI_SOAP_ENVELOPE, "Body");
+        
+    }
+    
+    public void writeAfterBody(XMLStreamWriter writer) throws XMLStreamException {
+        writer.writeEndElement();
+        writer.writeEndElement();
+        writer.writeEndDocument();        
+    }
+    
+    public void readBeforeBody(XMLStreamReader reader) throws XMLStreamException {
+        if (reader.next() != XMLStreamConstants.START_ELEMENT) {
+            reader.nextTag();
+        }
+        reader.require(XMLStreamConstants.START_ELEMENT, NamespaceConstants.NSURI_SOAP_ENVELOPE, "Envelope");
+        reader.nextTag();
+        reader.require(XMLStreamConstants.START_ELEMENT, NamespaceConstants.NSURI_SOAP_ENVELOPE, "Body");
+        reader.nextTag();        
+    }
+    
+    public void readAfterBody(XMLStreamReader reader) throws XMLStreamException {
+        reader.nextTag();
+        reader.require(XMLStreamConstants.END_ELEMENT, NamespaceConstants.NSURI_SOAP_ENVELOPE, "Body");
+        reader.nextTag();
+        reader.require(XMLStreamConstants.END_ELEMENT, NamespaceConstants.NSURI_SOAP_ENVELOPE, "Envelope");        
+    }
+}

Added: webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/MailAgent.java
URL: http://svn.apache.org/viewcvs/webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/MailAgent.java?rev=232254&view=auto
==============================================================================
--- webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/MailAgent.java (added)
+++ webservices/mirae/trunk/src/mirae/ws/org/apache/mirae/ws/MailAgent.java Fri Aug 12 03:08:51 2005
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2005 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.ws;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import de.trantor.mail.InboxClient;
+import de.trantor.mail.MailException;
+import de.trantor.mail.Message;
+import de.trantor.mail.Pop3Client;
+import de.trantor.mail.SmtpClient;
+
+public class MailAgent implements Runnable {
+
+    private static MailAgent agent;
+
+    private Hashtable requests;
+
+    private InboxClient pop3Client;
+
+    private String pop3Host = "localhost";
+
+    private String pop3User = "ias";
+
+    private String pop3Pass = "cb";
+
+    private int pop3Port = 9110;
+
+    private int smtpPort = 9025;
+
+    private String smtpHost = "localhost";
+
+    private boolean smtpAuth = false;
+
+    private String fromAddress = "ias@localhost";
+
+    private String endpointAddress = "cb@localhost";
+
+    private MailAgent() throws IOException, MailException, Exception {
+        pop3Client = new Pop3Client();
+        pop3Client.open(pop3Host, pop3Port, false, pop3User, pop3Pass);
+    }
+
+    public static MailAgent getSingleton() throws IOException, MailException,
+            Exception {
+        if (agent == null) {
+            agent = new MailAgent();
+            new Thread(agent).start();
+        }
+        return agent;
+    }
+
+    public void run() {
+        // check mail
+        try {
+            while (true) {
+                for (int i = 0; i < pop3Client.getMessageCount(); i++) {
+                    Message message = pop3Client.getHeaders(i);
+                    String subject = message.getHeaderValue("Subject",
+                            "No subject");
+                    // message.getHeaderValue("From", "No sender");
+                    for (Enumeration e = requests.keys(); e.hasMoreElements();) {
+                        String receivedId = (String) e.nextElement();
+                        if (subject.endsWith(receivedId)) {
+                            OperationMail request = (OperationMail) requests
+                                    .get(receivedId);
+                            request.callBack(message);
+                            requests.remove(request);
+                        }
+                    }
+                }
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (MailException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void sendRequest(String request, OperationMail call) {
+        String subject = "Mirae:" + System.currentTimeMillis();
+        Message message = new Message(fromAddress, endpointAddress, subject);
+        message.addBodyLine(request);
+        SmtpClient smtpClient = new SmtpClient(smtpHost);
+        try {
+            if (smtpAuth) {
+                smtpClient.open(smtpHost, smtpPort, false, pop3User, pop3Pass);
+            } else {
+                smtpClient.open(smtpHost, smtpPort, false, null, null);
+            }
+
+            smtpClient.sendMessage(message);
+            requests.put(subject, call);
+        } catch (IOException e) {
+            e.printStackTrace();
+        } catch (MailException e) {
+            e.printStackTrace();
+        } finally {
+            try {
+                smtpClient.close();
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (MailException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+}



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