Author: mheath
Date: Tue Jan 30 20:50:55 2007
New Revision: 501729

URL: http://svn.apache.org/viewvc?view=rev&rev=501729
Log:
Added some JNI testing in preparation for POSIX AIO support.

Added:
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/test/Test.java
Modified:
    mina/sandbox/mheath/aioj/trunk/src/main/c/Makefile
    mina/sandbox/mheath/aioj/trunk/src/main/c/org_apache_aio.cpp

Modified: mina/sandbox/mheath/aioj/trunk/src/main/c/Makefile
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/c/Makefile?view=diff&rev=501729&r1=501728&r2=501729
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/c/Makefile (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/c/Makefile Tue Jan 30 20:50:55 2007
@@ -25,5 +25,9 @@
 
 all: $(TARGET)
 
-$(TARGET): org_apache_aio.cpp
+$(TARGET): org_apache_aio.cpp $(WORKING_DIR)/org_apache_aio_test_Test.h
        g++ -shared -lrt -lstdc++ $(INCLUDES) org_apache_aio.cpp -o $(TARGET)
+
+$(WORKING_DIR)/org_apache_aio_test_Test.h: 
$(TARGET_DIR)/classes/org/apache/aio/test/Test.class
+       mkdir -p $(TARGET_DIR)/jni
+       javah -force -classpath $(JAVAH_CLASSPATH) -d $(WORKING_DIR) 
org.apache.aio.test.Test

Modified: mina/sandbox/mheath/aioj/trunk/src/main/c/org_apache_aio.cpp
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/c/org_apache_aio.cpp?view=diff&rev=501729&r1=501728&r2=501729
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/c/org_apache_aio.cpp (original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/c/org_apache_aio.cpp Tue Jan 30 
20:50:55 2007
@@ -4,6 +4,8 @@
 #include <stdio.h>
 #include <string.h>
 
+#include "org_apache_aio_test_Test.h"
+
 #define DEBUG
 
 #ifdef DEBUG
@@ -65,4 +67,26 @@
        
        env->DeleteWeakGlobalRef(ioException);
        env->DeleteWeakGlobalRef(nullPointerException);
+}
+
+/**********************************************************************************************************************
+ * 
+ * org.apache.aio.test.Test methods
+ * 
+ 
*********************************************************************************************************************/
+
+JNIEXPORT void JNICALL Java_org_apache_aio_test_Test_read(JNIEnv *env, jobject 
self, jobject buffer)
+{
+       LOG_DEBUG("read\n");
+
+       void *address = env->GetDirectBufferAddress(buffer);
+       if (address == NULL) {
+               LOG_DEBUG("Non-direct buffer\n");
+               
+       }
+}
+
+JNIEXPORT void JNICALL Java_org_apache_aio_test_Test_write(JNIEnv *env, 
jobject self, jobject buffer)
+{
+       LOG_DEBUG("write\n");
 }

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/test/Test.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/test/Test.java?view=auto&rev=501729
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/test/Test.java 
(added)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/test/Test.java 
Tue Jan 30 20:50:55 2007
@@ -0,0 +1,23 @@
+package org.apache.aio.test;
+
+import java.nio.ByteBuffer;
+
+public class Test {
+    
+    static {
+        System.loadLibrary("aioj");
+    }
+    
+    public native void read(ByteBuffer buffer);
+    
+    public native void write(ByteBuffer buffer);
+
+    public static void main(String[] args) {
+        Test test = new Test();
+        
+        ByteBuffer buffer = ByteBuffer.allocate(1024);
+        test.read(buffer);
+        test.write(buffer);
+    }
+    
+}


Reply via email to