Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TSet.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TSet.java?rev=999022&view=auto
==============================================================================
--- incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TSet.java 
(added)
+++ incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TSet.java 
Mon Sep 20 17:49:09 2010
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.protocol;
+
+/**
+ * Helper class that encapsulates set metadata.
+ *
+ */
+public class TSet {
+  public TSet() {}
+
+  public TSet(byte t, int s) {
+    elemType = t;
+    size = s;
+  }
+
+  public byte elemType = TType.STOP;
+  public int  size     = 0;
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TStruct.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TStruct.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TStruct.java 
(added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TStruct.java 
Mon Sep 20 17:49:09 2010
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.protocol;
+
+/**
+ * Helper class that encapsulates struct metadata.
+ *
+ */
+public class TStruct {
+  public TStruct() {}
+
+  public TStruct(String n) {
+    name = n;
+  }
+
+  public String name = "";
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TType.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TType.java?rev=999022&view=auto
==============================================================================
--- incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TType.java 
(added)
+++ incubator/thrift/trunk/lib/javame/src/org/apache/thrift/protocol/TType.java 
Mon Sep 20 17:49:09 2010
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.protocol;
+
+/**
+ * Type constants in the Thrift protocol.
+ *
+ */
+public final class TType {
+  public static final byte STOP   = 0;
+  public static final byte VOID   = 1;
+  public static final byte BOOL   = 2;
+  public static final byte BYTE   = 3;
+  public static final byte DOUBLE = 4;
+  public static final byte I16    = 6;
+  public static final byte I32    = 8;
+  public static final byte I64    = 10;
+  public static final byte STRING = 11;
+  public static final byte STRUCT = 12;
+  public static final byte MAP    = 13;
+  public static final byte SET    = 14;
+  public static final byte LIST   = 15;
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TFramedTransport.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TFramedTransport.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TFramedTransport.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TFramedTransport.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+import java.io.ByteArrayInputStream;
+
+import org.apache.thrift.TByteArrayOutputStream;
+
+/**
+ * Socket implementation of the TTransport interface. To be commented soon!
+ *
+ */
+public class TFramedTransport extends TTransport {
+
+  /**
+   * Underlying transport
+   */
+  private TTransport transport_ = null;
+
+  /**
+   * Buffer for output
+   */
+  private final TByteArrayOutputStream writeBuffer_ =
+    new TByteArrayOutputStream(1024);
+
+  /**
+   * Buffer for input
+   */
+  private ByteArrayInputStream readBuffer_ = null;
+
+  public static class Factory extends TTransportFactory {
+    public Factory() {
+    }
+
+    public TTransport getTransport(TTransport base) {
+      return new TFramedTransport(base);
+    }
+  }
+
+  /**
+   * Constructor wraps around another tranpsort
+   */
+  public TFramedTransport(TTransport transport) {
+    transport_ = transport;
+  }
+
+  public void open() throws TTransportException {
+    transport_.open();
+  }
+
+  public boolean isOpen() {
+    return transport_.isOpen();
+  }
+
+  public void close() {
+    transport_.close();
+  }
+
+  public int read(byte[] buf, int off, int len) throws TTransportException {
+    if (readBuffer_ != null) {
+      int got = readBuffer_.read(buf, off, len);
+      if (got > 0) {
+        return got;
+      }
+    }
+
+    // Read another frame of data
+    readFrame();
+
+    return readBuffer_.read(buf, off, len);
+  }
+
+  private void readFrame() throws TTransportException {
+    byte[] i32rd = new byte[4];
+    transport_.readAll(i32rd, 0, 4);
+    int size =
+      ((i32rd[0] & 0xff) << 24) |
+      ((i32rd[1] & 0xff) << 16) |
+      ((i32rd[2] & 0xff) <<  8) |
+      ((i32rd[3] & 0xff));
+
+    byte[] buff = new byte[size];
+    transport_.readAll(buff, 0, size);
+    readBuffer_ = new ByteArrayInputStream(buff);
+  }
+
+  public void write(byte[] buf, int off, int len) throws TTransportException {
+    writeBuffer_.write(buf, off, len);
+  }
+
+  public void flush() throws TTransportException {
+    byte[] buf = writeBuffer_.get();
+    int len = writeBuffer_.len();
+    writeBuffer_.reset();
+
+    byte[] i32out = new byte[4];
+    i32out[0] = (byte)(0xff & (len >> 24));
+    i32out[1] = (byte)(0xff & (len >> 16));
+    i32out[2] = (byte)(0xff & (len >> 8));
+    i32out[3] = (byte)(0xff & (len));
+    transport_.write(i32out, 0, 4);
+    transport_.write(buf, 0, len);
+    transport_.flush();
+  }
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/THttpClient.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/THttpClient.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/THttpClient.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/THttpClient.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,167 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import javax.microedition.io.Connector;
+import javax.microedition.io.HttpConnection;
+
+/**
+ * HTTP implementation of the TTransport interface. Used for working with a
+ * Thrift web services implementation.
+ *
+ */
+public class THttpClient extends TTransport {
+
+  private String url_ = null;
+
+  private final ByteArrayOutputStream requestBuffer_ = new 
ByteArrayOutputStream();
+
+  private InputStream inputStream_ = null;
+
+  private int connectTimeout_ = 0;
+
+  private int readTimeout_ = 0;
+
+  private Hashtable customHeaders_ = null;
+
+  public THttpClient(String url) throws TTransportException {
+                url_ = url;
+  }
+
+  public void setConnectTimeout(int timeout) {
+    connectTimeout_ = timeout;
+  }
+
+  public void setReadTimeout(int timeout) {
+    readTimeout_ = timeout;
+  }
+
+  public void setCustomHeaders(Hashtable headers) {
+    customHeaders_ = headers;
+  }
+
+  public void setCustomHeader(String key, String value) {
+    if (customHeaders_ == null) {
+      customHeaders_ = new Hashtable();
+    }
+    customHeaders_.put(key, value);
+  }
+
+  public void open() {}
+
+  public void close() {
+    if (null != inputStream_) {
+      try {
+        inputStream_.close();
+      } catch (IOException ioe) {
+      }
+      inputStream_ = null;
+    }
+  }
+
+  public boolean isOpen() {
+    return true;
+  }
+
+  public int read(byte[] buf, int off, int len) throws TTransportException {
+    if (inputStream_ == null) {
+      throw new TTransportException("Response buffer is empty, no request.");
+    }
+    try {
+      int ret = inputStream_.read(buf, off, len);
+      if (ret == -1) {
+        throw new TTransportException("No more data available.");
+      }
+      return ret;
+    } catch (IOException iox) {
+      throw new TTransportException(iox);
+    }
+  }
+
+  public void write(byte[] buf, int off, int len) {
+    requestBuffer_.write(buf, off, len);
+  }
+  
+    public void flush() throws TTransportException {
+    // Extract request and reset buffer
+        byte[] data = requestBuffer_.toByteArray();
+        requestBuffer_.reset();
+
+        try {
+            // Create connection object
+            HttpConnection connection = (HttpConnection)Connector.open(url_);
+    
+            // Timeouts, only if explicitly set
+            if (connectTimeout_ > 0) {
+            //  XXX: not available
+            //  connection.setConnectTimeout(connectTimeout_);
+            }   
+            if (readTimeout_ > 0) {
+            //  XXX: not available
+            //  connection.setReadTimeout(readTimeout_);
+            }
+    
+            // Make the request
+            connection.setRequestMethod("POST");
+            connection.setRequestProperty("Content-Type", 
"application/x-thrift");
+            connection.setRequestProperty("Accept", "application/x-thrift");
+            connection.setRequestProperty("User-Agent", "JavaME/THttpClient");
+
+            connection.setRequestProperty("Connection", "Keep-Alive");
+            connection.setRequestProperty("Keep-Alive", "5000");
+            connection.setRequestProperty("Http-version", "HTTP/1.1");
+            connection.setRequestProperty("Cache-Control", "no-transform");
+
+
+            if (customHeaders_ != null) {
+                for (Enumeration e = customHeaders_.keys() ; 
e.hasMoreElements() ;) {
+                    String key = (String)e.nextElement();
+                    String value = (String)customHeaders_.get(key);
+                    connection.setRequestProperty(key, value);
+                }
+            }
+            // connection.setDoOutput(true);
+            //  connection.connect();
+    
+            OutputStream os = connection.openOutputStream();
+            os.write(data);
+            os.close();
+
+            int responseCode = connection.getResponseCode();
+            if (responseCode != HttpConnection.HTTP_OK) {
+                throw new TTransportException("HTTP Response code: " + 
responseCode);
+            }
+
+            // Read the responses
+            inputStream_ = connection.openInputStream();
+
+        } catch (IOException iox) {
+            System.out.println(iox.toString());
+            throw new TTransportException(iox);
+        }
+    }
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TIOStreamTransport.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TIOStreamTransport.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TIOStreamTransport.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TIOStreamTransport.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,153 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+/**
+ * This is the most commonly used base transport. It takes an InputStream
+ * and an OutputStream and uses those to perform all transport operations.
+ * This allows for compatibility with all the nice constructs Java already
+ * has to provide a variety of types of streams.
+ *
+ */
+public class TIOStreamTransport extends TTransport {
+
+
+  /** Underlying inputStream */
+  protected InputStream inputStream_ = null;
+
+  /** Underlying outputStream */
+  protected OutputStream outputStream_ = null;
+
+  /**
+   * Subclasses can invoke the default constructor and then assign the input
+   * streams in the open method.
+   */
+  protected TIOStreamTransport() {}
+
+  /**
+   * Input stream constructor.
+   *
+   * @param is Input stream to read from
+   */
+  public TIOStreamTransport(InputStream is) {
+    inputStream_ = is;
+  }
+
+  /**
+   * Output stream constructor.
+   *
+   * @param os Output stream to read from
+   */
+  public TIOStreamTransport(OutputStream os) {
+    outputStream_ = os;
+  }
+
+  /**
+   * Two-way stream constructor.
+   *
+   * @param is Input stream to read from
+   * @param os Output stream to read from
+   */
+  public TIOStreamTransport(InputStream is, OutputStream os) {
+    inputStream_ = is;
+    outputStream_ = os;
+  }
+
+  /**
+   * The streams must already be open at construction time, so this should
+   * always return true.
+   *
+   * @return true
+   */
+  public boolean isOpen() {
+    return true;
+  }
+
+  /**
+   * The streams must already be open. This method does nothing.
+   */
+  public void open() throws TTransportException {}
+
+  /**
+   * Closes both the input and output streams.
+   */
+  public void close() {
+    if (inputStream_ != null) {
+      try {
+        inputStream_.close();
+      } catch (IOException iox) {
+      }
+      inputStream_ = null;
+    }
+    if (outputStream_ != null) {
+      try {
+        outputStream_.close();
+      } catch (IOException iox) {
+      }
+      outputStream_ = null;
+    }
+  }
+
+  /**
+   * Reads from the underlying input stream if not null.
+   */
+  public int read(byte[] buf, int off, int len) throws TTransportException {
+    if (inputStream_ == null) {
+      throw new TTransportException(TTransportException.NOT_OPEN, "Cannot read 
from null inputStream");
+    }
+    try {
+      return inputStream_.read(buf, off, len);
+    } catch (IOException iox) {
+      throw new TTransportException(TTransportException.UNKNOWN, iox);
+    }
+  }
+
+  /**
+   * Writes to the underlying output stream if not null.
+   */
+  public void write(byte[] buf, int off, int len) throws TTransportException {
+    if (outputStream_ == null) {
+      throw new TTransportException(TTransportException.NOT_OPEN, "Cannot 
write to null outputStream");
+    }
+    try {
+      outputStream_.write(buf, off, len);
+    } catch (IOException iox) {
+      throw new TTransportException(TTransportException.UNKNOWN, iox);
+    }
+  }
+
+  /**
+   * Flushes the underlying output stream if not null.
+   */
+  public void flush() throws TTransportException {
+    if (outputStream_ == null) {
+      throw new TTransportException(TTransportException.NOT_OPEN, "Cannot 
flush null outputStream");
+    }
+    try {
+      outputStream_.flush();
+    } catch (IOException iox) {
+      throw new TTransportException(TTransportException.UNKNOWN, iox);
+    }
+  }
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransport.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransport.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransport.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransport.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+/**
+ * Generic class that encapsulates the I/O layer. This is basically a thin
+ * wrapper around the combined functionality of Java input/output streams.
+ *
+ */
+public abstract class TTransport {
+
+  /**
+   * Queries whether the transport is open.
+   *
+   * @return True if the transport is open.
+   */
+  public abstract boolean isOpen();
+
+  /**
+   * Is there more data to be read?
+   *
+   * @return True if the remote side is still alive and feeding us
+   */
+  public boolean peek() {
+    return isOpen();
+  }
+
+  /**
+   * Opens the transport for reading/writing.
+   *
+   * @throws TTransportException if the transport could not be opened
+   */
+  public abstract void open()
+    throws TTransportException;
+
+  /**
+   * Closes the transport.
+   */
+  public abstract void close();
+
+  /**
+   * Reads up to len bytes into buffer buf, starting att offset off.
+   *
+   * @param buf Array to read into
+   * @param off Index to start reading at
+   * @param len Maximum number of bytes to read
+   * @return The number of bytes actually read
+   * @throws TTransportException if there was an error reading data
+   */
+  public abstract int read(byte[] buf, int off, int len)
+    throws TTransportException;
+
+  /**
+   * Guarantees that all of len bytes are actually read off the transport.
+   *
+   * @param buf Array to read into
+   * @param off Index to start reading at
+   * @param len Maximum number of bytes to read
+   * @return The number of bytes actually read, which must be equal to len
+   * @throws TTransportException if there was an error reading data
+   */
+  public int readAll(byte[] buf, int off, int len)
+    throws TTransportException {
+    int got = 0;
+    int ret = 0;
+    while (got < len) {
+      ret = read(buf, off+got, len-got);
+      if (ret <= 0) {
+        throw new TTransportException("Cannot read. Remote side has closed. 
Tried to read " + len + " bytes, but only got " + got + " bytes.");
+      }
+      got += ret;
+    }
+    return got;
+  }
+
+  /**
+   * Writes the buffer to the output
+   *
+   * @param buf The output data buffer
+   * @throws TTransportException if an error occurs writing data
+   */
+  public void write(byte[] buf) throws TTransportException {
+    write(buf, 0, buf.length);
+  }
+
+  /**
+   * Writes up to len bytes from the buffer.
+   *
+   * @param buf The output data buffer
+   * @param off The offset to start writing from
+   * @param len The number of bytes to write
+   * @throws TTransportException if there was an error writing data
+   */
+  public abstract void write(byte[] buf, int off, int len)
+    throws TTransportException;
+
+  /**
+   * Flush any pending data out of a transport buffer.
+   *
+   * @throws TTransportException if there was an error writing out data.
+   */
+  public void flush()
+    throws TTransportException {}
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportException.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportException.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportException.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportException.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+import org.apache.thrift.TException;
+
+/**
+ * Transport exceptions.
+ *
+ */
+public class TTransportException extends TException {
+
+  private static final long serialVersionUID = 1L;
+
+  public static final int UNKNOWN = 0;
+  public static final int NOT_OPEN = 1;
+  public static final int ALREADY_OPEN = 2;
+  public static final int TIMED_OUT = 3;
+  public static final int END_OF_FILE = 4;
+
+  protected int type_ = UNKNOWN;
+
+  public TTransportException() {
+    super();
+  }
+
+  public TTransportException(int type) {
+    super();
+    type_ = type;
+  }
+
+  public TTransportException(int type, String message) {
+    super(message);
+    type_ = type;
+  }
+
+  public TTransportException(String message) {
+    super(message);
+  }
+
+  public TTransportException(int type, Throwable cause) {
+    super(cause);
+    type_ = type;
+  }
+
+  public TTransportException(Throwable cause) {
+    super(cause);
+  }
+
+  public TTransportException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public TTransportException(int type, String message, Throwable cause) {
+    super(message, cause);
+    type_ = type;
+  }
+
+  public int getType() {
+    return type_;
+  }
+
+}

Added: 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportFactory.java?rev=999022&view=auto
==============================================================================
--- 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportFactory.java
 (added)
+++ 
incubator/thrift/trunk/lib/javame/src/org/apache/thrift/transport/TTransportFactory.java
 Mon Sep 20 17:49:09 2010
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.thrift.transport;
+
+/**
+ * Factory class used to create wrapped instance of Transports.
+ * This is used primarily in servers, which get Transports from
+ * a ServerTransport and then may want to mutate them (i.e. create
+ * a BufferedTransport from the underlying base transport)
+ *
+ */
+public class TTransportFactory {
+
+  /**
+   * Return a wrapped instance of the base Transport.
+   *
+   * @param in The base transport
+   * @returns Wrapped Transport
+   */
+  public TTransport getTransport(TTransport trans) {
+    return trans;
+  }
+
+}


Reply via email to