Author: mheath
Date: Sun Jan 14 22:14:40 2007
New Revision: 496235

URL: http://svn.apache.org/viewvc?view=rev&rev=496235
Log:
Updated API.

Added:
    mina/sandbox/mheath/aioj/trunk/README.txt
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java
      - copied, changed from r496215, 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/ConcurrentAsynchronousFileChannelProvider.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/PosixAsynchronousFileChannelProvider.java
    mina/sandbox/mheath/aioj/trunk/src/test/java/Test.java
Removed:
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java
Modified:
    mina/sandbox/mheath/aioj/trunk/NOTICE.txt
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioExceptionHandler.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioListener.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
    
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
    mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java

Modified: mina/sandbox/mheath/aioj/trunk/NOTICE.txt
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/NOTICE.txt?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/NOTICE.txt (original)
+++ mina/sandbox/mheath/aioj/trunk/NOTICE.txt Sun Jan 14 22:14:40 2007
@@ -1,2 +1,5 @@
+Asynchronous File I/O in Java
+Copyright 2007 The Apache Software Foundation.
+
 This product includes software developed by
 The Apache Software Foundation (http://www.apache.org/).

Added: mina/sandbox/mheath/aioj/trunk/README.txt
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/README.txt?view=auto&rev=496235
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/README.txt (added)
+++ mina/sandbox/mheath/aioj/trunk/README.txt Sun Jan 14 22:14:40 2007
@@ -0,0 +1,4 @@
+Asynchronous File I/O in Java
+
+Special thanks to Brigham Young University (http://byu.edu) for allowing Mike
+Heath to contribute to this project as part of his graduate studies.

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java 
(original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioBatchFuture.java 
Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 public interface AioBatchFuture extends AioFuture<Long, AioBatchFuture> {

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java
 (original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioByteBufferFuture.java
 Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 public interface AioByteBufferFuture extends AioFuture<Integer, 
AioByteBufferFuture>, ByteBufferPosition {

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java?view=auto&rev=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
 (added)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioCallbackException.java
 Sun Jan 14 22:14:40 2007
@@ -0,0 +1,59 @@
+/*
+ *  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.aio;
+
+import java.util.concurrent.ExecutionException;
+
+/**
+ * 
+ * 
+ * @author mheath
+ */
+public class AioCallbackException extends ExecutionException {
+
+       private static final long serialVersionUID = 1L;
+
+       private final AioFuture future;
+       
+       public AioCallbackException(AioFuture future) {
+               super();
+               this.future = future;
+       }
+
+       public AioCallbackException(AioFuture future, String message, Throwable 
cause) {
+               super(message, cause);
+               this.future = future;
+       }
+
+       public AioCallbackException(AioFuture future, String message) {
+               super(message);
+               this.future = future;
+       }
+
+       public AioCallbackException(AioFuture future, Throwable cause) {
+               super(cause);
+               this.future = future;
+       }
+
+       public AioFuture getAioFuture() {
+               return future;
+       }
+       
+}

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java?view=auto&rev=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java 
(added)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioException.java 
Sun Jan 14 22:14:40 2007
@@ -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.aio;
+
+public class AioException extends RuntimeException {
+
+       private static final long serialVersionUID = 1L;
+
+       public AioException() {
+       }
+
+       public AioException(String message) {
+               super(message);
+       }
+
+       public AioException(Throwable cause) {
+               super(cause);
+       }
+
+       public AioException(String message, Throwable cause) {
+               super(message, cause);
+       }
+
+}

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioExceptionHandler.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioExceptionHandler.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioExceptionHandler.java
 (original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioExceptionHandler.java
 Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 public interface AioExceptionHandler {

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java 
(original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioFuture.java 
Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 import java.util.concurrent.Future;

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioListener.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioListener.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioListener.java 
(original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioListener.java 
Sun Jan 14 22:14:40 2007
@@ -1,7 +1,26 @@
+/*
+ *  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.aio;
 
 public interface AioListener<T extends AioFuture> {
 
-       void onCompletion(T future);
+       void onCompletion(T future) throws AioCallbackException;
        
 }

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java 
(original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioLockFuture.java 
Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 import java.nio.channels.FileLock;

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java?view=auto&rev=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java 
(added)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioOpenFuture.java 
Sun Jan 14 22:14:40 2007
@@ -0,0 +1,24 @@
+/*
+ *  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.aio;
+
+public interface AioOpenFuture extends AioFuture<AsynchronousFileChannel, 
AioOpenFuture> {
+
+}

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java 
(original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AioSyncFuture.java 
Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 public interface AioSyncFuture extends AioFuture<Void, AioSyncFuture> {

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
 (original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannel.java
 Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 import java.nio.ByteBuffer;

Copied: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java
 (from r496215, 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java)
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java?view=diff&rev=496235&p1=mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java&r1=496215&p2=mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelProvider.java
 (original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/AsynchronousFileChannelFactory.java
 Sun Jan 14 22:14:40 2007
@@ -1,14 +1,68 @@
+/*
+ *  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.aio;
 
 import java.util.EnumSet;
 import java.util.Properties;
 
-public abstract class AsynchronousFileChannelProvider {
+import org.apache.aio.concurrent.ConcurrentAsynchronousFileChannelProvider;
+import org.apache.aio.posix.PosixAsynchronousFileChannelProvider;
 
-       public AioFuture<AsynchronousFileChannel, AioFuture> open(String 
fileName, EnumSet<Flags> flags) {
-               return open(fileName, flags, System.getProperties());
-       }
+public class AsynchronousFileChannelFactory {
+
+    public static final String PROPERTY_ASYNCHRONOUS_FILE_CHANNEL_PROVIDER = 
"org.apache.aio.asynchronousFileChannelProvider";
+
+    private static final String asynchronousFileChannelProvider = 
getDefaultAsynchronousFileChannelProvider();
+
+    private AsynchronousFileChannelFactory() {
+    }
+
+    private static String getDefaultAsynchronousFileChannelProvider() {
+        if ("Linux".equals(System.getProperty("os.name"))) {
+            // TODO Determine if we should only use the POSIX provider if 
we're using a 2.6+ kernel
+            return PosixAsynchronousFileChannelProvider.class.getName();
+        }
+        return ConcurrentAsynchronousFileChannelProvider.class.getName();
+    }
+
+    public static AioOpenFuture open(String fileName, EnumSet<Flags> flags) {
+        return open(fileName, flags, System.getProperties());
+    }
+
+    @SuppressWarnings("unchecked")
+    public static AioOpenFuture open(final String fileName, final 
EnumSet<Flags> flags, final Properties properties) {
+        String systemProvider = System.getProperty(
+                PROPERTY_ASYNCHRONOUS_FILE_CHANNEL_PROVIDER,
+                asynchronousFileChannelProvider);
+        String providerName = (properties == null) ? systemProvider : 
properties.getProperty(PROPERTY_ASYNCHRONOUS_FILE_CHANNEL_PROVIDER, 
systemProvider);
+        try {
+            Class<? extends AsynchronousFileChannelProvider> clazz = (Class<? 
extends AsynchronousFileChannelProvider>)Class.forName(providerName);
+            AsynchronousFileChannelProvider provider = clazz.newInstance();
+            return provider.open(fileName, flags, properties);
+        } catch (ClassNotFoundException e) {
+            throw new AioException(e);
+        } catch (InstantiationException e) {
+            throw new AioException(e);
+        } catch (IllegalAccessException e) {
+            throw new AioException(e);
+        }
+    }
 
-       public abstract AioFuture<AsynchronousFileChannel, AioFuture> 
open(String fileName, EnumSet<Flags> flags, Properties properties);
-       
 }

Modified: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
 (original)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/ByteBufferPosition.java
 Sun Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 import java.nio.ByteBuffer;

Modified: mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java?view=diff&rev=496235&r1=496234&r2=496235
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java 
(original)
+++ mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/Flags.java Sun 
Jan 14 22:14:40 2007
@@ -1,3 +1,22 @@
+/*
+ *  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.aio;
 
 public enum Flags {

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/ConcurrentAsynchronousFileChannelProvider.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/ConcurrentAsynchronousFileChannelProvider.java?view=auto&rev=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/ConcurrentAsynchronousFileChannelProvider.java
 (added)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/concurrent/ConcurrentAsynchronousFileChannelProvider.java
 Sun Jan 14 22:14:40 2007
@@ -0,0 +1,24 @@
+/*
+ *  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.aio.concurrent;
+
+public class ConcurrentAsynchronousFileChannelProvider {
+
+}

Added: 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/PosixAsynchronousFileChannelProvider.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/PosixAsynchronousFileChannelProvider.java?view=auto&rev=496235
==============================================================================
--- 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/PosixAsynchronousFileChannelProvider.java
 (added)
+++ 
mina/sandbox/mheath/aioj/trunk/src/main/java/org/apache/aio/posix/PosixAsynchronousFileChannelProvider.java
 Sun Jan 14 22:14:40 2007
@@ -0,0 +1,24 @@
+/*
+ *  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.aio.posix;
+
+public class PosixAsynchronousFileChannelProvider {
+
+}

Added: mina/sandbox/mheath/aioj/trunk/src/test/java/Test.java
URL: 
http://svn.apache.org/viewvc/mina/sandbox/mheath/aioj/trunk/src/test/java/Test.java?view=auto&rev=496235
==============================================================================
--- mina/sandbox/mheath/aioj/trunk/src/test/java/Test.java (added)
+++ mina/sandbox/mheath/aioj/trunk/src/test/java/Test.java Sun Jan 14 22:14:40 
2007
@@ -0,0 +1,11 @@
+
+public class Test {
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               System.getProperties().list(System.out);
+       }
+
+}


Reply via email to