|
From: <hag...@us...> - 2006-12-14 14:56:05
|
Revision: 2928
http://jnode.svn.sourceforge.net/jnode/?rev=2928&view=rev
Author: hagar-wize
Date: 2006-12-14 06:56:03 -0800 (Thu, 14 Dec 2006)
Log Message:
-----------
Classpath patches - with a stub class that needs to be worked on
Modified Paths:
--------------
trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/VmChannel.java
Modified: trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-14 13:00:14 UTC (rev 2927)
+++ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-14 14:56:03 UTC (rev 2928)
@@ -50,6 +50,8 @@
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
+import org.jnode.vm.VmChannel;
+
/**
* Native interface to support configuring of channel to run in a non-blocking
* manner and support scatter/gather io operations.
@@ -103,28 +105,25 @@
{
System.loadLibrary ("javanio");
}
- initIDs();
+ VmChannel.initIDs();
}
public static VMChannel getStdin() throws IOException
{
- return new VMChannel(stdin_fd());
+ return new VMChannel(VmChannel.stdin_fd());
}
public static VMChannel getStdout() throws IOException
{
- return new VMChannel(stdout_fd());
+ return new VMChannel(VmChannel.stdout_fd());
}
public static VMChannel getStderr() throws IOException
{
- return new VMChannel(stderr_fd());
+ return new VMChannel(VmChannel.stderr_fd());
}
- private static native int stdin_fd();
- private static native int stdout_fd();
- private static native int stderr_fd();
-
+
/**
* Set the file descriptor to have the required blocking
* setting.
@@ -133,18 +132,15 @@
*/
public void setBlocking(boolean blocking) throws IOException
{
- setBlocking(nfd.getNativeFD(), blocking);
+ VmChannel.setBlocking(nfd.getNativeFD(), blocking);
}
- private static native void setBlocking(int fd, boolean blocking)
- throws IOException;
-
+
public int available() throws IOException
{
- return available(nfd.getNativeFD());
+ return VmChannel.available(nfd.getNativeFD());
}
- private static native int available(int native_fd) throws IOException;
/**
* Reads a byte buffer directly using the supplied file descriptor.
@@ -156,11 +152,9 @@
public int read(ByteBuffer dst)
throws IOException
{
- return read(nfd.getNativeFD(), dst);
+ return VmChannel.read(nfd.getNativeFD(), dst);
}
- private static native int read(int fd, ByteBuffer dst) throws IOException;
-
/**
* Read a single byte.
*
@@ -169,11 +163,10 @@
*/
public int read() throws IOException
{
- return read(nfd.getNativeFD());
+ return VmChannel.read(nfd.getNativeFD());
}
- private static native int read(int fd) throws IOException;
-
+
/**
* Reads into byte buffers directly using the supplied file descriptor.
* Assumes that the buffer list contains DirectBuffers. Will perform a
@@ -191,13 +184,10 @@
if (offset + length > dsts.length)
throw new IndexOutOfBoundsException("offset + length > dsts.length");
- return readScattering(nfd.getNativeFD(), dsts, offset, length);
+ return VmChannel.readScattering(nfd.getNativeFD(), dsts, offset, length);
}
- private static native long readScattering(int fd, ByteBuffer[] dsts,
- int offset, int length)
- throws IOException;
-
+
/**
* Receive a datagram on this channel, returning the host address
* that sent the datagram.
@@ -211,7 +201,7 @@
if (kind != Kind.SOCK_DGRAM)
throw new SocketException("not a datagram socket");
ByteBuffer hostPort = ByteBuffer.allocateDirect(18);
- int hostlen = receive(nfd.getNativeFD(), dst, hostPort);
+ int hostlen = VmChannel.receive(nfd.getNativeFD(), dst, hostPort);
if (hostlen == 0)
return null;
if (hostlen == 4) // IPv4
@@ -233,9 +223,6 @@
+ hostlen);
}
- private static native int receive (int fd, ByteBuffer dst, ByteBuffer address)
- throws IOException;
-
/**
* Writes from a direct byte bufer using the supplied file descriptor.
* Assumes the buffer is a DirectBuffer.
@@ -246,10 +233,9 @@
*/
public int write(ByteBuffer src) throws IOException
{
- return write(nfd.getNativeFD(), src);
+ return VmChannel.write(nfd.getNativeFD(), src);
}
- private native int write(int fd, ByteBuffer src) throws IOException;
/**
* Writes from byte buffers directly using the supplied file descriptor.
@@ -284,13 +270,10 @@
if (length > srcs.length - offset)
length = srcs.length - offset;
- return writeGathering(nfd.getNativeFD(), srcs, offset, length);
+ return VmChannel.writeGathering(nfd.getNativeFD(), srcs, offset, length);
}
- private native long writeGathering(int fd, ByteBuffer[] srcs,
- int offset, int length)
- throws IOException;
-
+
/**
* Send a datagram to the given address.
*
@@ -306,21 +289,13 @@
if (addr == null)
throw new NullPointerException();
if (addr instanceof Inet4Address)
- return send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
+ return VmChannel.send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
else if (addr instanceof Inet6Address)
- return send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
+ return VmChannel.send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
else
throw new SocketException("unrecognized inet address type");
}
- // Send to an IPv4 address.
- private static native int send(int fd, ByteBuffer src, byte[] addr, int port)
- throws IOException;
-
- // Send to an IPv6 address.
- private static native int send6(int fd, ByteBuffer src, byte[] addr, int port)
- throws IOException;
-
/**
* Write a single byte.
*
@@ -329,12 +304,9 @@
*/
public void write(int b) throws IOException
{
- write(nfd.getNativeFD(), b);
+ VmChannel.write(nfd.getNativeFD(), b);
}
- private static native void write(int fd, int b) throws IOException;
-
- private native static void initIDs();
// Network (socket) specific methods.
@@ -355,17 +327,9 @@
kind = Kind.SOCK_STREAM;
else
kind = Kind.SOCK_DGRAM;
- nfd.setNativeFD(socket(stream));
+ nfd.setNativeFD(VmChannel.socket(stream));
}
- /**
- * Create a new socket, returning the native file descriptor.
- *
- * @param stream Set to true for streaming sockets; false for datagrams.
- * @return The native file descriptor.
- * @throws IOException If creating the socket fails.
- */
- private static native int socket(boolean stream) throws IOException;
/**
* Connect the underlying socket file descriptor to the remote host.
@@ -396,20 +360,14 @@
}
if (addr instanceof Inet4Address)
- return connect(fd, addr.getAddress(), saddr.getPort(),
+ return VmChannel.connect(fd, addr.getAddress(), saddr.getPort(),
timeout);
if (addr instanceof Inet6Address)
- return connect6(fd, addr.getAddress(), saddr.getPort(),
+ return VmChannel.connect6(fd, addr.getAddress(), saddr.getPort(),
timeout);
throw new SocketException("unsupported internet address");
}
- private static native boolean connect(int fd, byte[] addr, int port, int timeout)
- throws SocketException;
-
- private static native boolean connect6(int fd, byte[] addr, int port, int timeout)
- throws SocketException;
-
/**
* Disconnect this channel, if it is a datagram socket. Disconnecting
* a datagram channel will disassociate it from any address, so the
@@ -423,17 +381,16 @@
{
if (kind != Kind.SOCK_DGRAM)
throw new IOException("can only disconnect datagram channels");
- disconnect(nfd.getNativeFD());
+ VmChannel.disconnect(nfd.getNativeFD());
}
- private static native void disconnect(int fd) throws IOException;
-
+
public InetSocketAddress getLocalAddress() throws IOException
{
if (!nfd.isValid())
return null;
ByteBuffer name = ByteBuffer.allocateDirect(18);
- int namelen = getsockname(nfd.getNativeFD(), name);
+ int namelen = VmChannel.getsockname(nfd.getNativeFD(), name);
if (namelen == 0) // not bound
return null; // XXX return some wildcard?
if (namelen == 4)
@@ -453,9 +410,6 @@
throw new SocketException("invalid address length");
}
- private static native int getsockname(int fd, ByteBuffer name)
- throws IOException;
-
/**
* Returns the socket address of the remote peer this channel is connected
* to, or null if this channel is not yet connected.
@@ -468,7 +422,7 @@
if (!nfd.isValid())
return null;
ByteBuffer name = ByteBuffer.allocateDirect(18);
- int namelen = getpeername (nfd.getNativeFD(), name);
+ int namelen = VmChannel.getpeername (nfd.getNativeFD(), name);
if (namelen == 0) // not connected yet
return null;
if (namelen == 4) // IPv4
@@ -488,14 +442,7 @@
throw new SocketException("invalid address length");
}
- /*
- * The format here is the peer address, followed by the port number.
- * The returned value is the length of the peer address; thus, there
- * will be LEN + 2 valid bytes put into NAME.
- */
- private static native int getpeername(int fd, ByteBuffer name)
- throws IOException;
-
+
/**
* Accept an incoming connection, returning a new VMChannel, or null
* if the channel is nonblocking and no connection is pending.
@@ -505,14 +452,12 @@
*/
public VMChannel accept() throws IOException
{
- int new_fd = accept(nfd.getNativeFD());
+ int new_fd = VmChannel.accept(nfd.getNativeFD());
if (new_fd == -1) // non-blocking accept had no pending connection
return null;
return new VMChannel(new_fd);
}
- private static native int accept(int native_fd) throws IOException;
-
// File-specific methods.
/**
@@ -527,91 +472,76 @@
{
if (nfd.isValid() || nfd.isClosed())
throw new IOException("can't reinitialize this channel");
- int fd = open(path, mode);
+ int fd = VmChannel.open(path, mode);
nfd.setNativeFD(fd);
kind = Kind.FILE;
}
- private static native int open(String path, int mode) throws IOException;
-
+
public long position() throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- return position(nfd.getNativeFD());
+ return VmChannel.position(nfd.getNativeFD());
}
- private static native long position(int fd) throws IOException;
-
+
public void seek(long pos) throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- seek(nfd.getNativeFD(), pos);
+ VmChannel.seek(nfd.getNativeFD(), pos);
}
- private static native void seek(int fd, long pos) throws IOException;
public void truncate(long length) throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- truncate(nfd.getNativeFD(), length);
+ VmChannel.truncate(nfd.getNativeFD(), length);
}
- private static native void truncate(int fd, long len) throws IOException;
-
+
public boolean lock(long pos, long len, boolean shared, boolean wait)
throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- return lock(nfd.getNativeFD(), pos, len, shared, wait);
+ return VmChannel.lock(nfd.getNativeFD(), pos, len, shared, wait);
}
- private static native boolean lock(int fd, long pos, long len,
- boolean shared, boolean wait)
- throws IOException;
-
+
public void unlock(long pos, long len) throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- unlock(nfd.getNativeFD(), pos, len);
+ VmChannel.unlock(nfd.getNativeFD(), pos, len);
}
- private static native void unlock(int fd, long pos, long len) throws IOException;
-
+
public long size() throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- return size(nfd.getNativeFD());
+ return VmChannel.size(nfd.getNativeFD());
}
- private static native long size(int fd) throws IOException;
-
public MappedByteBuffer map(char mode, long position, int size)
throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- return map(nfd.getNativeFD(), mode, position, size);
+ return VmChannel.map(nfd.getNativeFD(), mode, position, size);
}
- private static native MappedByteBuffer map(int fd, char mode,
- long position, int size)
- throws IOException;
-
+
public boolean flush(boolean metadata) throws IOException
{
if (kind != Kind.FILE)
throw new IOException("not a file");
- return flush(nfd.getNativeFD(), metadata);
+ return VmChannel.flush(nfd.getNativeFD(), metadata);
}
- private static native boolean flush(int fd, boolean metadata) throws IOException;
-
// Close.
/**
@@ -626,8 +556,7 @@
nfd.close();
}
- static native void close(int native_fd) throws IOException;
-
+
/**
* <p>Provides a simple mean for the JNI code to find out whether the
* current thread was interrupted by a call to Thread.interrupt().</p>
@@ -696,7 +625,7 @@
throw new IOException("invalid file descriptor");
try
{
- VMChannel.close(native_fd);
+ VmChannel.close(native_fd);
}
finally
{
Added: trunk/core/src/core/org/jnode/vm/VmChannel.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmChannel.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/VmChannel.java 2006-12-14 14:56:03 UTC (rev 2928)
@@ -0,0 +1,118 @@
+package org.jnode.vm;
+
+import gnu.classpath.Configuration;
+import gnu.java.nio.VMChannel;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+import java.net.*;
+
+/**
+ * Native interface to support configuring of channel to run in a non-blocking
+ * manner and support scatter/gather io operations.
+ *
+ * @author
+ *
+ */
+public final class VmChannel
+{
+
+ public static int stdin_fd(){return 0;}
+ public static int stdout_fd(){return 0;}
+ public static int stderr_fd(){return 0;}
+
+ public static void setBlocking(int fd, boolean blocking)
+ throws IOException{}
+
+ public static int available(int native_fd) throws IOException{return 0;}
+
+ public static int read(int fd, ByteBuffer dst) throws IOException{return 0;}
+
+
+ public static int read(int fd) throws IOException{return 0;}
+ public static long readScattering(int fd, ByteBuffer[] dsts,
+ int offset, int length)
+ throws IOException{return 0;}
+
+
+ public static int receive (int fd, ByteBuffer dst, ByteBuffer address)
+ throws IOException{return 0;}
+
+ public static int write(int fd, ByteBuffer src) throws IOException{return 0;}
+
+ public static long writeGathering(int fd, ByteBuffer[] srcs,
+ int offset, int length)
+ throws IOException{return 0;}
+
+ // Send to an IPv4 address.
+ public static int send(int fd, ByteBuffer src, byte[] addr, int port)
+ throws IOException{return 0;}
+
+ // Send to an IPv6 address.
+ public static int send6(int fd, ByteBuffer src, byte[] addr, int port)
+ throws IOException{return 0;}
+
+ public static void write(int fd, int b) throws IOException{}
+
+ public static void initIDs(){}
+
+ // Network (socket) specific methods.
+
+
+ /**
+ * Create a new socket, returning the native file descriptor.
+ *
+ * @param stream Set to true for streaming sockets{} false for datagrams.
+ * @return The native file descriptor.
+ * @throws java.io.IOException If creating the socket fails.
+ */
+ public static int socket(boolean stream) throws IOException{return 0;}
+
+
+ public static boolean connect(int fd, byte[] addr, int port, int timeout)
+ throws SocketException{return false;}
+
+ public static boolean connect6(int fd, byte[] addr, int port, int timeout)
+ throws SocketException{return false;}
+
+ public static void disconnect(int fd) throws IOException{}
+
+ public static int getsockname(int fd, ByteBuffer name)
+ throws IOException{return 0;}
+
+ /*
+ * The format here is the peer address, followed by the port number.
+ * The returned value is the length of the peer address{} thus, there
+ * will be LEN + 2 valid bytes put into NAME.
+ */
+ public static int getpeername(int fd, ByteBuffer name)
+ throws IOException{return 0;}
+
+ public static int accept(int native_fd) throws IOException{return 0;}
+
+
+ public static int open(String path, int mode) throws IOException{return 0;}
+
+ public static long position(int fd) throws IOException{return 0;}
+
+ public static void seek(int fd, long pos) throws IOException{}
+
+ public static void truncate(int fd, long len) throws IOException{}
+
+ public static boolean lock(int fd, long pos, long len,
+ boolean shared, boolean wait)
+ throws IOException{return false;}
+
+ public static void unlock(int fd, long pos, long len) throws IOException{}
+
+ public static long size(int fd) throws IOException{return 0;}
+
+ public static MappedByteBuffer map(int fd, char mode,
+ long position, int size)
+ throws IOException{return null;}
+
+ public static boolean flush(int fd, boolean metadata) throws IOException{return false;}
+
+ public static void close(int native_fd) throws IOException{}
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hag...@us...> - 2006-12-20 12:02:06
|
Revision: 2946
http://jnode.svn.sourceforge.net/jnode/?rev=2946&view=rev
Author: hagar-wize
Date: 2006-12-20 04:01:58 -0800 (Wed, 20 Dec 2006)
Log Message:
-----------
Classpath patches - with a stub class that needs to be worked on - recommit, but note these are not currently used
Added Paths:
-----------
trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
trunk/core/src/core/org/jnode/vm/VmChannel.java
Added: trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java (rev 0)
+++ trunk/core/src/classpath/vm/gnu/java/nio/VMChannel.java 2006-12-20 12:01:58 UTC (rev 2946)
@@ -0,0 +1,686 @@
+/* VMChannel.java -- Native interface suppling channel operations.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package gnu.java.nio;
+
+import gnu.classpath.Configuration;
+
+import java.io.IOException;
+import java.net.Inet4Address;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.SocketAddress;
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+import org.jnode.vm.VmChannel;
+
+/**
+ * Native interface to support configuring of channel to run in a non-blocking
+ * manner and support scatter/gather io operations.
+ *
+ * @author Michael Barker <mi...@mi...>
+ *
+ */
+public final class VMChannel
+{
+ /**
+ * Our reference implementation uses an integer to store the native
+ * file descriptor. Implementations without such support
+ */
+ private final State nfd;
+
+ private Kind kind;
+
+ public VMChannel()
+ {
+ // XXX consider adding security check here, so only Classpath
+ // code may create instances.
+ this.nfd = new State();
+ kind = Kind.OTHER;
+ }
+
+ /**
+ * This constructor is used by the POSIX reference implementation;
+ * other virtual machines need not support it.
+ *
+ * <strong>Important:</strong> do not call this in library code that is
+ * not specific to Classpath's reference implementation.
+ *
+ * @param native_fd The native file descriptor integer.
+ * @throws IOException
+ */
+ VMChannel(final int native_fd) throws IOException
+ {
+ this();
+ this.nfd.setNativeFD(native_fd);
+ }
+
+ public State getState()
+ {
+ return nfd;
+ }
+
+ static
+ {
+ // load the shared library needed for native methods.
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javanio");
+ }
+ try
+ {
+ // so fare this will throw an IOException
+ VmChannel.initIDs();
+ }
+ catch (IOException e)
+ {
+ }
+ }
+
+ public static VMChannel getStdin() throws IOException
+ {
+ return new VMChannel(VmChannel.stdin_fd());
+ }
+
+ public static VMChannel getStdout() throws IOException
+ {
+ return new VMChannel(VmChannel.stdout_fd());
+ }
+
+ public static VMChannel getStderr() throws IOException
+ {
+ return new VMChannel(VmChannel.stderr_fd());
+ }
+
+
+ /**
+ * Set the file descriptor to have the required blocking
+ * setting.
+ *
+ * @param blocking The blocking flag to set.
+ */
+ public void setBlocking(boolean blocking) throws IOException
+ {
+ VmChannel.setBlocking(nfd.getNativeFD(), blocking);
+ }
+
+
+ public int available() throws IOException
+ {
+ return VmChannel.available(nfd.getNativeFD());
+ }
+
+
+ /**
+ * Reads a byte buffer directly using the supplied file descriptor.
+ *
+ * @param dst Direct Byte Buffer to read to.
+ * @return Number of bytes read.
+ * @throws IOException If an error occurs or dst is not a direct buffers.
+ */
+ public int read(ByteBuffer dst)
+ throws IOException
+ {
+ return VmChannel.read(nfd.getNativeFD(), dst);
+ }
+
+ /**
+ * Read a single byte.
+ *
+ * @return The byte read, or -1 on end of file.
+ * @throws IOException
+ */
+ public int read() throws IOException
+ {
+ return VmChannel.read(nfd.getNativeFD());
+ }
+
+
+ /**
+ * Reads into byte buffers directly using the supplied file descriptor.
+ * Assumes that the buffer list contains DirectBuffers. Will perform a
+ * scattering read.
+ *
+ * @param dsts An array direct byte buffers.
+ * @param offset Index of the first buffer to read to.
+ * @param length The number of buffers to read to.
+ * @return Number of bytes read.
+ * @throws IOException If an error occurs or the dsts are not direct buffers.
+ */
+ public long readScattering(ByteBuffer[] dsts, int offset, int length)
+ throws IOException
+ {
+ if (offset + length > dsts.length)
+ throw new IndexOutOfBoundsException("offset + length > dsts.length");
+
+ return VmChannel.readScattering(nfd.getNativeFD(), dsts, offset, length);
+ }
+
+
+ /**
+ * Receive a datagram on this channel, returning the host address
+ * that sent the datagram.
+ *
+ * @param dst Where to store the datagram.
+ * @return The host address that sent the datagram.
+ * @throws IOException
+ */
+ public SocketAddress receive(ByteBuffer dst) throws IOException
+ {
+ if (kind != Kind.SOCK_DGRAM)
+ throw new SocketException("not a datagram socket");
+ ByteBuffer hostPort = ByteBuffer.allocateDirect(18);
+ int hostlen = VmChannel.receive(nfd.getNativeFD(), dst, hostPort);
+ if (hostlen == 0)
+ return null;
+ if (hostlen == 4) // IPv4
+ {
+ byte[] addr = new byte[4];
+ hostPort.get(addr);
+ int port = hostPort.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet4Address.getByAddress(addr), port);
+ }
+ if (hostlen == 16) // IPv6
+ {
+ byte[] addr = new byte[16];
+ hostPort.get(addr);
+ int port = hostPort.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet6Address.getByAddress(addr), port);
+ }
+
+ throw new SocketException("host address received with invalid length: "
+ + hostlen);
+ }
+
+ /**
+ * Writes from a direct byte bufer using the supplied file descriptor.
+ * Assumes the buffer is a DirectBuffer.
+ *
+ * @param src The source buffer.
+ * @return Number of bytes written.
+ * @throws IOException
+ */
+ public int write(ByteBuffer src) throws IOException
+ {
+ return VmChannel.write(nfd.getNativeFD(), src);
+ }
+
+
+ /**
+ * Writes from byte buffers directly using the supplied file descriptor.
+ * Assumes the that buffer list constains DirectBuffers. Will perform
+ * as gathering write.
+ *
+ * @param fd
+ * @param srcs
+ * @param offset
+ * @param length
+ * @return Number of bytes written.
+ * @throws IOException
+ */
+ public long writeGathering(ByteBuffer[] srcs, int offset, int length)
+ throws IOException
+ {
+ if (offset + length > srcs.length)
+ throw new IndexOutOfBoundsException("offset + length > srcs.length");
+
+ // A gathering write is limited to 16 buffers; when writing, ensure
+ // that we have at least one buffer with something in it in the 16
+ // buffer window starting at offset.
+ while (!srcs[offset].hasRemaining() && offset < srcs.length)
+ offset++;
+
+ // There are no buffers with anything to write.
+ if (offset == srcs.length)
+ return 0;
+
+ // If we advanced `offset' so far that we don't have `length'
+ // buffers left, reset length to only the remaining buffers.
+ if (length > srcs.length - offset)
+ length = srcs.length - offset;
+
+ return VmChannel.writeGathering(nfd.getNativeFD(), srcs, offset, length);
+ }
+
+
+ /**
+ * Send a datagram to the given address.
+ *
+ * @param src The source buffer.
+ * @param dst The destination address.
+ * @return The number of bytes written.
+ * @throws IOException
+ */
+ public int send(ByteBuffer src, InetSocketAddress dst)
+ throws IOException
+ {
+ InetAddress addr = dst.getAddress();
+ if (addr == null)
+ throw new NullPointerException();
+ if (addr instanceof Inet4Address)
+ return VmChannel.send(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
+ else if (addr instanceof Inet6Address)
+ return VmChannel.send6(nfd.getNativeFD(), src, addr.getAddress(), dst.getPort());
+ else
+ throw new SocketException("unrecognized inet address type");
+ }
+
+ /**
+ * Write a single byte.
+ *
+ * @param b The byte to write.
+ * @throws IOException
+ */
+ public void write(int b) throws IOException
+ {
+ VmChannel.write(nfd.getNativeFD(), b);
+ }
+
+
+ // Network (socket) specific methods.
+
+ /**
+ * Create a new socket. This method will initialize the native file
+ * descriptor state of this instance.
+ *
+ * @param stream Whether or not to create a streaming socket, or a datagram
+ * socket.
+ * @throws IOException If creating a new socket fails, or if this
+ * channel already has its native descriptor initialized.
+ */
+ public void initSocket(boolean stream) throws IOException
+ {
+ if (nfd.isValid())
+ throw new IOException("native FD already initialized");
+ if (stream)
+ kind = Kind.SOCK_STREAM;
+ else
+ kind = Kind.SOCK_DGRAM;
+ nfd.setNativeFD(VmChannel.socket(stream));
+ }
+
+
+ /**
+ * Connect the underlying socket file descriptor to the remote host.
+ *
+ * @param saddr The address to connect to.
+ * @param timeout The connect timeout to use for blocking connects.
+ * @return True if the connection succeeded; false if the file descriptor
+ * is in non-blocking mode and the connection did not immediately
+ * succeed.
+ * @throws IOException If an error occurs while connecting.
+ */
+ public boolean connect(InetSocketAddress saddr, int timeout)
+ throws SocketException
+ {
+ int fd;
+
+ InetAddress addr = saddr.getAddress();
+
+ // Translates an IOException into a SocketException to conform
+ // to the throws clause.
+ try
+ {
+ fd = nfd.getNativeFD();
+ }
+ catch (IOException ioe)
+ {
+ throw new SocketException(ioe.getMessage());
+ }
+
+ if (addr instanceof Inet4Address)
+ return VmChannel.connect(fd, addr.getAddress(), saddr.getPort(),
+ timeout);
+ if (addr instanceof Inet6Address)
+ return VmChannel.connect6(fd, addr.getAddress(), saddr.getPort(),
+ timeout);
+ throw new SocketException("unsupported internet address");
+ }
+
+ /**
+ * Disconnect this channel, if it is a datagram socket. Disconnecting
+ * a datagram channel will disassociate it from any address, so the
+ * socket will remain open, but can send and receive datagrams from
+ * any address.
+ *
+ * @throws IOException If disconnecting this channel fails, or if this
+ * channel is not a datagram channel.
+ */
+ public void disconnect() throws IOException
+ {
+ if (kind != Kind.SOCK_DGRAM)
+ throw new IOException("can only disconnect datagram channels");
+ VmChannel.disconnect(nfd.getNativeFD());
+ }
+
+
+ public InetSocketAddress getLocalAddress() throws IOException
+ {
+ if (!nfd.isValid())
+ return null;
+ ByteBuffer name = ByteBuffer.allocateDirect(18);
+ int namelen = VmChannel.getsockname(nfd.getNativeFD(), name);
+ if (namelen == 0) // not bound
+ return null; // XXX return some wildcard?
+ if (namelen == 4)
+ {
+ byte[] addr = new byte[4];
+ name.get(addr);
+ int port = name.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet4Address.getByAddress(addr), port);
+ }
+ if (namelen == 16)
+ {
+ byte[] addr = new byte[16];
+ name.get(addr);
+ int port = name.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet6Address.getByAddress(addr), port);
+ }
+ throw new SocketException("invalid address length");
+ }
+
+ /**
+ * Returns the socket address of the remote peer this channel is connected
+ * to, or null if this channel is not yet connected.
+ *
+ * @return The peer address.
+ * @throws IOException
+ */
+ public InetSocketAddress getPeerAddress() throws IOException
+ {
+ if (!nfd.isValid())
+ return null;
+ ByteBuffer name = ByteBuffer.allocateDirect(18);
+ int namelen = VmChannel.getpeername (nfd.getNativeFD(), name);
+ if (namelen == 0) // not connected yet
+ return null;
+ if (namelen == 4) // IPv4
+ {
+ byte[] addr = new byte[4];
+ name.get(addr);
+ int port = name.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet4Address.getByAddress(addr), port);
+ }
+ else if (namelen == 16) // IPv6
+ {
+ byte[] addr = new byte[16];
+ name.get(addr);
+ int port = name.getShort() & 0xFFFF;
+ return new InetSocketAddress(Inet6Address.getByAddress(addr), port);
+ }
+ throw new SocketException("invalid address length");
+ }
+
+
+ /**
+ * Accept an incoming connection, returning a new VMChannel, or null
+ * if the channel is nonblocking and no connection is pending.
+ *
+ * @return The accepted connection, or null.
+ * @throws IOException If an IO error occurs.
+ */
+ public VMChannel accept() throws IOException
+ {
+ int new_fd = VmChannel.accept(nfd.getNativeFD());
+ if (new_fd == -1) // non-blocking accept had no pending connection
+ return null;
+ return new VMChannel(new_fd);
+ }
+
+ // File-specific methods.
+
+ /**
+ * Open a file at PATH, initializing the native state to operate on
+ * that open file.
+ *
+ * @param path The absolute file path.
+ * @throws IOException If the file cannot be opened, or if this
+ * channel was previously initialized.
+ */
+ public void openFile(String path, int mode) throws IOException
+ {
+ if (nfd.isValid() || nfd.isClosed())
+ throw new IOException("can't reinitialize this channel");
+ int fd = VmChannel.open(path, mode);
+ nfd.setNativeFD(fd);
+ kind = Kind.FILE;
+ }
+
+
+ public long position() throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ return VmChannel.position(nfd.getNativeFD());
+ }
+
+
+ public void seek(long pos) throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ VmChannel.seek(nfd.getNativeFD(), pos);
+ }
+
+
+ public void truncate(long length) throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ VmChannel.truncate(nfd.getNativeFD(), length);
+ }
+
+
+ public boolean lock(long pos, long len, boolean shared, boolean wait)
+ throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ return VmChannel.lock(nfd.getNativeFD(), pos, len, shared, wait);
+ }
+
+
+ public void unlock(long pos, long len) throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ VmChannel.unlock(nfd.getNativeFD(), pos, len);
+ }
+
+
+ public long size() throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ return VmChannel.size(nfd.getNativeFD());
+ }
+
+ public MappedByteBuffer map(char mode, long position, int size)
+ throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ return VmChannel.map(nfd.getNativeFD(), mode, position, size);
+ }
+
+
+ public boolean flush(boolean metadata) throws IOException
+ {
+ if (kind != Kind.FILE)
+ throw new IOException("not a file");
+ return VmChannel.flush(nfd.getNativeFD(), metadata);
+ }
+
+ // Close.
+
+ /**
+ * Close this socket. The socket is also automatically closed when this
+ * object is finalized.
+ *
+ * @throws IOException If closing the socket fails, or if this object has
+ * no open socket.
+ */
+ public void close() throws IOException
+ {
+ nfd.close();
+ }
+
+
+ /**
+ * <p>Provides a simple mean for the JNI code to find out whether the
+ * current thread was interrupted by a call to Thread.interrupt().</p>
+ *
+ * @return
+ */
+ static boolean isThreadInterrupted()
+ {
+ return Thread.currentThread().isInterrupted();
+ }
+
+ // Inner classes.
+
+ /**
+ * A wrapper for a native file descriptor integer. This tracks the state
+ * of an open file descriptor, and ensures that
+ *
+ * This class need not be fully supported by virtual machines; if a
+ * virtual machine does not use integer file descriptors, or does and
+ * wishes to hide that, then the methods of this class may be stubbed out.
+ *
+ * System-specific classes that depend on access to native file descriptor
+ * integers SHOULD declare this fact.
+ */
+ public final class State
+ {
+ private int native_fd;
+ private boolean valid;
+ private boolean closed;
+
+ State()
+ {
+ native_fd = -1;
+ valid = false;
+ closed = false;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public boolean isClosed()
+ {
+ return closed;
+ }
+
+ public int getNativeFD() throws IOException
+ {
+ if (!valid)
+ throw new IOException("invalid file descriptor");
+ return native_fd;
+ }
+
+ void setNativeFD(final int native_fd) throws IOException
+ {
+ if (valid)
+ throw new IOException("file descriptor already initialized");
+ this.native_fd = native_fd;
+ valid = true;
+ }
+
+ public void close() throws IOException
+ {
+ if (!valid)
+ throw new IOException("invalid file descriptor");
+ try
+ {
+ VmChannel.close(native_fd);
+ }
+ finally
+ {
+ valid = false;
+ closed = true;
+ }
+ }
+
+ public String toString()
+ {
+ if (closed)
+ return "<<closed>>";
+ if (!valid)
+ return "<<invalid>>";
+ return String.valueOf(native_fd);
+ }
+
+ protected void finalize() throws Throwable
+ {
+ try
+ {
+ if (valid)
+ close();
+ }
+ finally
+ {
+ super.finalize();
+ }
+ }
+ }
+
+ /**
+ * An enumeration of possible kinds of channel.
+ */
+ static class Kind // XXX enum
+ {
+ /** A streaming (TCP) socket. */
+ static final Kind SOCK_STREAM = new Kind();
+
+ /** A datagram (UDP) socket. */
+ static final Kind SOCK_DGRAM = new Kind();
+
+ /** A file. */
+ static final Kind FILE = new Kind();
+
+ /** Something else; not a socket or file. */
+ static final Kind OTHER = new Kind();
+
+ private Kind() { }
+ }
+}
Added: trunk/core/src/core/org/jnode/vm/VmChannel.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmChannel.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/VmChannel.java 2006-12-20 12:01:58 UTC (rev 2946)
@@ -0,0 +1,224 @@
+/*
+ * $Id: VmChannel.java $
+ *
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.vm;
+
+import java.io.IOException;
+import java.net.SocketException;
+import java.nio.ByteBuffer;
+import java.nio.MappedByteBuffer;
+
+/**
+ * Native interface to support configuring of channel to run in a non-blocking
+ * manner and support scatter/gather io operations.
+ *
+ *
+ * This has to give the functionality of the classpath/native/jni/java-nio/gnu_java_nio_VMChannel.c
+ *
+ * @author
+ */
+public final class VmChannel
+{
+
+ public static int stdin_fd() throws IOException
+ {
+ // shouldn't throw IOException
+ throw new IOException("Not implemented");
+ }
+
+ public static int stdout_fd() throws IOException
+ {
+ // shouldn't throw IOException
+ throw new IOException("Not implemented");
+ }
+
+ public static int stderr_fd() throws IOException
+ {
+ // shouldn't throw IOException
+ throw new IOException("Not implemented");
+ }
+
+ public static void setBlocking(int fd, boolean blocking) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static int available(int native_fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static int read(int fd, ByteBuffer dst) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+
+ public static int read(int fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static long readScattering(int fd, ByteBuffer[] dsts, int offset, int length) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+
+ public static int receive(int fd, ByteBuffer dst, ByteBuffer address) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static int write(int fd, ByteBuffer src) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static long writeGathering(int fd, ByteBuffer[] srcs, int offset, int length) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ // Send to an IPv4 address.
+ public static int send(int fd, ByteBuffer src, byte[] addr, int port) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ // Send to an IPv6 address.
+ public static int send6(int fd, ByteBuffer src, byte[] addr, int port) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void write(int fd, int b) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void initIDs() throws IOException
+ {
+ // shouldn't throw IOException
+ throw new IOException("Not implemented");
+ }
+
+ // Network (socket) specific methods.
+
+ /**
+ * Create a new socket, returning the native file descriptor.
+ *
+ * @param stream Set to true for streaming sockets{} false for datagrams.
+ * @return The native file descriptor.
+ * @throws java.io.IOException If creating the socket fails.
+ */
+ public static int socket(boolean stream) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+
+ public static boolean connect(int fd, byte[] addr, int port, int timeout) throws SocketException
+ {
+ throw new SocketException("Not implemented");
+ }
+
+ public static boolean connect6(int fd, byte[] addr, int port, int timeout) throws SocketException
+ {
+ throw new SocketException("Not implemented");
+ }
+
+ public static void disconnect(int fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static int getsockname(int fd, ByteBuffer name) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ /*
+ * The format here is the peer address, followed by the port number.
+ * The returned value is the length of the peer address{} thus, there
+ * will be LEN + 2 valid bytes put into NAME.
+ */
+ public static int getpeername(int fd, ByteBuffer name) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static int accept(int native_fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+
+ public static int open(String path, int mode) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static long position(int fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void seek(int fd, long pos) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void truncate(int fd, long len) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static boolean lock(int fd, long pos, long len, boolean shared, boolean wait) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void unlock(int fd, long pos, long len) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static long size(int fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static MappedByteBuffer map(int fd, char mode, long position, int size) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static boolean flush(int fd, boolean metadata) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+
+ public static void close(int native_fd) throws IOException
+ {
+ throw new IOException("Not implemented");
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2006-12-26 00:22:52
|
Revision: 2955
http://jnode.svn.sourceforge.net/jnode/?rev=2955&view=rev
Author: fduminy
Date: 2006-12-25 16:22:49 -0800 (Mon, 25 Dec 2006)
Log Message:
-----------
patch submited by Andrei DORE :
fixed bug in ByteBufferInputStream.available() implementation + added test case
Modified Paths:
--------------
trunk/core/src/core/org/jnode/util/ByteBufferInputStream.java
Added Paths:
-----------
trunk/core/src/test/org/jnode/test/bugs/TestByteBufferInputStream.java
Modified: trunk/core/src/core/org/jnode/util/ByteBufferInputStream.java
===================================================================
--- trunk/core/src/core/org/jnode/util/ByteBufferInputStream.java 2006-12-22 21:17:39 UTC (rev 2954)
+++ trunk/core/src/core/org/jnode/util/ByteBufferInputStream.java 2006-12-26 00:22:49 UTC (rev 2955)
@@ -33,6 +33,7 @@
}
/**
+ * @Override
* @see java.io.InputStream#read()
*/
public int read() throws IOException {
@@ -41,5 +42,14 @@
} else {
return -1;
}
- }
+ }
+
+ @Override
+ /**
+ * @author Andrei DORE
+ */
+ public int available() throws IOException
+ {
+ return buf.remaining();
+ }
}
Added: trunk/core/src/test/org/jnode/test/bugs/TestByteBufferInputStream.java
===================================================================
--- trunk/core/src/test/org/jnode/test/bugs/TestByteBufferInputStream.java (rev 0)
+++ trunk/core/src/test/org/jnode/test/bugs/TestByteBufferInputStream.java 2006-12-26 00:22:49 UTC (rev 2955)
@@ -0,0 +1,41 @@
+package org.jnode.test.bugs;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import junit.framework.TestCase;
+
+import org.jnode.util.ByteBufferInputStream;
+
+/**
+ *
+ * @author Andrei DORE
+ *
+ */
+public class TestByteBufferInputStream extends TestCase {
+ /**
+ * That test show if the (ByteBuffer)InputStream.available is properly implemented
+ * or not
+ * @throws IOException
+ */
+ public void testWrappedByBufferedInputStream() throws IOException{
+ final int SIZE = 5000;
+
+ ByteBuffer buffer=ByteBuffer.allocate(SIZE);
+ for(int i=0;i<SIZE;i++){
+ buffer.put((byte)1);
+ }
+
+ buffer.rewind();
+
+ ByteBufferInputStream input=new ByteBufferInputStream(buffer);
+
+ BufferedInputStream bufferedInputStream=new BufferedInputStream(input,2048);
+
+
+ byte data[]=new byte[SIZE];
+
+ assertEquals(SIZE, bufferedInputStream.read(data));
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <kon...@us...> - 2007-02-14 23:00:33
|
Revision: 3126
http://jnode.svn.sourceforge.net/jnode/?rev=3126&view=rev
Author: konkubinaten
Date: 2007-02-14 15:00:16 -0800 (Wed, 14 Feb 2007)
Log Message:
-----------
added getNanoTime to java.lang.System based on cpu cycles
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/lang/VMSystem.java
trunk/core/src/core/org/jnode/vm/Unsafe.java
trunk/core/src/core/org/jnode/vm/VmSystem.java
trunk/core/src/native/x86/unsafe.asm
Added Paths:
-----------
trunk/core/src/test/org/jnode/test/NanoTimeTest.java
Modified: trunk/core/src/classpath/vm/java/lang/VMSystem.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/VMSystem.java 2007-02-14 19:59:46 UTC (rev 3125)
+++ trunk/core/src/classpath/vm/java/lang/VMSystem.java 2007-02-14 23:00:16 UTC (rev 3126)
@@ -195,8 +195,7 @@
* @since 1.5
*/
public static long nanoTime(){
- //TODO implement it
- throw new UnsupportedOperationException();
+ return VmSystem.nanoTime();
};
/**
Modified: trunk/core/src/core/org/jnode/vm/Unsafe.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/Unsafe.java 2007-02-14 19:59:46 UTC (rev 3125)
+++ trunk/core/src/core/org/jnode/vm/Unsafe.java 2007-02-14 23:00:16 UTC (rev 3126)
@@ -742,4 +742,12 @@
VmProcessor.current().getArchitecture().getStackReader()
.debugStackTrace(max);
}
+
+ /**
+ * return a nanosecond accurate timer based on the clock cycles
+ * of the CPU
+ * @return nanosecond accurate time
+ */
+ public static native long getCpuCycles();
+
}
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-02-14 19:59:46 UTC (rev 3125)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-02-14 23:00:16 UTC (rev 3126)
@@ -90,6 +90,8 @@
private static volatile long currentTimeMillis;
+ private static long mhz = -1;
+
private static long rtcIncrement;
private static RTCService rtcService;
@@ -700,6 +702,47 @@
}
/**
+ * <p>
+ * Returns the current value of a nanosecond-precise system timer.
+ * The value of the timer is an offset relative to some arbitrary fixed
+ * time, which may be in the future (making the value negative). This
+ * method is useful for timing events where nanosecond precision is
+ * required. This is achieved by calling this method before and after the
+ * event, and taking the difference betweent the two times:
+ * </p>
+ * <p>
+ * <code>long startTime = System.nanoTime();</code><br />
+ * <code>... <emph>event code</emph> ...</code><br />
+ * <code>long endTime = System.nanoTime();</code><br />
+ * <code>long duration = endTime - startTime;</code><br />
+ * </p>
+ * <p>
+ * Note that the value is only nanosecond-precise, and not accurate; there
+ * is no guarantee that the difference between two values is really a
+ * nanosecond. Also, the value is prone to overflow if the offset
+ * exceeds 2^63.
+ * </p>
+ *
+ * @return the time of a system timer in nanoseconds.
+ * @since 1.5
+ */
+ public static long nanoTime(){
+ if (mhz == -1) {
+ long start = Unsafe.getCpuCycles();
+ try {
+ Thread.sleep(1000);
+ } catch (Exception e) {
+ // set some "random" value
+ mhz = 1000;
+ }
+ long end = Unsafe.getCpuCycles();
+ mhz = end - start;
+ mhz = mhz / 1000000;
+ }
+ return Unsafe.getCpuCycles() / mhz;
+ }
+
+ /**
* Returns the number of milliseconds since booting the kernel of JNode.
*
* This method does not call any other method and CAN be used in the
Modified: trunk/core/src/native/x86/unsafe.asm
===================================================================
--- trunk/core/src/native/x86/unsafe.asm 2007-02-14 19:59:46 UTC (rev 3125)
+++ trunk/core/src/native/x86/unsafe.asm 2007-02-14 23:00:16 UTC (rev 3126)
@@ -355,4 +355,9 @@
; static native int readKdbInput();
GLABEL Q43org5jnode2vm6Unsafe23readKdbInput2e2829I
jmp kdb_recv_char
-
\ No newline at end of file
+
+; public static native long getCpuCycles();
+GLABEL Q43org5jnode2vm6Unsafe23getCpuCycles2e2829J
+ rdtsc
+ ret
+
Added: trunk/core/src/test/org/jnode/test/NanoTimeTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/NanoTimeTest.java (rev 0)
+++ trunk/core/src/test/org/jnode/test/NanoTimeTest.java 2007-02-14 23:00:16 UTC (rev 3126)
@@ -0,0 +1,53 @@
+/*
+ * JNode.org
+ * Copyright (C) 2003-2006 JNode.org
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation; either version 2.1 of the License, or
+ * (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; If not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+package org.jnode.test;
+
+
+/**
+ * @author Peter
+ */
+public class NanoTimeTest {
+
+ public static void main(String[] args) {
+ NanoTimeTest ntt = new NanoTimeTest();
+ ntt.run(500);
+ ntt.run(1000);
+ ntt.run(1500);
+ ntt.run(2000);
+ ntt.run(2500);
+ ntt.run(3000);
+ }
+
+ public void run(int ms) {
+ long start = System.nanoTime();
+ try {
+ Thread.sleep(ms);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ long end = System.nanoTime();
+ long nano = end - start;
+
+ System.out.println("The test ran " + ms + "ms and according to " +
+ "System.nanoTime that was " + nano + "ns");
+ long p = Math.abs(ms * 1000L - nano) / ms;
+ System.out.println("Aberration : " + p + " promill");
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-05-13 17:02:24
|
Revision: 3193
http://jnode.svn.sourceforge.net/jnode/?rev=3193&view=rev
Author: lsantha
Date: 2007-05-13 10:02:22 -0700 (Sun, 13 May 2007)
Log Message:
-----------
First merges of OpenJDK.
Added Paths:
-----------
trunk/core/src/openjdk/
trunk/core/src/openjdk/java/
trunk/core/src/openjdk/java/java/
trunk/core/src/openjdk/java/java/lang/
trunk/core/src/openjdk/java/java/lang/Double.java
Added: trunk/core/src/openjdk/java/java/lang/Double.java
===================================================================
--- trunk/core/src/openjdk/java/java/lang/Double.java (rev 0)
+++ trunk/core/src/openjdk/java/java/lang/Double.java 2007-05-13 17:02:22 UTC (rev 3193)
@@ -0,0 +1,975 @@
+/*
+ * Copyright 1994-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang;
+
+import sun.misc.FloatingDecimal;
+import sun.misc.FpUtils;
+import sun.misc.DoubleConsts;
+
+/**
+ * The {@code Double} class wraps a value of the primitive type
+ * {@code double} in an object. An object of type
+ * {@code Double} contains a single field whose type is
+ * {@code double}.
+ *
+ * <p>In addition, this class provides several methods for converting a
+ * {@code double} to a {@code String} and a
+ * {@code String} to a {@code double}, as well as other
+ * constants and methods useful when dealing with a
+ * {@code double}.
+ *
+ * @author Lee Boynton
+ * @author Arthur van Hoff
+ * @author Joseph D. Darcy
+ * @version 1.107, 05/05/07
+ * @since JDK1.0
+ */
+public final class Double extends Number implements Comparable<Double> {
+ /**
+ * A constant holding the positive infinity of type
+ * {@code double}. It is equal to the value returned by
+ * {@code Double.longBitsToDouble(0x7ff0000000000000L)}.
+ */
+ public static final double POSITIVE_INFINITY = 1.0 / 0.0;
+
+ /**
+ * A constant holding the negative infinity of type
+ * {@code double}. It is equal to the value returned by
+ * {@code Double.longBitsToDouble(0xfff0000000000000L)}.
+ */
+ public static final double NEGATIVE_INFINITY = -1.0 / 0.0;
+
+ /**
+ * A constant holding a Not-a-Number (NaN) value of type
+ * {@code double}. It is equivalent to the value returned by
+ * {@code Double.longBitsToDouble(0x7ff8000000000000L)}.
+ */
+ public static final double NaN = 0.0d / 0.0;
+
+ /**
+ * A constant holding the largest positive finite value of type
+ * {@code double},
+ * (2-2<sup>-52</sup>)·2<sup>1023</sup>. It is equal to
+ * the hexadecimal floating-point literal
+ * {@code 0x1.fffffffffffffP+1023} and also equal to
+ * {@code Double.longBitsToDouble(0x7fefffffffffffffL)}.
+ */
+ public static final double MAX_VALUE = 0x1.fffffffffffffP+1023; // 1.7976931348623157e+308
+
+ /**
+ * A constant holding the smallest positive normal value of type
+ * {@code double}, 2<sup>-1022</sup>. It is equal to the
+ * hexadecimal floating-point literal {@code 0x1.0p-1022} and also
+ * equal to {@code Double.longBitsToDouble(0x0010000000000000L)}.
+ *
+ * @since 1.6
+ */
+ public static final double MIN_NORMAL = 0x1.0p-1022; // 2.2250738585072014E-308
+
+ /**
+ * A constant holding the smallest positive nonzero value of type
+ * {@code double}, 2<sup>-1074</sup>. It is equal to the
+ * hexadecimal floating-point literal
+ * {@code 0x0.0000000000001P-1022} and also equal to
+ * {@code Double.longBitsToDouble(0x1L)}.
+ */
+ public static final double MIN_VALUE = 0x0.0000000000001P-1022; // 4.9e-324
+
+ /**
+ * Maximum exponent a finite {@code double} variable may have.
+ * It is equal to the value returned by
+ * {@code Math.getExponent(Double.MAX_VALUE)}.
+ *
+ * @since 1.6
+ */
+ public static final int MAX_EXPONENT = 1023;
+
+ /**
+ * Minimum exponent a normalized {@code double} variable may
+ * have. It is equal to the value returned by
+ * {@code Math.getExponent(Double.MIN_NORMAL)}.
+ *
+ * @since 1.6
+ */
+ public static final int MIN_EXPONENT = -1022;
+
+ /**
+ * The number of bits used to represent a {@code double} value.
+ *
+ * @since 1.5
+ */
+ public static final int SIZE = 64;
+
+ /**
+ * The {@code Class} instance representing the primitive type
+ * {@code double}.
+ *
+ * @since JDK1.1
+ */
+ public static final Class<Double> TYPE = (Class<Double>) Class.getPrimitiveClass("double");
+
+ /**
+ * Returns a string representation of the {@code double}
+ * argument. All characters mentioned below are ASCII characters.
+ * <ul>
+ * <li>If the argument is NaN, the result is the string
+ * "{@code NaN}".
+ * <li>Otherwise, the result is a string that represents the sign and
+ * magnitude (absolute value) of the argument. If the sign is negative,
+ * the first character of the result is '{@code -}'
+ * (<code>'\u002D'</code>); if the sign is positive, no sign character
+ * appears in the result. As for the magnitude <i>m</i>:
+ * <ul>
+ * <li>If <i>m</i> is infinity, it is represented by the characters
+ * {@code "Infinity"}; thus, positive infinity produces the result
+ * {@code "Infinity"} and negative infinity produces the result
+ * {@code "-Infinity"}.
+ *
+ * <li>If <i>m</i> is zero, it is represented by the characters
+ * {@code "0.0"}; thus, negative zero produces the result
+ * {@code "-0.0"} and positive zero produces the result
+ * {@code "0.0"}.
+ *
+ * <li>If <i>m</i> is greater than or equal to 10<sup>-3</sup> but less
+ * than 10<sup>7</sup>, then it is represented as the integer part of
+ * <i>m</i>, in decimal form with no leading zeroes, followed by
+ * '{@code .}' (<code>'\u002E'</code>), followed by one or
+ * more decimal digits representing the fractional part of <i>m</i>.
+ *
+ * <li>If <i>m</i> is less than 10<sup>-3</sup> or greater than or
+ * equal to 10<sup>7</sup>, then it is represented in so-called
+ * "computerized scientific notation." Let <i>n</i> be the unique
+ * integer such that 10<sup><i>n</i></sup> ≤ <i>m</i> {@literal <}
+ * 10<sup><i>n</i>+1</sup>; then let <i>a</i> be the
+ * mathematically exact quotient of <i>m</i> and
+ * 10<sup><i>n</i></sup> so that 1 ≤ <i>a</i> {@literal <} 10. The
+ * magnitude is then represented as the integer part of <i>a</i>,
+ * as a single decimal digit, followed by '{@code .}'
+ * (<code>'\u002E'</code>), followed by decimal digits
+ * representing the fractional part of <i>a</i>, followed by the
+ * letter '{@code E}' (<code>'\u0045'</code>), followed
+ * by a representation of <i>n</i> as a decimal integer, as
+ * produced by the method {@link Integer#toString(int)}.
+ * </ul>
+ * </ul>
+ * How many digits must be printed for the fractional part of
+ * <i>m</i> or <i>a</i>? There must be at least one digit to represent
+ * the fractional part, and beyond that as many, but only as many, more
+ * digits as are needed to uniquely distinguish the argument value from
+ * adjacent values of type {@code double}. That is, suppose that
+ * <i>x</i> is the exact mathematical value represented by the decimal
+ * representation produced by this method for a finite nonzero argument
+ * <i>d</i>. Then <i>d</i> must be the {@code double} value nearest
+ * to <i>x</i>; or if two {@code double} values are equally close
+ * to <i>x</i>, then <i>d</i> must be one of them and the least
+ * significant bit of the significand of <i>d</i> must be {@code 0}.
+ *
+ * <p>To create localized string representations of a floating-point
+ * value, use subclasses of {@link java.text.NumberFormat}.
+ *
+ * @param d the {@code double} to be converted.
+ * @return a string representation of the argument.
+ */
+ public static String toString(double d) {
+ return new FloatingDecimal(d).toJavaFormatString();
+ }
+
+ /**
+ * Returns a hexadecimal string representation of the
+ * {@code double} argument. All characters mentioned below
+ * are ASCII characters.
+ *
+ * <ul>
+ * <li>If the argument is NaN, the result is the string
+ * "{@code NaN}".
+ * <li>Otherwise, the result is a string that represents the sign
+ * and magnitude of the argument. If the sign is negative, the
+ * first character of the result is '{@code -}'
+ * (<code>'\u002D'</code>); if the sign is positive, no sign
+ * character appears in the result. As for the magnitude <i>m</i>:
+ *
+ * <ul>
+ * <li>If <i>m</i> is infinity, it is represented by the string
+ * {@code "Infinity"}; thus, positive infinity produces the
+ * result {@code "Infinity"} and negative infinity produces
+ * the result {@code "-Infinity"}.
+ *
+ * <li>If <i>m</i> is zero, it is represented by the string
+ * {@code "0x0.0p0"}; thus, negative zero produces the result
+ * {@code "-0x0.0p0"} and positive zero produces the result
+ * {@code "0x0.0p0"}.
+ *
+ * <li>If <i>m</i> is a {@code double} value with a
+ * normalized representation, substrings are used to represent the
+ * significand and exponent fields. The significand is
+ * represented by the characters {@code "0x1."}
+ * followed by a lowercase hexadecimal representation of the rest
+ * of the significand as a fraction. Trailing zeros in the
+ * hexadecimal representation are removed unless all the digits
+ * are zero, in which case a single zero is used. Next, the
+ * exponent is represented by {@code "p"} followed
+ * by a decimal string of the unbiased exponent as if produced by
+ * a call to {@link Integer#toString(int) Integer.toString} on the
+ * exponent value.
+ *
+ * <li>If <i>m</i> is a {@code double} value with a subnormal
+ * representation, the significand is represented by the
+ * characters {@code "0x0."} followed by a
+ * hexadecimal representation of the rest of the significand as a
+ * fraction. Trailing zeros in the hexadecimal representation are
+ * removed. Next, the exponent is represented by
+ * {@code "p-1022"}. Note that there must be at
+ * least one nonzero digit in a subnormal significand.
+ *
+ * </ul>
+ *
+ * </ul>
+ *
+ * <table border>
+ * <caption><h3>Examples</h3></caption>
+ * <tr><th>Floating-point Value</th><th>Hexadecimal String</th>
+ * <tr><td>{@code 1.0}</td> <td>{@code 0x1.0p0}</td>
+ * <tr><td>{@code -1.0}</td> <td>{@code -0x1.0p0}</td>
+ * <tr><td>{@code 2.0}</td> <td>{@code 0x1.0p1}</td>
+ * <tr><td>{@code 3.0}</td> <td>{@code 0x1.8p1}</td>
+ * <tr><td>{@code 0.5}</td> <td>{@code 0x1.0p-1}</td>
+ * <tr><td>{@code 0.25}</td> <td>{@code 0x1.0p-2}</td>
+ * <tr><td>{@code Double.MAX_VALUE}</td>
+ * <td>{@code 0x1.fffffffffffffp1023}</td>
+ * <tr><td>{@code Minimum Normal Value}</td>
+ * <td>{@code 0x1.0p-1022}</td>
+ * <tr><td>{@code Maximum Subnormal Value}</td>
+ * <td>{@code 0x0.fffffffffffffp-1022}</td>
+ * <tr><td>{@code Double.MIN_VALUE}</td>
+ * <td>{@code 0x0.0000000000001p-1022}</td>
+ * </table>
+ * @param d the {@code double} to be converted.
+ * @return a hex string representation of the argument.
+ * @since 1.5
+ * @author Joseph D. Darcy
+ */
+ public static String toHexString(double d) {
+ /*
+ * Modeled after the "a" conversion specifier in C99, section
+ * 7.19.6.1; however, the output of this method is more
+ * tightly specified.
+ */
+ if (!FpUtils.isFinite(d) )
+ // For infinity and NaN, use the decimal output.
+ return Double.toString(d);
+ else {
+ // Initialized to maximum size of output.
+ StringBuffer answer = new StringBuffer(24);
+
+ if (FpUtils.rawCopySign(1.0, d) == -1.0) // value is negative,
+ answer.append("-"); // so append sign info
+
+ answer.append("0x");
+
+ d = Math.abs(d);
+
+ if(d == 0.0) {
+ answer.append("0.0p0");
+ }
+ else {
+ boolean subnormal = (d < DoubleConsts.MIN_NORMAL);
+
+ // Isolate significand bits and OR in a high-order bit
+ // so that the string representation has a known
+ // length.
+ long signifBits = (Double.doubleToLongBits(d)
+ & DoubleConsts.SIGNIF_BIT_MASK) |
+ 0x1000000000000000L;
+
+ // Subnormal values have a 0 implicit bit; normal
+ // values have a 1 implicit bit.
+ answer.append(subnormal ? "0." : "1.");
+
+ // Isolate the low-order 13 digits of the hex
+ // representation. If all the digits are zero,
+ // replace with a single 0; otherwise, remove all
+ // trailing zeros.
+ String signif = Long.toHexString(signifBits).substring(3,16);
+ answer.append(signif.equals("0000000000000") ? // 13 zeros
+ "0":
+ signif.replaceFirst("0{1,12}$", ""));
+
+ // If the value is subnormal, use the E_min exponent
+ // value for double; otherwise, extract and report d's
+ // exponent (the representation of a subnormal uses
+ // E_min -1).
+ answer.append("p" + (subnormal ?
+ DoubleConsts.MIN_EXPONENT:
+ FpUtils.getExponent(d) ));
+ }
+ return answer.toString();
+ }
+ }
+
+ /**
+ * Returns a {@code Double} object holding the
+ * {@code double} value represented by the argument string
+ * {@code s}.
+ *
+ * <p>If {@code s} is {@code null}, then a
+ * {@code NullPointerException} is thrown.
+ *
+ * <p>Leading and trailing whitespace characters in {@code s}
+ * are ignored. Whitespace is removed as if by the {@link
+ * String#trim} method; that is, both ASCII space and control
+ * characters are removed. The rest of {@code s} should
+ * constitute a <i>FloatValue</i> as described by the lexical
+ * syntax rules:
+ *
+ * <blockquote>
+ * <dl>
+ * <dt><i>FloatValue:</i>
+ * <dd><i>Sign<sub>opt</sub></i> {@code NaN}
+ * <dd><i>Sign<sub>opt</sub></i> {@code Infinity}
+ * <dd><i>Sign<sub>opt</sub> FloatingPointLiteral</i>
+ * <dd><i>Sign<sub>opt</sub> HexFloatingPointLiteral</i>
+ * <dd><i>SignedInteger</i>
+ * </dl>
+ *
+ * <p>
+ *
+ * <dl>
+ * <dt><i>HexFloatingPointLiteral</i>:
+ * <dd> <i>HexSignificand BinaryExponent FloatTypeSuffix<sub>opt</sub></i>
+ * </dl>
+ *
+ * <p>
+ *
+ * <dl>
+ * <dt><i>HexSignificand:</i>
+ * <dd><i>HexNumeral</i>
+ * <dd><i>HexNumeral</i> {@code .}
+ * <dd>{@code 0x} <i>HexDigits<sub>opt</sub>
+ * </i>{@code .}<i> HexDigits</i>
+ * <dd>{@code 0X}<i> HexDigits<sub>opt</sub>
+ * </i>{@code .} <i>HexDigits</i>
+ * </dl>
+ *
+ * <p>
+ *
+ * <dl>
+ * <dt><i>BinaryExponent:</i>
+ * <dd><i>BinaryExponentIndicator SignedInteger</i>
+ * </dl>
+ *
+ * <p>
+ *
+ * <dl>
+ * <dt><i>BinaryExponentIndicator:</i>
+ * <dd>{@code p}
+ * <dd>{@code P}
+ * </dl>
+ *
+ * </blockquote>
+ *
+ * where <i>Sign</i>, <i>FloatingPointLiteral</i>,
+ * <i>HexNumeral</i>, <i>HexDigits</i>, <i>SignedInteger</i> and
+ * <i>FloatTypeSuffix</i> are as defined in the lexical structure
+ * sections of the of the <a
+ * href="http://java.sun.com/docs/books/jls/html/">Java Language
+ * Specification</a>. If {@code s} does not have the form of
+ * a <i>FloatValue</i>, then a {@code NumberFormatException}
+ * is thrown. Otherwise, {@code s} is regarded as
+ * representing an exact decimal value in the usual
+ * "computerized scientific notation" or as an exact
+ * hexadecimal value; this exact numerical value is then
+ * conceptually converted to an "infinitely precise"
+ * binary value that is then rounded to type {@code double}
+ * by the usual round-to-nearest rule of IEEE 754 floating-point
+ * arithmetic, which includes preserving the sign of a zero
+ * value. Finally, a {@code Double} object representing this
+ * {@code double} value is returned.
+ *
+ * <p> To interpret localized string representations of a
+ * floating-point value, use subclasses of {@link
+ * java.text.NumberFormat}.
+ *
+ * <p>Note that trailing format specifiers, specifiers that
+ * determine the type of a floating-point literal
+ * ({@code 1.0f} is a {@code float} value;
+ * {@code 1.0d} is a {@code double} value), do
+ * <em>not</em> influence the results of this method. In other
+ * words, the numerical value of the input string is converted
+ * directly to the target floating-point type. The two-step
+ * sequence of conversions, string to {@code float} followed
+ * by {@code float} to {@code double}, is <em>not</em>
+ * equivalent to converting a string directly to
+ * {@code double}. For example, the {@code float}
+ * literal {@code 0.1f} is equal to the {@code double}
+ * value {@code 0.10000000149011612}; the {@code float}
+ * literal {@code 0.1f} represents a different numerical
+ * value than the {@code double} literal
+ * {@code 0.1}. (The numerical value 0.1 cannot be exactly
+ * represented in a binary floating-point number.)
+ *
+ * <p>To avoid calling this method on an invalid string and having
+ * a {@code NumberFormatException} be thrown, the regular
+ * expression below can be used to screen the input string:
+ *
+ * <code>
+ * <pre>
+ * final String Digits = "(\\p{Digit}+)";
+ * final String HexDigits = "(\\p{XDigit}+)";
+ * // an exponent is 'e' or 'E' followed by an optionally
+ * // signed decimal integer.
+ * final String Exp = "[eE][+-]?"+Digits;
+ * final String fpRegex =
+ * ("[\\x00-\\x20]*"+ // Optional leading "whitespace"
+ * "[+-]?(" + // Optional sign character
+ * "NaN|" + // "NaN" string
+ * "Infinity|" + // "Infinity" string
+ *
+ * // A decimal floating-point string representing a finite positive
+ * // number without a leading sign has at most five basic pieces:
+ * // Digits . Digits ExponentPart FloatTypeSuffix
+ * //
+ * // Since this method allows integer-only strings as input
+ * // in addition to strings of floating-point literals, the
+ * // two sub-patterns below are simplifications of the grammar
+ * // productions from the Java Language Specification, 2nd
+ * // edition, section 3.10.2.
+ *
+ * // Digits ._opt Digits_opt ExponentPart_opt FloatTypeSuffix_opt
+ * "((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+
+ *
+ * // . Digits ExponentPart_opt FloatTypeSuffix_opt
+ * "(\\.("+Digits+")("+Exp+")?)|"+
+ *
+ * // Hexadecimal strings
+ * "((" +
+ * // 0[xX] HexDigits ._opt BinaryExponent FloatTypeSuffix_opt
+ * "(0[xX]" + HexDigits + "(\\.)?)|" +
+ *
+ * // 0[xX] HexDigits_opt . HexDigits BinaryExponent FloatTypeSuffix_opt
+ * "(0[xX]" + HexDigits + "?(\\.)" + HexDigits + ")" +
+ *
+ * ")[pP][+-]?" + Digits + "))" +
+ * "[fFdD]?))" +
+ * "[\\x00-\\x20]*");// Optional trailing "whitespace"
+ *
+ * if (Pattern.matches(fpRegex, myString))
+ * Double.valueOf(myString); // Will not throw NumberFormatException
+ * else {
+ * // Perform suitable alternative action
+ * }
+ * </pre>
+ * </code>
+ *
+ * @param s the string to be parsed.
+ * @return a {@code Double} object holding the value
+ * represented by the {@code String} argument.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ */
+ public static Double valueOf(String s) throws NumberFormatException {
+ return new Double(FloatingDecimal.readJavaFormatString(s).doubleValue());
+ }
+
+ /**
+ * Returns a {@code Double} instance representing the specified
+ * {@code double} value.
+ * If a new {@code Double} instance is not required, this method
+ * should generally be used in preference to the constructor
+ * {@link #Double(double)}, as this method is likely to yield
+ * significantly better space and time performance by caching
+ * frequently requested values.
+ *
+ * @param d a double value.
+ * @return a {@code Double} instance representing {@code d}.
+ * @since 1.5
+ */
+ public static Double valueOf(double d) {
+ return new Double(d);
+ }
+
+ /**
+ * Returns a new {@code double} initialized to the value
+ * represented by the specified {@code String}, as performed
+ * by the {@code valueOf} method of class
+ * {@code Double}.
+ *
+ * @param s the string to be parsed.
+ * @return the {@code double} value represented by the string
+ * argument.
+ * @throws NumberFormatException if the string does not contain
+ * a parsable {@code double}.
+ * @see java.lang.Double#valueOf(String)
+ * @since 1.2
+ */
+ public static double parseDouble(String s) throws NumberFormatException {
+ return FloatingDecimal.readJavaFormatString(s).doubleValue();
+ }
+
+ /**
+ * Returns {@code true} if the specified number is a
+ * Not-a-Number (NaN) value, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the value of the argument is NaN;
+ * {@code false} otherwise.
+ */
+ static public boolean isNaN(double v) {
+ return (v != v);
+ }
+
+ /**
+ * Returns {@code true} if the specified number is infinitely
+ * large in magnitude, {@code false} otherwise.
+ *
+ * @param v the value to be tested.
+ * @return {@code true} if the value of the argument is positive
+ * infinity or negative infinity; {@code false} otherwise.
+ */
+ static public boolean isInfinite(double v) {
+ return (v == POSITIVE_INFINITY) || (v == NEGATIVE_INFINITY);
+ }
+
+ /**
+ * The value of the Double.
+ *
+ * @serial
+ */
+ private final double value;
+
+ /**
+ * Constructs a newly allocated {@code Double} object that
+ * represents the primitive {@code double} argument.
+ *
+ * @param value the value to be represented by the {@code Double}.
+ */
+ public Double(double value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructs a newly allocated {@code Double} object that
+ * represents the floating-point value of type {@code double}
+ * represented by the string. The string is converted to a
+ * {@code double} value as if by the {@code valueOf} method.
+ *
+ * @param s a string to be converted to a {@code Double}.
+ * @throws NumberFormatException if the string does not contain a
+ * parsable number.
+ * @see java.lang.Double#valueOf(java.lang.String)
+ */
+ public Double(String s) throws NumberFormatException {
+ // REMIND: this is inefficient
+ this(valueOf(s).doubleValue());
+ }
+
+ /**
+ * Returns {@code true} if this {@code Double} value is
+ * a Not-a-Number (NaN), {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * NaN; {@code false} otherwise.
+ */
+ public boolean isNaN() {
+ return isNaN(value);
+ }
+
+ /**
+ * Returns {@code true} if this {@code Double} value is
+ * infinitely large in magnitude, {@code false} otherwise.
+ *
+ * @return {@code true} if the value represented by this object is
+ * positive infinity or negative infinity;
+ * {@code false} otherwise.
+ */
+ public boolean isInfinite() {
+ return isInfinite(value);
+ }
+
+ /**
+ * Returns a string representation of this {@code Double} object.
+ * The primitive {@code double} value represented by this
+ * object is converted to a string exactly as if by the method
+ * {@code toString} of one argument.
+ *
+ * @return a {@code String} representation of this object.
+ * @see java.lang.Double#toString(double)
+ */
+ public String toString() {
+ return String.valueOf(value);
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a {@code byte} (by
+ * casting to a {@code byte}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code byte}
+ * @since JDK1.1
+ */
+ public byte byteValue() {
+ return (byte)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a
+ * {@code short} (by casting to a {@code short}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code short}
+ * @since JDK1.1
+ */
+ public short shortValue() {
+ return (short)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as an
+ * {@code int} (by casting to type {@code int}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code int}
+ */
+ public int intValue() {
+ return (int)value;
+ }
+
+ /**
+ * Returns the value of this {@code Double} as a
+ * {@code long} (by casting to type {@code long}).
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code long}
+ */
+ public long longValue() {
+ return (long)value;
+ }
+
+ /**
+ * Returns the {@code float} value of this
+ * {@code Double} object.
+ *
+ * @return the {@code double} value represented by this object
+ * converted to type {@code float}
+ * @since JDK1.0
+ */
+ public float floatValue() {
+ return (float)value;
+ }
+
+ /**
+ * Returns the {@code double} value of this
+ * {@code Double} object.
+ *
+ * @return the {@code double} value represented by this object
+ */
+ public double doubleValue() {
+ return (double)value;
+ }
+
+ /**
+ * Returns a hash code for this {@code Double} object. The
+ * result is the exclusive OR of the two halves of the
+ * {@code long} integer bit representation, exactly as
+ * produced by the method {@link #doubleToLongBits(double)}, of
+ * the primitive {@code double} value represented by this
+ * {@code Double} object. That is, the hash code is the value
+ * of the expression:
+ *
+ * <blockquote>
+ * {@code (int)(v^(v>>>32))}
+ * </blockquote>
+ *
+ * where {@code v} is defined by:
+ *
+ * <blockquote>
+ * {@code long v = Double.doubleToLongBits(this.doubleValue());}
+ * </blockquote>
+ *
+ * @return a {@code hash code} value for this object.
+ */
+ public int hashCode() {
+ long bits = doubleToLongBits(value);
+ return (int)(bits ^ (bits >>> 32));
+ }
+
+ /**
+ * Compares this object against the specified object. The result
+ * is {@code true} if and only if the argument is not
+ * {@code null} and is a {@code Double} object that
+ * represents a {@code double} that has the same value as the
+ * {@code double} represented by this object. For this
+ * purpose, two {@code double} values are considered to be
+ * the same if and only if the method {@link
+ * #doubleToLongBits(double)} returns the identical
+ * {@code long} value when applied to each.
+ *
+ * <p>Note that in most cases, for two instances of class
+ * {@code Double}, {@code d1} and {@code d2}, the
+ * value of {@code d1.equals(d2)} is {@code true} if and
+ * only if
+ *
+ * <blockquote>
+ * {@code d1.doubleValue() == d2.doubleValue()}
+ * </blockquote>
+ *
+ * <p>also has the value {@code true}. However, there are two
+ * exceptions:
+ * <ul>
+ * <li>If {@code d1} and {@code d2} both represent
+ * {@code Double.NaN}, then the {@code equals} method
+ * returns {@code true}, even though
+ * {@code Double.NaN==Double.NaN} has the value
+ * {@code false}.
+ * <li>If {@code d1} represents {@code +0.0} while
+ * {@code d2} represents {@code -0.0}, or vice versa,
+ * the {@code equal} test has the value {@code false},
+ * even though {@code +0.0==-0.0} has the value {@code true}.
+ * </ul>
+ * This definition allows hash tables to operate properly.
+ * @param obj the object to compare with.
+ * @return {@code true} if the objects are the same;
+ * {@code false} otherwise.
+ * @see java.lang.Double#doubleToLongBits(double)
+ */
+ public boolean equals(Object obj) {
+ return ...
[truncated message content] |
|
From: <ls...@us...> - 2007-06-17 06:56:28
|
Revision: 3263
http://jnode.svn.sourceforge.net/jnode/?rev=3263&view=rev
Author: lsantha
Date: 2007-06-16 23:56:25 -0700 (Sat, 16 Jun 2007)
Log Message:
-----------
Added icedtea sourcetree.
Added Paths:
-----------
trunk/core/src/icedtea/
trunk/core/src/icedtea/sun/
trunk/core/src/icedtea/sun/nio/
trunk/core/src/icedtea/sun/nio/cs/
trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java
Added: trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java
===================================================================
--- trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java (rev 0)
+++ trunk/core/src/icedtea/sun/nio/cs/StandardCharsets.java 2007-06-17 06:56:25 UTC (rev 3263)
@@ -0,0 +1,680 @@
+/*
+ * @(#)StandardCharsets.java 1.30 06/01/20
+ */
+
+// -- This file was mechanically generated: Do not edit! -- //
+
+package sun.nio.cs;
+
+import java.nio.charset.*;
+
+
+public class StandardCharsets
+ extends FastCharsetProvider
+{
+
+ static final String[] aliases_US_ASCII = new String[] {
+ "iso-ir-6",
+ "ANSI_X3.4-1986",
+ "ISO_646.irv:1991",
+ "ASCII",
+ "ISO646-US",
+ "us",
+ "IBM367",
+ "cp367",
+ "csASCII",
+ "default",
+ "646",
+ "iso_646.irv:1983",
+ "ANSI_X3.4-1968",
+ "ascii7",
+ };
+
+ static final String[] aliases_UTF_8 = new String[] {
+ "UTF8",
+ "unicode-1-1-utf-8",
+ };
+
+ static final String[] aliases_UTF_16 = new String[] {
+ "UTF_16",
+ "utf16",
+ "unicode",
+ "UnicodeBig",
+ };
+
+ static final String[] aliases_UTF_16BE = new String[] {
+ "UTF_16BE",
+ "ISO-10646-UCS-2",
+ "X-UTF-16BE",
+ "UnicodeBigUnmarked",
+ };
+
+ static final String[] aliases_UTF_16LE = new String[] {
+ "UTF_16LE",
+ "X-UTF-16LE",
+ "UnicodeLittleUnmarked",
+ };
+
+ static final String[] aliases_UTF_16LE_BOM = new String[] {
+ "UnicodeLittle",
+ };
+
+ static final String[] aliases_UTF_32 = new String[] {
+ "UTF_32",
+ "UTF32",
+ };
+
+ static final String[] aliases_UTF_32LE = new String[] {
+ "UTF_32LE",
+ "X-UTF-32LE",
+ };
+
+ static final String[] aliases_UTF_32BE = new String[] {
+ "UTF_32BE",
+ "X-UTF-32BE",
+ };
+
+ static final String[] aliases_UTF_32LE_BOM = new String[] {
+ "UTF_32LE_BOM",
+ "UTF-32LE-BOM",
+ };
+
+ static final String[] aliases_UTF_32BE_BOM = new String[] {
+ "UTF_32BE_BOM",
+ "UTF-32BE-BOM",
+ };
+
+ static final String[] aliases_ISO_8859_1 = new String[] {
+ "iso-ir-100",
+ "ISO_8859-1",
+ "latin1",
+ "l1",
+ "IBM819",
+ "cp819",
+ "csISOLatin1",
+ "819",
+ "IBM-819",
+ "ISO8859_1",
+ "ISO_8859-1:1987",
+ "ISO_8859_1",
+ "8859_1",
+ "ISO8859-1",
+ };
+
+ static final String[] aliases_ISO_8859_2 = new String[] {
+ "iso8859_2",
+ "8859_2",
+ "iso-ir-101",
+ "ISO_8859-2",
+ "ISO_8859-2:1987",
+ "ISO8859-2",
+ "latin2",
+ "l2",
+ "ibm912",
+ "ibm-912",
+ "cp912",
+ "912",
+ "csISOLatin2",
+ };
+
+ static final String[] aliases_ISO_8859_4 = new String[] {
+ "iso8859_4",
+ "iso8859-4",
+ "8859_4",
+ "iso-ir-110",
+ "ISO_8859-4",
+ "ISO_8859-4:1988",
+ "latin4",
+ "l4",
+ "ibm914",
+ "ibm-914",
+ "cp914",
+ "914",
+ "csISOLatin4",
+ };
+
+ static final String[] aliases_ISO_8859_5 = new String[] {
+ "iso8859_5",
+ "8859_5",
+ "iso-ir-144",
+ "ISO_8859-5",
+ "ISO_8859-5:1988",
+ "ISO8859-5",
+ "cyrillic",
+ "ibm915",
+ "ibm-915",
+ "cp915",
+ "915",
+ "csISOLatinCyrillic",
+ };
+
+ static final String[] aliases_ISO_8859_7 = new String[] {
+ "iso8859_7",
+ "8859_7",
+ "iso-ir-126",
+ "ISO_8859-7",
+ "ISO_8859-7:1987",
+ "ELOT_928",
+ "ECMA-118",
+ "greek",
+ "greek8",
+ "csISOLatinGreek",
+ "sun_eu_greek",
+ "ibm813",
+ "ibm-813",
+ "813",
+ "cp813",
+ "iso8859-7",
+ };
+
+ static final String[] aliases_ISO_8859_9 = new String[] {
+ "iso8859_9",
+ "8859_9",
+ "iso-ir-148",
+ "ISO_8859-9",
+ "ISO_8859-9:1989",
+ "ISO8859-9",
+ "latin5",
+ "l5",
+ "ibm920",
+ "ibm-920",
+ "920",
+ "cp920",
+ "csISOLatin5",
+ };
+
+ static final String[] aliases_ISO_8859_13 = new String[] {
+ "iso8859_13",
+ "8859_13",
+ "iso_8859-13",
+ "ISO8859-13",
+ };
+
+ static final String[] aliases_ISO_8859_15 = new String[] {
+ "ISO_8859-15",
+ "8859_15",
+ "ISO-8859-15",
+ "ISO8859_15",
+ "ISO8859-15",
+ "IBM923",
+ "IBM-923",
+ "cp923",
+ "923",
+ "LATIN0",
+ "LATIN9",
+ "L9",
+ "csISOlatin0",
+ "csISOlatin9",
+ "ISO8859_15_FDIS",
+ };
+
+ static final String[] aliases_KOI8_R = new String[] {
+ "koi8_r",
+ "koi8",
+ "cskoi8r",
+ };
+
+ static final String[] aliases_KOI8_U = new String[] {
+ "koi8_u",
+ };
+
+ static final String[] aliases_MS1250 = new String[] {
+ "cp1250",
+ "cp5346",
+ };
+
+ static final String[] aliases_MS1251 = new String[] {
+ "cp1251",
+ "cp5347",
+ "ansi-1251",
+ };
+
+ static final String[] aliases_MS1252 = new String[] {
+ "cp1252",
+ "cp5348",
+ };
+
+ static final String[] aliases_MS1253 = new String[] {
+ "cp1253",
+ "cp5349",
+ };
+
+ static final String[] aliases_MS1254 = new String[] {
+ "cp1254",
+ "cp5350",
+ };
+
+ static final String[] aliases_MS1257 = new String[] {
+ "cp1257",
+ "cp5353",
+ };
+
+ static final String[] aliases_IBM437 = new String[] {
+ "cp437",
+ "ibm437",
+ "ibm-437",
+ "437",
+ "cspc8codepage437",
+ "windows-437",
+ };
+
+ static final String[] aliases_IBM737 = new String[] {
+ "cp737",
+ "ibm737",
+ "ibm-737",
+ "737",
+ };
+
+ static final String[] aliases_IBM775 = new String[] {
+ "cp775",
+ "ibm775",
+ "ibm-775",
+ "775",
+ };
+
+ static final String[] aliases_IBM850 = new String[] {
+ "cp850",
+ "ibm-850",
+ "ibm850",
+ "850",
+ "cspc850multilingual",
+ };
+
+ static final String[] aliases_IBM852 = new String[] {
+ "cp852",
+ "ibm852",
+ "ibm-852",
+ "852",
+ "csPCp852",
+ };
+
+ static final String[] aliases_IBM855 = new String[] {
+ "cp855",
+ "ibm-855",
+ "ibm855",
+ "855",
+ "cspcp855",
+ };
+
+ static final String[] aliases_IBM857 = new String[] {
+ "cp857",
+ "ibm857",
+ "ibm-857",
+ "857",
+ "csIBM857",
+ };
+
+ static final String[] aliases_IBM858 = new String[] {
+ "cp858",
+ "ccsid00858",
+ "cp00858",
+ "858",
+ };
+
+ static final String[] aliases_IBM862 = new String[] {
+ "cp862",
+ "ibm862",
+ "ibm-862",
+ "862",
+ "csIBM862",
+ "cspc862latinhebrew",
+ };
+
+ static final String[] aliases_IBM866 = new String[] {
+ "cp866",
+ "ibm866",
+ "ibm-866",
+ "866",
+ "csIBM866",
+ };
+
+ static final String[] aliases_IBM874 = new String[] {
+ "cp874",
+ "ibm874",
+ "ibm-874",
+ "874",
+ };
+
+ private static final class Aliases
+ extends sun.util.PreHashedMap<String>
+ {
+
+ private static final int ROWS = 1024;
+ private static final int SIZE = 208;
+ private static final int SHIFT = 0;
+ private static final int MASK = 0x3ff;
+
+ private Aliases() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[1] = new Object[] { "csisolatin0", "iso-8859-15" };
+ ht[2] = new Object[] { "csisolatin1", "iso-8859-1" };
+ ht[3] = new Object[] { "csisolatin2", "iso-8859-2" };
+ ht[5] = new Object[] { "csisolatin4", "iso-8859-4" };
+ ht[6] = new Object[] { "csisolatin5", "iso-8859-9" };
+ ht[10] = new Object[] { "csisolatin9", "iso-8859-15" };
+ ht[19] = new Object[] { "unicodelittle", "x-utf-16le-bom" };
+ ht[24] = new Object[] { "iso646-us", "us-ascii" };
+ ht[25] = new Object[] { "iso_8859-7:1987", "iso-8859-7" };
+ ht[26] = new Object[] { "912", "iso-8859-2" };
+ ht[28] = new Object[] { "914", "iso-8859-4" };
+ ht[29] = new Object[] { "915", "iso-8859-5" };
+ ht[55] = new Object[] { "920", "iso-8859-9" };
+ ht[58] = new Object[] { "923", "iso-8859-15" };
+ ht[86] = new Object[] { "csisolatincyrillic", "iso-8859-5",
+ new Object[] { "8859_1", "iso-8859-1" } };
+ ht[87] = new Object[] { "8859_2", "iso-8859-2" };
+ ht[89] = new Object[] { "8859_4", "iso-8859-4" };
+ ht[90] = new Object[] { "813", "iso-8859-7",
+ new Object[] { "8859_5", "iso-8859-5" } };
+ ht[92] = new Object[] { "8859_7", "iso-8859-7" };
+ ht[94] = new Object[] { "8859_9", "iso-8859-9" };
+ ht[95] = new Object[] { "iso_8859-1:1987", "iso-8859-1" };
+ ht[96] = new Object[] { "819", "iso-8859-1" };
+ ht[106] = new Object[] { "unicode-1-1-utf-8", "utf-8" };
+ ht[121] = new Object[] { "x-utf-16le", "utf-16le" };
+ ht[125] = new Object[] { "ecma-118", "iso-8859-7" };
+ ht[134] = new Object[] { "koi8_r", "koi8-r" };
+ ht[137] = new Object[] { "koi8_u", "koi8-u" };
+ ht[141] = new Object[] { "cp912", "iso-8859-2" };
+ ht[143] = new Object[] { "cp914", "iso-8859-4" };
+ ht[144] = new Object[] { "cp915", "iso-8859-5" };
+ ht[170] = new Object[] { "cp920", "iso-8859-9" };
+ ht[173] = new Object[] { "cp923", "iso-8859-15" };
+ ht[177] = new Object[] { "utf_32le_bom", "x-utf-32le-bom" };
+ ht[192] = new Object[] { "utf_16be", "utf-16be" };
+ ht[199] = new Object[] { "cspc8codepage437", "ibm437",
+ new Object[] { "ansi-1251", "windows-1251" } };
+ ht[205] = new Object[] { "cp813", "iso-8859-7" };
+ ht[211] = new Object[] { "850", "ibm850",
+ new Object[] { "cp819", "iso-8859-1" } };
+ ht[213] = new Object[] { "852", "ibm852" };
+ ht[216] = new Object[] { "855", "ibm855" };
+ ht[218] = new Object[] { "857", "ibm857",
+ new Object[] { "iso-ir-6", "us-ascii" } };
+ ht[219] = new Object[] { "858", "ibm00858",
+ new Object[] { "737", "x-ibm737" } };
+ ht[225] = new Object[] { "csascii", "us-ascii" };
+ ht[244] = new Object[] { "862", "ibm862" };
+ ht[248] = new Object[] { "866", "ibm866" };
+ ht[253] = new Object[] { "x-utf-32be", "utf-32be" };
+ ht[254] = new Object[] { "iso_8859-2:1987", "iso-8859-2" };
+ ht[259] = new Object[] { "unicodebig", "utf-16" };
+ ht[269] = new Object[] { "iso8859_15_fdis", "iso-8859-15" };
+ ht[277] = new Object[] { "874", "x-ibm874" };
+ ht[280] = new Object[] { "unicodelittleunmarked", "utf-16le" };
+ ht[283] = new Object[] { "iso8859_1", "iso-8859-1" };
+ ht[284] = new Object[] { "iso8859_2", "iso-8859-2" };
+ ht[286] = new Object[] { "iso8859_4", "iso-8859-4" };
+ ht[287] = new Object[] { "iso8859_5", "iso-8859-5" };
+ ht[289] = new Object[] { "iso8859_7", "iso-8859-7" };
+ ht[291] = new Object[] { "iso8859_9", "iso-8859-9" };
+ ht[294] = new Object[] { "ibm912", "iso-8859-2" };
+ ht[296] = new Object[] { "ibm914", "iso-8859-4" };
+ ht[297] = new Object[] { "ibm915", "iso-8859-5" };
+ ht[305] = new Object[] { "iso_8859-13", "iso-8859-13" };
+ ht[307] = new Object[] { "iso_8859-15", "iso-8859-15" };
+ ht[312] = new Object[] { "greek8", "iso-8859-7",
+ new Object[] { "646", "us-ascii" } };
+ ht[321] = new Object[] { "ibm-912", "iso-8859-2" };
+ ht[323] = new Object[] { "ibm920", "iso-8859-9",
+ new Object[] { "ibm-914", "iso-8859-4" } };
+ ht[324] = new Object[] { "ibm-915", "iso-8859-5" };
+ ht[325] = new Object[] { "l1", "iso-8859-1" };
+ ht[326] = new Object[] { "cp850", "ibm850",
+ new Object[] { "ibm923", "iso-8859-15",
+ new Object[] { "l2", "iso-8859-2" } } };
+ ht[327] = new Object[] { "cyrillic", "iso-8859-5" };
+ ht[328] = new Object[] { "cp852", "ibm852",
+ new Object[] { "l4", "iso-8859-4" } };
+ ht[329] = new Object[] { "l5", "iso-8859-9" };
+ ht[331] = new Object[] { "cp855", "ibm855" };
+ ht[333] = new Object[] { "cp857", "ibm857",
+ new Object[] { "l9", "iso-8859-15" } };
+ ht[334] = new Object[] { "cp858", "ibm00858",
+ new Object[] { "cp737", "x-ibm737" } };
+ ht[336] = new Object[] { "iso_8859_1", "iso-8859-1" };
+ ht[339] = new Object[] { "koi8", "koi8-r" };
+ ht[341] = new Object[] { "775", "ibm775" };
+ ht[345] = new Object[] { "iso_8859-9:1989", "iso-8859-9" };
+ ht[350] = new Object[] { "ibm-920", "iso-8859-9" };
+ ht[353] = new Object[] { "ibm-923", "iso-8859-15" };
+ ht[358] = new Object[] { "ibm813", "iso-8859-7" };
+ ht[359] = new Object[] { "cp862", "ibm862" };
+ ht[363] = new Object[] { "cp866", "ibm866" };
+ ht[364] = new Object[] { "ibm819", "iso-8859-1" };
+ ht[378] = new Object[] { "ansi_x3.4-1968", "us-ascii" };
+ ht[385] = new Object[] { "ibm-813", "iso-8859-7" };
+ ht[391] = new Object[] { "ibm-819", "iso-8859-1" };
+ ht[392] = new Object[] { "cp874", "x-ibm874" };
+ ht[405] = new Object[] { "iso-ir-100", "iso-8859-1" };
+ ht[406] = new Object[] { "iso-ir-101", "iso-8859-2" };
+ ht[408] = new Object[] { "437", "ibm437" };
+ ht[421] = new Object[] { "iso-8859-15", "iso-8859-15" };
+ ht[428] = new Object[] { "latin0", "iso-8859-15" };
+ ht[429] = new Object[] { "latin1", "iso-8859-1" };
+ ht[430] = new Object[] { "latin2", "iso-8859-2" };
+ ht[432] = new Object[] { "latin4", "iso-8859-4" };
+ ht[433] = new Object[] { "latin5", "iso-8859-9" };
+ ht[436] = new Object[] { "iso-ir-110", "iso-8859-4" };
+ ht[437] = new Object[] { "latin9", "iso-8859-15" };
+ ht[438] = new Object[] { "ansi_x3.4-1986", "us-ascii" };
+ ht[443] = new Object[] { "utf-32be-bom", "x-utf-32be-bom" };
+ ht[456] = new Object[] { "cp775", "ibm775" };
+ ht[473] = new Object[] { "iso-ir-126", "iso-8859-7" };
+ ht[479] = new Object[] { "ibm850", "ibm850" };
+ ht[481] = new Object[] { "ibm852", "ibm852" };
+ ht[484] = new Object[] { "ibm855", "ibm855" };
+ ht[486] = new Object[] { "ibm857", "ibm857" };
+ ht[487] = new Object[] { "ibm737", "x-ibm737" };
+ ht[502] = new Object[] { "utf_16le", "utf-16le" };
+ ht[506] = new Object[] { "ibm-850", "ibm850" };
+ ht[508] = new Object[] { "ibm-852", "ibm852" };
+ ht[511] = new Object[] { "ibm-855", "ibm855" };
+ ht[512] = new Object[] { "ibm862", "ibm862" };
+ ht[513] = new Object[] { "ibm-857", "ibm857" };
+ ht[514] = new Object[] { "ibm-737", "x-ibm737" };
+ ht[516] = new Object[] { "ibm866", "ibm866" };
+ ht[520] = new Object[] { "unicodebigunmarked", "utf-16be" };
+ ht[523] = new Object[] { "cp437", "ibm437" };
+ ht[524] = new Object[] { "utf16", "utf-16" };
+ ht[533] = new Object[] { "iso-ir-144", "iso-8859-5" };
+ ht[537] = new Object[] { "iso-ir-148", "iso-8859-9" };
+ ht[539] = new Object[] { "ibm-862", "ibm862" };
+ ht[543] = new Object[] { "ibm-866", "ibm866" };
+ ht[545] = new Object[] { "ibm874", "x-ibm874" };
+ ht[563] = new Object[] { "x-utf-32le", "utf-32le" };
+ ht[572] = new Object[] { "ibm-874", "x-ibm874" };
+ ht[573] = new Object[] { "iso_8859-4:1988", "iso-8859-4" };
+ ht[577] = new Object[] { "default", "us-ascii" };
+ ht[582] = new Object[] { "utf32", "utf-32" };
+ ht[588] = new Object[] { "elot_928", "iso-8859-7" };
+ ht[593] = new Object[] { "csisolatingreek", "iso-8859-7" };
+ ht[598] = new Object[] { "csibm857", "ibm857" };
+ ht[609] = new Object[] { "ibm775", "ibm775" };
+ ht[617] = new Object[] { "cp1250", "windows-1250" };
+ ht[618] = new Object[] { "cp1251", "windows-1251" };
+ ht[619] = new Object[] { "cp1252", "windows-1252" };
+ ht[620] = new Object[] { "cp1253", "windows-1253" };
+ ht[621] = new Object[] { "cp1254", "windows-1254" };
+ ht[624] = new Object[] { "csibm862", "ibm862",
+ new Object[] { "cp1257", "windows-1257" } };
+ ht[628] = new Object[] { "csibm866", "ibm866" };
+ ht[632] = new Object[] { "iso8859_13", "iso-8859-13" };
+ ht[634] = new Object[] { "iso8859_15", "iso-8859-15",
+ new Object[] { "utf_32be", "utf-32be" } };
+ ht[635] = new Object[] { "utf_32be_bom", "x-utf-32be-bom" };
+ ht[636] = new Object[] { "ibm-775", "ibm775" };
+ ht[654] = new Object[] { "cp00858", "ibm00858" };
+ ht[669] = new Object[] { "8859_13", "iso-8859-13" };
+ ht[670] = new Object[] { "us", "us-ascii" };
+ ht[671] = new Object[] { "8859_15", "iso-8859-15" };
+ ht[676] = new Object[] { "ibm437", "ibm437" };
+ ht[679] = new Object[] { "cp367", "us-ascii" };
+ ht[686] = new Object[] { "iso-10646-ucs-2", "utf-16be" };
+ ht[703] = new Object[] { "ibm-437", "ibm437" };
+ ht[710] = new Object[] { "iso8859-13", "iso-8859-13" };
+ ht[712] = new Object[] { "iso8859-15", "iso-8859-15" };
+ ht[732] = new Object[] { "iso_8859-5:1988", "iso-8859-5" };
+ ht[733] = new Object[] { "unicode", "utf-16" };
+ ht[768] = new Object[] { "greek", "iso-8859-7" };
+ ht[774] = new Object[] { "ascii7", "us-ascii" };
+ ht[781] = new Object[] { "iso8859-1", "iso-8859-1" };
+ ht[782] = new Object[] { "iso8859-2", "iso-8859-2" };
+ ht[783] = new Object[] { "cskoi8r", "koi8-r" };
+ ht[784] = new Object[] { "iso8859-4", "iso-8859-4" };
+ ht[785] = new Object[] { "iso8859-5", "iso-8859-5" };
+ ht[787] = new Object[] { "iso8859-7", "iso-8859-7" };
+ ht[789] = new Object[] { "iso8859-9", "iso-8859-9" };
+ ht[813] = new Object[] { "ccsid00858", "ibm00858" };
+ ht[818] = new Object[] { "cspc862latinhebrew", "ibm862" };
+ ht[832] = new Object[] { "ibm367", "us-ascii" };
+ ht[834] = new Object[] { "iso_8859-1", "iso-8859-1" };
+ ht[835] = new Object[] { "iso_8859-2", "iso-8859-2",
+ new Object[] { "x-utf-16be", "utf-16be" } };
+ ht[836] = new Object[] { "sun_eu_greek", "iso-8859-7" };
+ ht[837] = new Object[] { "iso_8859-4", "iso-8859-4" };
+ ht[838] = new Object[] { "iso_8859-5", "iso-8859-5" };
+ ht[840] = new Object[] { "cspcp852", "ibm852",
+ new Object[] { "iso_8859-7", "iso-8859-7" } };
+ ht[842] = new Object[] { "iso_8859-9", "iso-8859-9" };
+ ht[843] = new Object[] { "cspcp855", "ibm855" };
+ ht[846] = new Object[] { "windows-437", "ibm437" };
+ ht[849] = new Object[] { "ascii", "us-ascii" };
+ ht[881] = new Object[] { "utf8", "utf-8" };
+ ht[896] = new Object[] { "iso_646.irv:1983", "us-ascii" };
+ ht[909] = new Object[] { "cp5346", "windows-1250" };
+ ht[910] = new Object[] { "cp5347", "windows-1251" };
+ ht[911] = new Object[] { "cp5348", "windows-1252" };
+ ht[912] = new Object[] { "cp5349", "windows-1253" };
+ ht[925] = new Object[] { "iso_646.irv:1991", "us-ascii" };
+ ht[934] = new Object[] { "cp5350", "windows-1254" };
+ ht[937] = new Object[] { "cp5353", "windows-1257" };
+ ht[944] = new Object[] { "utf_32le", "utf-32le" };
+ ht[957] = new Object[] { "utf_16", "utf-16" };
+ ht[993] = new Object[] { "cspc850multilingual", "ibm850" };
+ ht[1009] = new Object[] { "utf-32le-bom", "x-utf-32le-bom" };
+ ht[1015] = new Object[] { "utf_32", "utf-32" };
+ }
+
+ }
+
+ private static final class Classes
+ extends sun.util.PreHashedMap<String>
+ {
+
+ private static final int ROWS = 32;
+ private static final int SIZE = 38;
+ private static final int SHIFT = 1;
+ private static final int MASK = 0x1f;
+
+ private Classes() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[0] = new Object[] { "ibm862", "IBM862" };
+ ht[2] = new Object[] { "ibm866", "IBM866",
+ new Object[] { "utf-32", "UTF_32",
+ new Object[] { "utf-16le", "UTF_16LE" } } };
+ ht[3] = new Object[] { "windows-1251", "MS1251",
+ new Object[] { "windows-1250", "MS1250" } };
+ ht[4] = new Object[] { "windows-1253", "MS1253",
+ new Object[] { "windows-1252", "MS1252",
+ new Object[] { "utf-32be", "UTF_32BE" } } };
+ ht[5] = new Object[] { "windows-1254", "MS1254",
+ new Object[] { "utf-16", "UTF_16" } };
+ ht[6] = new Object[] { "windows-1257", "MS1257" };
+ ht[7] = new Object[] { "utf-16be", "UTF_16BE" };
+ ht[8] = new Object[] { "iso-8859-2", "ISO_8859_2",
+ new Object[] { "iso-8859-1", "ISO_8859_1" } };
+ ht[9] = new Object[] { "iso-8859-4", "ISO_8859_4",
+ new Object[] { "utf-8", "UTF_8" } };
+ ht[10] = new Object[] { "iso-8859-5", "ISO_8859_5" };
+ ht[11] = new Object[] { "x-ibm874", "IBM874",
+ new Object[] { "iso-8859-7", "ISO_8859_7" } };
+ ht[12] = new Object[] { "iso-8859-9", "ISO_8859_9" };
+ ht[14] = new Object[] { "x-ibm737", "IBM737" };
+ ht[15] = new Object[] { "ibm850", "IBM850" };
+ ht[16] = new Object[] { "ibm852", "IBM852",
+ new Object[] { "ibm775", "IBM775" } };
+ ht[17] = new Object[] { "iso-8859-13", "ISO_8859_13",
+ new Object[] { "us-ascii", "US_ASCII" } };
+ ht[18] = new Object[] { "ibm855", "IBM855",
+ new Object[] { "ibm437", "IBM437",
+ new Object[] { "iso-8859-15", "ISO_8859_15" } } };
+ ht[19] = new Object[] { "ibm00858", "IBM858",
+ new Object[] { "ibm857", "IBM857",
+ new Object[] { "x-utf-32le-bom", "UTF_32LE_BOM" } } };
+ ht[22] = new Object[] { "x-utf-16le-bom", "UTF_16LE_BOM" };
+ ht[24] = new Object[] { "x-utf-32be-bom", "UTF_32BE_BOM" };
+ ht[28] = new Object[] { "koi8-r", "KOI8_R" };
+ ht[29] = new Object[] { "koi8-u", "KOI8_U" };
+ ht[31] = new Object[] { "utf-32le", "UTF_32LE" };
+ }
+
+ }
+
+ private static final class Cache
+ extends sun.util.PreHashedMap<Charset>
+ {
+
+ private static final int ROWS = 32;
+ private static final int SIZE = 38;
+ private static final int SHIFT = 1;
+ private static final int MASK = 0x1f;
+
+ private Cache() {
+ super(ROWS, SIZE, SHIFT, MASK);
+ }
+
+ protected void init(Object[] ht) {
+ ht[0] = new Object[] { "ibm862", null };
+ ht[2] = new Object[] { "ibm866", null,
+ new Object[] { "utf-32", null,
+ new Object[] { "utf-16le", null } } };
+ ht[3] = new Object[] { "windows-1251", null,
+ new Object[] { "windows-1250", null } };
+ ht[4] = new Object[] { "windows-1253", null,
+ new Object[] { "windows-1252", null,
+ new Object[] { "utf-32be", null } } };
+ ht[5] = new Object[] { "windows-1254", null,
+ new Object[] { "utf-16", null } };
+ ht[6] = new Object[] { "windows-1257", null };
+ ht[7] = new Object[] { "utf-16be", null };
+ ht[8] = new Object[] { "iso-8859-2", null,
+ new Object[] { "iso-8859-1", null } };
+ ht[9] = new Object[] { "iso-8859-4", null,
+ new Object[] { "utf-8", null } };
+ ht[10] = new Object[] { "iso-8859-5", null };
+ ht[11] = new Object[] { "x-ibm874", null,
+ new Object[] { "iso-8859-7", null } };
+ ht[12] = new Object[] { "iso-8859-9", null };
+ ht[14] = new Object[] { "x-ibm737", null };
+ ht[15] = new Object[] { "ibm850", null };
+ ht[16] = new Object[] { "ibm852", null,
+ new Object[] { "ibm775", null } };
+ ht[17] = new Object[] { "iso-8859-13", null,
+ new Object[] { "us-ascii", null } };
+ ht[18] = new Object[] { "ibm855", null,
+ new Object[] { "ibm437", null,
+ new Object[] { "iso-8859-15", null } } };
+ ht[19] = new Object[] { "ibm00858", null,
+ new Object[] { "ibm857", null,
+ new Object[] { "x-utf-32le-bom", null } } };
+ ht[22] = new Object[] { "x-utf-16le-bom", null };
+ ht[24] = new Object[] { "x-utf-32be-bom", null };
+ ht[28] = new Object[] { "koi8-r", null };
+ ht[29] = new Object[] { "koi8-u", null };
+ ht[31] = new Object[] { "utf-32le", null };
+ }
+
+ }
+
+ public StandardCharsets() {
+ super("sun.nio.cs", new Aliases(), new Classes(), new Cache());
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2007-06-30 11:50:31
|
Revision: 3334
http://jnode.svn.sourceforge.net/jnode/?rev=3334&view=rev
Author: fduminy
Date: 2007-06-30 04:50:26 -0700 (Sat, 30 Jun 2007)
Log Message:
-----------
integration of OpenJDK: added binding with VM for new File APIs (jdk 1.6)
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/io/VMFile.java
trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
trunk/core/src/core/org/jnode/util/FileUtils.java
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/DeleteOnExitHook.java
trunk/core/src/openjdk/java/java/io/FileSystem.java
trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java
trunk/core/src/openjdk/vm/java/io/NativeFileSystem.java
Modified: trunk/core/src/classpath/vm/java/io/VMFile.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMFile.java 2007-06-26 18:57:25 UTC (rev 3333)
+++ trunk/core/src/classpath/vm/java/io/VMFile.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -198,6 +198,41 @@
}
}
+ static synchronized boolean canExecute(String path) {
+ try {
+ return VMIOUtils.getAPI().canExecute(getNormalizedPath(path));
+ } catch (IOException ex) {
+ return false;
+ }
+ }
+
+ public static boolean setReadable(String path, boolean enable,
+ boolean owneronly) {
+ try {
+ return VMIOUtils.getAPI().setReadable(getNormalizedPath(path), enable, owneronly);
+ } catch (IOException ex) {
+ return false;
+ }
+ }
+
+ public static boolean setWritable(String path, boolean enable,
+ boolean owneronly) {
+ try {
+ return VMIOUtils.getAPI().setWritable(getNormalizedPath(path), enable, owneronly);
+ } catch (IOException ex) {
+ return false;
+ }
+ }
+
+ public static boolean setExecutable(String path, boolean enable,
+ boolean owneronly) {
+ try {
+ return VMIOUtils.getAPI().setExecutable(getNormalizedPath(path), enable, owneronly);
+ } catch (IOException ex) {
+ return false;
+ }
+ }
+
/*
* This method does the actual check of whether or not a file is a directory
* or not. It also handle the existence check to eliminate the overhead of a
@@ -307,4 +342,28 @@
}
return path;
}
+
+ public static long getTotalSpace(String path) {
+ try {
+ return VMIOUtils.getAPI().getTotalSpace(getNormalizedPath(path));
+ } catch (IOException ex) {
+ return 0L;
+ }
+ }
+
+ public static long getFreeSpace(String path) {
+ try {
+ return VMIOUtils.getAPI().getFreeSpace(getNormalizedPath(path));
+ } catch (IOException ex) {
+ return 0L;
+ }
+ }
+
+ public static long getUsableSpace(String path) {
+ try {
+ return VMIOUtils.getAPI().getUsableSpace(getNormalizedPath(path));
+ } catch (IOException ex) {
+ return 0L;
+ }
+ }
}
Modified: trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java 2007-06-26 18:57:25 UTC (rev 3333)
+++ trunk/core/src/classpath/vm/java/io/VMFileSystemAPI.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -53,15 +53,17 @@
*
* @param file
*/
- public boolean canRead(String file);
+ public boolean canRead(String file) throws IOException;
/**
* Can the given file be written to?
*
* @param file
*/
- public boolean canWrite(String file);
+ public boolean canWrite(String file) throws IOException;
+ public boolean canExecute(String file) throws IOException;
+
/**
* Gets the length in bytes of the given file or 0 if the file does not exist.
*
@@ -91,6 +93,15 @@
*/
public void setReadOnly(String file) throws IOException;
+ public boolean setReadable(String normalizedPath, boolean enable,
+ boolean owneronly) throws IOException;
+
+ public boolean setWritable(String normalizedPath, boolean enable,
+ boolean owneronly) throws IOException;
+
+ public boolean setExecutable(String normalizedPath, boolean enable,
+ boolean owneronly) throws IOException;
+
/**
* Delete the given file.
*
@@ -136,4 +147,10 @@
* @throws IOException
*/
public boolean mkFile(String file, VMOpenMode mode) throws IOException;
+
+ public long getTotalSpace(String normalizedPath) throws IOException;
+
+ public long getFreeSpace(String normalizedPath) throws IOException;
+
+ public long getUsableSpace(String normalizedPath) throws IOException;
}
Modified: trunk/core/src/core/org/jnode/util/FileUtils.java
===================================================================
--- trunk/core/src/core/org/jnode/util/FileUtils.java 2007-06-26 18:57:25 UTC (rev 3333)
+++ trunk/core/src/core/org/jnode/util/FileUtils.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -60,17 +60,23 @@
* @throws IOException
*/
public static final void copy(InputStream is, OutputStream os, byte[] buf, boolean close) throws IOException {
- int len;
- if (buf == null) {
- buf = new byte[4096];
+ try
+ {
+ int len;
+ if (buf == null) {
+ buf = new byte[4096];
+ }
+ while ((len = is.read(buf)) > 0) {
+ os.write(buf, 0, len);
+ }
+ os.flush();
}
- while ((len = is.read(buf)) > 0) {
- os.write(buf, 0, len);
+ finally // in any case, we must close the stream if requested
+ {
+ if (close) {
+ is.close();
+ }
}
- os.flush();
- if (close) {
- is.close();
- }
}
/**
Added: trunk/core/src/openjdk/java/java/io/DeleteOnExitHook.java
===================================================================
--- trunk/core/src/openjdk/java/java/io/DeleteOnExitHook.java (rev 0)
+++ trunk/core/src/openjdk/java/java/io/DeleteOnExitHook.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package java.io;
+
+import java.util.*;
+import java.io.File;
+
+/**
+ * This class holds a set of filenames to be deleted on VM exit through a shutdown hook.
+ * A set is used both to prevent double-insertion of the same file as well as offer
+ * quick removal.
+ */
+
+class DeleteOnExitHook {
+ private static DeleteOnExitHook instance = null;
+
+ private static LinkedHashSet<String> files = new LinkedHashSet<String>();
+
+ static DeleteOnExitHook hook() {
+ if (instance == null)
+ instance = new DeleteOnExitHook();
+
+ return instance;
+ }
+
+ private DeleteOnExitHook() {}
+
+ static synchronized void add(String file) {
+ if(files == null)
+ throw new IllegalStateException("Shutdown in progress");
+
+ files.add(file);
+ }
+
+ void run() {
+ LinkedHashSet<String> theFiles;
+
+ synchronized (DeleteOnExitHook.class) {
+ theFiles = files;
+ files = null;
+ }
+
+ ArrayList<String> toBeDeleted = new ArrayList<String>(theFiles);
+
+ // reverse the list to maintain previous jdk deletion order.
+ // Last in first deleted.
+ Collections.reverse(toBeDeleted);
+ for (String filename : toBeDeleted) {
+ (new File(filename)).delete();
+ }
+ }
+}
+
Added: trunk/core/src/openjdk/java/java/io/FileSystem.java
===================================================================
--- trunk/core/src/openjdk/java/java/io/FileSystem.java (rev 0)
+++ trunk/core/src/openjdk/java/java/io/FileSystem.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -0,0 +1,252 @@
+/*
+ * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.io;
+
+
+/**
+ * Package-private abstract class for the local filesystem abstraction.
+ */
+
+abstract class FileSystem {
+
+ /**
+ * Return the FileSystem object representing this platform's local
+ * filesystem.
+ */
+ public static native FileSystem getFileSystem();
+
+
+ /* -- Normalization and construction -- */
+
+ /**
+ * Return the local filesystem's name-separator character.
+ */
+ public abstract char getSeparator();
+
+ /**
+ * Return the local filesystem's path-separator character.
+ */
+ public abstract char getPathSeparator();
+
+ /**
+ * Convert the given pathname string to normal form. If the string is
+ * already in normal form then it is simply returned.
+ */
+ public abstract String normalize(String path);
+
+ /**
+ * Compute the length of this pathname string's prefix. The pathname
+ * string must be in normal form.
+ */
+ public abstract int prefixLength(String path);
+
+ /**
+ * Resolve the child pathname string against the parent.
+ * Both strings must be in normal form, and the result
+ * will be in normal form.
+ */
+ public abstract String resolve(String parent, String child);
+
+ /**
+ * Return the parent pathname string to be used when the parent-directory
+ * argument in one of the two-argument File constructors is the empty
+ * pathname.
+ */
+ public abstract String getDefaultParent();
+
+ /**
+ * Post-process the given URI path string if necessary. This is used on
+ * win32, e.g., to transform "/c:/foo" into "c:/foo". The path string
+ * still has slash separators; code in the File class will translate them
+ * after this method returns.
+ */
+ public abstract String fromURIPath(String path);
+
+
+ /* -- Path operations -- */
+
+ /**
+ * Tell whether or not the given abstract pathname is absolute.
+ */
+ public abstract boolean isAbsolute(File f);
+
+ /**
+ * Resolve the given abstract pathname into absolute form. Invoked by the
+ * getAbsolutePath and getCanonicalPath methods in the File class.
+ */
+ public abstract String resolve(File f);
+
+ public abstract String canonicalize(String path) throws IOException;
+
+
+ /* -- Attribute accessors -- */
+
+ /* Constants for simple boolean attributes */
+ public static final int BA_EXISTS = 0x01;
+ public static final int BA_REGULAR = 0x02;
+ public static final int BA_DIRECTORY = 0x04;
+ public static final int BA_HIDDEN = 0x08;
+
+ /**
+ * Return the simple boolean attributes for the file or directory denoted
+ * by the given abstract pathname, or zero if it does not exist or some
+ * other I/O error occurs.
+ */
+ public abstract int getBooleanAttributes(File f);
+
+ public static final int ACCESS_READ = 0x04;
+ public static final int ACCESS_WRITE = 0x02;
+ public static final int ACCESS_EXECUTE = 0x01;
+
+ /**
+ * Check whether the file or directory denoted by the given abstract
+ * pathname may be accessed by this process. The second argument specifies
+ * which access, ACCESS_READ, ACCESS_WRITE or ACCESS_EXECUTE, to check.
+ * Return false if access is denied or an I/O error occurs
+ */
+ public abstract boolean checkAccess(File f, int access);
+ /**
+ * Set on or off the access permission (to owner only or to all) to the file
+ * or directory denoted by the given abstract pathname, based on the parameters
+ * enable, access and oweronly.
+ */
+ public abstract boolean setPermission(File f, int access, boolean enable, boolean owneronly);
+
+ /**
+ * Return the time at which the file or directory denoted by the given
+ * abstract pathname was last modified, or zero if it does not exist or
+ * some other I/O error occurs.
+ */
+ public abstract long getLastModifiedTime(File f);
+
+ /**
+ * Return the length in bytes of the file denoted by the given abstract
+ * pathname, or zero if it does not exist, is a directory, or some other
+ * I/O error occurs.
+ */
+ public abstract long getLength(File f);
+
+
+ /* -- File operations -- */
+
+ /**
+ * Create a new empty file with the given pathname. Return
+ * <code>true</code> if the file was created and <code>false</code> if a
+ * file or directory with the given pathname already exists. Throw an
+ * IOException if an I/O error occurs.
+ */
+ public abstract boolean createFileExclusively(String pathname)
+ throws IOException;
+
+ /**
+ * Delete the file or directory denoted by the given abstract pathname,
+ * returning <code>true</code> if and only if the operation succeeds.
+ */
+ public abstract boolean delete(File f);
+
+ /**
+ * List the elements of the directory denoted by the given abstract
+ * pathname. Return an array of strings naming the elements of the
+ * directory if successful; otherwise, return <code>null</code>.
+ */
+ public abstract String[] list(File f);
+
+ /**
+ * Create a new directory denoted by the given abstract pathname,
+ * returning <code>true</code> if and only if the operation succeeds.
+ */
+ public abstract boolean createDirectory(File f);
+
+ /**
+ * Rename the file or directory denoted by the first abstract pathname to
+ * the second abstract pathname, returning <code>true</code> if and only if
+ * the operation succeeds.
+ */
+ public abstract boolean rename(File f1, File f2);
+
+ /**
+ * Set the last-modified time of the file or directory denoted by the
+ * given abstract pathname, returning <code>true</code> if and only if the
+ * operation succeeds.
+ */
+ public abstract boolean setLastModifiedTime(File f, long time);
+
+ /**
+ * Mark the file or directory denoted by the given abstract pathname as
+ * read-only, returning <code>true</code> if and only if the operation
+ * succeeds.
+ */
+ public abstract boolean setReadOnly(File f);
+
+
+ /* -- Filesystem interface -- */
+
+ /**
+ * List the available filesystem roots.
+ */
+ public abstract File[] listRoots();
+
+ /* -- Disk usage -- */
+ public static final int SPACE_TOTAL = 0;
+ public static final int SPACE_FREE = 1;
+ public static final int SPACE_USABLE = 2;
+
+ public abstract long getSpace(File f, int t);
+
+ /* -- Basic infrastructure -- */
+
+ /**
+ * Compare two abstract pathnames lexicographically.
+ */
+ public abstract int compare(File f1, File f2);
+
+ /**
+ * Compute the hash code of an abstract pathname.
+ */
+ public abstract int hashCode(File f);
+
+ // Flags for enabling/disabling performance optimizations for file
+ // name canonicalization
+ static boolean useCanonCaches = true;
+ static boolean useCanonPrefixCache = true;
+
+ private static boolean getBooleanProperty(String prop, boolean defaultVal) {
+ String val = System.getProperty(prop);
+ if (val == null) return defaultVal;
+ if (val.equalsIgnoreCase("true")) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ static {
+ useCanonCaches = getBooleanProperty("sun.io.useCanonCaches",
+ useCanonCaches);
+ useCanonPrefixCache = getBooleanProperty("sun.io.useCanonPrefixCache",
+ useCanonPrefixCache);
+ }
+}
Added: trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java
===================================================================
--- trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java (rev 0)
+++ trunk/core/src/openjdk/vm/java/io/JNodeFileSystem.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -0,0 +1,245 @@
+package java.io;
+
+import gnu.classpath.SystemProperties;
+
+/**
+ *
+ * @author Fabien DUMINY (fduminy at jnode.org)
+ *
+ */
+class JNodeFileSystem extends FileSystem {
+ private static final String dupSeparator;
+ static
+ {
+ String separator = SystemProperties.getProperty("file.separator");
+ dupSeparator = separator + separator;
+ }
+
+ @Override
+ public String canonicalize(String path) throws IOException {
+ // note : we expect that the File class from OpenJDK give an absolute path
+ return VMFile.toCanonicalForm(path);
+ }
+
+ @Override
+ public boolean checkAccess(File f, int access) {
+ boolean canAccess;
+ if (! VMFile.exists(f.getPath()))
+ return false;
+
+ switch(access)
+ {
+ case ACCESS_READ: canAccess = VMFile.canRead(f.getPath()); break;
+ case ACCESS_WRITE:
+ if (VMFile.isDirectory(f.getPath()))
+ canAccess = VMFile.canWriteDirectory(f);
+ else
+ canAccess = VMFile.canWrite(f.getPath());
+
+ break;
+ case ACCESS_EXECUTE: canAccess = VMFile.canExecute(f.getPath()); break;
+ default: throw new IllegalArgumentException("invalid access : "+access);
+ }
+ return canAccess;
+ }
+
+ @Override
+ public int compare(File f1, File f2) {
+ final String f1Path = f1.getAbsolutePath();
+ final String f2Path = f2.getAbsolutePath();
+ return f1Path.compareTo(f2Path);
+ }
+
+ @Override
+ public boolean createDirectory(File f) {
+ return VMFile.mkdir(f.getPath());
+ }
+
+ @Override
+ public boolean createFileExclusively(String pathname) throws IOException {
+ return VMFile.create(pathname);
+ }
+
+ @Override
+ public boolean delete(File f) {
+ return VMFile.delete(f.getPath());
+ }
+
+ @Override
+ public String fromURIPath(String path) {
+ return path;
+ }
+
+ @Override
+ public int getBooleanAttributes(File f) {
+ int attributes = 0;
+
+ attributes |= (VMFile.exists(f.getPath()) ? BA_EXISTS : 0);
+ attributes |= (VMFile.isFile(f.getPath()) ? BA_REGULAR : 0);
+ attributes |= (VMFile.isDirectory(f.getPath()) ? BA_DIRECTORY : 0);
+ attributes |= (VMFile.isHidden(f.getPath()) ? BA_HIDDEN : 0);
+
+ return attributes;
+ }
+
+ @Override
+ public String getDefaultParent() {
+ return File.separator;
+ }
+
+ @Override
+ public long getLastModifiedTime(File f) {
+ return VMFile.lastModified(f.getPath());
+ }
+
+ @Override
+ public long getLength(File f) {
+ return VMFile.length(f.getPath());
+ }
+
+ @Override
+ public char getPathSeparator() {
+ return SystemProperties.getProperty("path.separator").charAt(0);
+ }
+
+ @Override
+ public char getSeparator() {
+ return SystemProperties.getProperty("file.separator").charAt(0);
+ }
+
+ @Override
+ public long getSpace(File f, int t) {
+ long space = 0L;
+ switch(t)
+ {
+ case SPACE_TOTAL: space = VMFile.getTotalSpace(f.getPath()); break; //TODO
+ case SPACE_FREE: space = VMFile.getFreeSpace(f.getPath()); break; //TODO
+ case SPACE_USABLE: space = VMFile.getUsableSpace(f.getPath()); break; //TODO
+ }
+ return space;
+ }
+
+ /**
+ * implemented by taking the UNIX way regarding javadoc of File.hashCode() from openjdk
+ */
+ @Override
+ public int hashCode(File f) {
+ return f.getPath().hashCode() ^ 1234321;
+ }
+
+ @Override
+ public boolean isAbsolute(File f) {
+ return f.getPath().startsWith(File.separator);
+ }
+
+ @Override
+ public String[] list(File f) {
+ if (!f.exists() || !f.isDirectory())
+ return null;
+
+ // Get the list of files
+ return VMFile.list(f.getPath());
+ }
+
+ @Override
+ public File[] listRoots() {
+ return VMFile.listRoots();
+ }
+
+ @Override
+ public String normalize(String path) {
+ char separatorChar = SystemProperties.getProperty("file.separator").charAt(0);
+ int dupIndex = path.indexOf(dupSeparator);
+ int plen = path.length();
+
+ if (dupIndex == -1)
+ {
+ // Ignore trailing separator (though on Windows "a:\", for
+ // example, is a valid and minimal path).
+ if (plen > 1 && path.charAt (plen - 1) == separatorChar)
+ {
+ if (! (separatorChar == '\\' && plen == 3 && path.charAt (1) == ':'))
+ return path.substring (0, plen - 1);
+ }
+ else
+ return path;
+ }
+
+ StringBuffer newpath = new StringBuffer(plen);
+ int last = 0;
+ while (dupIndex != -1)
+ {
+ newpath.append(path.substring(last, dupIndex));
+ // Ignore the duplicate path characters.
+ while (path.charAt(dupIndex) == separatorChar)
+ {
+ dupIndex++;
+ if (dupIndex == plen)
+ return newpath.toString();
+ }
+ newpath.append(separatorChar);
+ last = dupIndex;
+ dupIndex = path.indexOf(dupSeparator, last);
+ }
+
+ newpath.append(path.substring(last, plen));
+
+ return newpath.toString();
+ }
+
+ @Override
+ public int prefixLength(String path) {
+ return path.lastIndexOf(File.separatorChar) + 1;
+ }
+
+ @Override
+ public boolean rename(File f1, File f2) {
+ return VMFile.renameTo(f1.getPath(), f2.getPath());
+ }
+
+ @Override
+ public String resolve(String parent, String child) {
+ return parent + File.separatorChar + child;
+ }
+
+ @Override
+ public String resolve(File f) {
+ if (isAbsolute(f))
+ return f.getPath();
+
+ String currentDir = System.getProperty("user.dir");
+
+ if (currentDir.endsWith(File.separator))
+ return currentDir + f.getPath();
+ else
+ return currentDir + File.separator + f.getPath();
+ }
+
+ @Override
+ public boolean setLastModifiedTime(File f, long time) {
+ return VMFile.setLastModified(f.getPath(), time);
+ }
+
+ @Override
+ public boolean setPermission(File f, int access, boolean enable,
+ boolean owneronly)
+ {
+ boolean success = false;
+ switch(access)
+ {
+ case ACCESS_READ: success = VMFile.setReadable(f.getPath(), enable, owneronly); break;
+ case ACCESS_WRITE: success = VMFile.setWritable(f.getPath(), enable, owneronly); break;
+ case ACCESS_EXECUTE: success = VMFile.setExecutable(f.getPath(), enable, owneronly); break;
+ }
+ return success;
+ }
+
+ @Override
+ public boolean setReadOnly(File f) {
+ // Test for existence.
+ if (! VMFile.exists(f.getPath()))
+ return false;
+
+ return VMFile.setReadOnly(f.getPath());
+ }
+}
Added: trunk/core/src/openjdk/vm/java/io/NativeFileSystem.java
===================================================================
--- trunk/core/src/openjdk/vm/java/io/NativeFileSystem.java (rev 0)
+++ trunk/core/src/openjdk/vm/java/io/NativeFileSystem.java 2007-06-30 11:50:26 UTC (rev 3334)
@@ -0,0 +1,18 @@
+package java.io;
+
+
+/**
+ *
+ * @author Fabien DUMINY (fduminy at jnode.org)
+ *
+ */
+public class NativeFileSystem {
+ /**
+ * Return the FileSystem object representing this platform's local
+ * filesystem.
+ */
+ public static Object getFileSystem()
+ {
+ return new JNodeFileSystem();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-07-26 09:41:18
|
Revision: 3364
http://jnode.svn.sourceforge.net/jnode/?rev=3364&view=rev
Author: lsantha
Date: 2007-07-26 02:39:03 -0700 (Thu, 26 Jul 2007)
Log Message:
-----------
Progress on isolates.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/io/VMIOUtils.java
trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
Modified: trunk/core/src/classpath/vm/java/io/VMIOUtils.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2007-07-07 20:31:54 UTC (rev 3363)
+++ trunk/core/src/classpath/vm/java/io/VMIOUtils.java 2007-07-26 09:39:03 UTC (rev 3364)
@@ -22,12 +22,14 @@
package java.io;
import org.jnode.system.BootLog;
+import org.jnode.vm.annotation.SharedStatics;
/**
* Helper class for connecting java.io to JNode.
*
* @author epr
*/
+@SharedStatics
public class VMIOUtils {
/** The filesystem API of JNode */
Modified: trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2007-07-07 20:31:54 UTC (rev 3363)
+++ trunk/core/src/core/org/jnode/vm/MemoryBlockManager.java 2007-07-26 09:39:03 UTC (rev 3364)
@@ -23,6 +23,7 @@
import org.jnode.vm.annotation.MagicPermission;
import org.jnode.vm.annotation.Uninterruptible;
+import org.jnode.vm.annotation.SharedStatics;
import org.jnode.vm.scheduler.VmProcessor;
import org.jnode.vm.scheduler.VmThread;
import org.vmmagic.unboxed.Address;
@@ -39,6 +40,7 @@
*/
@MagicPermission
@Uninterruptible
+@SharedStatics
public final class MemoryBlockManager extends VmSystemObject {
/** Size of a memory block. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-11 20:33:39
|
Revision: 3393
http://jnode.svn.sourceforge.net/jnode/?rev=3393&view=rev
Author: lsantha
Date: 2007-08-11 13:33:38 -0700 (Sat, 11 Aug 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/util/Arrays.java
trunk/core/src/openjdk/java/java/util/BitSet.java
trunk/core/src/openjdk/java/java/util/EnumSet.java
trunk/core/src/openjdk/java/java/util/JumboEnumSet.java
trunk/core/src/openjdk/java/java/util/RegularEnumSet.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/util/Arrays.java
trunk/core/src/classpath/java/java/util/BitSet.java
trunk/core/src/classpath/java/java/util/EnumSet.java
Deleted: trunk/core/src/classpath/java/java/util/Arrays.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Arrays.java 2007-08-11 19:58:14 UTC (rev 3392)
+++ trunk/core/src/classpath/java/java/util/Arrays.java 2007-08-11 20:33:38 UTC (rev 3393)
@@ -1,4028 +0,0 @@
-/* Arrays.java -- Utility class with methods to operate on arrays
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-import java.io.Serializable;
-import java.lang.reflect.Array;
-
-/**
- * This class contains various static utility methods performing operations on
- * arrays, and a method to provide a List "view" of an array to facilitate
- * using arrays with Collection-based APIs. All methods throw a
- * {@link NullPointerException} if the parameter array is null.
- * <p>
- *
- * Implementations may use their own algorithms, but must obey the general
- * properties; for example, the sort must be stable and n*log(n) complexity.
- * Sun's implementation of sort, and therefore ours, is a tuned quicksort,
- * adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort
- * Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265
- * (November 1993). This algorithm offers n*log(n) performance on many data
- * sets that cause other quicksorts to degrade to quadratic performance.
- *
- * @author Original author unknown
- * @author Bryce McKinlay
- * @author Eric Blake (eb...@em...)
- * @see Comparable
- * @see Comparator
- * @since 1.2
- * @status updated to 1.4
- */
-public class Arrays
-{
- /**
- * This class is non-instantiable.
- */
- private Arrays()
- {
- }
-
-
-// binarySearch
- /**
- * Perform a binary search of a byte array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(byte[] a, byte key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a byte array for a key. The range
- * must be sorted (as by the <code>sort(byte[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(byte[] a, int low, int hi, byte key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final byte d = a[mid];
- if (d == key)
- return mid;
- else if (d > key)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop.
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of a char array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(char[] a, char key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a char array for a key. The range
- * must be sorted (as by the <code>sort(char[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(char[] a, int low, int hi, char key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final char d = a[mid];
- if (d == key)
- return mid;
- else if (d > key)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop.
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of a short array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(short[] a, short key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a short array for a key. The range
- * must be sorted (as by the <code>sort(short[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(short[] a, int low, int hi, short key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final short d = a[mid];
- if (d == key)
- return mid;
- else if (d > key)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop.
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of an int array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(int[] a, int key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of an integer array for a key. The range
- * must be sorted (as by the <code>sort(int[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(int[] a, int low, int hi, int key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final int d = a[mid];
- if (d == key)
- return mid;
- else if (d > key)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop.
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of a long array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(long[] a, long key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a long array for a key. The range
- * must be sorted (as by the <code>sort(long[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(long[] a, int low, int hi, long key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final long d = a[mid];
- if (d == key)
- return mid;
- else if (d > key)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop.
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of a float array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(float[] a, float key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a float array for a key. The range
- * must be sorted (as by the <code>sort(float[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(float[] a, int low, int hi, float key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- // Must use Float.compare to take into account NaN, +-0.
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final int r = Float.compare(a[mid], key);
- if (r == 0)
- return mid;
- else if (r > 0)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of a double array for a key. The array must be
- * sorted (as by the sort() method) - if it is not, the behaviour of this
- * method is undefined, and may be an infinite loop. If the array contains
- * the key more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(double[] a, double key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key);
- }
-
- /**
- * Perform a binary search of a range of a double array for a key. The range
- * must be sorted (as by the <code>sort(double[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static int binarySearch(double[] a, int low, int hi, double key)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- // Must use Double.compare to take into account NaN, +-0.
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final int r = Double.compare(a[mid], key);
- if (r == 0)
- return mid;
- else if (r > 0)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop
- low = ++mid;
- }
- return -mid - 1;
- }
-
- /**
- * Perform a binary search of an Object array for a key, using the natural
- * ordering of the elements. The array must be sorted (as by the sort()
- * method) - if it is not, the behaviour of this method is undefined, and may
- * be an infinite loop. Further, the key must be comparable with every item
- * in the array. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this (JCL)
- * implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws ClassCastException if key could not be compared with one of the
- * elements of a
- * @throws NullPointerException if a null element in a is compared
- */
- public static int binarySearch(Object[] a, Object key)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, key, null);
- }
-
- /**
- * Perform a binary search of a range of an Object array for a key. The range
- * must be sorted (as by the <code>sort(Object[], int, int)</code> method) -
- * if it is not, the behaviour of this method is undefined, and may be an
- * infinite loop. If the array contains the key more than once, any one of
- * them may be found. Note: although the specification allows for an infinite
- * loop if the array is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- */
- public static int binarySearch(Object[] a, int low, int hi, Object key)
- {
- return binarySearch(a, low, hi, key, null);
- }
-
- /**
- * Perform a binary search of an Object array for a key, using a supplied
- * Comparator. The array must be sorted (as by the sort() method with the
- * same Comparator) - if it is not, the behaviour of this method is
- * undefined, and may be an infinite loop. Further, the key must be
- * comparable with every item in the array. If the array contains the key
- * more than once, any one of them may be found. Note: although the
- * specification allows for an infinite loop if the array is unsorted, it
- * will not happen in this (JCL) implementation.
- *
- * @param a the array to search (must be sorted)
- * @param key the value to search for
- * @param c the comparator by which the array is sorted; or null to
- * use the elements' natural order
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws ClassCastException if key could not be compared with one of the
- * elements of a
- * @throws NullPointerException if a null element is compared with natural
- * ordering (only possible when c is null)
- */
- public static <T> int binarySearch(T[] a, T key, Comparator<? super T> c)
- {
- if (a.length == 0)
- return -1;
- return binarySearch(a, 0, a.length - 1, key, c);
- }
-
- /**
- * Perform a binary search of a range of an Object array for a key using
- * a {@link Comparator}. The range must be sorted (as by the
- * <code>sort(Object[], int, int)</code> method) - if it is not, the
- * behaviour of this method is undefined, and may be an infinite loop. If
- * the array contains the key more than once, any one of them may be found.
- * Note: although the specification allows for an infinite loop if the array
- * is unsorted, it will not happen in this implementation.
- *
- * @param a the array to search (must be sorted)
- * @param low the lowest index to search from.
- * @param hi the highest index to search to.
- * @param key the value to search for
- * @param c the comparator by which the array is sorted; or null to
- * use the elements' natural order
- * @return the index at which the key was found, or -n-1 if it was not
- * found, where n is the index of the first value higher than key or
- * a.length if there is no such value.
- * @throws ClassCastException if key could not be compared with one of the
- * elements of a
- * @throws IllegalArgumentException if <code>low > hi</code>
- * @throws ArrayIndexOutOfBoundsException if <code>low < 0</code> or
- * <code>hi > a.length</code>.
- */
- public static <T> int binarySearch(T[] a, int low, int hi, T key,
- Comparator<? super T> c)
- {
- if (low > hi)
- throw new IllegalArgumentException("The start index is higher than " +
- "the finish index.");
- if (low < 0 || hi > a.length)
- throw new ArrayIndexOutOfBoundsException("One of the indices is out " +
- "of bounds.");
- int mid = 0;
- while (low <= hi)
- {
- mid = (low + hi) >>> 1;
- final int d = Collections.compare(key, a[mid], c);
- if (d == 0)
- return mid;
- else if (d < 0)
- hi = mid - 1;
- else
- // This gets the insertion point right on the last loop
- low = ++mid;
- }
- return -mid - 1;
- }
-
-
-// equals
- /**
- * Compare two boolean arrays for equality.
- *
- * @param a1 the first array to compare
- * @param a2 the second array to compare
- * @return true if a1 and a2 are both null, or if a2 is of the same length
- * as a1, and for each 0 <= i < a1.length, a1[i] == a2[i]
- */
- public static boolean equals(boolean[] a1, boolean[] a2)
- {
- // Quick test which saves comparing elements of the same array, and also
- // catches the case that both are null.
- if (a1 == a2)
- return true;
-
- if (null == a1 || null == a2)
- return false;
-
- // If they're the same length, test each element
- if (a1.length == a2.length)
- {
- int i = a1.length;
- while (--i >= 0)
- if (a1[i] != a2[i])
- return false;
- return true;
- }
- return false;
- }
-
- /**
- * Compare two byte arrays for equality.
- *
- * @param a1 the first array to compare
- * @param a2 the second array to compare
- * @return true if a1 and a2 are both null, or if a2 is of the same length
- * as a1, and for each 0 <= i < a1.length, a1[i] == a2[i]
- */
- public static boolean equals(byte[] a1, byte[] a2)
- {
- // Quick test which saves comparing elements of the same array, and also
- // catches the case that both ...
[truncated message content] |
|
From: <ls...@us...> - 2007-08-13 07:39:03
|
Revision: 3395
http://jnode.svn.sourceforge.net/jnode/?rev=3395&view=rev
Author: lsantha
Date: 2007-08-13 00:38:53 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Openjdk patches.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/CharConversionException.java
trunk/core/src/openjdk/java/java/io/Closeable.java
trunk/core/src/openjdk/java/java/io/DataInput.java
trunk/core/src/openjdk/java/java/io/DataOutput.java
trunk/core/src/openjdk/java/java/io/FileFilter.java
trunk/core/src/openjdk/java/java/io/FileNotFoundException.java
trunk/core/src/openjdk/java/java/io/Flushable.java
trunk/core/src/openjdk/java/java/io/InterruptedIOException.java
trunk/core/src/openjdk/java/java/io/InvalidClassException.java
trunk/core/src/openjdk/java/java/io/InvalidObjectException.java
trunk/core/src/openjdk/java/java/io/NotActiveException.java
trunk/core/src/openjdk/java/java/io/NotSerializableException.java
trunk/core/src/openjdk/java/java/io/ObjectInput.java
trunk/core/src/openjdk/java/java/io/ObjectInputValidation.java
trunk/core/src/openjdk/java/java/io/ObjectOutput.java
trunk/core/src/openjdk/java/java/io/ObjectStreamConstants.java
trunk/core/src/openjdk/java/java/io/ObjectStreamException.java
trunk/core/src/openjdk/java/java/io/OptionalDataException.java
trunk/core/src/openjdk/java/java/io/Serializable.java
trunk/core/src/openjdk/java/java/io/StreamCorruptedException.java
trunk/core/src/openjdk/java/java/io/SyncFailedException.java
trunk/core/src/openjdk/java/java/io/UnsupportedEncodingException.java
trunk/core/src/openjdk/java/java/io/WriteAbortedException.java
trunk/core/src/openjdk/java/java/io/package.html
trunk/core/src/openjdk/java/java/lang/AbstractMethodError.java
trunk/core/src/openjdk/java/java/lang/Appendable.java
trunk/core/src/openjdk/java/java/lang/ArithmeticException.java
trunk/core/src/openjdk/java/java/lang/ArrayIndexOutOfBoundsException.java
trunk/core/src/openjdk/java/java/lang/ArrayStoreException.java
trunk/core/src/openjdk/java/java/lang/AssertionError.java
trunk/core/src/openjdk/java/java/lang/CharSequence.java
trunk/core/src/openjdk/java/java/lang/ClassCastException.java
trunk/core/src/openjdk/java/java/lang/ClassCircularityError.java
trunk/core/src/openjdk/java/java/lang/ClassFormatError.java
trunk/core/src/openjdk/java/java/lang/ClassNotFoundException.java
trunk/core/src/openjdk/java/java/lang/CloneNotSupportedException.java
trunk/core/src/openjdk/java/java/lang/Cloneable.java
trunk/core/src/openjdk/java/java/lang/Comparable.java
trunk/core/src/openjdk/java/java/lang/Deprecated.java
trunk/core/src/openjdk/java/java/lang/EnumConstantNotPresentException.java
trunk/core/src/openjdk/java/java/lang/Error.java
trunk/core/src/openjdk/java/java/lang/Exception.java
trunk/core/src/openjdk/java/java/lang/ExceptionInInitializerError.java
trunk/core/src/openjdk/java/java/lang/IllegalAccessError.java
trunk/core/src/openjdk/java/java/lang/IllegalAccessException.java
trunk/core/src/openjdk/java/java/lang/IllegalArgumentException.java
trunk/core/src/openjdk/java/java/lang/IllegalMonitorStateException.java
trunk/core/src/openjdk/java/java/lang/IllegalStateException.java
trunk/core/src/openjdk/java/java/lang/IllegalThreadStateException.java
trunk/core/src/openjdk/java/java/lang/IncompatibleClassChangeError.java
trunk/core/src/openjdk/java/java/lang/IndexOutOfBoundsException.java
trunk/core/src/openjdk/java/java/lang/InstantiationError.java
trunk/core/src/openjdk/java/java/lang/InstantiationException.java
trunk/core/src/openjdk/java/java/lang/InternalError.java
trunk/core/src/openjdk/java/java/lang/InterruptedException.java
trunk/core/src/openjdk/java/java/lang/Iterable.java
trunk/core/src/openjdk/java/java/lang/LinkageError.java
trunk/core/src/openjdk/java/java/lang/NegativeArraySizeException.java
trunk/core/src/openjdk/java/java/lang/NoClassDefFoundError.java
trunk/core/src/openjdk/java/java/lang/NoSuchFieldError.java
trunk/core/src/openjdk/java/java/lang/NoSuchFieldException.java
trunk/core/src/openjdk/java/java/lang/NoSuchMethodError.java
trunk/core/src/openjdk/java/java/lang/NoSuchMethodException.java
trunk/core/src/openjdk/java/java/lang/NullPointerException.java
trunk/core/src/openjdk/java/java/lang/OutOfMemoryError.java
trunk/core/src/openjdk/java/java/lang/Override.java
trunk/core/src/openjdk/java/java/lang/Readable.java
trunk/core/src/openjdk/java/java/lang/Runnable.java
trunk/core/src/openjdk/java/java/lang/RuntimeException.java
trunk/core/src/openjdk/java/java/lang/RuntimePermission.java
trunk/core/src/openjdk/java/java/lang/SecurityException.java
trunk/core/src/openjdk/java/java/lang/StackOverflowError.java
trunk/core/src/openjdk/java/java/lang/StringIndexOutOfBoundsException.java
trunk/core/src/openjdk/java/java/lang/SuppressWarnings.java
trunk/core/src/openjdk/java/java/lang/TypeNotPresentException.java
trunk/core/src/openjdk/java/java/lang/UnknownError.java
trunk/core/src/openjdk/java/java/lang/UnsatisfiedLinkError.java
trunk/core/src/openjdk/java/java/lang/UnsupportedClassVersionError.java
trunk/core/src/openjdk/java/java/lang/UnsupportedOperationException.java
trunk/core/src/openjdk/java/java/lang/VerifyError.java
trunk/core/src/openjdk/java/java/lang/VirtualMachineError.java
trunk/core/src/openjdk/java/java/lang/package-info.java
trunk/core/src/openjdk/java/java/util/IllegalFormatCodePointException.java
trunk/core/src/openjdk/java/java/util/IllegalFormatConversionException.java
trunk/core/src/openjdk/java/java/util/IllegalFormatException.java
trunk/core/src/openjdk/java/java/util/IllegalFormatFlagsException.java
trunk/core/src/openjdk/java/java/util/IllegalFormatPrecisionException.java
trunk/core/src/openjdk/java/java/util/IllegalFormatWidthException.java
trunk/core/src/openjdk/java/java/util/InputMismatchException.java
trunk/core/src/openjdk/java/java/util/InvalidPropertiesFormatException.java
trunk/core/src/openjdk/java/java/util/MissingFormatArgumentException.java
trunk/core/src/openjdk/java/java/util/MissingFormatWidthException.java
trunk/core/src/openjdk/java/java/util/NoSuchElementException.java
trunk/core/src/openjdk/java/java/util/ServiceConfigurationError.java
trunk/core/src/openjdk/java/java/util/TooManyListenersException.java
trunk/core/src/openjdk/java/java/util/UUID.java
trunk/core/src/openjdk/java/java/util/UnknownFormatConversionException.java
trunk/core/src/openjdk/java/java/util/UnknownFormatFlagsException.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/io/CharConversionException.java
trunk/core/src/classpath/java/java/io/Closeable.java
trunk/core/src/classpath/java/java/io/DataInput.java
trunk/core/src/classpath/java/java/io/DataOutput.java
trunk/core/src/classpath/java/java/io/FileFilter.java
trunk/core/src/classpath/java/java/io/FileNotFoundException.java
trunk/core/src/classpath/java/java/io/Flushable.java
trunk/core/src/classpath/java/java/io/InterruptedIOException.java
trunk/core/src/classpath/java/java/io/InvalidClassException.java
trunk/core/src/classpath/java/java/io/InvalidObjectException.java
trunk/core/src/classpath/java/java/io/NotActiveException.java
trunk/core/src/classpath/java/java/io/NotSerializableException.java
trunk/core/src/classpath/java/java/io/ObjectInput.java
trunk/core/src/classpath/java/java/io/ObjectInputValidation.java
trunk/core/src/classpath/java/java/io/ObjectOutput.java
trunk/core/src/classpath/java/java/io/ObjectStreamConstants.java
trunk/core/src/classpath/java/java/io/ObjectStreamException.java
trunk/core/src/classpath/java/java/io/OptionalDataException.java
trunk/core/src/classpath/java/java/io/Serializable.java
trunk/core/src/classpath/java/java/io/StreamCorruptedException.java
trunk/core/src/classpath/java/java/io/SyncFailedException.java
trunk/core/src/classpath/java/java/io/UnsupportedEncodingException.java
trunk/core/src/classpath/java/java/io/WriteAbortedException.java
trunk/core/src/classpath/java/java/io/package.html
trunk/core/src/classpath/java/java/lang/AbstractMethodError.java
trunk/core/src/classpath/java/java/lang/Appendable.java
trunk/core/src/classpath/java/java/lang/ArithmeticException.java
trunk/core/src/classpath/java/java/lang/ArrayIndexOutOfBoundsException.java
trunk/core/src/classpath/java/java/lang/ArrayStoreException.java
trunk/core/src/classpath/java/java/lang/AssertionError.java
trunk/core/src/classpath/java/java/lang/CharSequence.java
trunk/core/src/classpath/java/java/lang/ClassCastException.java
trunk/core/src/classpath/java/java/lang/ClassCircularityError.java
trunk/core/src/classpath/java/java/lang/ClassFormatError.java
trunk/core/src/classpath/java/java/lang/ClassNotFoundException.java
trunk/core/src/classpath/java/java/lang/CloneNotSupportedException.java
trunk/core/src/classpath/java/java/lang/Cloneable.java
trunk/core/src/classpath/java/java/lang/Comparable.java
trunk/core/src/classpath/java/java/lang/Deprecated.java
trunk/core/src/classpath/java/java/lang/EnumConstantNotPresentException.java
trunk/core/src/classpath/java/java/lang/Error.java
trunk/core/src/classpath/java/java/lang/Exception.java
trunk/core/src/classpath/java/java/lang/ExceptionInInitializerError.java
trunk/core/src/classpath/java/java/lang/IllegalAccessError.java
trunk/core/src/classpath/java/java/lang/IllegalAccessException.java
trunk/core/src/classpath/java/java/lang/IllegalArgumentException.java
trunk/core/src/classpath/java/java/lang/IllegalMonitorStateException.java
trunk/core/src/classpath/java/java/lang/IllegalStateException.java
trunk/core/src/classpath/java/java/lang/IllegalThreadStateException.java
trunk/core/src/classpath/java/java/lang/IncompatibleClassChangeError.java
trunk/core/src/classpath/java/java/lang/IndexOutOfBoundsException.java
trunk/core/src/classpath/java/java/lang/InstantiationError.java
trunk/core/src/classpath/java/java/lang/InstantiationException.java
trunk/core/src/classpath/java/java/lang/InternalError.java
trunk/core/src/classpath/java/java/lang/InterruptedException.java
trunk/core/src/classpath/java/java/lang/Iterable.java
trunk/core/src/classpath/java/java/lang/LinkageError.java
trunk/core/src/classpath/java/java/lang/NegativeArraySizeException.java
trunk/core/src/classpath/java/java/lang/NoClassDefFoundError.java
trunk/core/src/classpath/java/java/lang/NoSuchFieldError.java
trunk/core/src/classpath/java/java/lang/NoSuchFieldException.java
trunk/core/src/classpath/java/java/lang/NoSuchMethodError.java
trunk/core/src/classpath/java/java/lang/NoSuchMethodException.java
trunk/core/src/classpath/java/java/lang/NullPointerException.java
trunk/core/src/classpath/java/java/lang/OutOfMemoryError.java
trunk/core/src/classpath/java/java/lang/Override.java
trunk/core/src/classpath/java/java/lang/Readable.java
trunk/core/src/classpath/java/java/lang/Runnable.java
trunk/core/src/classpath/java/java/lang/RuntimeException.java
trunk/core/src/classpath/java/java/lang/RuntimePermission.java
trunk/core/src/classpath/java/java/lang/SecurityException.java
trunk/core/src/classpath/java/java/lang/StackOverflowError.java
trunk/core/src/classpath/java/java/lang/StringIndexOutOfBoundsException.java
trunk/core/src/classpath/java/java/lang/SuppressWarnings.java
trunk/core/src/classpath/java/java/lang/TypeNotPresentException.java
trunk/core/src/classpath/java/java/lang/UnknownError.java
trunk/core/src/classpath/java/java/lang/UnsatisfiedLinkError.java
trunk/core/src/classpath/java/java/lang/UnsupportedClassVersionError.java
trunk/core/src/classpath/java/java/lang/UnsupportedOperationException.java
trunk/core/src/classpath/java/java/lang/VerifyError.java
trunk/core/src/classpath/java/java/lang/VirtualMachineError.java
trunk/core/src/classpath/java/java/lang/package.html
trunk/core/src/classpath/java/java/util/IllegalFormatCodePointException.java
trunk/core/src/classpath/java/java/util/IllegalFormatConversionException.java
trunk/core/src/classpath/java/java/util/IllegalFormatException.java
trunk/core/src/classpath/java/java/util/IllegalFormatFlagsException.java
trunk/core/src/classpath/java/java/util/IllegalFormatPrecisionException.java
trunk/core/src/classpath/java/java/util/IllegalFormatWidthException.java
trunk/core/src/classpath/java/java/util/InputMismatchException.java
trunk/core/src/classpath/java/java/util/InvalidPropertiesFormatException.java
trunk/core/src/classpath/java/java/util/MissingFormatArgumentException.java
trunk/core/src/classpath/java/java/util/MissingFormatWidthException.java
trunk/core/src/classpath/java/java/util/NoSuchElementException.java
trunk/core/src/classpath/java/java/util/ServiceConfigurationError.java
trunk/core/src/classpath/java/java/util/TooManyListenersException.java
trunk/core/src/classpath/java/java/util/UUID.java
trunk/core/src/classpath/java/java/util/UnknownFormatConversionException.java
trunk/core/src/classpath/java/java/util/UnknownFormatFlagsException.java
Deleted: trunk/core/src/classpath/java/java/io/CharConversionException.java
===================================================================
--- trunk/core/src/classpath/java/java/io/CharConversionException.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/CharConversionException.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,73 +0,0 @@
-/* CharConversionException.java -- Character conversion exceptions
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This exception is thrown to indicate that a problem occurred with
- * an attempted character conversion.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- * @since 1.1
- * @status updated to 1.4
- */
-public class CharConversionException extends IOException
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = -8680016352018427031L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public CharConversionException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public CharConversionException(String message)
- {
- super(message);
- }
-} // class CharConversionException
Deleted: trunk/core/src/classpath/java/java/io/Closeable.java
===================================================================
--- trunk/core/src/classpath/java/java/io/Closeable.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/Closeable.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,63 +0,0 @@
-/* Closeable.java -- Closeable object
- Copyright (C) 2004, 2005 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.io;
-
-/**
- * A <code>Closeable</code> class represents a stream of
- * data, which can be closed when it is no longer needed.
- * Closing a stream allows the resources it uses to be
- * freed for an alternate use.
- *
- * @author Tom Tromey (tr...@re...)
- * @author Andrew John Hughes (gnu...@me...)
- * @since 1.5
- */
-public interface Closeable
-{
-
- /**
- * Closes the stream represented by this class, thus freeing
- * system resources. In that case that the stream is already
- * in the closed state, this method has no effect.
- *
- * @throws IOException if an I/O error occurs in closing.
- */
- void close()
- throws IOException;
-
-}
Deleted: trunk/core/src/classpath/java/java/io/DataInput.java
===================================================================
--- trunk/core/src/classpath/java/java/io/DataInput.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/DataInput.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,456 +0,0 @@
-/* DataInput.java -- Interface for reading data from a stream
- Copyright (C) 1998, 1999, 2001, 2003, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct. */
-
-/**
- * This interface is implemented by classes that can data from streams
- * into Java primitive types.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Warren Levy (wa...@cy...)
- */
-public interface DataInput
-{
-
- /**
- * This method reads a Java boolean value from an input stream. It does
- * so by reading a single byte of data. If that byte is zero, then the
- * value returned is <code>false</code>. If the byte is non-zero, then
- * the value returned is <code>true</code>.
- * <p>
- * This method can read a <code>boolean</code> written by an object
- * implementing the <code>writeBoolean()</code> method in the
- * <code>DataOutput</code> interface.
- *
- * @return The <code>boolean</code> value read
- *
- * @exception EOFException If end of file is reached before
- * reading the boolean
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeBoolean
- */
- boolean readBoolean() throws EOFException, IOException;
-
- /**
- * This method reads a Java byte value from an input stream. The value
- * is in the range of -128 to 127.
- * <p>
- * This method can read a <code>byte</code> written by an object
- * implementing the
- * <code>writeByte()</code> method in the <code>DataOutput</code> interface.
- * <p>
- * @return The <code>byte</code> value read
- *
- * @exception EOFException If end of file is reached before reading the byte
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- byte readByte() throws EOFException, IOException;
-
- /**
- * This method reads 8 unsigned bits into a Java <code>int</code> value from
- * the stream. The value returned is in the range of 0 to 255.
- * <p>
- * This method can read an unsigned byte written by an object
- * implementing the
- * <code>writeByte()</code> method in the <code>DataOutput</code>
- * interface.
- *
- * @return The unsigned bytes value read as a Java <code>int</code>.
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeByte
- */
- int readUnsignedByte() throws EOFException, IOException;
-
- /**
- * This method reads a Java <code>char</code> value from an input stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single 16-bit Java <code>char</code>. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * <p>
- * As an example, if <code>byte1</code> and <code>byte2</code> represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to a <code>char</code> in the following manner:
- * <p>
- * <code>(char)((byte1 << 8) + byte2)</code>
- * <p>
- * This method can read a <code>char</code> written by an object implementing
- * the
- * <code>writeChar()</code> method in the <code>DataOutput</code> interface.
- *
- * @return The <code>char</code> value read
- *
- * @exception EOFException If end of file is reached before reading the char
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeChar
- */
- char readChar() throws EOFException, IOException;
-
- /**
- * This method reads a signed 16-bit value into a Java in from the stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single 16-bit Java <code>short</code>. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * <p>
- * As an example, if <code>byte1</code> and <code>byte2</code> represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to a <code>short</code> in the following manner:
- * <p>
- * <code>(short)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))</code>
- * <p>
- * The value returned is in the range of -32768 to 32767.
- * <p>
- * This method can read a <code>short</code> written by an object
- * implementing
- * the <code>writeShort()</code> method in the <code>DataOutput</code>
- * interface.
- *
- * @return The <code>short</code> value read
- *
- * @exception EOFException If end of file is reached before reading the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- short readShort() throws EOFException, IOException;
-
- /**
- * This method reads 16 unsigned bits into a Java int value from the stream.
- * It operates by reading two bytes from the stream and converting them to
- * a single Java <code>int</code>. The two bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * <p>
- * As an example, if <code>byte1</code> and <code>byte2</code> represent the
- * first and second byte read from the stream respectively, they will be
- * transformed to an <code>int</code> in the following manner:
- * <p>
- * <code>(int)(((byte1 0xFF) << 8) + (byte2 & 0xFF))</code>
- * <p>
- * The value returned is in the range of 0 to 65535.
- * <p>
- * This method can read an unsigned short written by an object implementing
- * the <code>writeShort()</code> method in the
- * <code>DataOutput</code>
- * interface.
- *
- * @return The unsigned short value read as a Java <code>int</code>.
- *
- * @exception EOFException If end of file is reached before reading
- * the value
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeShort
- */
- int readUnsignedShort() throws EOFException, IOException;
-
- /**
- * This method reads a Java <code>int</code> value from an input stream
- * It operates by reading four bytes from the stream and converting them to
- * a single Java <code>int</code>. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * <p>
- * As an example, if <code>byte1</code> through <code>byte4</code> represent
- * the first four bytes read from the stream, they will be
- * transformed to an <code>int</code> in the following manner:
- * <p>
- * <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) +
- * ((byte3 & 0xFF)<< 8) + (byte4 & 0xFF)))</code>
- * <p>
- * The value returned is in the range of -2147483648 to 2147483647.
- * <p>
- * This method can read an <code>int</code> written by an object
- * implementing the <code>writeInt()</code> method in the
- * <code>DataOutput</code> interface.
- *
- * @return The <code>int</code> value read
- *
- * @exception EOFException If end of file is reached before reading the int
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeInt
- */
- int readInt() throws EOFException, IOException;
-
- /**
- * This method reads a Java <code>long</code> value from an input stream
- * It operates by reading eight bytes from the stream and converting them to
- * a single Java <code>long</code>. The bytes are stored most
- * significant byte first (i.e., "big endian") regardless of the native
- * host byte ordering.
- * <p>
- * As an example, if <code>byte1</code> through <code>byte8</code> represent
- * the first eight bytes read from the stream, they will be
- * transformed to an <code>long</code> in the following manner:
- * <p>
- * <code>(long)(((byte1 & 0xFF) << 56) + ((byte2 & 0xFF) << 48) +
- * ((byte3 & 0xFF) << 40) + ((byte4 & 0xFF) << 32) +
- * ((byte5 & 0xFF) << 24) + ((byte6 & 0xFF) << 16) +
- * ((byte7 & 0xFF) << 8) + (byte8 & 0xFF)))
- * </code>
- * <p>
- * The value returned is in the range of -9223372036854775808 to
- * 9223372036854775807.
- * <p>
- * This method can read an <code>long</code> written by an object
- * implementing the <code>writeLong()</code> method in the
- * <code>DataOutput</code> interface.
- *
- * @return The <code>long</code> value read
- *
- * @exception EOFException If end of file is reached before reading the long
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeLong
- */
- long readLong() throws EOFException, IOException;
-
- /**
- * This method reads a Jav...
[truncated message content] |
|
From: <ls...@us...> - 2007-08-13 20:40:49
|
Revision: 3397
http://jnode.svn.sourceforge.net/jnode/?rev=3397&view=rev
Author: lsantha
Date: 2007-08-13 13:40:48 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
Openjdk patches.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/util/CurrencyData.properties
trunk/core/src/openjdk/java/java/util/EventListener.java
trunk/core/src/openjdk/java/java/util/EventListenerProxy.java
trunk/core/src/openjdk/java/java/util/EventObject.java
trunk/core/src/openjdk/java/java/util/ListIterator.java
trunk/core/src/openjdk/java/java/util/NavigableMap.java
trunk/core/src/openjdk/java/java/util/NavigableSet.java
trunk/core/src/openjdk/java/java/util/Observable.java
trunk/core/src/openjdk/java/java/util/Observer.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/util/EventListener.java
trunk/core/src/classpath/java/java/util/EventListenerProxy.java
trunk/core/src/classpath/java/java/util/EventObject.java
trunk/core/src/classpath/java/java/util/ListIterator.java
trunk/core/src/classpath/java/java/util/NavigableMap.java
trunk/core/src/classpath/java/java/util/NavigableSet.java
trunk/core/src/classpath/java/java/util/Observable.java
trunk/core/src/classpath/java/java/util/Observer.java
Deleted: trunk/core/src/classpath/java/java/util/EventListener.java
===================================================================
--- trunk/core/src/classpath/java/java/util/EventListener.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/EventListener.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,54 +0,0 @@
-/* EventListener.java -- tagging interface for all event listeners
- Copyright (C) 1998, 1999, 2001, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-/**
- * Empty interface that is implemented by classes that need to receive
- * events. Subinterfaces define methods that can be called to fire an
- * event notification. Normally the name of these subinterfaces end in
- * <code>Listener</code> and all method described by the subinterface
- * take as argument an subclass of <code>EventObject</code>.
- *
- * @author Tom Tromey (tr...@cy...)
- * @see EventObject
- * @status updated to 1.4
- */
-public interface EventListener
-{
-}
Deleted: trunk/core/src/classpath/java/java/util/EventListenerProxy.java
===================================================================
--- trunk/core/src/classpath/java/java/util/EventListenerProxy.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/EventListenerProxy.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,75 +0,0 @@
-/* EventListenerProxy.java -- abstract wrapper for event listeners
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-/**
- * An abstract wrapper for event listeners. This allows subclasses to
- * attach additional parameters to an existing event listener to create
- * a new one. Subclasses are expected to add methods to set and retrieve
- * any attached properties.
- *
- * @author Eric Blake (eb...@em...)
- * @since 1.4
- * @status updated to 1.4
- */
-public abstract class EventListenerProxy implements EventListener
-{
- /** The listener that this proxy wraps. */
- private final EventListener listener;
-
- /**
- * Construct a proxy event listener, given an existing one to augment.
- *
- * @param listener the listener to wrap
- */
- public EventListenerProxy(EventListener listener)
- {
- this.listener = listener;
- }
-
- /**
- * Return the wrapped event listener.
- *
- * @return the listener associated with this proxy
- */
- public EventListener getListener()
- {
- return listener;
- }
-} // class EventListenerProxy
Deleted: trunk/core/src/classpath/java/java/util/EventObject.java
===================================================================
--- trunk/core/src/classpath/java/java/util/EventObject.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/EventObject.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,101 +0,0 @@
-/* EventObject.java -- represents an event on an object
- Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-import java.io.Serializable;
-
-/**
- * Represents Events fired by Objects.
- *
- * @author Eric Blake (eb...@em...)
- * @see EventListener
- * @since 1.1
- * @status updated to 1.4
- */
-public class EventObject implements Serializable
-{
- /**
- * Compatible with JDK 1.1+.
- */
- private static final long serialVersionUID = 5516075349620653480L;
-
- /**
- * The source object; in other words, the object which this event takes
- * place on.
- */
- protected transient Object source;
-
- /**
- * Constructs an EventObject with the specified source.
- *
- * @param source the source of the event
- * @throws IllegalArgumentException if source is null (This is not
- * specified, but matches the behavior of the JDK)
- */
- public EventObject(Object source)
- {
- // This check for null is stupid, if you ask me, since source is
- // protected and non-final, so a subclass can set it to null later on.
- if (source == null)
- throw new IllegalArgumentException();
- this.source = source;
- }
-
- /**
- * Returns the source of the event.
- *
- * @return the event source
- */
- public Object getSource()
- {
- return source;
- }
-
- /**
- * Converts the event to a String. The format is not specified, but by
- * observation, the JDK uses:
- * <code>getClass().getName() + "[source=" + source + "]";</code>.
- *
- * @return String representation of the Event
- */
- public String toString()
- {
- return getClass().getName() + "[source=" + source + "]";
- }
-} // class EventObject
Deleted: trunk/core/src/classpath/java/java/util/ListIterator.java
===================================================================
--- trunk/core/src/classpath/java/java/util/ListIterator.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/ListIterator.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,170 +0,0 @@
-/* ListIterator.java -- Extended Iterator for iterating over ordered lists
- Copyright (C) 1998, 1999, 2001, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.util;
-
-/**
- * An extended version of Iterator to support the extra features of Lists. The
- * elements may be accessed in forward or reverse order, elements may be
- * replaced as well as removed, and new elements may be inserted, during the
- * traversal of the list.
- * <p>
- *
- * A list with n elements provides n+1 iterator positions (the front, the end,
- * or between two elements). Note that <code>remove</code> and <code>set</code>
- * operate on the last element returned, whether it was by <code>next</code>
- * or <code>previous</code>.
- *
- * @author Original author unknown
- * @author Eric Blake (eb...@em...)
- * @see Collection
- * @see List
- * @see Iterator
- * @see Enumeration
- * @since 1.2
- * @status updated to 1.4
- */
-public interface ListIterator<E> extends Iterator<E>
-{
- /**
- * Tests whether there are elements remaining in the list in the forward
- * direction. In other words, next() will not fail with a
- * NoSuchElementException.
- *
- * @return true if the list continues in the forward direction
- */
- boolean hasNext();
-
- /**
- * Tests whether there are elements remaining in the list in the reverse
- * direction. In other words, previous() will not fail with a
- * NoSuchElementException.
- *
- * @return true if the list continues in the reverse direction
- */
- boolean hasPrevious();
-
- /**
- * Obtain the next element in the list in the forward direction. Repeated
- * calls to next may be used to iterate over the entire list, or calls to
- * next and previous may be used together to go forwards and backwards.
- * Alternating calls to next and previous will return the same element.
- *
- * @return the next element in the list in the forward direction
- * @throws NoSuchElementException if there are no more elements
- */
- E next();
-
- /**
- * Obtain the next element in the list in the reverse direction. Repeated
- * calls to previous may be used to iterate backwards over the entire list,
- * or calls to next and previous may be used together to go forwards and
- * backwards. Alternating calls to next and previous will return the same
- * element.
- *
- * @return the next element in the list in the reverse direction
- * @throws NoSuchElementException if there are no more elements
- */
- E previous();
-
- /**
- * Find the index of the element that would be returned by a call to next.
- * If hasNext() returns false, this returns the list size.
- *
- * @return the index of the element that would be returned by next()
- */
- int nextIndex();
-
- /**
- * Find the index of the element that would be returned by a call to
- * previous. If hasPrevious() returns false, this returns -1.
- *
- * @return the index of the element that would be returned by previous()
- */
- int previousIndex();
-
- /**
- * Insert an element into the list at the current position of the iterator
- * (optional operation). The element is inserted in between the element that
- * would be returned by previous and the element that would be returned by
- * next. After the insertion, a subsequent call to next is unaffected, but
- * a call to previous returns the item that was added. The values returned
- * by nextIndex() and previousIndex() are incremented.
- *
- * @param o the object to insert into the list
- * @throws ClassCastException if the object is of a type which cannot be added
- * to this list.
- * @throws IllegalArgumentException if some other aspect of the object stops
- * it being added to this list.
- * @throws UnsupportedOperationException if this ListIterator does not
- * support the add operation.
- */
- void add(E o);
-
- /**
- * Remove from the list the element last returned by a call to next or
- * previous (optional operation). This method may only be called if neither
- * add nor remove have been called since the last call to next or previous.
- *
- * @throws IllegalStateException if neither next or previous have been
- * called, or if add or remove has been called since the last call
- * to next or previous
- * @throws UnsupportedOperationException if this ListIterator does not
- * support the remove operation
- */
- void remove();
-
- /**
- * Replace the element last returned by a call to next or previous with a
- * given object (optional operation). This method may only be called if
- * neither add nor remove have been called since the last call to next or
- * previous.
- *
- * @param o the object to replace the element with
- * @throws ClassCastException the object is of a type which cannot be added
- * to this list
- * @throws IllegalArgumentException some other aspect of the object stops
- * it being added to this list
- * @throws IllegalStateException if neither next or previous have been
- * called, or if add or remove has been called since the last call
- * to next or previous
- * @throws UnsupportedOperationException if this ListIterator does not
- * support the set operation
- */
- void set(E o);
-}
Deleted: trunk/core/src/classpath/java/java/util/NavigableMap.java
===================================================================
--- trunk/core/src/classpath/java/java/util/NavigableMap.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/NavigableMap.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,395 +0,0 @@
-/*
- * Written by Doug Lea and Josh Bloch with assistance from members of JCP
- * JSR-166 Expert Group and released to the public domain, as explained at
- * http://creativecommons.org/licenses/publicdomain
- */
-
-package java.util;
-
-/**
- * A {@link SortedMap} extended with navigation methods returning the
- * closest matches for given search targets. Methods
- * {@code lowerEntry}, {@code floorEntry}, {@code ceilingEntry},
- * and {@code higherEntry} return {@code Map.Entry} objects
- * associated with keys respectively less than, less than or equal,
- * greater than or equal, and greater than a given key, returning
- * {@code null} if there is no such key. Similarly, methods
- * {@code lowerKey}, {@code floorKey}, {@code ceilingKey}, and
- * {@code higherKey} return only the associated keys. All of these
- * methods are designed for locating, not traversing entries.
- *
- * <p>A {@code NavigableMap} may be accessed and traversed in either
- * ascending or descending key order. The {@code descendingMap}
- * method returns a view of the map with the senses of all relational
- * and directional methods inverted. The performance of ascending
- * operations and views is likely to be faster than that of descending
- * ones. Methods {@code subMap}, {@code headMap},
- * and {@code tailMap} differ from the like-named {@code
- * SortedMap} methods in accepting additional arguments describing
- * whether lower and upper bounds are inclusive versus exclusive.
- * Submaps of any {@code NavigableMap} must implement the {@code
- * NavigableMap} interface.
- *
- * <p>This interface additionally defines methods {@code firstEntry},
- * {@code pollFirstEntry}, {@code lastEntry}, and
- * {@code pollLastEntry} that return and/or remove the least and
- * greatest mappings, if any exist, else returning {@code null}.
- *
- * <p>Implementations of entry-returning methods are expected to
- * return {@code Map.Entry} pairs representing snapshots of mappings
- * at the time they were produced, and thus generally do <em>not</em>
- * support the optional {@code Entry.setValue} method. Note however
- * that it is possible to change mappings in the associated map using
- * method {@code put}.
- *
- * <p>Methods
- * {@link #subMap(Object, Object) subMap(K, K)},
- * {@link #headMap(Object) headMap(K)}, and
- * {@link #tailMap(Object) tailMap(K)}
- * are specified to return {@code SortedMap} to allow existing
- * implementations of {@code SortedMap} to be compatibly retrofitted to
- * implement {@code NavigableMap}, but extensions and implementations
- * of this interface are encouraged to override these methods to return
- * {@code NavigableMap}. Similarly,
- * {@link #keySet()} can be overriden to return {@code NavigableSet}.
- *
- * <p>This interface is a member of the
- * <a href="{@docRoot}/../technotes/guides/collections/index.html">
- * Java Collections Framework</a>.
- *
- * @author Doug Lea
- * @author Josh Bloch
- * @param <K> the type of keys maintained by this map
- * @param <V> the type of mapped values
- * @since 1.6
- */
-public interface NavigableMap<K,V> extends SortedMap<K,V> {
- /**
- * Returns a key-value mapping associated with the greatest key
- * strictly less than the given key, or {@code null} if there is
- * no such key.
- *
- * @param key the key
- * @return an entry with the greatest key less than {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- Map.Entry<K,V> lowerEntry(K key);
-
- /**
- * Returns the greatest key strictly less than the given key, or
- * {@code null} if there is no such key.
- *
- * @param key the key
- * @return the greatest key less than {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- K lowerKey(K key);
-
- /**
- * Returns a key-value mapping associated with the greatest key
- * less than or equal to the given key, or {@code null} if there
- * is no such key.
- *
- * @param key the key
- * @return an entry with the greatest key less than or equal to
- * {@code key}, or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- Map.Entry<K,V> floorEntry(K key);
-
- /**
- * Returns the greatest key less than or equal to the given key,
- * or {@code null} if there is no such key.
- *
- * @param key the key
- * @return the greatest key less than or equal to {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- K floorKey(K key);
-
- /**
- * Returns a key-value mapping associated with the least key
- * greater than or equal to the given key, or {@code null} if
- * there is no such key.
- *
- * @param key the key
- * @return an entry with the least key greater than or equal to
- * {@code key}, or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- Map.Entry<K,V> ceilingEntry(K key);
-
- /**
- * Returns the least key greater than or equal to the given key,
- * or {@code null} if there is no such key.
- *
- * @param key the key
- * @return the least key greater than or equal to {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- K ceilingKey(K key);
-
- /**
- * Returns a key-value mapping associated with the least key
- * strictly greater than the given key, or {@code null} if there
- * is no such key.
- *
- * @param key the key
- * @return an entry with the least key greater than {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- Map.Entry<K,V> higherEntry(K key);
-
- /**
- * Returns the least key strictly greater than the given key, or
- * {@code null} if there is no such key.
- *
- * @param key the key
- * @return the least key greater than {@code key},
- * or {@code null} if there is no such key
- * @throws ClassCastException if the specified key cannot be compared
- * with the keys currently in the map
- * @throws NullPointerException if the specified key is null
- * and this map does not permit null keys
- */
- K higherKey(K key);
-
- /**
- * Returns a key-value mapping associated with the least
- * key in this map, or {@code null} if the map is empty.
- *
- * @return an entry with the least key,
- * or {@code null} if this map is empty
- */
- Map.Entry<K,V> firstEntry();
-
- /**
- * Returns a key-value mapping associated with the greatest
- * key in this map, or {@code null} if the map is empty.
- *
- * @return an entry with the greatest key,
- * or {@code null} if this map is empty
- */
- Map.Entry<K,V> lastEntry();
-
- /**
- * Removes and returns a key-value mapping associated with
- * the least key in this map, or {@code null} if the map is empty.
- *
- * @return the removed first entry of this map,
- * or {@code null} if this map is empty
- */
- Map.Entry<K,V> pollFirstEntry();
-
- /**
- * Removes and returns a key-value mapping associated with
- * the greatest key in this map, or {@code null} if the map is empty.
- *
- * @return the removed last entry of this map,
- * or {@code null} if this map is empty
- */
- Map.Entry<K,V> pollLastEntry();
-
- /**
- * Returns a reverse order view of the mappings contained in this map.
- * The descending map is backed by this map, so changes to the map are
- * reflected in the descending map, and vice-versa. If either map is
- * modified while an iteration over a collection view of either map
- * is in progress (except through the iterator's own {@code remove}
- * operation), the results of the iteration are undefined.
- *
- * <p>The returned map has an ordering equivalent to
- * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
- * The expression {@code m.descendingMap().descendingMap()} returns a
- * view of {@code m} essentially equivalent to {@code m}.
- *
- * @return a reverse order view of this map
- */
- NavigableMap<K,V> descendingMap();
-
- /**
- * Returns a {@link NavigableSet} view of the keys contained in this map.
- * The set's iterator returns the keys in ascending order.
- * The set is backed by the map, so changes to the map are reflected in
- * the set, and vice-versa. If the map is modified while an iteration
- * over the set is in progress (except through the iterator's own {@code
- * remove} operation), the results of the iteration are undefined. The
- * set supports element removal, which removes the corresponding mapping
- * from the map, via the {@code Iterator.remove}, {@code Set.remove},
- * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
- * It does not support the {@code add} or {@code addAll} operations.
- *
- * @return a navigable set view of the keys in this map
- */
- NavigableSet<K> navigableKeySet();
-
- /**
- * Returns a reverse order {@link NavigableSet} view of the keys contained in this map.
- * The set's iterator returns the keys in descending order.
- * The set is backed by the map, so changes to the map are reflected in
- * the set, and vice-versa. If the map is modified while an iteration
- * over the set is in progress (except through the iterator's own {@code
- * remove} operation), the results of the iteration are undefined. The
- * set supports element removal, which removes the corresponding mapping
- * from the map, via the {@code Iterator.remove}, {@code Set.remove},
- * {@code removeAll}, {@code retainAll}, and {@code clear} operations.
- * It does not support the {@code add} or {@code addAll} operations.
- *
- * @return a reverse order navig...
[truncated message content] |
|
From: <ls...@us...> - 2007-09-06 14:46:24
|
Revision: 3461
http://jnode.svn.sourceforge.net/jnode/?rev=3461&view=rev
Author: lsantha
Date: 2007-09-06 07:46:22 -0700 (Thu, 06 Sep 2007)
Log Message:
-----------
openjdk integration
Added Paths:
-----------
trunk/core/src/icedtea/java/
trunk/core/src/icedtea/java/lang/
trunk/core/src/icedtea/java/lang/CharacterData00.java
trunk/core/src/icedtea/java/lang/CharacterData01.java
trunk/core/src/icedtea/java/lang/CharacterData02.java
trunk/core/src/icedtea/java/lang/CharacterData0E.java
trunk/core/src/icedtea/java/lang/CharacterDataLatin1.java
trunk/core/src/icedtea/java/lang/CharacterDataPrivateUse.java
trunk/core/src/icedtea/java/lang/CharacterDataUndefined.java
trunk/core/src/openjdk/java/java/lang/AbstractStringBuilder.java
trunk/core/src/openjdk/java/java/lang/AssertionStatusDirectives.java
trunk/core/src/openjdk/java/java/lang/Boolean.java
trunk/core/src/openjdk/java/java/lang/Character.java
trunk/core/src/openjdk/java/java/lang/CharacterData.java
trunk/core/src/openjdk/java/java/lang/Compiler.java
trunk/core/src/openjdk/java/java/lang/ConditionalSpecialCasing.java
trunk/core/src/openjdk/java/java/lang/Enum.java
trunk/core/src/openjdk/java/java/lang/StackTraceElement.java
trunk/core/src/openjdk/java/java/lang/String.java
trunk/core/src/openjdk/java/java/lang/StringBuffer.java
trunk/core/src/openjdk/java/java/lang/StringBuilder.java
trunk/core/src/openjdk/java/java/lang/StringCoding.java
trunk/core/src/openjdk/java/java/util/logging/
trunk/core/src/openjdk/java/java/util/logging/ConsoleHandler.java
trunk/core/src/openjdk/java/java/util/logging/ErrorManager.java
trunk/core/src/openjdk/java/java/util/logging/FileHandler.java
trunk/core/src/openjdk/java/java/util/logging/Filter.java
trunk/core/src/openjdk/java/java/util/logging/Formatter.java
trunk/core/src/openjdk/java/java/util/logging/Handler.java
trunk/core/src/openjdk/java/java/util/logging/Level.java
trunk/core/src/openjdk/java/java/util/logging/LogManager.java
trunk/core/src/openjdk/java/java/util/logging/LogRecord.java
trunk/core/src/openjdk/java/java/util/logging/Logger.java
trunk/core/src/openjdk/java/java/util/logging/Logging.java
trunk/core/src/openjdk/java/java/util/logging/LoggingMXBean.java
trunk/core/src/openjdk/java/java/util/logging/LoggingPermission.java
trunk/core/src/openjdk/java/java/util/logging/MemoryHandler.java
trunk/core/src/openjdk/java/java/util/logging/SimpleFormatter.java
trunk/core/src/openjdk/java/java/util/logging/SocketHandler.java
trunk/core/src/openjdk/java/java/util/logging/StreamHandler.java
trunk/core/src/openjdk/java/java/util/logging/XMLFormatter.java
trunk/core/src/openjdk/java/java/util/logging/package.html
trunk/core/src/openjdk/vm/java/lang/NativeCompiler.java
trunk/core/src/openjdk/vm/java/lang/NativeString.java
trunk/core/src/openjdk/vm/java/util/logging/
trunk/core/src/openjdk/vm/java/util/logging/NativeFileHandler.java
Added: trunk/core/src/icedtea/java/lang/CharacterData00.java
===================================================================
--- trunk/core/src/icedtea/java/lang/CharacterData00.java (rev 0)
+++ trunk/core/src/icedtea/java/lang/CharacterData00.java 2007-09-06 14:46:22 UTC (rev 3461)
@@ -0,0 +1,1110 @@
+// This file was generated AUTOMATICALLY from a template file Fri May 25 16:17:10 EDT 2007
+/*
+ * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.lang;
+
+/**
+ * The CharacterData00 class encapsulates the large tables once found in
+ * java.lang.Character
+*/
+
+class CharacterData00 extends CharacterData {
+ /* The character properties are currently encoded into 32 bits in the following manner:
+ 1 bit mirrored property
+ 4 bits directionality property
+ 9 bits signed offset used for converting case
+ 1 bit if 1, adding the signed offset converts the character to lowercase
+ 1 bit if 1, subtracting the signed offset converts the character to uppercase
+ 1 bit if 1, this character has a titlecase equivalent (possibly itself)
+ 3 bits 0 may not be part of an identifier
+ 1 ignorable control; may continue a Unicode identifier or Java identifier
+ 2 may continue a Java identifier but not a Unicode identifier (unused)
+ 3 may continue a Unicode identifier or Java identifier
+ 4 is a Java whitespace character
+ 5 may start or continue a Java identifier;
+ may continue but not start a Unicode identifier (underscores)
+ 6 may start or continue a Java identifier but not a Unicode identifier ($)
+ 7 may start or continue a Unicode identifier or Java identifier
+ Thus:
+ 5, 6, 7 may start a Java identifier
+ 1, 2, 3, 5, 6, 7 may continue a Java identifier
+ 7 may start a Unicode identifier
+ 1, 3, 5, 7 may continue a Unicode identifier
+ 1 is ignorable within an identifier
+ 4 is Java whitespace
+ 2 bits 0 this character has no numeric property
+ 1 adding the digit offset to the character code and then
+ masking with 0x1F will produce the desired numeric value
+ 2 this character has a "strange" numeric value
+ 3 a Java supradecimal digit: adding the digit offset to the
+ character code, then masking with 0x1F, then adding 10
+ will produce the desired numeric value
+ 5 bits digit offset
+ 5 bits character type
+
+ The encoding of character properties is subject to change at any time.
+ */
+
+ int getProperties(int ch) {
+ char offset = (char)ch;
+ int props = A[Y[X[offset>>5]|((offset>>1)&0xF)]|(offset&0x1)];
+ return props;
+ }
+
+ int getType(int ch) {
+ int props = getProperties(ch);
+ return (props & 0x1F);
+ }
+
+ boolean isJavaIdentifierStart(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00007000) >= 0x00005000);
+ }
+
+ boolean isJavaIdentifierPart(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00003000) != 0);
+ }
+
+ boolean isUnicodeIdentifierStart(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00007000) == 0x00007000);
+ }
+
+ boolean isUnicodeIdentifierPart(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00001000) != 0);
+ }
+
+ boolean isIdentifierIgnorable(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00007000) == 0x00001000);
+ }
+
+ int toLowerCase(int ch) {
+ int mapChar = ch;
+ int val = getProperties(ch);
+
+ if ((val & 0x00020000) != 0) {
+ if ((val & 0x07FC0000) == 0x07FC0000) {
+ switch(ch) {
+ // map the offset overflow chars
+ case 0x0130 : mapChar = 0x0069; break;
+ case 0x2126 : mapChar = 0x03C9; break;
+ case 0x212A : mapChar = 0x006B; break;
+ case 0x212B : mapChar = 0x00E5; break;
+ // map the titlecase chars with both a 1:M uppercase map
+ // and a lowercase map
+ case 0x1F88 : mapChar = 0x1F80; break;
+ case 0x1F89 : mapChar = 0x1F81; break;
+ case 0x1F8A : mapChar = 0x1F82; break;
+ case 0x1F8B : mapChar = 0x1F83; break;
+ case 0x1F8C : mapChar = 0x1F84; break;
+ case 0x1F8D : mapChar = 0x1F85; break;
+ case 0x1F8E : mapChar = 0x1F86; break;
+ case 0x1F8F : mapChar = 0x1F87; break;
+ case 0x1F98 : mapChar = 0x1F90; break;
+ case 0x1F99 : mapChar = 0x1F91; break;
+ case 0x1F9A : mapChar = 0x1F92; break;
+ case 0x1F9B : mapChar = 0x1F93; break;
+ case 0x1F9C : mapChar = 0x1F94; break;
+ case 0x1F9D : mapChar = 0x1F95; break;
+ case 0x1F9E : mapChar = 0x1F96; break;
+ case 0x1F9F : mapChar = 0x1F97; break;
+ case 0x1FA8 : mapChar = 0x1FA0; break;
+ case 0x1FA9 : mapChar = 0x1FA1; break;
+ case 0x1FAA : mapChar = 0x1FA2; break;
+ case 0x1FAB : mapChar = 0x1FA3; break;
+ case 0x1FAC : mapChar = 0x1FA4; break;
+ case 0x1FAD : mapChar = 0x1FA5; break;
+ case 0x1FAE : mapChar = 0x1FA6; break;
+ case 0x1FAF : mapChar = 0x1FA7; break;
+ case 0x1FBC : mapChar = 0x1FB3; break;
+ case 0x1FCC : mapChar = 0x1FC3; break;
+ case 0x1FFC : mapChar = 0x1FF3; break;
+ // default mapChar is already set, so no
+ // need to redo it here.
+ // default : mapChar = ch;
+ }
+ }
+ else {
+ int offset = val << 5 >> (5+18);
+ mapChar = ch + offset;
+ }
+ }
+ return mapChar;
+ }
+
+ int toUpperCase(int ch) {
+ int mapChar = ch;
+ int val = getProperties(ch);
+
+ if ((val & 0x00010000) != 0) {
+ if ((val & 0x07FC0000) == 0x07FC0000) {
+ switch(ch) {
+ // map chars with overflow offsets
+ case 0x00B5 : mapChar = 0x039C; break;
+ case 0x017F : mapChar = 0x0053; break;
+ case 0x1FBE : mapChar = 0x0399; break;
+ // map char that have both a 1:1 and 1:M map
+ case 0x1F80 : mapChar = 0x1F88; break;
+ case 0x1F81 : mapChar = 0x1F89; break;
+ case 0x1F82 : mapChar = 0x1F8A; break;
+ case 0x1F83 : mapChar = 0x1F8B; break;
+ case 0x1F84 : mapChar = 0x1F8C; break;
+ case 0x1F85 : mapChar = 0x1F8D; break;
+ case 0x1F86 : mapChar = 0x1F8E; break;
+ case 0x1F87 : mapChar = 0x1F8F; break;
+ case 0x1F90 : mapChar = 0x1F98; break;
+ case 0x1F91 : mapChar = 0x1F99; break;
+ case 0x1F92 : mapChar = 0x1F9A; break;
+ case 0x1F93 : mapChar = 0x1F9B; break;
+ case 0x1F94 : mapChar = 0x1F9C; break;
+ case 0x1F95 : mapChar = 0x1F9D; break;
+ case 0x1F96 : mapChar = 0x1F9E; break;
+ case 0x1F97 : mapChar = 0x1F9F; break;
+ case 0x1FA0 : mapChar = 0x1FA8; break;
+ case 0x1FA1 : mapChar = 0x1FA9; break;
+ case 0x1FA2 : mapChar = 0x1FAA; break;
+ case 0x1FA3 : mapChar = 0x1FAB; break;
+ case 0x1FA4 : mapChar = 0x1FAC; break;
+ case 0x1FA5 : mapChar = 0x1FAD; break;
+ case 0x1FA6 : mapChar = 0x1FAE; break;
+ case 0x1FA7 : mapChar = 0x1FAF; break;
+ case 0x1FB3 : mapChar = 0x1FBC; break;
+ case 0x1FC3 : mapChar = 0x1FCC; break;
+ case 0x1FF3 : mapChar = 0x1FFC; break;
+ // ch must have a 1:M case mapping, but we
+ // can't handle it here. Return ch.
+ // since mapChar is already set, no need
+ // to redo it here.
+ //default : mapChar = ch;
+ }
+ }
+ else {
+ int offset = val << 5 >> (5+18);
+ mapChar = ch - offset;
+ }
+ }
+ return mapChar;
+ }
+
+ int toTitleCase(int ch) {
+ int mapChar = ch;
+ int val = getProperties(ch);
+
+ if ((val & 0x00008000) != 0) {
+ // There is a titlecase equivalent. Perform further checks:
+ if ((val & 0x00010000) == 0) {
+ // The character does not have an uppercase equivalent, so it must
+ // already be uppercase; so add 1 to get the titlecase form.
+ mapChar = ch + 1;
+ }
+ else if ((val & 0x00020000) == 0) {
+ // The character does not have a lowercase equivalent, so it must
+ // already be lowercase; so subtract 1 to get the titlecase form.
+ mapChar = ch - 1;
+ }
+ // else {
+ // The character has both an uppercase equivalent and a lowercase
+ // equivalent, so it must itself be a titlecase form; return it.
+ // return ch;
+ //}
+ }
+ else if ((val & 0x00010000) != 0) {
+ // This character has no titlecase equivalent but it does have an
+ // uppercase equivalent, so use that (subtract the signed case offset).
+ mapChar = toUpperCase(ch);
+ }
+ return mapChar;
+ }
+
+ int digit(int ch, int radix) {
+ int value = -1;
+ if (radix >= Character.MIN_RADIX && radix <= Character.MAX_RADIX) {
+ int val = getProperties(ch);
+ int kind = val & 0x1F;
+ if (kind == Character.DECIMAL_DIGIT_NUMBER) {
+ value = ch + ((val & 0x3E0) >> 5) & 0x1F;
+ }
+ else if ((val & 0xC00) == 0x00000C00) {
+ // Java supradecimal digit
+ value = (ch + ((val & 0x3E0) >> 5) & 0x1F) + 10;
+ }
+ }
+ return (value < radix) ? value : -1;
+ }
+
+ int getNumericValue(int ch) {
+ int val = getProperties(ch);
+ int retval = -1;
+
+ switch (val & 0xC00) {
+ default: // cannot occur
+ case (0x00000000): // not numeric
+ retval = -1;
+ break;
+ case (0x00000400): // simple numeric
+ retval = ch + ((val & 0x3E0) >> 5) & 0x1F;
+ break;
+ case (0x00000800) : // "strange" numeric
+ switch (ch) {
+ case 0x0BF1: retval = 100; break; // TAMIL NUMBER ONE HUNDRED
+ case 0x0BF2: retval = 1000; break; // TAMIL NUMBER ONE THOUSAND
+ case 0x1375: retval = 40; break; // ETHIOPIC NUMBER FORTY
+ case 0x1376: retval = 50; break; // ETHIOPIC NUMBER FIFTY
+ case 0x1377: retval = 60; break; // ETHIOPIC NUMBER SIXTY
+ case 0x1378: retval = 70; break; // ETHIOPIC NUMBER SEVENTY
+ case 0x1379: retval = 80; break; // ETHIOPIC NUMBER EIGHTY
+ case 0x137A: retval = 90; break; // ETHIOPIC NUMBER NINETY
+ case 0x137B: retval = 100; break; // ETHIOPIC NUMBER HUNDRED
+ case 0x137C: retval = 10000; break; // ETHIOPIC NUMBER TEN THOUSAND
+ case 0x215F: retval = 1; break; // FRACTION NUMERATOR ONE
+ case 0x216C: retval = 50; break; // ROMAN NUMERAL FIFTY
+ case 0x216D: retval = 100; break; // ROMAN NUMERAL ONE HUNDRED
+ case 0x216E: retval = 500; break; // ROMAN NUMERAL FIVE HUNDRED
+ case 0x216F: retval = 1000; break; // ROMAN NUMERAL ONE THOUSAND
+ case 0x217C: retval = 50; break; // SMALL ROMAN NUMERAL FIFTY
+ case 0x217D: retval = 100; break; // SMALL ROMAN NUMERAL ONE HUNDRED
+ case 0x217E: retval = 500; break; // SMALL ROMAN NUMERAL FIVE HUNDRED
+ case 0x217F: retval = 1000; break; // SMALL ROMAN NUMERAL ONE THOUSAND
+ case 0x2180: retval = 1000; break; // ROMAN NUMERAL ONE THOUSAND C D
+ case 0x2181: retval = 5000; break; // ROMAN NUMERAL FIVE THOUSAND
+ case 0x2182: retval = 10000; break; // ROMAN NUMERAL TEN THOUSAND
+
+ case 0x325C: retval = 32; break;
+
+ case 0x325D: retval = 33; break; // CIRCLED NUMBER THIRTY THREE
+ case 0x325E: retval = 34; break; // CIRCLED NUMBER THIRTY FOUR
+ case 0x325F: retval = 35; break; // CIRCLED NUMBER THIRTY FIVE
+ case 0x32B1: retval = 36; break; // CIRCLED NUMBER THIRTY SIX
+ case 0x32B2: retval = 37; break; // CIRCLED NUMBER THIRTY SEVEN
+ case 0x32B3: retval = 38; break; // CIRCLED NUMBER THIRTY EIGHT
+ case 0x32B4: retval = 39; break; // CIRCLED NUMBER THIRTY NINE
+ case 0x32B5: retval = 40; break; // CIRCLED NUMBER FORTY
+ case 0x32B6: retval = 41; break; // CIRCLED NUMBER FORTY ONE
+ case 0x32B7: retval = 42; break; // CIRCLED NUMBER FORTY TWO
+ case 0x32B8: retval = 43; break; // CIRCLED NUMBER FORTY THREE
+ case 0x32B9: retval = 44; break; // CIRCLED NUMBER FORTY FOUR
+ case 0x32BA: retval = 45; break; // CIRCLED NUMBER FORTY FIVE
+ case 0x32BB: retval = 46; break; // CIRCLED NUMBER FORTY SIX
+ case 0x32BC: retval = 47; break; // CIRCLED NUMBER FORTY SEVEN
+ case 0x32BD: retval = 48; break; // CIRCLED NUMBER FORTY EIGHT
+ case 0x32BE: retval = 49; break; // CIRCLED NUMBER FORTY NINE
+ case 0x32BF: retval = 50; break; // CIRCLED NUMBER FIFTY
+
+ default: retval = -2; break;
+ }
+ break;
+ case (0x00000C00): // Java supradecimal
+ retval = (ch + ((val & 0x3E0) >> 5) & 0x1F) + 10;
+ break;
+ }
+ return retval;
+ }
+
+ boolean isWhitespace(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x00007000) == 0x00004000);
+ }
+
+ byte getDirectionality(int ch) {
+ int val = getProperties(ch);
+ byte directionality = (byte)((val & 0x78000000) >> 27);
+ if (directionality == 0xF ) {
+ switch(ch) {
+ case 0x202A :
+ // This is the only char with LRE
+ directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_EMBEDDING;
+ break;
+ case 0x202B :
+ // This is the only char with RLE
+ directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_EMBEDDING;
+ break;
+ case 0x202C :
+ // This is the only char with PDF
+ directionality = Character.DIRECTIONALITY_POP_DIRECTIONAL_FORMAT;
+ break;
+ case 0x202D :
+ // This is the only char with LRO
+ directionality = Character.DIRECTIONALITY_LEFT_TO_RIGHT_OVERRIDE;
+ break;
+ case 0x202E :
+ // This is the only char with RLO
+ directionality = Character.DIRECTIONALITY_RIGHT_TO_LEFT_OVERRIDE;
+ break;
+ default :
+ directionality = Character.DIRECTIONALITY_UNDEFINED;
+ break;
+ }
+ }
+ return directionality;
+ }
+
+ boolean isMirrored(int ch) {
+ int props = getProperties(ch);
+ return ((props & 0x80000000) != 0);
+ }
+
+ int toUpperCaseEx(int ch) {
+ int mapChar = ch;
+ int val = getProperties(ch);
+
+ if ((val & 0x00010000) != 0) {
+ if ((val & 0x07FC0000) != 0x07FC0000) {
+ int offset = val << 5 >> (5+18);
+ mapChar = ch - offset;
+ }
+ else {
+ switch(ch) {
+ // map overflow characters
+ case 0x00B5 : mapChar = 0x039C; break;
+ case 0x017F : mapChar = 0x0053; break;
+ case 0x1FBE : mapChar = 0x0399; break;
+ default : mapChar = Character.ERROR; break;
+ }
+ }
+ }
+ return mapChar;
+ }
+
+ char[] toUpperCaseCharArray(int ch) {
+ char[] upperMap = {(char)ch};
+ int location = findInCharMap(ch);
+ if (location != -1) {
+ upperMap = charMap[location][1];
+ }
+ return upperMap;
+ }
+
+
+ /**
+ * Finds the character in the uppercase mapping table.
+ *
+ * @param ch the <code>char</code> to search
+ * @return the index location ch in the table or -1 if not found
+ * @since 1.4
+ */
+ int findInCharMap(int ch) {
+ if (charMap == null || charMap.length == 0) {
+ return -1;
+ }
+ int top, bottom, current;
+ bottom = 0;
+ top = charMap.length;
+ current = top/2;
+ // invariant: top > current >= bottom && ch >= CharacterData.charMap[bottom][0]
+ while (top - bottom > 1) {
+ if (ch >= charMap[current][0][0]) {
+ bottom = current;
+ } else {
+ top = current;
+ }
+ current = (top + bottom) / 2;
+ }
+ if (ch == charMap[current][0][0]) return current;
+ else return -1;
+ }
+
+ static final CharacterData00 instance = new CharacterData00();
+ private CharacterData00() {};
+
+ // The following tables and code generated using:
+ // java GenerateCharacter -plane 0 -template ../../tools/GenerateCharacter/CharacterData00.java.template -spec ../../tools/UnicodeData/UnicodeData.txt -specialcasing ../../tools/UnicodeData/SpecialCasing.txt -o /notnfs/fkung/workspace/openjdk/control/build/linux-i586/gensrc/java/lang/CharacterData00.java -string -usecharforbyte 11 4 1
+ static final char[][][] charMap;
+// The X table has 2048 entries for a total of 4096 bytes.
+
+ static final char X[] = (
+ "\000\020\040\060\100\120\140\160\200\220\240\260\300\320\340\360\200\u0100"+
+ "\u0110\u0120\u0130\u0140\u0150\u0160\u0170\u0170\u0180\u0190\u01A0\u01B0\u01C0"+
+ "\u01D0\u01E0\u01F0\u0200\200\u0210\200\u0220\u0230\u0240\u0250\u0260\u0270"+
+ "\u0280\u0290\u02A0\u02B0\u02C0\u02D0\u02E0\u02F0\u0300\u0300\u0310\u0320\u0330"+
+ "\u0340\u0350\u0360\u0300\u0370\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360"+
+ "\u0360\u0360\u0380\u0390\u03A0\u03B0\u03C0\u03D0\u03E0\u03F0\u0400\u0410\u0420"+
+ "\u0430\u0440\u0450\u0460\u0470\u03C0\u0480\u0490\u04A0\u04B0\u04C0\u04D0\u04E0"+
+ "\u04F0\u0500\u0510\u0520\u0530\u0540\u0550\u0520\u0530\u0560\u0570\u0520\u0580"+
+ "\u0590\u05A0\u05B0\u05C0\u05D0\u05E0\u0360\u05F0\u0600\u0610\u0360\u0620\u0630"+
+ "\u0640\u0650\u0660\u0670\u0680\u0360\u0690\u06A0\u06B0\u0360\u0360\u06C0\u06D0"+
+ "\u06E0\u0690\u0690\u06F0\u0690\u0690\u0700\u0690\u0710\u0720\u0690\u0730\u0690"+
+ "\u0740\u0750\u0760\u0770\u0750\u0690\u0780\u0790\u0360\u0690\u0690\u07A0\u05C0"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u07B0\u07C0\u0690\u0690\u07D0\u07E0\u07F0\u0800"+
+ "\u0810\u0690\u0820\u0830\u0840\u0850\u0690\u0860\u0870\u0690\u0880\u0360\u0360"+
+ "\u0890\u08A0\u08B0\u08C0\u0360\u0360\u0360\u08D0\u0360\u0360\u0360\u0360\u0360"+
+ "\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360"+
+ "\u0360\u0360\u0360\u0360\u0360\u0360\u08E0\u08F0\u0900\u0910\u0360\u0360\u0360"+
+ "\u0360\200\200\200\200\u0920\200\200\u0930\u0940\u0950\u0960\u0970\u0980\u0990"+
+ "\u09A0\u09B0\u09C0\u09D0\u09E0\u09F0\u0A00\u0A10\u0A20\u0A30\u0A40\u0A50\u0A60"+
+ "\u0A70\u0A80\u0A90\u0AA0\u0AB0\u0AC0\u0AD0\u0AE0\u0AF0\u0B00\u0B10\u0B20\u0B30"+
+ "\u0B40\u0B50\u0B60\u0B70\u0B80\u0B90\u0BA0\u0360\u08D0\u0BB0\u0BC0\u0BD0\u0BE0"+
+ "\u0BF0\u0C00\u0C10\u08D0\u08D0\u08D0\u08D0\u08D0\u0C20\u0C30\u0C40\u0C50\u08D0"+
+ "\u08D0\u0C60\u0C70\u0C80\u0360\u0360\u0C90\u0CA0\u0CB0\u0CC0\u0CD0\u0CE0\u0CF0"+
+ "\u0D00\u08D0\u08D0\u08D0\u08D0\u08D0\u08D0\u08D0\u08D0\u0D10\u0D10\u0D10\u0D10"+
+ "\u0D20\u0D30\u0D40\u0D50\u0D60\u0D70\u0D80\u0D90\u0DA0\u0DB0\u0DC0\u0DD0\u0DE0"+
+ "\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360"+
+ "\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360\u0360"+
+ "\u0360\u0DF0\u08D0\u08D0\u0E00\u08D0\u08D0\u08D0\u08D0\u08D0\u08D0\u0E10\u0E20"+
+ "\u0E30\u0E40\u05C0\u0690\u0E50\u0E60\u0690\u0E70\u0E80\u0E90\u0690\u0690\u0EA0"+
+ "\u0870\u0360\u0EB0\u0EC0\u0ED0\u0EE0\u0EF0\u0ED0\u0F00\u0F10\u0F20\u0B60\u0B60"+
+ "\u0B60\u0F30\u0B60\u0B60\u0F40\u0F50\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0F60\u08D0\u08D0\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+
+ "\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690\u0690"+...
[truncated message content] |
|
From: <ls...@us...> - 2007-09-08 16:43:40
|
Revision: 3470
http://jnode.svn.sourceforge.net/jnode/?rev=3470&view=rev
Author: lsantha
Date: 2007-09-08 09:43:35 -0700 (Sat, 08 Sep 2007)
Log Message:
-----------
openjdk integration
Modified Paths:
--------------
trunk/core/src/classpath/java/java/security/AccessController.java
trunk/core/src/classpath/vm/java/lang/ClassLoader.java
trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java
Modified: trunk/core/src/classpath/java/java/security/AccessController.java
===================================================================
--- trunk/core/src/classpath/java/java/security/AccessController.java 2007-09-08 12:09:23 UTC (rev 3469)
+++ trunk/core/src/classpath/java/java/security/AccessController.java 2007-09-08 16:43:35 UTC (rev 3470)
@@ -113,10 +113,10 @@
* domains should be added to the protection domain of the calling class.
* @return the result of the <code>action.run()</code> method.
*/
- public static Object doPrivileged(PrivilegedAction action,
+ public static <T> T doPrivileged(PrivilegedAction<T> action,
AccessControlContext context)
{
- return VmAccessController.doPrivileged(action, context.getVmContext());
+ return (T) VmAccessController.doPrivileged(action, context.getVmContext());
}
/**
Modified: trunk/core/src/classpath/vm/java/lang/ClassLoader.java
===================================================================
--- trunk/core/src/classpath/vm/java/lang/ClassLoader.java 2007-09-08 12:09:23 UTC (rev 3469)
+++ trunk/core/src/classpath/vm/java/lang/ClassLoader.java 2007-09-08 16:43:35 UTC (rev 3470)
@@ -201,7 +201,7 @@
*
* @param vmClassLoader
*/
- protected ClassLoader(VmSystemClassLoader vmClassLoader) {
+ protected ClassLoader(VmSystemClassLoader vmClassLoader, int discriminator) {
/* May we create a new classloader? */
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
Modified: trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2007-09-08 12:09:23 UTC (rev 3469)
+++ trunk/core/src/core/org/jnode/vm/VmSystemClassLoader.java 2007-09-08 16:43:35 UTC (rev 3470)
@@ -764,7 +764,7 @@
private final VmSystemClassLoader vmClassLoader;
public ClassLoaderWrapper(VmSystemClassLoader vmClassLoader) {
- super(vmClassLoader);
+ super(vmClassLoader, 0);
this.vmClassLoader = vmClassLoader;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-09-15 21:45:22
|
Revision: 3504
http://jnode.svn.sourceforge.net/jnode/?rev=3504&view=rev
Author: lsantha
Date: 2007-09-15 14:45:19 -0700 (Sat, 15 Sep 2007)
Log Message:
-----------
Solution for the bug where jnode crashes after the gc is executed after the ping command.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/util/Timer.java
trunk/core/src/openjdk/java/java/util/TimerTask.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/util/Timer.java
trunk/core/src/classpath/java/java/util/TimerTask.java
Deleted: trunk/core/src/classpath/java/java/util/Timer.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Timer.java 2007-09-15 19:58:16 UTC (rev 3503)
+++ trunk/core/src/classpath/java/java/util/Timer.java 2007-09-15 21:45:19 UTC (rev 3504)
@@ -1,704 +0,0 @@
-/* Timer.java -- Timer that runs TimerTasks at a later time.
- Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.util;
-
-/**
- * Timer that can run TimerTasks at a later time.
- * TimerTasks can be scheduled for one time execution at some time in the
- * future. They can be scheduled to be rescheduled at a time period after the
- * task was last executed. Or they can be scheduled to be executed repeatedly
- * at a fixed rate.
- * <p>
- * The normal scheduling will result in a more or less even delay in time
- * between successive executions, but the executions could drift in time if
- * the task (or other tasks) takes a long time to execute. Fixed delay
- * scheduling guarantees more or less that the task will be executed at a
- * specific time, but if there is ever a delay in execution then the period
- * between successive executions will be shorter. The first method of
- * repeated scheduling is preferred for repeated tasks in response to user
- * interaction, the second method of repeated scheduling is preferred for tasks
- * that act like alarms.
- * <p>
- * The Timer keeps a binary heap as a task priority queue which means that
- * scheduling and serving of a task in a queue of n tasks costs O(log n).
- *
- * @see TimerTask
- * @since 1.3
- * @author Mark Wielaard (ma...@kl...)
- */
-public class Timer
-{
- /**
- * Priority Task Queue.
- * TimerTasks are kept in a binary heap.
- * The scheduler calls sleep() on the queue when it has nothing to do or
- * has to wait. A sleeping scheduler can be notified by calling interrupt()
- * which is automatically called by the enqueue(), cancel() and
- * timerFinalized() methods.
- */
- private static final class TaskQueue
- {
- /** Default size of this queue */
- private static final int DEFAULT_SIZE = 32;
-
- /** Whether to return null when there is nothing in the queue */
- private boolean nullOnEmpty;
-
- /**
- * The heap containing all the scheduled TimerTasks
- * sorted by the TimerTask.scheduled field.
- * Null when the stop() method has been called.
- */
- private TimerTask heap[];
-
- /**
- * The actual number of elements in the heap
- * Can be less then heap.length.
- * Note that heap[0] is used as a sentinel.
- */
- private int elements;
-
- /**
- * Creates a TaskQueue of default size without any elements in it.
- */
- public TaskQueue()
- {
- heap = new TimerTask[DEFAULT_SIZE];
- elements = 0;
- nullOnEmpty = false;
- }
-
- /**
- * Adds a TimerTask at the end of the heap.
- * Grows the heap if necessary by doubling the heap in size.
- */
- private void add(TimerTask task)
- {
- elements++;
- if (elements == heap.length)
- {
- TimerTask new_heap[] = new TimerTask[heap.length * 2];
- System.arraycopy(heap, 0, new_heap, 0, heap.length);
- heap = new_heap;
- }
- heap[elements] = task;
- }
-
- /**
- * Removes the last element from the heap.
- * Shrinks the heap in half if
- * elements+DEFAULT_SIZE/2 <= heap.length/4.
- */
- private void remove()
- {
- // clear the entry first
- heap[elements] = null;
- elements--;
- if (elements + DEFAULT_SIZE / 2 <= (heap.length / 4))
- {
- TimerTask new_heap[] = new TimerTask[heap.length / 2];
- System.arraycopy(heap, 0, new_heap, 0, elements + 1);
- heap = new_heap;
- }
- }
-
- /**
- * Adds a task to the queue and puts it at the correct place
- * in the heap.
- */
- public synchronized void enqueue(TimerTask task)
- {
- // Check if it is legal to add another element
- if (heap == null)
- {
- throw new IllegalStateException
- ("cannot enqueue when stop() has been called on queue");
- }
-
- heap[0] = task; // sentinel
- add(task); // put the new task at the end
- // Now push the task up in the heap until it has reached its place
- int child = elements;
- int parent = child / 2;
- while (heap[parent].scheduled > task.scheduled)
- {
- heap[child] = heap[parent];
- child = parent;
- parent = child / 2;
- }
- // This is the correct place for the new task
- heap[child] = task;
- heap[0] = null; // clear sentinel
- // Maybe sched() is waiting for a new element
- this.notify();
- }
-
- /**
- * Returns the top element of the queue.
- * Can return null when no task is in the queue.
- */
- private TimerTask top()
- {
- if (elements == 0)
- {
- return null;
- }
- else
- {
- return heap[1];
- }
- }
-
- /**
- * Returns the top task in the Queue.
- * Removes the element from the heap and reorders the heap first.
- * Can return null when there is nothing in the queue.
- */
- public synchronized TimerTask serve()
- {
- // The task to return
- TimerTask task = null;
-
- while (task == null)
- {
- // Get the next task
- task = top();
-
- // return null when asked to stop
- // or if asked to return null when the queue is empty
- if ((heap == null) || (task == null && nullOnEmpty))
- {
- return null;
- }
-
- // Do we have a task?
- if (task != null)
- {
- // The time to wait until the task should be served
- long time = task.scheduled - System.currentTimeMillis();
- if (time > 0)
- {
- // This task should not yet be served
- // So wait until this task is ready
- // or something else happens to the queue
- task = null; // set to null to make sure we call top()
- try
- {
- this.wait(time);
- }
- catch (InterruptedException _)
- {
- }
- }
- }
- else
- {
- // wait until a task is added
- // or something else happens to the queue
- try
- {
- this.wait();
- }
- catch (InterruptedException _)
- {
- }
- }
- }
-
- // reconstruct the heap
- TimerTask lastTask = heap[elements];
- remove();
-
- // drop lastTask at the beginning and move it down the heap
- int parent = 1;
- int child = 2;
- heap[1] = lastTask;
- while (child <= elements)
- {
- if (child < elements)
- {
- if (heap[child].scheduled > heap[child + 1].scheduled)
- {
- child++;
- }
- }
-
- if (lastTask.scheduled <= heap[child].scheduled)
- break; // found the correct place (the parent) - done
-
- heap[parent] = heap[child];
- parent = child;
- child = parent * 2;
- }
-
- // this is the correct new place for the lastTask
- heap[parent] = lastTask;
-
- // return the task
- return task;
- }
-
- /**
- * When nullOnEmpty is true the serve() method will return null when
- * there are no tasks in the queue, otherwise it will wait until
- * a new element is added to the queue. It is used to indicate to
- * the scheduler that no new tasks will ever be added to the queue.
- */
- public synchronized void setNullOnEmpty(boolean nullOnEmpty)
- {
- this.nullOnEmpty = nullOnEmpty;
- this.notify();
- }
-
- /**
- * When this method is called the current and all future calls to
- * serve() will return null. It is used to indicate to the Scheduler
- * that it should stop executing since no more tasks will come.
- */
- public synchronized void stop()
- {
- this.heap = null;
- this.elements = 0;
- this.notify();
- }
-
- /**
- * Remove all canceled tasks from the queue.
- */
- public synchronized int purge()
- {
- int removed = 0;
- // Null out any elements that are canceled. Skip element 0 as
- // it is the sentinel.
- for (int i = elements; i > 0; --i)
- {
- if (heap[i].scheduled < 0)
- {
- ++removed;
-
- // Remove an element by pushing the appropriate child
- // into place, and then iterating to the bottom of the
- // tree.
- int index = i;
- while (heap[index] != null)
- {
- int child = 2 * index;
- if (child >= heap.length)
- {
- // Off end; we're done.
- heap[index] = null;
- break;
- }
-
- if (child + 1 >= heap.length || heap[child + 1] == null)
- {
- // Nothing -- we're done.
- }
- else if (heap[child] == null
- || (heap[child].scheduled
- > heap[child + 1].scheduled))
- ++child;
- heap[index] = heap[child];
- index = child;
- }
- }
- }
-
- // Make a new heap if we shrank enough.
- int newLen = heap.length;
- while (elements - removed + DEFAULT_SIZE / 2 <= newLen / 4)
- newLen /= 2;
- if (newLen != heap.length)
- {
- TimerTask[] newHeap = new TimerTask[newLen];
- System.arraycopy(heap, 0, newHeap, 0, elements + 1);
- heap = newHeap;
- }
-
- return removed;
- }
- } // TaskQueue
-
- /**
- * The scheduler that executes all the tasks on a particular TaskQueue,
- * reschedules any repeating tasks and that waits when no task has to be
- * executed immediately. Stops running when canceled or when the parent
- * Timer has been finalized and no more tasks have to be executed.
- */
- private static final class Scheduler implements Runnable
- {
- // The priority queue containing all the TimerTasks.
- private TaskQueue queue;
-
- /**
- * Creates a new Scheduler that will schedule the tasks on the
- * given TaskQueue.
- */
- public Scheduler(TaskQueue queue)
- {
- this.queue = queue;
- }
-
- public void run()
- {
- TimerTask task;
- while ((task = queue.serve()) != null)
- {
- // If this task has not been canceled
- if (task.scheduled >= 0)
- {
-
- // Mark execution time
- task.lastExecutionTime = task.scheduled;
-
- // Repeatable task?
- if (task.period < 0)
- {
- // Last time this task is executed
- task.scheduled = -1;
- }
-
- // Run the task
- try
- {
- task.run();
- }
- catch (ThreadDeath death)
- {
- // If an exception escapes, the Timer becomes invalid.
- queue.stop();
- throw death;
- }
- catch (Throwable t)
- {
- // If an exception escapes, the Timer becomes invalid.
- queue.stop();
- }
- }
-
- // Calculate next time and possibly re-enqueue.
- if (task.scheduled >= 0)
- {
- if (task.fixed)
- {
- task.scheduled += task.period;
- }
- else
- {
- task.scheduled = task.period + System.currentTimeMillis();
- }
-
- try
- {
- queue.enqueue(task);
- }
- catch (IllegalStateException ise)
- {
- // Ignore. Apparently the Timer queue has been stopped.
- }
- }
- }
- }
- } // Scheduler
-
- // Number of Timers created.
- // Used for creating nice Thread names.
- private static int nr;
-
- // The queue that all the tasks are put in.
- // Given to the scheduler
- private TaskQueue queue;
-
- // The Scheduler that does all the real work
- private Scheduler scheduler;
-
- // Used to run the scheduler.
- // Also used to checked if the Thread is still running by calling
- // thread.isAlive(). Sometimes a Thread is suddenly killed by the system
- // (if it belonged to an Applet).
- private Thread thread;
-
- // When cancelled we don't accept any more TimerTasks.
- private boolean canceled;
-
- /**
- * Creates a new Timer with a non daemon Thread as Scheduler, with normal
- * priority and a default name.
- */
- public Timer()
- {
- this(false);
- }
-
- /**
- * Creates a new Timer with a daemon Thread as scheduler if daemon is true,
- * with normal priority and a default name.
- */
- public Timer(boolean daemon)
- {
- this(daemon, Thread.NORM_PRIORITY);
- }
-
- /**
- * Create a new Timer whose Thread has the indicated name. It will have
- * normal priority and will not be a daemon thread.
- * @param name the name of the Thread
- * @since 1.5
- */
- public Timer(String name)
- {
- this(false, Thread.NORM_PRIORITY, name);
- }
-
- /**
- * Create a new Timer whose Thread has the indicated name. It will have
- * normal priority. The boolean argument controls whether or not it
- * will be a daemon thread.
- * @param name the name of the Thread
- * @param daemon true if the Thread should be a daemon thread
- * @since 1.5
- */
- public Timer(String name, boolean daemon)
- {
- this(daemon, Thread.NORM_PRIORITY, name);
- }
-
- /**
- * Creates a new Timer with a daemon Thread as scheduler if daemon is true,
- * with the priority given and a default name.
- */
- private Timer(boolean daemon, int priority)
- {
- this(daemon, priority, "Timer-" + (++nr));
- }
-
- /**
- * Creates a new Timer with a daemon Thread as scheduler if daemon is true,
- * with the priority and name given.E
- */
- private Timer(boolean daemon, int priority, String name)
- {
- canceled = false;
- queue = new TaskQueue();
- scheduler = new Scheduler(queue);
- thread = new Thread(scheduler, name);
- thread.setDaemon(daemon);
- thread.setPriority(priority);
- thread.start();
- }
-
- /**
- * Cancels the execution of the scheduler. If a task is executing it will
- * normally finish execution, but no other tasks will be executed and no
- * more tasks can be scheduled.
- */
- public void cancel()
- {
- canceled = true;
- queue.stop();
- }
-
- /**
- * Schedules the task at Time time, repeating every period
- * milliseconds if period is positive and at a fixed rate if fixed is true.
- *
- * @exception IllegalArgumentException if time is negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- private void schedule(TimerTask task, long time, long period, boolean fixed)
- {
- if (time < 0)
- throw new IllegalArgumentException("negative time");
-
- if (task.scheduled == 0 && task.lastExecutionTime == -1)
- {
- task.scheduled = time;
- task.period = period;
- task.fixed = fixed;
- }
- else
- {
- throw new IllegalStateException
- ("task was already scheduled or canceled");
- }
-
- if (!this.canceled && this.thread != null)
- {
- queue.enqueue(task);
- }
- else
- {
- throw new IllegalStateException
- ("timer was canceled or scheduler thread has died");
- }
- }
-
- private static void positiveDelay(long delay)
- {
- if (delay < 0)
- {
- throw new IllegalArgumentException("delay is negative");
- }
- }
-
- private static void positivePeriod(long period)
- {
- if (period < 0)
- {
- throw new IllegalArgumentException("period is negative");
- }
- }
-
- /**
- * Schedules the task at the specified data for one time execution.
- *
- * @exception IllegalArgumentException if date.getTime() is negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void schedule(TimerTask task, Date date)
- {
- long time = date.getTime();
- schedule(task, time, -1, false);
- }
-
- /**
- * Schedules the task at the specified date and reschedules the task every
- * period milliseconds after the last execution of the task finishes until
- * this timer or the task is canceled.
- *
- * @exception IllegalArgumentException if period or date.getTime() is
- * negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void schedule(TimerTask task, Date date, long period)
- {
- positivePeriod(period);
- long time = date.getTime();
- schedule(task, time, period, false);
- }
-
- /**
- * Schedules the task after the specified delay milliseconds for one time
- * execution.
- *
- * @exception IllegalArgumentException if delay or
- * System.currentTimeMillis + delay is negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void schedule(TimerTask task, long delay)
- {
- positiveDelay(delay);
- long time = System.currentTimeMillis() + delay;
- schedule(task, time, -1, false);
- }
-
- /**
- * Schedules the task after the delay milliseconds and reschedules the
- * task every period milliseconds after the last execution of the task
- * finishes until this timer or the task is canceled.
- *
- * @exception IllegalArgumentException if delay or period is negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void schedule(TimerTask task, long delay, long period)
- {
- positiveDelay(delay);
- positivePeriod(period);
- long time = System.currentTimeMillis() + delay;
- schedule(task, time, period, false);
- }
-
- /**
- * Schedules the task at the specified date and reschedules the task at a
- * fixed rate every period milliseconds until this timer or the task is
- * canceled.
- *
- * @exception IllegalArgumentException if period or date.getTime() is
- * negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void scheduleAtFixedRate(TimerTask task, Date date, long period)
- {
- positivePeriod(period);
- long time = date.getTime();
- schedule(task, time, period, true);
- }
-
- /**
- * Schedules the task after the delay milliseconds and reschedules the task
- * at a fixed rate every period milliseconds until this timer or the task
- * is canceled.
- *
- * @exception IllegalArgumentException if delay or
- * System.currentTimeMillis + delay is negative
- * @exception IllegalStateException if the task was already scheduled or
- * canceled or this Timer is canceled or the scheduler thread has died
- */
- public void scheduleAtFixedRate(TimerTask task, long delay, long period)
- {
- positiveDelay(delay);
- positivePeriod(period);
- long time = System.currentTimeMillis() + delay;
- schedule(task, time, period, true);
- }
-
- /**
- * Tells the scheduler that the Timer task died
- * so there will be no more new tasks scheduled.
- */
- protected void finalize() throws Throwable
- {
- queue.setNullOnEmpty(true);
- }
-
- /**
- * Removes all cancelled tasks from the queue.
- * @return the number of tasks removed
- * @since 1.5
- */
- public int purge()
- {
- return queue.purge();
- }
-}
Deleted: trunk/core/src/classpath/java/java/util/TimerTask.java
===================================================================
--- trunk/core/src/classpath/java/java/util/TimerTask.java 2007-09-15 19:58:16 UTC (rev 3503)
+++ trunk/core/src/classpath/java/java/util/TimerTask.java 2007-09-15 21:45:19 UTC (rev 3504)
@@ -1,145 +0,0 @@
-/* TimerTask.java -- Task that can be run at a later time if given to a Timer.
- Copyright (C) 2000 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.util;
-
-/**
- * Task that can be run at a later time if given to a Timer.
- * The TimerTask must implement a run method that will be called by the
- * Timer when the task is scheduled for execution. The task can check when
- * it should have been scheduled and cancel itself when no longer needed.
- * <p>
- * Example:
- * <pre>
- * Timer timer = new Timer();
- * TimerTask task = new TimerTask() {
- * public void run() {
- * if (this.scheduledExecutionTime() < System.currentTimeMillis() + 500)
- * // Do something
- * else
- * // Complain: We are more then half a second late!
- * if (someStopCondition)
- * this.cancel(); // This was our last execution
- * };
- * timer.scheduleAtFixedRate(task, 1000, 1000); // schedule every second
- * </pre>
- * <p>
- * Note that a TimerTask object is a one shot object and can only given once
- * to a Timer. (The Timer will use the TimerTask object for bookkeeping,
- * in this implementation).
- * <p>
- * This class also implements <code>Runnable</code> to make it possible to
- * give a TimerTask directly as a target to a <code>Thread</code>.
- *
- * @see Timer
- * @since 1.3
- * @author Mark Wielaard (ma...@kl...)
- */
-public abstract class TimerTask implements Runnable
-{
- /**
- * If positive the next time this task should be run.
- * If negative this TimerTask is canceled or executed for the last time.
- */
- long scheduled;
-
- /**
- * If positive the last time this task was run.
- * If negative this TimerTask has not yet been scheduled.
- */
- long lastExecutionTime;
-
- /**
- * If positive the number of milliseconds between runs of this task.
- * If -1 this task doesn't have to be run more then once.
- */
- long period;
-
- /**
- * If true the next time this task should be run is relative to
- * the last scheduled time, otherwise it can drift in time.
- */
- boolean fixed;
-
- /**
- * Creates a TimerTask and marks it as not yet scheduled.
- */
- protected TimerTask()
- {
- this.scheduled = 0;
- this.lastExecutionTime = -1;
- }
-
- /**
- * Marks the task as canceled and prevents any further execution.
- * Returns true if the task was scheduled for any execution in the future
- * and this cancel operation prevents that execution from happening.
- * <p>
- * A task that has been canceled can never be scheduled again.
- * <p>
- * In this implementation the TimerTask it is possible that the Timer does
- * keep a reference to the TimerTask until the first time the TimerTask
- * is actually scheduled. But the reference will disappear immediatly when
- * cancel is called from within the TimerTask run method.
- */
- public boolean cancel()
- {
- boolean prevented_execution = (this.scheduled >= 0);
- this.scheduled = -1;
- return prevented_execution;
- }
-
- /**
- * Method that is called when this task is scheduled for execution.
- */
- public abstract void run();
-
- /**
- * Returns the last time this task was scheduled or (when called by the
- * task from the run method) the time the current execution of the task
- * was scheduled. When the task has not yet run the return value is
- * undefined.
- * <p>
- * Can be used (when the task is scheduled at fixed rate) to see the
- * difference between the requested schedule time and the actual time
- * that can be found with <code>System.currentTimeMillis()</code>.
- */
- public long scheduledExecutionTime()
- {
- return lastExecutionTime;
- }
-}
Added: trunk/core/src/openjdk/java/java/util/Timer.java
===================================================================
--- trunk/core/src/openjdk/java/java/util/Timer.java (rev 0)
+++ trunk/core/src/openjdk/java/java/util/Timer.java 2007-09-15 21:45:19 UTC (rev 3504)
@@ -0,0 +1,700 @@
+/*
+ * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.util;
+import java.util.Date;
+
+/**
+ * A facility for threads to schedule tasks for future execution in a
+ * background thread. Tasks may be scheduled for one-time execution, or for
+ * repeated execution at regular intervals.
+ *
+ * <p>Corresponding to each <tt>Timer</tt> object is a single background
+ * thread that is used to execute all of the timer's tasks, sequentially.
+ * Timer tasks should complete quickly. If a timer task takes excessive time
+ * to complete, it "hogs" the timer's task execution thread. This can, in
+ * turn, delay the execution of subsequent tasks, which may "bunch up" and
+ * execute in rapid succession when (and if) the offending task finally
+ * completes.
+ *
+ * <p>After the last live reference to a <tt>Timer</tt> object goes away
+ * <i>and</i> all outstanding tasks have completed execution, the timer's task
+ * execution thread terminates gracefully (and becomes subject to garbage
+ * collection). However, this can take arbitrarily long to occur. By
+ * default, the task execution thread does not run as a <i>daemon thread</i>,
+ * so it is capable of keeping an application from terminating. If a caller
+ * wants to termina...
[truncated message content] |
|
From: <ls...@us...> - 2007-09-22 12:08:39
|
Revision: 3519
http://jnode.svn.sourceforge.net/jnode/?rev=3519&view=rev
Author: lsantha
Date: 2007-09-22 05:08:36 -0700 (Sat, 22 Sep 2007)
Log Message:
-----------
Iniherit system properties in isolates.
Modified Paths:
--------------
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
Modified: trunk/core/src/classpath/ext/javax/isolate/Isolate.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2007-09-22 12:07:49 UTC (rev 3518)
+++ trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2007-09-22 12:08:36 UTC (rev 3519)
@@ -50,7 +50,7 @@
* @param args
*/
public Isolate(String mainClass, String[] args) {
- this(new StreamBindings(), new Properties(), mainClass, args);
+ this(new StreamBindings(), System.getProperties(), mainClass, args);
}
/**
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-09-22 12:07:49 UTC (rev 3518)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-09-22 12:08:36 UTC (rev 3519)
@@ -125,6 +125,8 @@
*/
private IOContext ioContext = vmIoContext;
+ private Properties initProperties;
+
/**
* Isolate states.
*
@@ -205,6 +207,7 @@
public VmIsolate(Isolate isolate, VmStreamBindings bindings,
Properties properties, String mainClass, String[] args) {
StaticData.isolates.add(this);
+ this.initProperties = properties;
this.isolate = isolate;
this.mainClass = mainClass;
this.args = args;
@@ -537,6 +540,12 @@
final Method mainMethod = cls.getMethod("main",
IsolatedStaticData.mainTypes);
+ //inherit properties
+ Properties sys_porps = System.getProperties();
+ for( String prop : initProperties.stringPropertyNames()){
+ sys_porps.setProperty(prop, initProperties.getProperty(prop));
+ }
+
// Run main method.
mainMethod.invoke(null, new Object[] { args });
} catch (Throwable ex) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-09-24 21:57:57
|
Revision: 3527
http://jnode.svn.sourceforge.net/jnode/?rev=3527&view=rev
Author: lsantha
Date: 2007-09-24 14:57:54 -0700 (Mon, 24 Sep 2007)
Log Message:
-----------
Fixed security issues.
Modified Paths:
--------------
trunk/core/src/classpath/ext/javax/isolate/Isolate.java
trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
Modified: trunk/core/src/classpath/ext/javax/isolate/Isolate.java
===================================================================
--- trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2007-09-23 21:38:55 UTC (rev 3526)
+++ trunk/core/src/classpath/ext/javax/isolate/Isolate.java 2007-09-24 21:57:54 UTC (rev 3527)
@@ -22,8 +22,10 @@
package javax.isolate;
import java.util.Properties;
+import java.security.AccessController;
import org.jnode.vm.isolate.VmIsolate;
+import gnu.java.security.action.GetPropertiesAction;
/**
* @author Ewout Prangsma (ep...@us...)
@@ -50,7 +52,9 @@
* @param args
*/
public Isolate(String mainClass, String[] args) {
- this(new StreamBindings(), System.getProperties(), mainClass, args);
+ this(new StreamBindings(),
+ (Properties) AccessController.doPrivileged(new GetPropertiesAction()),
+ mainClass, args);
}
/**
Modified: trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-09-23 21:38:55 UTC (rev 3526)
+++ trunk/core/src/core/org/jnode/vm/isolate/VmIsolate.java 2007-09-24 21:57:54 UTC (rev 3527)
@@ -28,6 +28,8 @@
import java.util.Properties;
import java.util.Vector;
import java.util.ArrayList;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import javax.isolate.Isolate;
import javax.isolate.IsolateStartupException;
@@ -447,9 +449,11 @@
mainThread.start();
}
+ /*
private Vector<Runnable> taskList = new Vector<Runnable>();
private final Object taskSync = new Object();
private Thread executorThread;
+ */
public void invokeAndWait(final Runnable task){
/*
@@ -544,10 +548,15 @@
IsolatedStaticData.mainTypes);
//inherit properties
- Properties sys_porps = System.getProperties();
- for( String prop : initProperties.stringPropertyNames()){
- sys_porps.setProperty(prop, initProperties.getProperty(prop));
- }
+ AccessController.doPrivileged(new PrivilegedAction<Object>() {
+ public Object run() {
+ Properties sys_porps = System.getProperties();
+ for( String prop : initProperties.stringPropertyNames()){
+ sys_porps.setProperty(prop, initProperties.getProperty(prop));
+ }
+ return null;
+ }
+ });
// Run main method.
mainMethod.invoke(null, new Object[] { args });
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-10-06 20:26:20
|
Revision: 3537
http://jnode.svn.sourceforge.net/jnode/?rev=3537&view=rev
Author: lsantha
Date: 2007-10-06 13:26:18 -0700 (Sat, 06 Oct 2007)
Log Message:
-----------
Added a selfcontained implementation of getTime(), with no dependence on java.util.Calendar which was very expensive.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java
trunk/core/src/test/org/jnode/test/CMOSTest.java
Modified: trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java 2007-10-06 20:17:35 UTC (rev 3536)
+++ trunk/core/src/driver/org/jnode/driver/system/cmos/def/RTC.java 2007-10-06 20:26:18 UTC (rev 3537)
@@ -21,8 +21,6 @@
package org.jnode.driver.system.cmos.def;
-import java.util.GregorianCalendar;
-
import org.jnode.driver.system.cmos.CMOSConstants;
import org.jnode.driver.system.cmos.CMOSService;
import org.jnode.util.BCDUtils;
@@ -35,11 +33,10 @@
public class RTC extends RTCService implements CMOSConstants {
private final CMOSService cmos;
- private final ThreadLocal calendar = new ThreadLocal();
-
+
/**
* Create a new instance
- * @param cmos
+ * @param cmos the CMOS service
*/
public RTC(CMOSService cmos) {
this.cmos = cmos;
@@ -91,7 +88,7 @@
* Gets the current day of the month
* @return int
*/
- public int getDate() {
+ public int getDay() {
final int control = cmos.getRegister(RTC_CONTROL);
final int date = cmos.getRegister(CMOS_RTC_DAY_OF_MONTH);
if ((control & RTC_DM_BINARY) != 0) {
@@ -139,14 +136,32 @@
* @see java.util.Calendar#setTimeInMillis(long)
* @return The time
*/
- public long getTime() {
- GregorianCalendar cal = (GregorianCalendar)calendar.get();
- if (cal == null) {
- cal = new GregorianCalendar(getYear(), getMonth()-1, getDate(), getHours(), getMinutes(), getSeconds());
- calendar.set(cal);
- } else {
- cal.set(getYear(), getMonth()-1, getDate(), getHours(), getMinutes(), getSeconds());
- }
- return cal.getTimeInMillis();
- }
+ public long getTime() {
+ return time2millis(getYear(), getMonth(), getDay(), getHours(), getMinutes(), getSeconds());
+ }
+
+ /**
+ * Converts Gregorian date to milliseconds since 1970-01-01 00:00:00 .
+ *
+ * @param year the year
+ * @param mon the month 1..12
+ * @param day the day of month 1..31
+ * @param hours hours of day 0..23
+ * @param mins minutes 0..59
+ * @param secs seconds 0..59
+ * @return the milliseconds since 1970-01-01 00:00:00
+ */
+ static long time2millis(int year, int mon, int day, int hours, int mins, int secs) {
+ if (0 >= (mon -= 2)) { /* 1..12 -> 11,12,1..10 */
+ mon += 12; /* Puts Feb last since it has leap day */
+ year -= 1;
+ }
+
+ return ((((
+ ((long) (year / 4 - year / 100 + year / 400 + 367 * mon / 12 + day) + year * 365 - 719499)) /* days */
+ * 24l + hours) /* hours */
+ * 60l + mins) /* minutes */
+ * 60l + secs) /* seconds */
+ * 1000l; /* milliseconds */
+ }
}
Modified: trunk/core/src/test/org/jnode/test/CMOSTest.java
===================================================================
--- trunk/core/src/test/org/jnode/test/CMOSTest.java 2007-10-06 20:17:35 UTC (rev 3536)
+++ trunk/core/src/test/org/jnode/test/CMOSTest.java 2007-10-06 20:26:18 UTC (rev 3537)
@@ -37,7 +37,7 @@
public static void main(String[] args)
throws ResourceNotFreeException, NamingException {
- CMOSService cmos = (CMOSService)InitialNaming.lookup(CMOSService.NAME);
+ CMOSService cmos = InitialNaming.lookup(CMOSService.NAME);
RTC rtc = new RTC(cmos);
for (int i = 0; i < 10; i++) {
@@ -45,7 +45,7 @@
}
System.out.println("time=" + rtc.getHours() + ":" + rtc.getMinutes() + ":" + rtc.getSeconds());
- System.out.println("date=" + rtc.getDate() + "-" + rtc.getMonth() + "-" + rtc.getYear());
+ System.out.println("date=" + rtc.getDay() + "-" + rtc.getMonth() + "-" + rtc.getYear());
int fp = cmos.getRegister(0x10);
System.out.println("floppy A: " + ((fp >> 4) & 0x0f));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-11-03 18:17:02
|
Revision: 3579
http://jnode.svn.sourceforge.net/jnode/?rev=3579&view=rev
Author: lsantha
Date: 2007-11-03 11:16:58 -0700 (Sat, 03 Nov 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/io/BufferedInputStream.java
trunk/core/src/openjdk/java/java/io/BufferedOutputStream.java
trunk/core/src/openjdk/java/java/io/BufferedReader.java
trunk/core/src/openjdk/java/java/io/BufferedWriter.java
trunk/core/src/openjdk/java/java/io/ByteArrayInputStream.java
trunk/core/src/openjdk/java/java/io/ByteArrayOutputStream.java
trunk/core/src/openjdk/java/java/io/CharArrayReader.java
trunk/core/src/openjdk/java/java/io/CharArrayWriter.java
trunk/core/src/openjdk/java/java/io/DataInputStream.java
trunk/core/src/openjdk/java/java/io/DataOutputStream.java
trunk/core/src/openjdk/java/java/io/FileReader.java
trunk/core/src/openjdk/java/java/io/FileWriter.java
trunk/core/src/openjdk/java/java/io/FilterInputStream.java
trunk/core/src/openjdk/java/java/io/FilterOutputStream.java
trunk/core/src/openjdk/java/java/io/FilterReader.java
trunk/core/src/openjdk/java/java/io/FilterWriter.java
trunk/core/src/openjdk/java/java/io/InputStream.java
trunk/core/src/openjdk/java/java/io/InputStreamReader.java
trunk/core/src/openjdk/java/java/io/LineNumberInputStream.java
trunk/core/src/openjdk/java/java/io/LineNumberReader.java
trunk/core/src/openjdk/java/java/io/OutputStream.java
trunk/core/src/openjdk/java/java/io/OutputStreamWriter.java
trunk/core/src/openjdk/java/java/io/PipedInputStream.java
trunk/core/src/openjdk/java/java/io/PipedOutputStream.java
trunk/core/src/openjdk/java/java/io/PipedReader.java
trunk/core/src/openjdk/java/java/io/PipedWriter.java
trunk/core/src/openjdk/java/java/io/PrintWriter.java
trunk/core/src/openjdk/java/java/io/PushbackInputStream.java
trunk/core/src/openjdk/java/java/io/PushbackReader.java
trunk/core/src/openjdk/java/java/io/Reader.java
trunk/core/src/openjdk/java/java/io/SequenceInputStream.java
trunk/core/src/openjdk/java/java/io/StringBufferInputStream.java
trunk/core/src/openjdk/java/java/io/StringReader.java
trunk/core/src/openjdk/java/java/io/StringWriter.java
trunk/core/src/openjdk/java/java/io/Writer.java
Removed Paths:
-------------
trunk/core/src/classpath/java/java/io/BufferedInputStream.java
trunk/core/src/classpath/java/java/io/BufferedOutputStream.java
trunk/core/src/classpath/java/java/io/BufferedReader.java
trunk/core/src/classpath/java/java/io/BufferedWriter.java
trunk/core/src/classpath/java/java/io/ByteArrayInputStream.java
trunk/core/src/classpath/java/java/io/ByteArrayOutputStream.java
trunk/core/src/classpath/java/java/io/CharArrayReader.java
trunk/core/src/classpath/java/java/io/CharArrayWriter.java
trunk/core/src/classpath/java/java/io/DataInputStream.java
trunk/core/src/classpath/java/java/io/DataOutputStream.java
trunk/core/src/classpath/java/java/io/DeleteFileHelper.java
trunk/core/src/classpath/java/java/io/FileReader.java
trunk/core/src/classpath/java/java/io/FileWriter.java
trunk/core/src/classpath/java/java/io/FilterInputStream.java
trunk/core/src/classpath/java/java/io/FilterOutputStream.java
trunk/core/src/classpath/java/java/io/FilterReader.java
trunk/core/src/classpath/java/java/io/FilterWriter.java
trunk/core/src/classpath/java/java/io/InputStream.java
trunk/core/src/classpath/java/java/io/InputStreamReader.java
trunk/core/src/classpath/java/java/io/LineNumberInputStream.java
trunk/core/src/classpath/java/java/io/LineNumberReader.java
trunk/core/src/classpath/java/java/io/OutputStream.java
trunk/core/src/classpath/java/java/io/OutputStreamWriter.java
trunk/core/src/classpath/java/java/io/PipedInputStream.java
trunk/core/src/classpath/java/java/io/PipedOutputStream.java
trunk/core/src/classpath/java/java/io/PipedReader.java
trunk/core/src/classpath/java/java/io/PipedWriter.java
trunk/core/src/classpath/java/java/io/PrintWriter.java
trunk/core/src/classpath/java/java/io/PushbackInputStream.java
trunk/core/src/classpath/java/java/io/PushbackReader.java
trunk/core/src/classpath/java/java/io/Reader.java
trunk/core/src/classpath/java/java/io/SequenceInputStream.java
trunk/core/src/classpath/java/java/io/StringBufferInputStream.java
trunk/core/src/classpath/java/java/io/StringReader.java
trunk/core/src/classpath/java/java/io/StringWriter.java
trunk/core/src/classpath/java/java/io/Writer.java
trunk/core/src/classpath/java/java/io/class-dependencies.conf
Deleted: trunk/core/src/classpath/java/java/io/BufferedInputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedInputStream.java 2007-11-03 18:08:09 UTC (rev 3578)
+++ trunk/core/src/classpath/java/java/io/BufferedInputStream.java 2007-11-03 18:16:58 UTC (rev 3579)
@@ -1,379 +0,0 @@
-/* BufferedInputStream.java -- An input stream that implements buffering
- Copyright (C) 1998, 1999, 2001, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
- * "The Java Language Specification", ISBN 0-201-63451-1
- * plus online API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This subclass of <code>FilterInputStream</code> buffers input from an
- * underlying implementation to provide a possibly more efficient read
- * mechanism. It maintains the buffer and buffer state in instance
- * variables that are available to subclasses. The default buffer size
- * of 2048 bytes can be overridden by the creator of the stream.
- * <p>
- * This class also implements mark/reset functionality. It is capable
- * of remembering any number of input bytes, to the limits of
- * system memory or the size of <code>Integer.MAX_VALUE</code>
- * <p>
- * Please note that this class does not properly handle character
- * encodings. Consider using the <code>BufferedReader</code> class which
- * does.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Warren Levy (wa...@cy...)
- * @author Jeroen Frijters (je...@fr...)
- */
-public class BufferedInputStream extends FilterInputStream
-{
-
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 2048;
-
- /**
- * The buffer used for storing data from the underlying stream.
- */
- protected byte[] buf;
-
- /**
- * The number of valid bytes currently in the buffer. It is also the index
- * of the buffer position one byte past the end of the valid data.
- */
- protected int count;
-
- /**
- * The index of the next character that will by read from the buffer.
- * When <code>pos == count</code>, the buffer is empty.
- */
- protected int pos;
-
- /**
- * The value of <code>pos</code> when the <code>mark()</code> method was
- * called.
- * This is set to -1 if there is no mark set.
- */
- protected int markpos = -1;
-
- /**
- * This is the maximum number of bytes than can be read after a
- * call to <code>mark()</code> before the mark can be discarded.
- * After this may bytes are read, the <code>reset()</code> method
- * may not be called successfully.
- */
- protected int marklimit;
-
- /**
- * This is the initial buffer size. When the buffer is grown because
- * of marking requirements, it will be grown by bufferSize increments.
- * The underlying stream will be read in chunks of bufferSize.
- */
- private final int bufferSize;
-
- /**
- * This method initializes a new <code>BufferedInputStream</code> that will
- * read from the specified subordinate stream with a default buffer size
- * of 2048 bytes
- *
- * @param in The subordinate stream to read from
- */
- public BufferedInputStream(InputStream in)
- {
- this(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new <code>BufferedInputStream</code> that will
- * read from the specified subordinate stream with a buffer size that
- * is specified by the caller.
- *
- * @param in The subordinate stream to read from
- * @param size The buffer size to use
- *
- * @exception IllegalArgumentException when size is smaller then 1
- */
- public BufferedInputStream(InputStream in, int size)
- {
- super(in);
- if (size <= 0)
- throw new IllegalArgumentException();
- buf = new byte[size];
- // initialize pos & count to bufferSize, to prevent refill from
- // allocating a new buffer (if the caller starts out by calling mark()).
- pos = count = bufferSize = size;
- }
-
- /**
- * This method returns the number of bytes that can be read from this
- * stream before a read can block. A return of 0 indicates that blocking
- * might (or might not) occur on the very next read attempt.
- * <p>
- * The number of available bytes will be the number of read ahead bytes
- * stored in the internal buffer plus the number of available bytes in
- * the underlying stream.
- *
- * @return The number of bytes that can be read before blocking could occur
- *
- * @exception IOException If an error occurs
- */
- public synchronized int available() throws IOException
- {
- return count - pos + super.available();
- }
-
- /**
- * This method closes the underlying input stream and frees any
- * resources associated with it. Sets <code>buf</code> to <code>null</code>.
- *
- * @exception IOException If an error occurs.
- */
- public void close() throws IOException
- {
- // Free up the array memory.
- buf = null;
- pos = count = 0;
- markpos = -1;
- super.close();
- }
-
- /**
- * This method marks a position in the input to which the stream can be
- * "reset" by calling the <code>reset()</code> method. The parameter
- * <code>readlimit</code> is the number of bytes that can be read from the
- * stream after setting the mark before the mark becomes invalid. For
- * example, if <code>mark()</code> is called with a read limit of 10, then
- * when 11 bytes of data are read from the stream before the
- * <code>reset()</code> method is called, then the mark is invalid and the
- * stream object instance is not required to remember the mark.
- * <p>
- * Note that the number of bytes that can be remembered by this method
- * can be greater than the size of the internal read buffer. It is also
- * not dependent on the subordinate stream supporting mark/reset
- * functionality.
- *
- * @param readlimit The number of bytes that can be read before the mark
- * becomes invalid
- */
- public synchronized void mark(int readlimit)
- {
- marklimit = readlimit;
- markpos = pos;
- }
-
- /**
- * This method returns <code>true</code> to indicate that this class
- * supports mark/reset functionality.
- *
- * @return <code>true</code> to indicate that mark/reset functionality is
- * supported
- *
- */
- public boolean markSupported()
- {
- return true;
- }
-
- /**
- * This method reads an unsigned byte from the input stream and returns it
- * as an int in the range of 0-255. This method also will return -1 if
- * the end of the stream has been reached.
- * <p>
- * This method will block until the byte can be read.
- *
- * @return The byte read or -1 if end of stream
- *
- * @exception IOException If an error occurs
- */
- public synchronized int read() throws IOException
- {
- if (pos >= count && !refill())
- return -1; // EOF
-
- return buf[pos++] & 0xFF;
- }
-
- /**
- * This method reads bytes from a stream and stores them into a caller
- * supplied buffer. It starts storing the data at index <code>off</code>
- * into the buffer and attempts to read <code>len</code> bytes. This method
- * can return before reading the number of bytes requested, but it will try
- * to read the requested number of bytes by repeatedly calling the underlying
- * stream as long as available() for this stream continues to return a
- * non-zero value (or until the requested number of bytes have been read).
- * The actual number of bytes read is returned as an int. A -1 is returned
- * to indicate the end of the stream.
- * <p>
- * This method will block until some data can be read.
- *
- * @param b The array into which the bytes read should be stored
- * @param off The offset into the array to start storing bytes
- * @param len The requested number of bytes to read
- *
- * @return The actual number of bytes read, or -1 if end of stream.
- *
- * @exception IOException If an error occurs.
- * @exception IndexOutOfBoundsException when <code>off</code> or
- * <code>len</code> are negative, or when <code>off + len</code>
- * is larger then the size of <code>b</code>,
- */
- public synchronized int read(byte[] b, int off, int len) throws IOException
- {
- if (off < 0 || len < 0 || b.length - off < len)
- throw new IndexOutOfBoundsException();
-
- if (len == 0)
- return 0;
-
- if (pos >= count && !refill())
- return -1; // No bytes were read before EOF.
-
- int totalBytesRead = Math.min(count - pos, len);
- System.arraycopy(buf, pos, b, off, totalBytesRead);
- pos += totalBytesRead;
- off += totalBytesRead;
- len -= totalBytesRead;
-
- while (len > 0 && super.available() > 0 && refill())
- {
- int remain = Math.min(count - pos, len);
- System.arraycopy(buf, pos, b, off, remain);
- pos += remain;
- off += remain;
- len -= remain;
- totalBytesRead += remain;
- }
-
- return totalBytesRead;
- }
-
- /**
- * This method resets a stream to the point where the <code>mark()</code>
- * method was called. Any bytes that were read after the mark point was
- * set will be re-read during subsequent reads.
- * <p>
- * This method will throw an IOException if the number of bytes read from
- * the stream since the call to <code>mark()</code> exceeds the mark limit
- * passed when establishing the mark.
- *
- * @exception IOException If <code>mark()</code> was never called or more
- * then <code>marklimit</code> bytes were read since the last
- * call to <code>mark()</code>
- */
- public synchronized void reset() throws IOException
- {
- if (markpos == -1)
- throw new IOException(buf == null ? "Stream closed." : "Invalid mark.");
-
- pos = markpos;
- }
-
- /**
- * This method skips the specified number of bytes in the stream. It
- * returns the actual number of bytes skipped, which may be less than the
- * requested amount.
- *
- * @param n The requested number of bytes to skip
- *
- * @return The actual number of bytes skipped.
- *
- * @exception IOException If an error occurs
- */
- public synchronized long skip(long n) throws IOException
- {
- if (buf == null)
- throw new IOException("Stream closed.");
-
- final long origN = n;
-
- while (n > 0L)
- {
- if (pos >= count && !refill())
- break;
-
- int numread = (int) Math.min((long) (count - pos), n);
- pos += numread;
- n -= numread;
- }
-
- return origN - n;
- }
-
- /**
- * Called to refill the buffer (when count is equal to pos).
- *
- * @return <code>true</code> when at least one additional byte was read
- * into <code>buf</code>, <code>false</code> otherwise (at EOF).
- */
- private boolean refill() throws IOException
- {
- if (buf == null)
- throw new IOException("Stream closed.");
-
- if (markpos == -1 || count - markpos >= marklimit)
- {
- markpos = -1;
- pos = count = 0;
- }
- else
- {
- byte[] newbuf = buf;
- if (markpos < bufferSize)
- {
- newbuf = new byte[count - markpos + bufferSize];
- }
- System.arraycopy(buf, markpos, newbuf, 0, count - markpos);
- buf = newbuf;
- count -= markpos;
- pos -= markpos;
- markpos = 0;
- }
-
- int numread = super.read(buf, count, bufferSize);
-
- if (numread <= 0) // EOF
- return false;
-
- count += numread;
- return true;
- }
-}
Deleted: trunk/core/src/classpath/java/java/io/BufferedOutputStream.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedOutputStream.java 2007-11-03 18:08:09 UTC (rev 3578)
+++ trunk/core/src/classpath/java/java/io/BufferedOutputStream.java 2007-11-03 18:16:58 UTC (rev 3579)
@@ -1,192 +0,0 @@
-/* BufferedOutputStream.java -- Buffer output into large blocks before writing
- Copyright (C) 1998, 2000, 2003 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/**
- * This class accumulates bytes written in a buffer instead of immediately
- * writing the data to the underlying output sink. The bytes are instead
- * as one large block when the buffer is filled, or when the stream is
- * closed or explicitly flushed. This mode operation can provide a more
- * efficient mechanism for writing versus doing numerous small unbuffered
- * writes.
- *
- * @author Aaron M. Renn (ar...@ur...)
- */
-public class BufferedOutputStream extends FilterOutputStream
-{
- /**
- * This is the default buffer size
- */
- private static final int DEFAULT_BUFFER_SIZE = 512;
-
- /**
- * This is the internal byte array used for buffering output before
- * writing it.
- */
- protected byte[] buf;
-
- /**
- * This is the number of bytes that are currently in the buffer and
- * are waiting to be written to the underlying stream. It always points to
- * the index into the buffer where the next byte of data will be stored
- */
- protected int count;
-
- /**
- * This method initializes a new <code>BufferedOutputStream</code> instance
- * that will write to the specified subordinate <code>OutputStream</code>
- * and which will use a default buffer size of 512 bytes.
- *
- * @param out The underlying <code>OutputStream</code> to write data to
- */
- public BufferedOutputStream(OutputStream out)
- {
- this(out, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * This method initializes a new <code>BufferedOutputStream</code> instance
- * that will write to the specified subordinate <code>OutputStream</code>
- * and which will use the specified buffer size
- *
- * @param out The underlying <code>OutputStream</code> to write data to
- * @param size The size of the internal buffer
- */
- public BufferedOutputStream(OutputStream out, int size)
- {
- super(out);
-
- buf = new byte[size];
- }
-
- /**
- * This method causes any currently buffered bytes to be immediately
- * written to the underlying output stream.
- *
- * @exception IOException If an error occurs
- */
- public synchronized void flush() throws IOException
- {
- if (count == 0)
- return;
-
- out.write(buf, 0, count);
- count = 0;
- out.flush();
- }
-
- /**
- * This method flushes any remaining buffered bytes then closes the
- * underlying output stream. Any further attempts to write to this stream
- * may throw an exception
- *
- public synchronized void close() throws IOException
- {
- flush();
- out.close();
- }
- */
-
- /**
- * This method runs when the object is garbage collected. It is
- * responsible for ensuring that all buffered bytes are written and
- * for closing the underlying stream.
- *
- * @exception IOException If an error occurs (ignored by the Java runtime)
- *
- protected void finalize() throws IOException
- {
- close();
- }
- */
-
- /**
- * This method writes a single byte of data. This will be written to the
- * buffer instead of the underlying data source. However, if the buffer
- * is filled as a result of this write request, it will be flushed to the
- * underlying output stream.
- *
- * @param b The byte of data to be written, passed as an int
- *
- * @exception IOException If an error occurs
- */
- public synchronized void write(int b) throws IOException
- {
- if (count == buf.length)
- flush();
-
- buf[count] = (byte)(b & 0xFF);
- ++count;
- }
-
- /**
- * This method writes <code>len</code> bytes from the byte array
- * <code>buf</code> starting at position <code>offset</code> in the buffer.
- * These bytes will be written to the internal buffer. However, if this
- * write operation fills the buffer, the buffer will be flushed to the
- * underlying output stream.
- *
- * @param buf The array of bytes to write.
- * @param offset The index into the byte array to start writing from.
- * @param len The number of bytes to write.
- *
- * @exception IOException If an error occurs
- */
- public synchronized void write(byte[] buf, int offset, int len)
- throws IOException
- {
- // Buffer can hold everything. Note that the case where LEN < 0
- // is automatically handled by the downstream write.
- if (len < (this.buf.length - count))
- {
- System.arraycopy(buf, offset, this.buf, count, len);
- count += len;
- }
- else
- {
- // The write was too big. So flush the buffer and write the new
- // bytes directly to the underlying stream, per the JDK 1.2
- // docs.
- flush();
- out.write (buf, offset, len);
- }
- }
-
-} // class BufferedOutputStream
-
Deleted: trunk/core/src/classpath/java/java/io/BufferedReader.java
===================================================================
--- trunk/core/src/classpath/java/java/io/BufferedReader.java 2007-11-03 18:08:09 UTC (rev 3578)
+++ trunk/core/src/classpath/java/java/io/BufferedReader.java 2007-11-03 18:16:58 UTC (rev 3579)
@@ -1,581 +0,0 @@
-/* BufferedReader.java
- Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
- Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.io;
-
-/* Written using "Java Class Libraries", 2nd edition, plus online
- * API docs for JDK 1.2 beta from http://www.javasoft.com.
- * Status: Believed complete and correct.
- */
-
-/**
- * This subclass of <code>FilterReader</code> buffers input from an
- * underlying implementation to provide a possibly more efficient read
- * mechanism. It maintains the buffer and buffer state in instance
- * variables that are available to subclasses. The default buffer size
- * of 8192 chars can be overridden by the creator of the stream.
- * <p>
- * This class also implements mark/reset functionality. It is capable
- * of remembering any number of input chars, to the limits of
- * system memory or the size of <code>Integer.MAX_VALUE</code>
- *
- * @author Per Bothner (bo...@cy...)
- * @author Aaron M. Renn (ar...@ur...)
- */
-public class BufferedReader extends Reader
-{
- Reader in;
- char[] buffer;
- /* Index of current read position. Must be >= 0 and <= limit. */
- /* There is a special case where pos may be equal to limit+1; this
- * is used as an indicator that a readLine was done with a '\r' was
- * the very last char in the buffer. Since we don't want to read-ahead
- * and potentially block, we set pos this way to indicate the situation
- * and deal with it later. Doing it this way rather than having a
- * separate boolean field to indicate the condition has the advantage
- * that it is self-clearing on things like mark/reset.
- */
- int pos;
- /* Limit of valid data in buffer. Must be >= pos and <= buffer.length. */
- /* This can be < pos in the one special case described above. */
- int limit;
-
- /* The value -1 means there is no mark, or the mark has been invalidated.
- Otherwise, markPos is the index in the buffer of the marked position.
- Must be >= 0 and <= pos.
- Note we do not explicitly store the read-limit.
- The implicit read-limit is (buffer.length - markPos), which is
- guaranteed to be >= the read-limit requested in the call to mark. */
- int markPos = -1;
-
- // The JCL book specifies the default buffer size as 8K characters.
- // This is package-private because it is used by LineNumberReader.
- static final int DEFAULT_BUFFER_SIZE = 8192;
-
- /**
- * The line buffer for <code>readLine</code>.
- */
- private StringBuffer sbuf = null;
-
- /**
- * Create a new <code>BufferedReader</code> that will read from the
- * specified subordinate stream with a default buffer size of 8192 chars.
- *
- * @param in The subordinate stream to read from
- */
- public BufferedReader(Reader in)
- {
- this(in, DEFAULT_BUFFER_SIZE);
- }
-
- /**
- * Create a new <code>BufferedReader</code> that will read from the
- * specified subordinate stream with a buffer size that is specified by the
- * caller.
- *
- * @param in The subordinate stream to read from
- * @param size The buffer size to use
- *
- * @exception IllegalArgumentException if size <= 0
- */
- public BufferedReader(Reader in, int size)
- {
- super(in.lock);
- if (size <= 0)
- throw new IllegalArgumentException("Illegal buffer size: " + size);
- this.i...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-17 19:36:22
|
Revision: 3591
http://jnode.svn.sourceforge.net/jnode/?rev=3591&view=rev
Author: lsantha
Date: 2007-11-17 11:36:16 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/acl/
trunk/core/src/openjdk/java/java/security/acl/Acl.java
trunk/core/src/openjdk/java/java/security/acl/AclEntry.java
trunk/core/src/openjdk/java/java/security/acl/AclNotFoundException.java
trunk/core/src/openjdk/java/java/security/acl/Group.java
trunk/core/src/openjdk/java/java/security/acl/LastOwnerException.java
trunk/core/src/openjdk/java/java/security/acl/NotOwnerException.java
trunk/core/src/openjdk/java/java/security/acl/Owner.java
trunk/core/src/openjdk/java/java/security/acl/Permission.java
trunk/core/src/openjdk/java/java/security/acl/package.html
Removed Paths:
-------------
trunk/core/src/classpath/java/java/security/acl/
Added: trunk/core/src/openjdk/java/java/security/acl/Acl.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/Acl.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/Acl.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,258 @@
+/*
+ * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * Interface representing an Access Control List (ACL). An Access
+ * Control List is a data structure used to guard access to
+ * resources.<p>
+ *
+ * An ACL can be thought of as a data structure with multiple ACL
+ * entries. Each ACL entry, of interface type AclEntry, contains a
+ * set of permissions associated with a particular principal. (A
+ * principal represents an entity such as an individual user or a
+ * group). Additionally, each ACL entry is specified as being either
+ * positive or negative. If positive, the permissions are to be
+ * granted to the associated principal. If negative, the permissions
+ * are to be denied.<p>
+ *
+ * The ACL Entries in each ACL observe the following rules:<p>
+ *
+ * <ul> <li>Each principal can have at most one positive ACL entry and
+ * one negative entry; that is, multiple positive or negative ACL
+ * entries are not allowed for any principal. Each entry specifies
+ * the set of permissions that are to be granted (if positive) or
+ * denied (if negative). <p>
+ *
+ * <li>If there is no entry for a particular principal, then the
+ * principal is considered to have a null (empty) permission set.<p>
+ *
+ * <li>If there is a positive entry that grants a principal a
+ * particular permission, and a negative entry that denies the
+ * principal the same permission, the result is as though the
+ * permission was never granted or denied. <p>
+ *
+ * <li>Individual permissions always override permissions of the
+ * group(s) to which the individual belongs. That is, individual
+ * negative permissions (specific denial of permissions) override the
+ * groups' positive permissions. And individual positive permissions
+ * override the groups' negative permissions.<p>
+ *
+ * </ul>
+ *
+ * The <code> java.security.acl </code> package provides the
+ * interfaces to the ACL and related data structures (ACL entries,
+ * groups, permissions, etc.), and the <code> sun.security.acl </code>
+ * classes provide a default implementation of the interfaces. For
+ * example, <code> java.security.acl.Acl </code> provides the
+ * interface to an ACL and the <code> sun.security.acl.AclImpl </code>
+ * class provides the default implementation of the interface.<p>
+ *
+ * The <code> java.security.acl.Acl </code> interface extends the
+ * <code> java.security.acl.Owner </code> interface. The Owner
+ * interface is used to maintain a list of owners for each ACL. Only
+ * owners are allowed to modify an ACL. For example, only an owner can
+ * call the ACL's <code>addEntry</code> method to add a new ACL entry
+ * to the ACL.
+ *
+ * @see java.security.acl.AclEntry
+ * @see java.security.acl.Owner
+ * @see java.security.acl.Acl#getPermissions
+ *
+ * @version 1.30, 07/05/05
+ * @author Satish Dharmaraj
+ */
+
+public interface Acl extends Owner {
+
+ /**
+ * Sets the name of this ACL.
+ *
+ * @param caller the principal invoking this method. It must be an
+ * owner of this ACL.
+ *
+ * @param name the name to be given to this ACL.
+ *
+ * @exception NotOwnerException if the caller principal
+ * is not an owner of this ACL.
+ *
+ * @see #getName
+ */
+ public void setName(Principal caller, String name)
+ throws NotOwnerException;
+
+ /**
+ * Returns the name of this ACL.
+ *
+ * @return the name of this ACL.
+ *
+ * @see #setName
+ */
+ public String getName();
+
+ /**
+ * Adds an ACL entry to this ACL. An entry associates a principal
+ * (e.g., an individual or a group) with a set of
+ * permissions. Each principal can have at most one positive ACL
+ * entry (specifying permissions to be granted to the principal)
+ * and one negative ACL entry (specifying permissions to be
+ * denied). If there is already an ACL entry of the same type
+ * (negative or positive) already in the ACL, false is returned.
+ *
+ * @param caller the principal invoking this method. It must be an
+ * owner of this ACL.
+ *
+ * @param entry the ACL entry to be added to this ACL.
+ *
+ * @return true on success, false if an entry of the same type
+ * (positive or negative) for the same principal is already
+ * present in this ACL.
+ *
+ * @exception NotOwnerException if the caller principal
+ * is not an owner of this ACL.
+ */
+ public boolean addEntry(Principal caller, AclEntry entry)
+ throws NotOwnerException;
+
+ /**
+ * Removes an ACL entry from this ACL.
+ *
+ * @param caller the principal invoking this method. It must be an
+ * owner of this ACL.
+ *
+ * @param entry the ACL entry to be removed from this ACL.
+ *
+ * @return true on success, false if the entry is not part of this ACL.
+ *
+ * @exception NotOwnerException if the caller principal is not
+ * an owner of this Acl.
+ */
+ public boolean removeEntry(Principal caller, AclEntry entry)
+ throws NotOwnerException;
+
+ /**
+ * Returns an enumeration for the set of allowed permissions for the
+ * specified principal (representing an entity such as an individual or
+ * a group). This set of allowed permissions is calculated as
+ * follows:<p>
+ *
+ * <ul>
+ *
+ * <li>If there is no entry in this Access Control List for the
+ * specified principal, an empty permission set is returned.<p>
+ *
+ * <li>Otherwise, the principal's group permission sets are determined.
+ * (A principal can belong to one or more groups, where a group is a
+ * group of principals, represented by the Group interface.)
+ * The group positive permission set is the union of all
+ * the positive permissions of each group that the principal belongs to.
+ * The group negative permission set is the union of all
+ * the negative permissions of each group that the principal belongs to.
+ * If there is a specific permission that occurs in both
+ * the positive permission set and the negative permission set,
+ * it is removed from both.<p>
+ *
+ * The individual positive and negative permission sets are also
+ * determined. The positive permission set contains the permissions
+ * specified in the positive ACL entry (if any) for the principal.
+ * Similarly, the negative permission set contains the permissions
+ * specified in the negative ACL entry (if any) for the principal.
+ * The individual positive (or negative) permission set is considered
+ * to be null if there is not a positive (negative) ACL entry for the
+ * principal in this ACL.<p>
+ *
+ * The set of permissions granted to the principal is then calculated
+ * using the simple rule that individual permissions always override
+ * the group permissions. That is, the principal's individual negative
+ * permission set (specific denial of permissions) overrides the group
+ * positive permission set, and the principal's individual positive
+ * permission set overrides the group negative permission set.
+ *
+ * </ul>
+ *
+ * @param user the principal whose permission set is to be returned.
+ *
+ * @return the permission set specifying the permissions the principal
+ * is allowed.
+ */
+ public Enumeration<Permission> getPermissions(Principal user);
+
+ /**
+ * Returns an enumeration of the entries in this ACL. Each element in
+ * the enumeration is of type AclEntry.
+ *
+ * @return an enumeration of the entries in this ACL.
+ */
+ public Enumeration<AclEntry> entries();
+
+ /**
+ * Checks whether or not the specified principal has the specified
+ * permission. If it does, true is returned, otherwise false is returned.
+ *
+ * More specifically, this method checks whether the passed permission
+ * is a member of the allowed permission set of the specified principal.
+ * The allowed permission set is determined by the same algorithm as is
+ * used by the <code>getPermissions</code> method.
+ *
+ * @param principal the principal, assumed to be a valid authenticated
+ * Principal.
+ *
+ * @param permission the permission to be checked for.
+ *
+ * @return true if the principal has the specified permission, false
+ * otherwise.
+ *
+ * @see #getPermissions
+ */
+ public boolean checkPermission(Principal principal, Permission permission);
+
+ /**
+ * Returns a string representation of the
+ * ACL contents.
+ *
+ * @return a string representation of the ACL contents.
+ */
+ public String toString();
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Added: trunk/core/src/openjdk/java/java/security/acl/AclEntry.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/AclEntry.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/AclEntry.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,156 @@
+/*
+ * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * This is the interface used for representing one entry in an Access
+ * Control List (ACL).<p>
+ *
+ * An ACL can be thought of as a data structure with multiple ACL entry
+ * objects. Each ACL entry object contains a set of permissions associated
+ * with a particular principal. (A principal represents an entity such as
+ * an individual user or a group). Additionally, each ACL entry is specified
+ * as being either positive or negative. If positive, the permissions are
+ * to be granted to the associated principal. If negative, the permissions
+ * are to be denied. Each principal can have at most one positive ACL entry
+ * and one negative entry; that is, multiple positive or negative ACL
+ * entries are not allowed for any principal.
+ *
+ * Note: ACL entries are by default positive. An entry becomes a
+ * negative entry only if the
+ * {@link #setNegativePermissions() setNegativePermissions}
+ * method is called on it.
+ *
+ * @see java.security.acl.Acl
+ *
+ * @author Satish Dharmaraj
+ */
+public interface AclEntry extends Cloneable {
+
+ /**
+ * Specifies the principal for which permissions are granted or denied
+ * by this ACL entry. If a principal was already set for this ACL entry,
+ * false is returned, otherwise true is returned.
+ *
+ * @param user the principal to be set for this entry.
+ *
+ * @return true if the principal is set, false if there was
+ * already a principal set for this entry.
+ *
+ * @see #getPrincipal
+ */
+ public boolean setPrincipal(Principal user);
+
+ /**
+ * Returns the principal for which permissions are granted or denied by
+ * this ACL entry. Returns null if there is no principal set for this
+ * entry yet.
+ *
+ * @return the principal associated with this entry.
+ *
+ * @see #setPrincipal
+ */
+ public Principal getPrincipal();
+
+ /**
+ * Sets this ACL entry to be a negative one. That is, the associated
+ * principal (e.g., a user or a group) will be denied the permission set
+ * specified in the entry.
+ *
+ * Note: ACL entries are by default positive. An entry becomes a
+ * negative entry only if this <code>setNegativePermissions</code>
+ * method is called on it.
+ */
+ public void setNegativePermissions();
+
+ /**
+ * Returns true if this is a negative ACL entry (one denying the
+ * associated principal the set of permissions in the entry), false
+ * otherwise.
+ *
+ * @return true if this is a negative ACL entry, false if it's not.
+ */
+ public boolean isNegative();
+
+ /**
+ * Adds the specified permission to this ACL entry. Note: An entry can
+ * have multiple permissions.
+ *
+ * @param permission the permission to be associated with
+ * the principal in this entry.
+ *
+ * @return true if the permission was added, false if the
+ * permission was already part of this entry's permission set.
+ */
+ public boolean addPermission(Permission permission);
+
+ /**
+ * Removes the specified permission from this ACL entry.
+ *
+ * @param permission the permission to be removed from this entry.
+ *
+ * @return true if the permission is removed, false if the
+ * permission was not part of this entry's permission set.
+ */
+ public boolean removePermission(Permission permission);
+
+ /**
+ * Checks if the specified permission is part of the
+ * permission set in this entry.
+ *
+ * @param permission the permission to be checked for.
+ *
+ * @return true if the permission is part of the
+ * permission set in this entry, false otherwise.
+ */
+ public boolean checkPermission(Permission permission);
+
+ /**
+ * Returns an enumeration of the permissions in this ACL entry.
+ *
+ * @return an enumeration of the permissions in this ACL entry.
+ */
+ public Enumeration<Permission> permissions();
+
+ /**
+ * Returns a string representation of the contents of this ACL entry.
+ *
+ * @return a string representation of the contents.
+ */
+ public String toString();
+
+ /**
+ * Clones this ACL entry.
+ *
+ * @return a clone of this ACL entry.
+ */
+ public Object clone();
+}
+
+
Added: trunk/core/src/openjdk/java/java/security/acl/AclNotFoundException.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/AclNotFoundException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/AclNotFoundException.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+/**
+ * This is an exception that is thrown whenever a reference is made to a
+ * non-existent ACL (Access Control List).
+ *
+ * @author Satish Dharmaraj
+ */
+public class AclNotFoundException extends Exception {
+
+ private static final long serialVersionUID = 5684295034092681791L;
+
+ /**
+ * Constructs an AclNotFoundException.
+ */
+ public AclNotFoundException() {
+ }
+
+}
Added: trunk/core/src/openjdk/java/java/security/acl/Group.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/Group.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/Group.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+import java.util.Enumeration;
+import java.security.Principal;
+
+/**
+ * This interface is used to represent a group of principals. (A principal
+ * represents an entity such as an individual user or a company). <p>
+ *
+ * Note that Group extends Principal. Thus, either a Principal or a Group can
+ * be passed as an argument to methods containing a Principal parameter. For
+ * example, you can add either a Principal or a Group to a Group object by
+ * calling the object's <code>addMember</code> method, passing it the
+ * Principal or Group.
+ *
+ * @author Satish Dharmaraj
+ */
+public interface Group extends Principal {
+
+ /**
+ * Adds the specified member to the group.
+ *
+ * @param user the principal to add to this group.
+ *
+ * @return true if the member was successfully added,
+ * false if the principal was already a member.
+ */
+ public boolean addMember(Principal user);
+
+ /**
+ * Removes the specified member from the group.
+ *
+ * @param user the principal to remove from this group.
+ *
+ * @return true if the principal was removed, or
+ * false if the principal was not a member.
+ */
+ public boolean removeMember(Principal user);
+
+ /**
+ * Returns true if the passed principal is a member of the group.
+ * This method does a recursive search, so if a principal belongs to a
+ * group which is a member of this group, true is returned.
+ *
+ * @param member the principal whose membership is to be checked.
+ *
+ * @return true if the principal is a member of this group,
+ * false otherwise.
+ */
+ public boolean isMember(Principal member);
+
+
+ /**
+ * Returns an enumeration of the members in the group.
+ * The returned objects can be instances of either Principal
+ * or Group (which is a subclass of Principal).
+ *
+ * @return an enumeration of the group members.
+ */
+ public Enumeration<? extends Principal> members();
+
+}
Added: trunk/core/src/openjdk/java/java/security/acl/LastOwnerException.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/LastOwnerException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/LastOwnerException.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+/**
+ * This is an exception that is thrown whenever an attempt is made to delete
+ * the last owner of an Access Control List.
+ *
+ * @see java.security.acl.Owner#deleteOwner
+ *
+ * @author Satish Dharmaraj
+ */
+public class LastOwnerException extends Exception {
+
+ private static final long serialVersionUID = -5141997548211140359L;
+
+ /**
+ * Constructs a LastOwnerException.
+ */
+ public LastOwnerException() {
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/acl/NotOwnerException.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/NotOwnerException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/NotOwnerException.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,44 @@
+/*
+ * Copyright 1996-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+/**
+ * This is an exception that is thrown whenever the modification of an object
+ * (such as an Access Control List) is only allowed to be done by an owner of
+ * the object, but the Principal attempting the modification is not an owner.
+ *
+ * @author Satish Dharmaraj
+ */
+public class NotOwnerException extends Exception {
+
+ private static final long serialVersionUID = -5555597911163362399L;
+
+ /**
+ * Constructs a NotOwnerException.
+ */
+ public NotOwnerException() {
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/acl/Owner.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/acl/Owner.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/acl/Owner.java 2007-11-17 19:36:16 UTC (rev 3591)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1996-1997 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.acl;
+
+import java.security.Principal;
+
+/**
+ * Interface for managing owners of Access Control Lists (ACLs) or ACL
+ * configurations. (Note that the Acl interface in the
+ * <code> java.security.acl </code> package extends this Owner
+ * interface.) The initial owner Principal should be specified as an
+ * argument to the constructor of the class implementing this interface.
+ *
+ * @see java.security.acl.Acl
+ *
+ */
+public interface Owner {
+
+ /**
+ * Adds an owner. Only owners can modify ACL contents. The caller
+ * principal must be an owner of the ACL in order to invoke this method.
+ * That is, only an owner can add another owner. The initial owner is
+ * configured at ACL construction time.
+ *
+ * @param caller the principal invoking this method. It must be an owner
+ * of the ACL.
+ *
+ * @param owner the owner that should be added to the list of owners.
+ *
+ * @return true if successful, false if owner is already an owner.
+ * @exception NotOwnerException if the caller principal is not an owner
+ * of the ACL.
+ */
+ public boolean addOwner(Principal caller, Principal owner)
+ throws NotOwnerException;
+
+ /**
+ * Deletes an owner. If this is the last owner in the ACL, an exception is
+ * raised.<p>
+ *
+ * The caller principal must be an owner of the ACL in order to invoke
+ * th...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-17 20:07:06
|
Revision: 3592
http://jnode.svn.sourceforge.net/jnode/?rev=3592&view=rev
Author: lsantha
Date: 2007-11-17 12:07:01 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/interfaces/DSAKey.java
trunk/core/src/openjdk/java/java/security/interfaces/DSAKeyPairGenerator.java
trunk/core/src/openjdk/java/java/security/interfaces/DSAParams.java
trunk/core/src/openjdk/java/java/security/interfaces/DSAPrivateKey.java
trunk/core/src/openjdk/java/java/security/interfaces/DSAPublicKey.java
trunk/core/src/openjdk/java/java/security/interfaces/RSAKey.java
trunk/core/src/openjdk/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateCrtKey.java
trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateKey.java
trunk/core/src/openjdk/java/java/security/interfaces/RSAPublicKey.java
trunk/core/src/openjdk/java/java/security/interfaces/package.html
Removed Paths:
-------------
trunk/core/src/classpath/java/java/security/interfaces/
Added: trunk/core/src/openjdk/java/java/security/interfaces/DSAKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/DSAKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/DSAKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+/**
+ * The interface to a DSA public or private key. DSA (Digital Signature
+ * Algorithm) is defined in NIST's FIPS-186.
+ *
+ * @see DSAParams
+ * @see java.security.Key
+ * @see java.security.Signature
+ *
+ * @version 1.24 07/05/05
+ * @author Benjamin Renaud
+ * @author Josh Bloch
+ */
+public interface DSAKey {
+
+ /**
+ * Returns the DSA-specific key parameters. These parameters are
+ * never secret.
+ *
+ * @return the DSA-specific key parameters.
+ *
+ * @see DSAParams
+ */
+ public DSAParams getParams();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/DSAKeyPairGenerator.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/DSAKeyPairGenerator.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/DSAKeyPairGenerator.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,115 @@
+/*
+ * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.security.*;
+
+/**
+ * An interface to an object capable of generating DSA key pairs.
+ *
+ * <p>The <code>initialize</code> methods may each be called any number
+ * of times. If no <code>initialize</code> method is called on a
+ * DSAKeyPairGenerator, the default is to generate 1024-bit keys, using
+ * precomputed p, q and g parameters and an instance of SecureRandom as
+ * the random bit source.
+ *
+ * <p>Users wishing to indicate DSA-specific parameters, and to generate a key
+ * pair suitable for use with the DSA algorithm typically
+ *
+ * <ol>
+ *
+ * <li>Get a key pair generator for the DSA algorithm by calling the
+ * KeyPairGenerator <code>getInstance</code> method with "DSA"
+ * as its argument.<p>
+ *
+ * <li>Initialize the generator by casting the result to a DSAKeyPairGenerator
+ * and calling one of the
+ * <code>initialize</code> methods from this DSAKeyPairGenerator interface.<p>
+ *
+ * <li>Generate a key pair by calling the <code>generateKeyPair</code>
+ * method from the KeyPairGenerator class.
+ *
+ * </ol>
+ *
+ * <p>Note: it is not always necessary to do do algorithm-specific
+ * initialization for a DSA key pair generator. That is, it is not always
+ * necessary to call an <code>initialize</code> method in this interface.
+ * Algorithm-independent initialization using the <code>initialize</code> method
+ * in the KeyPairGenerator
+ * interface is all that is needed when you accept defaults for algorithm-specific
+ * parameters.
+ *
+ * @see java.security.KeyPairGenerator
+ */
+public interface DSAKeyPairGenerator {
+
+ /**
+ * Initializes the key pair generator using the DSA family parameters
+ * (p,q and g) and an optional SecureRandom bit source. If a
+ * SecureRandom bit source is needed but not supplied, i.e. null, a
+ * default SecureRandom instance will be used.
+ *
+ * @param params the parameters to use to generate the keys.
+ *
+ * @param random the random bit source to use to generate key bits;
+ * can be null.
+ *
+ * @exception InvalidParameterException if the <code>params</code>
+ * value is invalid or null.
+ */
+ public void initialize(DSAParams params, SecureRandom random)
+ throws InvalidParameterException;
+
+ /**
+ * Initializes the key pair generator for a given modulus length
+ * (instead of parameters), and an optional SecureRandom bit source.
+ * If a SecureRandom bit source is needed but not supplied, i.e.
+ * null, a default SecureRandom instance will be used.
+ *
+ * <p>If <code>genParams</code> is true, this method generates new
+ * p, q and g parameters. If it is false, the method uses precomputed
+ * parameters for the modulus length requested. If there are no
+ * precomputed parameters for that modulus length, an exception will be
+ * thrown. It is guaranteed that there will always be
+ * default parameters for modulus lengths of 512 and 1024 bits.
+ *
+ * @param modlen the modulus length in bits. Valid values are any
+ * multiple of 8 between 512 and 1024, inclusive.
+ *
+ * @param random the random bit source to use to generate key bits;
+ * can be null.
+ *
+ * @param genParams whether or not to generate new parameters for
+ * the modulus length requested.
+ *
+ * @exception InvalidParameterException if <code>modlen</code> is not
+ * between 512 and 1024, or if <code>genParams</code> is false and
+ * there are no precomputed parameters for the requested modulus
+ * length.
+ */
+ public void initialize(int modlen, boolean genParams, SecureRandom random)
+ throws InvalidParameterException;
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/DSAParams.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/DSAParams.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/DSAParams.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * Interface to a DSA-specific set of key parameters, which defines a
+ * DSA <em>key family</em>. DSA (Digital Signature Algorithm) is defined
+ * in NIST's FIPS-186.
+ *
+ * @see DSAKey
+ * @see java.security.Key
+ * @see java.security.Signature
+ *
+ * @version 1.27 07/05/05
+ * @author Benjamin Renaud
+ * @author Josh Bloch
+ */
+public interface DSAParams {
+
+ /**
+ * Returns the prime, <code>p</code>.
+ *
+ * @return the prime, <code>p</code>.
+ */
+ public BigInteger getP();
+
+ /**
+ * Returns the subprime, <code>q</code>.
+ *
+ * @return the subprime, <code>q</code>.
+ */
+ public BigInteger getQ();
+
+ /**
+ * Returns the base, <code>g</code>.
+ *
+ * @return the base, <code>g</code>.
+ */
+ public BigInteger getG();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/DSAPrivateKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/DSAPrivateKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/DSAPrivateKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The standard interface to a DSA private key. DSA (Digital Signature
+ * Algorithm) is defined in NIST's FIPS-186.
+ *
+ * @see java.security.Key
+ * @see java.security.Signature
+ * @see DSAKey
+ * @see DSAPublicKey
+ *
+ * @version 1.26 07/05/05
+ * @author Benjamin Renaud
+ */
+public interface DSAPrivateKey extends DSAKey, java.security.PrivateKey {
+
+ // Declare serialVersionUID to be compatible with JDK1.1
+
+ /**
+ * The class fingerprint that is set to indicate
+ * serialization compatibility with a previous
+ * version of the class.
+ */
+ static final long serialVersionUID = 7776497482533790279L;
+
+ /**
+ * Returns the value of the private key, <code>x</code>.
+ *
+ * @return the value of the private key, <code>x</code>.
+ */
+ public BigInteger getX();
+}
+
+
Added: trunk/core/src/openjdk/java/java/security/interfaces/DSAPublicKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/DSAPublicKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/DSAPublicKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1996-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The interface to a DSA public key. DSA (Digital Signature Algorithm)
+ * is defined in NIST's FIPS-186.
+ *
+ * @see java.security.Key
+ * @see java.security.Signature
+ * @see DSAKey
+ * @see DSAPrivateKey
+ *
+ * @version 1.28 07/05/05
+ * @author Benjamin Renaud
+ */
+public interface DSAPublicKey extends DSAKey, java.security.PublicKey {
+
+ // Declare serialVersionUID to be compatible with JDK1.1
+
+ /**
+ * The class fingerprint that is set to indicate
+ * serialization compatibility with a previous
+ * version of the class.
+ */
+ static final long serialVersionUID = 1234526332779022332L;
+
+ /**
+ * Returns the value of the public key, <code>y</code>.
+ *
+ * @return the value of the public key, <code>y</code>.
+ */
+ public BigInteger getY();
+}
+
+
Added: trunk/core/src/openjdk/java/java/security/interfaces/RSAKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/RSAKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/RSAKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,50 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The interface to an RSA public or private key.
+ *
+ * @author Jan Luehe
+ * @version 1.13 05/05/07
+ *
+ * @see RSAPublicKey
+ * @see RSAPrivateKey
+ *
+ * @since 1.3
+ */
+
+public interface RSAKey {
+
+ /**
+ * Returns the modulus.
+ *
+ * @return the modulus
+ */
+ public BigInteger getModulus();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2001-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+import java.security.spec.RSAOtherPrimeInfo;
+
+/**
+ * The interface to an RSA multi-prime private key, as defined in the
+ * PKCS#1 v2.1, using the <i>Chinese Remainder Theorem</i>
+ * (CRT) information values.
+ *
+ * @author Valerie Peng
+ *
+ * @version 1.13 07/05/05
+ *
+ * @see java.security.spec.RSAPrivateKeySpec
+ * @see java.security.spec.RSAMultiPrimePrivateCrtKeySpec
+ * @see RSAPrivateKey
+ * @see RSAPrivateCrtKey
+ *
+ * @since 1.4
+ */
+
+public interface RSAMultiPrimePrivateCrtKey extends RSAPrivateKey {
+
+ static final long serialVersionUID = 618058533534628008L;
+
+ /**
+ * Returns the public exponent.
+ *
+ * @return the public exponent.
+ */
+ public BigInteger getPublicExponent();
+
+ /**
+ * Returns the primeP.
+ *
+ * @return the primeP.
+ */
+ public BigInteger getPrimeP();
+
+ /**
+ * Returns the primeQ.
+ *
+ * @return the primeQ.
+ */
+ public BigInteger getPrimeQ();
+
+ /**
+ * Returns the primeExponentP.
+ *
+ * @return the primeExponentP.
+ */
+ public BigInteger getPrimeExponentP();
+
+ /**
+ * Returns the primeExponentQ.
+ *
+ * @return the primeExponentQ.
+ */
+ public BigInteger getPrimeExponentQ();
+
+ /**
+ * Returns the crtCoefficient.
+ *
+ * @return the crtCoefficient.
+ */
+ public BigInteger getCrtCoefficient();
+
+ /**
+ * Returns the otherPrimeInfo or null if there are only
+ * two prime factors (p and q).
+ *
+ * @return the otherPrimeInfo.
+ */
+ public RSAOtherPrimeInfo[] getOtherPrimeInfo();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateCrtKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateCrtKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateCrtKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The interface to an RSA private key, as defined in the PKCS#1 standard,
+ * using the <i>Chinese Remainder Theorem</i> (CRT) information values.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.19 07/05/05
+ *
+ * @see RSAPrivateKey
+ */
+
+public interface RSAPrivateCrtKey extends RSAPrivateKey {
+
+ static final long serialVersionUID = -5682214253527700368L;
+
+ /**
+ * Returns the public exponent.
+ *
+ * @return the public exponent
+ */
+ public BigInteger getPublicExponent();
+
+ /**
+ * Returns the primeP.
+
+ * @return the primeP
+ */
+ public BigInteger getPrimeP();
+
+ /**
+ * Returns the primeQ.
+ *
+ * @return the primeQ
+ */
+ public BigInteger getPrimeQ();
+
+ /**
+ * Returns the primeExponentP.
+ *
+ * @return the primeExponentP
+ */
+ public BigInteger getPrimeExponentP();
+
+ /**
+ * Returns the primeExponentQ.
+ *
+ * @return the primeExponentQ
+ */
+ public BigInteger getPrimeExponentQ();
+
+ /**
+ * Returns the crtCoefficient.
+ *
+ * @return the crtCoefficient
+ */
+ public BigInteger getCrtCoefficient();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/RSAPrivateKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The interface to an RSA private key.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.18 07/05/05
+ *
+ * @see RSAPrivateCrtKey
+ */
+
+public interface RSAPrivateKey extends java.security.PrivateKey, RSAKey
+{
+
+ static final long serialVersionUID = 5187144804936595022L;
+
+ /**
+ * Returns the private exponent.
+ *
+ * @return the private exponent
+ */
+ public BigInteger getPrivateExponent();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/RSAPublicKey.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/RSAPublicKey.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/RSAPublicKey.java 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,48 @@
+/*
+ * Copyright 1998-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.interfaces;
+
+import java.math.BigInteger;
+
+/**
+ * The interface to an RSA public key.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.17 07/05/05
+ */
+
+public interface RSAPublicKey extends java.security.PublicKey, RSAKey
+{
+ static final long serialVersionUID = -8727434096241101194L;
+
+ /**
+ * Returns the public exponent.
+ *
+ * @return the public exponent
+ */
+ public BigInteger getPublicExponent();
+}
Added: trunk/core/src/openjdk/java/java/security/interfaces/package.html
===================================================================
--- trunk/core/src/openjdk/java/java/security/interfaces/package.html (rev 0)
+++ trunk/core/src/openjdk/java/java/security/interfaces/package.html 2007-11-17 20:07:01 UTC (rev 3592)
@@ -0,0 +1,77 @@
+<!--
+ Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Sun designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Sun in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ CA 95054 USA or visit www.sun.com if you need additional information or
+ have any questions.
+-->
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<body bgcolor="white">
+
+Provides interface...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-17 21:07:24
|
Revision: 3593
http://jnode.svn.sourceforge.net/jnode/?rev=3593&view=rev
Author: lsantha
Date: 2007-11-17 13:07:23 -0800 (Sat, 17 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/java/java/security/spec/AlgorithmParameterSpec.java
trunk/core/src/openjdk/java/java/security/spec/DSAParameterSpec.java
trunk/core/src/openjdk/java/java/security/spec/DSAPrivateKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/DSAPublicKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/EncodedKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/InvalidKeySpecException.java
trunk/core/src/openjdk/java/java/security/spec/InvalidParameterSpecException.java
trunk/core/src/openjdk/java/java/security/spec/KeySpec.java
trunk/core/src/openjdk/java/java/security/spec/MGF1ParameterSpec.java
trunk/core/src/openjdk/java/java/security/spec/PKCS8EncodedKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/PSSParameterSpec.java
trunk/core/src/openjdk/java/java/security/spec/RSAKeyGenParameterSpec.java
trunk/core/src/openjdk/java/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/RSAOtherPrimeInfo.java
trunk/core/src/openjdk/java/java/security/spec/RSAPrivateCrtKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/RSAPrivateKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/RSAPublicKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/X509EncodedKeySpec.java
trunk/core/src/openjdk/java/java/security/spec/package.html
Removed Paths:
-------------
trunk/core/src/classpath/java/java/security/spec/
Added: trunk/core/src/openjdk/java/java/security/spec/AlgorithmParameterSpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/AlgorithmParameterSpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/AlgorithmParameterSpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+/**
+ * A (transparent) specification of cryptographic parameters.
+ *
+ * <P> This interface contains no methods or constants. Its only purpose
+ * is to group (and provide type safety for) all parameter specifications.
+ * All parameter specifications must implement this interface.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.21, 05/05/07
+ *
+ * @see java.security.AlgorithmParameters
+ * @see DSAParameterSpec
+ *
+ * @since 1.2
+ */
+
+public interface AlgorithmParameterSpec { }
Added: trunk/core/src/openjdk/java/java/security/spec/DSAParameterSpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/DSAParameterSpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/DSAParameterSpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,90 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.math.BigInteger;
+
+/**
+ * This class specifies the set of parameters used with the DSA algorithm.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.23, 05/05/07
+ *
+ * @see AlgorithmParameterSpec
+ *
+ * @since 1.2
+ */
+
+public class DSAParameterSpec implements AlgorithmParameterSpec,
+java.security.interfaces.DSAParams {
+
+ BigInteger p;
+ BigInteger q;
+ BigInteger g;
+
+ /**
+ * Creates a new DSAParameterSpec with the specified parameter values.
+ *
+ * @param p the prime.
+ *
+ * @param q the sub-prime.
+ *
+ * @param g the base.
+ */
+ public DSAParameterSpec(BigInteger p, BigInteger q, BigInteger g) {
+ this.p = p;
+ this.q = q;
+ this.g = g;
+ }
+
+ /**
+ * Returns the prime <code>p</code>.
+ *
+ * @return the prime <code>p</code>.
+ */
+ public BigInteger getP() {
+ return this.p;
+ }
+
+ /**
+ * Returns the sub-prime <code>q</code>.
+ *
+ * @return the sub-prime <code>q</code>.
+ */
+ public BigInteger getQ() {
+ return this.q;
+ }
+
+ /**
+ * Returns the base <code>g</code>.
+ *
+ * @return the base <code>g</code>.
+ */
+ public BigInteger getG() {
+ return this.g;
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/DSAPrivateKeySpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/DSAPrivateKeySpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/DSAPrivateKeySpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.math.BigInteger;
+
+/**
+ * This class specifies a DSA private key with its associated parameters.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.25, 05/05/07
+ *
+ * @see java.security.Key
+ * @see java.security.KeyFactory
+ * @see KeySpec
+ * @see DSAPublicKeySpec
+ * @see PKCS8EncodedKeySpec
+ *
+ * @since 1.2
+ */
+
+public class DSAPrivateKeySpec implements KeySpec {
+
+ private BigInteger x;
+ private BigInteger p;
+ private BigInteger q;
+ private BigInteger g;
+
+ /**
+ * Creates a new DSAPrivateKeySpec with the specified parameter values.
+ *
+ * @param x the private key.
+ *
+ * @param p the prime.
+ *
+ * @param q the sub-prime.
+ *
+ * @param g the base.
+ */
+ public DSAPrivateKeySpec(BigInteger x, BigInteger p, BigInteger q,
+ BigInteger g) {
+ this.x = x;
+ this.p = p;
+ this.q = q;
+ this.g = g;
+ }
+
+ /**
+ * Returns the private key <code>x</code>.
+ *
+ * @return the private key <code>x</code>.
+ */
+ public BigInteger getX() {
+ return this.x;
+ }
+
+ /**
+ * Returns the prime <code>p</code>.
+ *
+ * @return the prime <code>p</code>.
+ */
+ public BigInteger getP() {
+ return this.p;
+ }
+
+ /**
+ * Returns the sub-prime <code>q</code>.
+ *
+ * @return the sub-prime <code>q</code>.
+ */
+ public BigInteger getQ() {
+ return this.q;
+ }
+
+ /**
+ * Returns the base <code>g</code>.
+ *
+ * @return the base <code>g</code>.
+ */
+ public BigInteger getG() {
+ return this.g;
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/DSAPublicKeySpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/DSAPublicKeySpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/DSAPublicKeySpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,107 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.math.BigInteger;
+
+/**
+ * This class specifies a DSA public key with its associated parameters.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.25, 05/05/07
+ *
+ * @see java.security.Key
+ * @see java.security.KeyFactory
+ * @see KeySpec
+ * @see DSAPrivateKeySpec
+ * @see X509EncodedKeySpec
+ *
+ * @since 1.2
+ */
+
+public class DSAPublicKeySpec implements KeySpec {
+
+ private BigInteger y;
+ private BigInteger p;
+ private BigInteger q;
+ private BigInteger g;
+
+ /**
+ * Creates a new DSAPublicKeySpec with the specified parameter values.
+ *
+ * @param y the public key.
+ *
+ * @param p the prime.
+ *
+ * @param q the sub-prime.
+ *
+ * @param g the base.
+ */
+ public DSAPublicKeySpec(BigInteger y, BigInteger p, BigInteger q,
+ BigInteger g) {
+ this.y = y;
+ this.p = p;
+ this.q = q;
+ this.g = g;
+ }
+
+ /**
+ * Returns the public key <code>y</code>.
+ *
+ * @return the public key <code>y</code>.
+ */
+ public BigInteger getY() {
+ return this.y;
+ }
+
+ /**
+ * Returns the prime <code>p</code>.
+ *
+ * @return the prime <code>p</code>.
+ */
+ public BigInteger getP() {
+ return this.p;
+ }
+
+ /**
+ * Returns the sub-prime <code>q</code>.
+ *
+ * @return the sub-prime <code>q</code>.
+ */
+ public BigInteger getQ() {
+ return this.q;
+ }
+
+ /**
+ * Returns the base <code>g</code>.
+ *
+ * @return the base <code>g</code>.
+ */
+ public BigInteger getG() {
+ return this.g;
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/EncodedKeySpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/EncodedKeySpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/EncodedKeySpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,86 @@
+/*
+ * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+/**
+ * This class represents a public or private key in encoded format.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.29, 05/05/07
+ *
+ * @see java.security.Key
+ * @see java.security.KeyFactory
+ * @see KeySpec
+ * @see X509EncodedKeySpec
+ * @see PKCS8EncodedKeySpec
+ *
+ * @since 1.2
+ */
+
+public abstract class EncodedKeySpec implements KeySpec {
+
+ private byte[] encodedKey;
+
+ /**
+ * Creates a new EncodedKeySpec with the given encoded key.
+ *
+ * @param encodedKey the encoded key. The contents of the
+ * array are copied to protect against subsequent modification.
+ * @exception NullPointerException if <code>encodedKey</code>
+ * is null.
+ */
+ public EncodedKeySpec(byte[] encodedKey) {
+ this.encodedKey = (byte[])encodedKey.clone();
+ }
+
+ /**
+ * Returns the encoded key.
+ *
+ * @return the encoded key. Returns a new array each time
+ * this method is called.
+ */
+ public byte[] getEncoded() {
+ return (byte[])this.encodedKey.clone();
+ }
+
+ /**
+ * Returns the name of the encoding format associated with this
+ * key specification.
+ *
+ * <p>If the opaque representation of a key
+ * (see {@link java.security.Key Key}) can be transformed
+ * (see {@link java.security.KeyFactory KeyFactory})
+ * into this key specification (or a subclass of it),
+ * <code>getFormat</code> called
+ * on the opaque key returns the same value as the
+ * <code>getFormat</code> method
+ * of this key specification.
+ *
+ * @return a string representation of the encoding format.
+ */
+ public abstract String getFormat();
+}
Added: trunk/core/src/openjdk/java/java/security/spec/InvalidKeySpecException.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/InvalidKeySpecException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/InvalidKeySpecException.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * This is the exception for invalid key specifications.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.23, 05/05/07
+ *
+ * @see KeySpec
+ *
+ * @since 1.2
+ */
+
+public class InvalidKeySpecException extends GeneralSecurityException {
+
+ private static final long serialVersionUID = 3546139293998810778L;
+
+ /**
+ * Constructs an InvalidKeySpecException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public InvalidKeySpecException() {
+ super();
+ }
+
+ /**
+ * Constructs an InvalidKeySpecException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param msg the detail message.
+ */
+ public InvalidKeySpecException(String msg) {
+ super(msg);
+ }
+
+ /**
+ * Creates a <code>InvalidKeySpecException</code> with the specified
+ * detail message and cause.
+ *
+ * @param message the detail message (which is saved for later retrieval
+ * by the {@link #getMessage()} method).
+ * @param cause the cause (which is saved for later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @since 1.5
+ */
+ public InvalidKeySpecException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ /**
+ * Creates a <code>InvalidKeySpecException</code> 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 later retrieval by the
+ * {@link #getCause()} method). (A <tt>null</tt> value is permitted,
+ * and indicates that the cause is nonexistent or unknown.)
+ * @since 1.5
+ */
+ public InvalidKeySpecException(Throwable cause) {
+ super(cause);
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/InvalidParameterSpecException.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/InvalidParameterSpecException.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/InvalidParameterSpecException.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.security.GeneralSecurityException;
+
+/**
+ * This is the exception for invalid parameter specifications.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.22, 05/05/07
+ *
+ * @see java.security.AlgorithmParameters
+ * @see AlgorithmParameterSpec
+ * @see DSAParameterSpec
+ *
+ * @since 1.2
+ */
+
+public class InvalidParameterSpecException extends GeneralSecurityException {
+
+ private static final long serialVersionUID = -970468769593399342L;
+
+ /**
+ * Constructs an InvalidParameterSpecException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public InvalidParameterSpecException() {
+ super();
+ }
+
+ /**
+ * Constructs an InvalidParameterSpecException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param msg the detail message.
+ */
+ public InvalidParameterSpecException(String msg) {
+ super(msg);
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/KeySpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/KeySpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/KeySpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+/**
+ * A (transparent) specification of the key material
+ * that constitutes a cryptographic key.
+ *
+ * <p>If the key is stored on a hardware device, its
+ * specification may contain information that helps identify the key on the
+ * device.
+ *
+ * <P> A key may be specified in an algorithm-specific way, or in an
+ * algorithm-independent encoding format (such as ASN.1).
+ * For example, a DSA private key may be specified by its components
+ * <code>x</code>, <code>p</code>, <code>q</code>, and <code>g</code>
+ * (see {@link DSAPrivateKeySpec}), or it may be
+ * specified using its DER encoding
+ * (see {@link PKCS8EncodedKeySpec}).
+ *
+ * <P> This interface contains no methods or constants. Its only purpose
+ * is to group (and provide type safety for) all key specifications.
+ * All key specifications must implement this interface.
+ *
+ * @author Jan Luehe
+ *
+ * @version 1.24, 05/05/07
+ *
+ * @see java.security.Key
+ * @see java.security.KeyFactory
+ * @see EncodedKeySpec
+ * @see X509EncodedKeySpec
+ * @see PKCS8EncodedKeySpec
+ * @see DSAPrivateKeySpec
+ * @see DSAPublicKeySpec
+ *
+ * @since 1.2
+ */
+
+public interface KeySpec { }
Added: trunk/core/src/openjdk/java/java/security/spec/MGF1ParameterSpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/MGF1ParameterSpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/MGF1ParameterSpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,108 @@
+/*
+ * Copyright 2003-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package java.security.spec;
+
+import java.security.spec.AlgorithmParameterSpec;
+
+/**
+ * This class specifies the set of parameters used with mask generation
+ * function MGF1 in OAEP Padding and RSA-PSS signature scheme, as
+ * defined in the
+ * <a href="http://www.ietf.org/rfc/rfc3447.txt">PKCS #1 v2.1</a>
+ * standard.
+ *
+ * <p>Its ASN.1 definition in PKCS#1 standard is described below:
+ * <pre>
+ * MGF1Parameters ::= OAEP-PSSDigestAlgorthms
+ * </pre>
+ * where
+ * <pre>
+ * OAEP-PSSDigestAlgorithms ALGORITHM-IDENTIFIER ::= {
+ * { OID id-sha1 PARAMETERS NULL }|
+ * { OID id-sha256 PARAMETERS NULL }|
+ * { OID id-sha384 PARAMETERS NULL }|
+ * { OID id-sha512 PARAMETERS NULL },
+ * ... -- Allows for future expansion --
+ * }
+ * </pre>
+ * @see PSSParameterSpec
+ * @see javax.crypto.spec.OAEPParameterSpec
+ *
+ * @author Valerie Peng
+ *
+ * @version 1.11, 05/05/07
+ * @since 1.5
+ */
+public class MGF1ParameterSpec implements AlgorithmParameterSpec {
+
+ /**
+ * The MGF1ParameterSpec which uses "SHA-1" message digest.
+ */
+ public static final MGF1ParameterSpec SHA1 =
+ new MGF1ParameterSpec("SHA-1");
+ /**
+ * The MGF1ParameterSpec which uses "SHA-256" message digest.
+ */
+ public static final MGF1ParameterSpec SHA256 =
+ new MGF1ParameterSpec("SHA-256");
+ /**
+ * The MGF1ParameterSpec which uses "SHA-384" message digest.
+ */
+ public static final MGF1ParameterSpec SHA384 =
+ new MGF1ParameterSpec("SHA-384");
+ /**
+ * The MGF1ParameterSpec which uses SHA-512 message digest.
+ */
+ public static final MGF1ParameterSpec SHA512 =
+ new MGF1ParameterSpec("SHA-512");
+
+ private String mdName;
+
+ /**
+ * Constructs a parameter set for mask generation function MGF1
+ * as defined in the PKCS #1 standard.
+ *
+ * @param mdName the algorithm name for the message digest
+ * used in this mask generation function MGF1.
+ * @exception NullPointerException if <code>mdName</code> is null.
+ */
+ public MGF1ParameterSpec(String mdName) {
+ if (mdName == null) {
+ throw new NullPointerException("digest algorithm is null");
+ }
+ this.mdName = mdName;
+ }
+
+ /**
+ * Returns the algorithm name of the message digest used by the mask
+ * generation function.
+ *
+ * @return the algorithm name of the message digest.
+ */
+ public String getDigestAlgorithm() {
+ return mdName;
+ }
+}
Added: trunk/core/src/openjdk/java/java/security/spec/PKCS8EncodedKeySpec.java
===================================================================
--- trunk/core/src/openjdk/java/java/security/spec/PKCS8EncodedKeySpec.java (rev 0)
+++ trunk/core/src/openjdk/java/java/security/spec/PKCS8EncodedKeySpec.java 2007-11-17 21:07:23 UTC (rev 3593)
@@ -0,0 +1,97 @@
+/*
+ * Copyright 1997-2005 ...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-18 10:34:29
|
Revision: 3594
http://jnode.svn.sourceforge.net/jnode/?rev=3594&view=rev
Author: lsantha
Date: 2007-11-18 02:34:24 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/security/cert/
trunk/core/src/openjdk/javax/javax/security/cert/Certificate.java
trunk/core/src/openjdk/javax/javax/security/cert/CertificateEncodingException.java
trunk/core/src/openjdk/javax/javax/security/cert/CertificateException.java
trunk/core/src/openjdk/javax/javax/security/cert/CertificateExpiredException.java
trunk/core/src/openjdk/javax/javax/security/cert/CertificateNotYetValidException.java
trunk/core/src/openjdk/javax/javax/security/cert/CertificateParsingException.java
trunk/core/src/openjdk/javax/javax/security/cert/X509Certificate.java
trunk/core/src/openjdk/javax/javax/security/cert/package.html
trunk/core/src/openjdk/javax/javax/security/sasl/AuthenticationException.java
trunk/core/src/openjdk/javax/javax/security/sasl/AuthorizeCallback.java
trunk/core/src/openjdk/javax/javax/security/sasl/RealmCallback.java
trunk/core/src/openjdk/javax/javax/security/sasl/RealmChoiceCallback.java
trunk/core/src/openjdk/javax/javax/security/sasl/SaslClient.java
trunk/core/src/openjdk/javax/javax/security/sasl/SaslClientFactory.java
trunk/core/src/openjdk/javax/javax/security/sasl/SaslException.java
trunk/core/src/openjdk/javax/javax/security/sasl/SaslServer.java
trunk/core/src/openjdk/javax/javax/security/sasl/SaslServerFactory.java
trunk/core/src/openjdk/javax/javax/security/sasl/package.html
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/security/cert/
trunk/core/src/classpath/javax/javax/security/sasl/
Added: trunk/core/src/openjdk/javax/javax/security/cert/Certificate.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/Certificate.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/Certificate.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,178 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+import java.security.PublicKey;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+import java.security.InvalidKeyException;
+import java.security.SignatureException;
+
+/**
+ * <p>Abstract class for managing a variety of identity certificates.
+ * An identity certificate is a guarantee by a principal that
+ * a public key is that of another principal. (A principal represents
+ * an entity such as an individual user, a group, or a corporation.)
+ *<p>
+ * This class is an abstraction for certificates that have different
+ * formats but important common uses. For example, different types of
+ * certificates, such as X.509 and PGP, share general certificate
+ * functionality (like encoding and verifying) and
+ * some types of information (like a public key).
+ * <p>
+ * X.509, PGP, and SDSI certificates can all be implemented by
+ * subclassing the Certificate class, even though they contain different
+ * sets of information, and they store and retrieve the information in
+ * different ways.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @since 1.4
+ * @see X509Certificate
+ *
+ * @author Hemma Prafullchandra
+ * @version 1.23
+ */
+public abstract class Certificate {
+
+ /**
+ * Compares this certificate for equality with the specified
+ * object. If the <code>other</code> object is an
+ * <code>instanceof</code> <code>Certificate</code>, then
+ * its encoded form is retrieved and compared with the
+ * encoded form of this certificate.
+ *
+ * @param other the object to test for equality with this certificate.
+ * @return true if the encoded forms of the two certificates
+ * match, false otherwise.
+ */
+ public boolean equals(Object other) {
+ if (this == other)
+ return true;
+ if (!(other instanceof Certificate))
+ return false;
+ try {
+ byte[] thisCert = this.getEncoded();
+ byte[] otherCert = ((Certificate)other).getEncoded();
+
+ if (thisCert.length != otherCert.length)
+ return false;
+ for (int i = 0; i < thisCert.length; i++)
+ if (thisCert[i] != otherCert[i])
+ return false;
+ return true;
+ } catch (CertificateException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns a hashcode value for this certificate from its
+ * encoded form.
+ *
+ * @return the hashcode value.
+ */
+ public int hashCode() {
+ int retval = 0;
+ try {
+ byte[] certData = this.getEncoded();
+ for (int i = 1; i < certData.length; i++) {
+ retval += certData[i] * i;
+ }
+ return (retval);
+ } catch (CertificateException e) {
+ return (retval);
+ }
+ }
+
+ /**
+ * Returns the encoded form of this certificate. It is
+ * assumed that each certificate type would have only a single
+ * form of encoding; for example, X.509 certificates would
+ * be encoded as ASN.1 DER.
+ *
+ * @return encoded form of this certificate
+ * @exception CertificateEncodingException on internal certificate
+ * encoding failure
+ */
+ public abstract byte[] getEncoded() throws CertificateEncodingException;
+
+ /**
+ * Verifies that this certificate was signed using the
+ * private key that corresponds to the specified public key.
+ *
+ * @param key the PublicKey used to carry out the verification.
+ *
+ * @exception NoSuchAlgorithmException on unsupported signature
+ * algorithms.
+ * @exception InvalidKeyException on incorrect key.
+ * @exception NoSuchProviderException if there's no default provider.
+ * @exception SignatureException on signature errors.
+ * @exception CertificateException on encoding errors.
+ */
+ public abstract void verify(PublicKey key)
+ throws CertificateException, NoSuchAlgorithmException,
+ InvalidKeyException, NoSuchProviderException,
+ SignatureException;
+
+ /**
+ * Verifies that this certificate was signed using the
+ * private key that corresponds to the specified public key.
+ * This method uses the signature verification engine
+ * supplied by the specified provider.
+ *
+ * @param key the PublicKey used to carry out the verification.
+ * @param sigProvider the name of the signature provider.
+ * @exception NoSuchAlgorithmException on unsupported signature algorithms.
+ * @exception InvalidKeyException on incorrect key.
+ * @exception NoSuchProviderException on incorrect provider.
+ * @exception SignatureException on signature errors.
+ * @exception CertificateException on encoding errors.
+ */
+ public abstract void verify(PublicKey key, String sigProvider)
+ throws CertificateException, NoSuchAlgorithmException,
+ InvalidKeyException, NoSuchProviderException,
+ SignatureException;
+
+ /**
+ * Returns a string representation of this certificate.
+ *
+ * @return a string representation of this certificate.
+ */
+ public abstract String toString();
+
+ /**
+ * Gets the public key from this certificate.
+ *
+ * @return the public key.
+ */
+ public abstract PublicKey getPublicKey();
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/CertificateEncodingException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/CertificateEncodingException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/CertificateEncodingException.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,64 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+/**
+ * Certificate Encoding Exception. This is thrown whenever an error
+ * occurs whilst attempting to encode a certificate.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @since 1.4
+ * @author Hemma Prafullchandra
+ * @version 1.14
+ */
+public class CertificateEncodingException extends CertificateException {
+
+ /**
+ * Constructs a CertificateEncodingException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public CertificateEncodingException() {
+ super();
+ }
+
+ /**
+ * Constructs a CertificateEncodingException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param message the detail message.
+ */
+ public CertificateEncodingException(String message) {
+ super(message);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/CertificateException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/CertificateException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/CertificateException.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+/**
+ * This exception indicates one of a variety of certificate problems.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @author Hemma Prafullchandra
+ * @version 1.36
+ * @since 1.4
+ * @see Certificate
+ */
+public class CertificateException extends Exception {
+
+ /**
+ * Constructs a certificate exception with no detail message. A detail
+ * message is a String that describes this particular exception.
+ */
+ public CertificateException() {
+ super();
+ }
+
+ /**
+ * Constructs a certificate exception with the given detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param msg the detail message.
+ */
+ public CertificateException(String msg) {
+ super(msg);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/CertificateExpiredException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/CertificateExpiredException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/CertificateExpiredException.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+/**
+ * Certificate Expired Exception. This is thrown whenever the current
+ * <code>Date</code> or the specified <code>Date</code> is after the
+ * <code>notAfter</code> date/time specified in the validity period
+ * of the certificate.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @since 1.4
+ * @author Hemma Prafullchandra
+ * @version 1.14
+ */
+public class CertificateExpiredException extends CertificateException {
+
+ /**
+ * Constructs a CertificateExpiredException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public CertificateExpiredException() {
+ super();
+ }
+
+ /**
+ * Constructs a CertificateExpiredException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param message the detail message.
+ */
+ public CertificateExpiredException(String message) {
+ super(message);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/CertificateNotYetValidException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/CertificateNotYetValidException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/CertificateNotYetValidException.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,66 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+/**
+ * Certificate is not yet valid exception. This is thrown whenever
+ * the current <code>Date</code> or the specified <code>Date</code>
+ * is before the <code>notBefore</code> date/time in the Certificate
+ * validity period.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @since 1.4
+ * @author Hemma Prafullchandra
+ * @version 1.14
+ */
+public class CertificateNotYetValidException extends CertificateException {
+
+ /**
+ * Constructs a CertificateNotYetValidException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public CertificateNotYetValidException() {
+ super();
+ }
+
+ /**
+ * Constructs a CertificateNotYetValidException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param message the detail message.
+ */
+ public CertificateNotYetValidException(String message) {
+ super(message);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/CertificateParsingException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/CertificateParsingException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/CertificateParsingException.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+/**
+ * Certificate Parsing Exception. This is thrown whenever
+ * invalid DER encoded certificate is parsed or unsupported DER features
+ * are found in the Certificate.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @since 1.4
+ * @author Hemma Prafullchandra
+ * @version 1.14
+ */
+public class CertificateParsingException extends CertificateException {
+
+ /**
+ * Constructs a CertificateParsingException with no detail message. A
+ * detail message is a String that describes this particular
+ * exception.
+ */
+ public CertificateParsingException() {
+ super();
+ }
+
+ /**
+ * Constructs a CertificateParsingException with the specified detail
+ * message. A detail message is a String that describes this
+ * particular exception.
+ *
+ * @param message the detail message.
+ */
+ public CertificateParsingException(String message) {
+ super(message);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/cert/X509Certificate.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/cert/X509Certificate.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/cert/X509Certificate.java 2007-11-18 10:34:24 UTC (rev 3594)
@@ -0,0 +1,453 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.security.cert;
+
+import java.io.InputStream;
+import java.lang.Class;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.Security;
+
+import java.math.BigInteger;
+import java.security.AccessController;
+import java.security.Principal;
+import java.security.PrivilegedAction;
+import java.security.PublicKey;
+import java.util.BitSet;
+import java.util.Date;
+
+/**
+ * Abstract class for X.509 v1 certificates. This provides a standard
+ * way to access all the version 1 attributes of an X.509 certificate.
+ * Attributes that are specific to X.509 v2 or v3 are not available
+ * through this interface. Future API evolution will provide full access to
+ * complete X.509 v3 attributes.
+ * <p>
+ * The basic X.509 format was defined by
+ * ISO/IEC and ANSI X9 and is described below in ASN.1:
+ * <pre>
+ * Certificate ::= SEQUENCE {
+ * tbsCertificate TBSCertificate,
+ * signatureAlgorithm AlgorithmIdentifier,
+ * signature BIT STRING }
+ * </pre>
+ * <p>
+ * These certificates are widely used to support authentication and
+ * other functionality in Internet security systems. Common applications
+ * include Privacy Enhanced Mail (PEM), Transport Layer Security (SSL),
+ * code signing for trusted software distribution, and Secure Electronic
+ * Transactions (SET).
+ * <p>
+ * These certificates are managed and vouched for by <em>Certificate
+ * Authorities</em> (CAs). CAs are services which create certificates by
+ * placing data in the X.509 standard format and then digitally signing
+ * that data. CAs act as trusted third parties, making introductions
+ * between principals who have no direct knowledge of each other.
+ * CA certificates are either signed by themselves, or by some other
+ * CA such as a "root" CA.
+ * <p>
+ * The ASN.1 definition of <code>tbsCertificate</code> is:
+ * <pre>
+ * TBSCertificate ::= SEQUENCE {
+ * version [0] EXPLICIT Version DEFAULT v1,
+ * serialNumber CertificateSerialNumber,
+ * signature AlgorithmIdentifier,
+ * issuer Name,
+ * validity Validity,
+ * subject Name,
+ * subjectPublicKeyInfo SubjectPublicKeyInfo,
+ * }
+ * </pre>
+ * <p>
+ * Here is sample code to instantiate an X.509 certificate:
+ * <pre>
+ * InputStream inStream = new FileInputStream("fileName-of-cert");
+ * X509Certificate cert = X509Certificate.getInstance(inStream);
+ * inStream.close();
+ * </pre>
+ * OR
+ * <pre>
+ * byte[] certData = <certificate read from a file, say>
+ * X509Certificate cert = X509Certificate.getInstance(certData);
+ * </pre>
+ * <p>
+ * In either case, the code that instantiates an X.509 certificate
+ * consults the Java security properties file to locate the actual
+ * implementation or instantiates a default implementation.
+ * <p>
+ * The Java security properties file is located in the file named
+ * <JAVA_HOME>/lib/security/java.security.
+ * <JAVA_HOME> refers to the value of the java.home system property,
+ * and specifies the directory where the JRE is installed.
+ * In the Security properties file, a default implementation
+ * for X.509 v1 may be given such as:
+ * <pre>
+ * cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl
+ * </pre>
+ * <p>
+ * The value of this <code>cert.provider.x509v1</code> property has to be
+ * changed to instatiate another implementation. If this security
+ * property is not set, a default implementation will be used.
+ * Currently, due to possible security restrictions on access to
+ * Security properties, this value is looked up and cached at class
+ * initialization time and will fallback on a default implementation if
+ * the Security property is not accessible.
+ *
+ * <p><em>Note: The classes in the package <code>javax.security.cert</code>
+ * exist for compatibility with earlier versions of the
+ * Java Secure Sockets Extension (JSSE). New applications should instead
+ * use the standard Java SE certificate classes located in
+ * <code>java.security.cert</code>.</em></p>
+ *
+ * @author Hemma Prafullchandra
+ * @version 1.38
+ * @since 1.4
+ * @see Certificate
+ * @see java.security.cert.X509Extension
+ */
+public abstract class X509Certificate extends Certificate {
+
+ /*
+ * Constant to lookup in the Security properties file.
+ * In the Security properties file the default implementation
+ * for X.509 v3 is given as:
+ * <pre>
+ * cert.provider.x509v1=com.sun.security.cert.internal.x509.X509V1CertImpl
+ * </pre>
+ */
+ private static final String X509_PROVIDER = "cert.provider.x509v1";
+ private static String X509Provider;
+
+ static {
+ X509Provider = AccessController.doPrivileged(
+ new PrivilegedAction<String>() {
+ public String run() {
+ return Security.getProperty(X509_PROVIDER);
+ }
+ }
+ );
+ }
+
+ /**
+ * Instantiates an X509Certificate object, and initializes it with
+ *...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-18 10:59:43
|
Revision: 3595
http://jnode.svn.sourceforge.net/jnode/?rev=3595&view=rev
Author: lsantha
Date: 2007-11-18 02:59:24 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/accessibility/
trunk/core/src/openjdk/javax/javax/accessibility/Accessible.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAction.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAttributeSequence.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleBundle.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleComponent.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleContext.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleEditableText.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleExtendedComponent.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleExtendedTable.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleExtendedText.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleHyperlink.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleHypertext.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleIcon.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleKeyBinding.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleRelation.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleRelationSet.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleResourceBundle.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleRole.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleSelection.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleState.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleStateSet.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleStreamable.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleTable.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleTableModelChange.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleText.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleTextSequence.java
trunk/core/src/openjdk/javax/javax/accessibility/AccessibleValue.java
trunk/core/src/openjdk/javax/javax/accessibility/package.html
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/accessibility/
Added: trunk/core/src/openjdk/javax/javax/accessibility/Accessible.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/Accessible.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/Accessible.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,51 @@
+/*
+ * Copyright 1997-1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.accessibility;
+
+/**
+ * Interface Accessible is the main interface for the accessibility package.
+ * All components that support
+ * the accessibility package must implement this interface.
+ * It contains a single method, {@link #getAccessibleContext}, which
+ * returns an instance of the class {@link AccessibleContext}.
+ *
+ * @version 1.1 11/24/97 20:34:48
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
+ */
+public interface Accessible {
+
+ /**
+ * Returns the AccessibleContext associated with this object. In most
+ * cases, the return value should not be null if the object implements
+ * interface Accessible. If a component developer creates a subclass
+ * of an object that implements Accessible, and that subclass
+ * is not Accessible, the developer should override the
+ * getAccessibleContext method to return null.
+ */
+ public AccessibleContext getAccessibleContext();
+}
Added: trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAction.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAction.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAction.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,114 @@
+/*
+ * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.accessibility;
+
+/**
+ * The AccessibleAction interface should be supported by any object
+ * that can perform one or more actions. This interface
+ * provides the standard mechanism for an assistive technology to determine
+ * what those actions are as well as tell the object to perform them.
+ * Any object that can be manipulated should support this
+ * interface. Applications can determine if an object supports the
+ * AccessibleAction interface by first obtaining its AccessibleContext (see
+ * {@link Accessible}) and then calling the {@link AccessibleContext#getAccessibleAction}
+ * method. If the return value is not null, the object supports this interface.
+ *
+ * @see Accessible
+ * @see Accessible#getAccessibleContext
+ * @see AccessibleContext
+ * @see AccessibleContext#getAccessibleAction
+ *
+ * @version 1.25 05/05/07
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
+ * @author Lynn Monsanto
+ */
+public interface AccessibleAction {
+
+ /**
+ * An action which causes a tree node to
+ * collapse if expanded and expand if collapsed.
+ * @since 1.5
+ */
+ public static final String TOGGLE_EXPAND =
+ new String ("toggle expand");
+
+ /**
+ * An action which increments a value.
+ * @since 1.5
+ */
+ public static final String INCREMENT =
+ new String ("increment");
+
+
+ /**
+ * An action which decrements a value.
+ * @since 1.5
+ */
+ public static final String DECREMENT =
+ new String ("decrement");
+
+ /**
+ * An action which causes a component to execute its default action.
+ * @since 1.6
+ */
+ public static final String CLICK = new String("click");
+
+ /**
+ * An action which causes a popup to become visible if it is hidden and
+ * hidden if it is visible.
+ * @since 1.6
+ */
+ public static final String TOGGLE_POPUP = new String("toggle popup");
+
+ /**
+ * Returns the number of accessible actions available in this object
+ * If there are more than one, the first one is considered the "default"
+ * action of the object.
+ *
+ * @return the zero-based number of Actions in this object
+ */
+ public int getAccessibleActionCount();
+
+ /**
+ * Returns a description of the specified action of the object.
+ *
+ * @param i zero-based index of the actions
+ * @return a String description of the action
+ * @see #getAccessibleActionCount
+ */
+ public String getAccessibleActionDescription(int i);
+
+ /**
+ * Performs the specified Action on the object
+ *
+ * @param i zero-based index of actions
+ * @return true if the action was performed; otherwise false.
+ * @see #getAccessibleActionCount
+ */
+ public boolean doAccessibleAction(int i);
+}
Added: trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAttributeSequence.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAttributeSequence.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/AccessibleAttributeSequence.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package javax.accessibility;
+
+import javax.swing.text.AttributeSet;
+
+
+/**
+ * <P>The AccessibleAttributeSequence provides information about
+ * a contiguous sequence of text attributes
+ *
+ * @see Accessible
+ * @see Accessible#getAccessibleContext
+ * @see AccessibleContext
+ * @see AccessibleContext#getAccessibleText
+ * @see AccessibleTextSequence
+ *
+ * @version 1.11 05/05/07
+ * @author Lynn Monsanto
+ */
+
+/**
+ * This class collects together the span of text that share the same
+ * contiguous set of attributes, along with that set of attributes. It
+ * is used by implementors of the class <code>AccessibleContext</code> in
+ * order to generate <code>ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED</code> events.
+ *
+ * @see javax.accessibility.AccessibleContext
+ * @see javax.accessibility.AccessibleContext#ACCESSIBLE_TEXT_ATTRIBUTES_CHANGED
+ */
+public class AccessibleAttributeSequence {
+ /** The start index of the text sequence */
+ public int startIndex;
+
+ /** The end index of the text sequence */
+ public int endIndex;
+
+ /** The text attributes */
+ public AttributeSet attributes;
+
+ /**
+ * Constructs an <code>AccessibleAttributeSequence</code> with the given
+ * parameters.
+ *
+ * @param start the beginning index of the span of text
+ * @param end the ending index of the span of text
+ * @param attr the <code>AttributeSet</code> shared by this text span
+ *
+ * @since 1.6
+ */
+ public AccessibleAttributeSequence(int start, int end, AttributeSet attr) {
+ startIndex = start;
+ endIndex = end;
+ attributes = attr;
+ }
+
+};
+
Added: trunk/core/src/openjdk/javax/javax/accessibility/AccessibleBundle.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/AccessibleBundle.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/AccessibleBundle.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,156 @@
+/*
+ * Copyright 1997-2002 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.accessibility;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+/**
+ * <p>Base class used to maintain a strongly typed enumeration. This is
+ * the superclass of {@link AccessibleState} and {@link AccessibleRole}.
+ * <p>The toDisplayString method allows you to obtain the localized string
+ * for a locale independent key from a predefined ResourceBundle for the
+ * keys defined in this class. This localized string is intended to be
+ * readable by humans.
+ *
+ * @see AccessibleRole
+ * @see AccessibleState
+ *
+ * @version 1.12 10/05/99
+ * @author Willie Walker
+ * @author Peter Korn
+ * @author Lynn Monsanto
+ */
+public abstract class AccessibleBundle {
+
+ private static Hashtable table = new Hashtable();
+ private final String defaultResourceBundleName
+ = "com.sun.accessibility.internal.resources.accessibility";
+
+ public AccessibleBundle() {
+ }
+
+ /**
+ * The locale independent name of the state. This is a programmatic
+ * name that is not intended to be read by humans.
+ * @see #toDisplayString
+ */
+ protected String key = null;
+
+ /**
+ * Obtains the key as a localized string.
+ * If a localized string cannot be found for the key, the
+ * locale independent key stored in the role will be returned.
+ * This method is intended to be used only by subclasses so that they
+ * can specify their own resource bundles which contain localized
+ * strings for their keys.
+ * @param resourceBundleName the name of the resource bundle to use for
+ * lookup
+ * @param locale the locale for which to obtain a localized string
+ * @return a localized String for the key.
+ */
+ protected String toDisplayString(String resourceBundleName,
+ Locale locale) {
+
+ // loads the resource bundle if necessary
+ loadResourceBundle(resourceBundleName, locale);
+
+ // returns the localized string
+ Object o = table.get(locale);
+ if (o != null && o instanceof Hashtable) {
+ Hashtable resourceTable = (Hashtable) o;
+ o = resourceTable.get(key);
+
+ if (o != null && o instanceof String) {
+ return (String)o;
+ }
+ }
+ return key;
+ }
+
+ /**
+ * Obtains the key as a localized string.
+ * If a localized string cannot be found for the key, the
+ * locale independent key stored in the role will be returned.
+ *
+ * @param locale the locale for which to obtain a localized string
+ * @return a localized String for the key.
+ */
+ public String toDisplayString(Locale locale) {
+ return toDisplayString(defaultResourceBundleName, locale);
+ }
+
+ /**
+ * Gets localized string describing the key using the default locale.
+ * @return a localized String describing the key for the default locale
+ */
+ public String toDisplayString() {
+ return toDisplayString(Locale.getDefault());
+ }
+
+ /**
+ * Gets localized string describing the key using the default locale.
+ * @return a localized String describing the key using the default locale
+ * @see #toDisplayString
+ */
+ public String toString() {
+ return toDisplayString();
+ }
+
+ /*
+ * Loads the Accessibility resource bundle if necessary.
+ */
+ private void loadResourceBundle(String resourceBundleName,
+ Locale locale) {
+ if (! table.contains(locale)) {
+
+ try {
+ Hashtable resourceTable = new Hashtable();
+
+ ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName, locale);
+
+ Enumeration iter = bundle.getKeys();
+ while(iter.hasMoreElements()) {
+ String key = (String)iter.nextElement();
+ resourceTable.put(key, bundle.getObject(key));
+ }
+
+ table.put(locale, resourceTable);
+ }
+ catch (MissingResourceException e) {
+ System.err.println("loadResourceBundle: " + e);
+ // Just return so toDisplayString() returns the
+ // non-localized key.
+ return;
+ }
+ }
+ }
+
+}
Added: trunk/core/src/openjdk/javax/javax/accessibility/AccessibleComponent.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/AccessibleComponent.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/AccessibleComponent.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,316 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.accessibility;
+
+import java.awt.*;
+import java.awt.event.*;
+
+/**
+ * The AccessibleComponent interface should be supported by any object
+ * that is rendered on the screen. This interface provides the standard
+ * mechanism for an assistive technology to determine and set the
+ * graphical representation of an object. Applications can determine
+ * if an object supports the AccessibleComponent interface by first
+ * obtaining its AccessibleContext
+ * and then calling the
+ * {@link AccessibleContext#getAccessibleComponent} method.
+ * If the return value is not null, the object supports this interface.
+ *
+ * @see Accessible
+ * @see Accessible#getAccessibleContext
+ * @see AccessibleContext
+ * @see AccessibleContext#getAccessibleComponent
+ *
+ * @version 1.7 10/05/99 14:00:28
+ * @author Peter Korn
+ * @author Hans Muller
+ * @author Willie Walker
+ */
+public interface AccessibleComponent {
+
+ /**
+ * Gets the background color of this object.
+ *
+ * @return the background color, if supported, of the object;
+ * otherwise, null
+ * @see #setBackground
+ */
+ public Color getBackground();
+
+ /**
+ * Sets the background color of this object.
+ *
+ * @param c the new Color for the background
+ * @see #setBackground
+ */
+ public void setBackground(Color c);
+
+ /**
+ * Gets the foreground color of this object.
+ *
+ * @return the foreground color, if supported, of the object;
+ * otherwise, null
+ * @see #setForeground
+ */
+ public Color getForeground();
+
+ /**
+ * Sets the foreground color of this object.
+ *
+ * @param c the new Color for the foreground
+ * @see #getForeground
+ */
+ public void setForeground(Color c);
+
+ /**
+ * Gets the Cursor of this object.
+ *
+ * @return the Cursor, if supported, of the object; otherwise, null
+ * @see #setCursor
+ */
+ public Cursor getCursor();
+
+ /**
+ * Sets the Cursor of this object.
+ *
+ * @param cursor the new Cursor for the object
+ * @see #getCursor
+ */
+ public void setCursor(Cursor cursor);
+
+ /**
+ * Gets the Font of this object.
+ *
+ * @return the Font,if supported, for the object; otherwise, null
+ * @see #setFont
+ */
+ public Font getFont();
+
+ /**
+ * Sets the Font of this object.
+ *
+ * @param f the new Font for the object
+ * @see #getFont
+ */
+ public void setFont(Font f);
+
+ /**
+ * Gets the FontMetrics of this object.
+ *
+ * @param f the Font
+ * @return the FontMetrics, if supported, the object; otherwise, null
+ * @see #getFont
+ */
+ public FontMetrics getFontMetrics(Font f);
+
+ /**
+ * Determines if the object is enabled. Objects that are enabled
+ * will also have the AccessibleState.ENABLED state set in their
+ * AccessibleStateSets.
+ *
+ * @return true if object is enabled; otherwise, false
+ * @see #setEnabled
+ * @see AccessibleContext#getAccessibleStateSet
+ * @see AccessibleState#ENABLED
+ * @see AccessibleStateSet
+ */
+ public boolean isEnabled();
+
+ /**
+ * Sets the enabled state of the object.
+ *
+ * @param b if true, enables this object; otherwise, disables it
+ * @see #isEnabled
+ */
+ public void setEnabled(boolean b);
+
+ /**
+ * Determines if the object is visible. Note: this means that the
+ * object intends to be visible; however, it may not be
+ * showing on the screen because one of the objects that this object
+ * is contained by is currently not visible. To determine if an object is
+ * showing on the screen, use isShowing().
+ * <p>Objects that are visible will also have the
+ * AccessibleState.VISIBLE state set in their AccessibleStateSets.
+ *
+ * @return true if object is visible; otherwise, false
+ * @see #setVisible
+ * @see AccessibleContext#getAccessibleStateSet
+ * @see AccessibleState#VISIBLE
+ * @see AccessibleStateSet
+ */
+ public boolean isVisible();
+
+ /**
+ * Sets the visible state of the object.
+ *
+ * @param b if true, shows this object; otherwise, hides it
+ * @see #isVisible
+ */
+ public void setVisible(boolean b);
+
+ /**
+ * Determines if the object is showing. This is determined by checking
+ * the visibility of the object and its ancestors.
+ * Note: this
+ * will return true even if the object is obscured by another (for example,
+ * it is underneath a menu that was pulled down).
+ *
+ * @return true if object is showing; otherwise, false
+ */
+ public boolean isShowing();
+
+ /**
+ * Checks whether the specified point is within this object's bounds,
+ * where the point's x and y coordinates are defined to be relative to the
+ * coordinate system of the object.
+ *
+ * @param p the Point relative to the coordinate system of the object
+ * @return true if object contains Point; otherwise false
+ * @see #getBounds
+ */
+ public boolean contains(Point p);
+
+ /**
+ * Returns the location of the object on the screen.
+ *
+ * @return the location of the object on screen; null if this object
+ * is not on the screen
+ * @see #getBounds
+ * @see #getLocation
+ */
+ public Point getLocationOnScreen();
+
+ /**
+ * Gets the location of the object relative to the parent in the form
+ * of a point specifying the object's top-left corner in the screen's
+ * coordinate space.
+ *
+ * @return An instance of Point representing the top-left corner of the
+ * object's bounds in the coordinate space of the screen; null if
+ * this object or its parent are not on the screen
+ * @see #getBounds
+ * @see #getLocationOnScreen
+ */
+ public Point getLocation();
+
+ /**
+ * Sets the location of the object relative to the parent.
+ * @param p the new position for the top-left corner
+ * @see #getLocation
+ */
+ public void setLocation(Point p);
+
+ /**
+ * Gets the bounds of this object in the form of a Rectangle object.
+ * The bounds specify this object's width, height, and location
+ * relative to its parent.
+ *
+ * @return A rectangle indicating this component's bounds; null if
+ * this object is not on the screen.
+ * @see #contains
+ */
+ public Rectangle getBounds();
+
+ /**
+ * Sets the bounds of this object in the form of a Rectangle object.
+ * The bounds specify this object's width, height, and location
+ * relative to its parent.
+ *
+ * @param r rectangle indicating this component's bounds
+ * @see #getBounds
+ */
+ public void setBounds(Rectangle r);
+
+ /**
+ * Returns the size of this object in the form of a Dimension object.
+ * The height field of the Dimension object contains this object's
+ * height, and the width field of the Dimension object contains this
+ * object's width.
+ *
+ * @return A Dimension object that indicates the size of this component;
+ * null if this object is not on the screen
+ * @see #setSize
+ */
+ public Dimension getSize();
+
+ /**
+ * Resizes this object so that it has width and height.
+ *
+ * @param d The dimension specifying the new size of the object.
+ * @see #getSize
+ */
+ public void setSize(Dimension d);
+
+ /**
+ * Returns the Accessible child, if one exists, contained at the local
+ * coordinate Point.
+ *
+ * @param p The point relative to the coordinate system of this object.
+ * @return the Accessible, if it exists, at the specified location;
+ * otherwise null
+ */
+ public Accessible getAccessibleAt(Point p);
+
+ /**
+ * Returns whether this object can accept focus or not. Objects that
+ * can accept focus will also have the AccessibleState.FOCUSABLE state
+ * set in their AccessibleStateSets.
+ *
+ * @return true if object can accept focus; otherwise false
+ * @see AccessibleContext#getAccessibleStateSet
+ * @see AccessibleState#FOCUSABLE
+ * @see AccessibleState#FOCUSED
+ * @see AccessibleStateSet
+ */
+ public boolean isFocusTraversable();
+
+ /**
+ * Requests focus for this object. If this object cannot accept focus,
+ * nothing will happen. Otherwise, the object will attempt to take
+ * focus.
+ * @see #isFocusTraversable
+ */
+ public void requestFocus();
+
+ /**
+ * Adds the specified focus listener to receive focus events from this
+ * component.
+ *
+ * @param l the focus listener
+ * @see #removeFocusListener
+ */
+ public void addFocusListener(FocusListener l);
+
+ /**
+ * Removes the specified focus listener so it no longer receives focus
+ * events from this component.
+ *
+ * @param l the focus listener
+ * @see #addFocusListener
+ */
+ public void removeFocusListener(FocusListener l);
+}
Added: trunk/core/src/openjdk/javax/javax/accessibility/AccessibleContext.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/accessibility/AccessibleContext.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/accessibility/AccessibleContext.java 2007-11-18 10:59:24 UTC (rev 3595)
@@ -0,0 +1,750 @@
+/*
+ * Copyright 1997-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 o...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-18 15:16:57
|
Revision: 3597
http://jnode.svn.sourceforge.net/jnode/?rev=3597&view=rev
Author: lsantha
Date: 2007-11-18 07:16:56 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/SocketFactory.java
trunk/core/src/openjdk/javax/javax/net/package.html
trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java
trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedListener.java
trunk/core/src/openjdk/javax/javax/net/ssl/HostnameVerifier.java
trunk/core/src/openjdk/javax/javax/net/ssl/HttpsURLConnection.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyManagerFactorySpi.java
trunk/core/src/openjdk/javax/javax/net/ssl/KeyStoreBuilderParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/ManagerFactoryParameters.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLEngine.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLEngineResult.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLHandshakeException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLKeyException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLPeerUnverifiedException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLPermission.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLProtocolException.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLServerSocket.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLServerSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSession.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionBindingEvent.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionBindingListener.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSessionContext.java
trunk/core/src/openjdk/javax/javax/net/ssl/SSLSocketFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManagerFactory.java
trunk/core/src/openjdk/javax/javax/net/ssl/TrustManagerFactorySpi.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509ExtendedKeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509KeyManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/X509TrustManager.java
trunk/core/src/openjdk/javax/javax/net/ssl/package.html
trunk/core/src/openjdk/sun/sun/net/www/protocol/https/
trunk/core/src/openjdk/sun/sun/net/www/protocol/https/DefaultHostnameVerifier.java
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/net/
Added: trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ServerSocketFactory.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,234 @@
+/*
+ * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.SocketException;
+
+/**
+ * This class creates server sockets. It may be subclassed by other
+ * factories, which create particular types of server sockets. This
+ * provides a general framework for the addition of public socket-level
+ * functionality. It is the server side analogue of a socket factory,
+ * and similarly provides a way to capture a variety of policies related
+ * to the sockets being constructed.
+ *
+ * <P> Like socket factories, server Socket factory instances have
+ * methods used to create sockets. There is also an environment
+ * specific default server socket factory; frameworks will often use
+ * their own customized factory.
+ *
+ * @since 1.4
+ * @see SocketFactory
+ *
+ * @version 1.27
+ * @author David Brownell
+ */
+public abstract class ServerSocketFactory
+{
+ //
+ // NOTE: JDK 1.1 bug in class GC, this can get collected
+ // even though it's always accessible via getDefault().
+ //
+ private static ServerSocketFactory theFactory;
+
+
+ /**
+ * Creates a server socket factory.
+ */
+ protected ServerSocketFactory() { /* NOTHING */ }
+
+ /**
+ * Returns a copy of the environment's default socket factory.
+ *
+ * @return the <code>ServerSocketFactory</code>
+ */
+ public static ServerSocketFactory getDefault()
+ {
+ synchronized (ServerSocketFactory.class) {
+ if (theFactory == null) {
+ //
+ // Different implementations of this method could
+ // work rather differently. For example, driving
+ // this from a system property, or using a different
+ // implementation than JavaSoft's.
+ //
+ theFactory = new DefaultServerSocketFactory();
+ }
+ }
+
+ return theFactory;
+ }
+
+
+ /**
+ * Returns an unbound server socket. The socket is configured with
+ * the socket options (such as accept timeout) given to this factory.
+ *
+ * @return the unbound socket
+ * @throws IOException if the socket cannot be created
+ * @see java.net.ServerSocket#bind(java.net.SocketAddress)
+ * @see java.net.ServerSocket#bind(java.net.SocketAddress, int)
+ * @see java.net.ServerSocket#ServerSocket()
+ */
+ public ServerSocket createServerSocket() throws IOException {
+ throw new SocketException("Unbound server sockets not implemented");
+ }
+
+ /**
+ * Returns a server socket bound to the specified port.
+ * The socket is configured with the socket options
+ * (such as accept timeout) given to this factory.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int)
+ */
+ public abstract ServerSocket createServerSocket(int port)
+ throws IOException;
+
+
+ /**
+ * Returns a server socket bound to the specified port, and uses the
+ * specified connection backlog. The socket is configured with
+ * the socket options (such as accept timeout) given to this factory.
+ * <P>
+ * The <code>backlog</code> argument must be a positive
+ * value greater than 0. If the value passed if equal or less
+ * than 0, then the default value will be assumed.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @param backlog how many connections are queued
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int, int)
+ */
+ public abstract ServerSocket
+ createServerSocket(int port, int backlog)
+ throws IOException;
+
+
+ /**
+ * Returns a server socket bound to the specified port,
+ * with a specified listen backlog and local IP.
+ * <P>
+ * The <code>ifAddress</code> argument can be used on a multi-homed
+ * host for a <code>ServerSocket</code> that will only accept connect
+ * requests to one of its addresses. If <code>ifAddress</code> is null,
+ * it will accept connections on all local addresses. The socket is
+ * configured with the socket options (such as accept timeout) given
+ * to this factory.
+ * <P>
+ * The <code>backlog</code> argument must be a positive
+ * value greater than 0. If the value passed if equal or less
+ * than 0, then the default value will be assumed.
+ * <P>
+ * If there is a security manager, its <code>checkListen</code>
+ * method is called with the <code>port</code> argument as its
+ * argument to ensure the operation is allowed. This could result
+ * in a SecurityException.
+ *
+ * @param port the port to listen to
+ * @param backlog how many connections are queued
+ * @param ifAddress the network interface address to use
+ * @return the <code>ServerSocket</code>
+ * @throws IOException for networking errors
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkListen</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkListen
+ * @see java.net.ServerSocket#ServerSocket(int, int, java.net.InetAddress)
+ */
+ public abstract ServerSocket
+ createServerSocket(int port, int backlog, InetAddress ifAddress)
+ throws IOException;
+}
+
+
+//
+// The default factory has NO intelligence. In fact it's not clear
+// what sort of intelligence servers need; the onus is on clients,
+// who have to know how to tunnel etc.
+//
+class DefaultServerSocketFactory extends ServerSocketFactory {
+
+ DefaultServerSocketFactory()
+ {
+ /* NOTHING */
+ }
+
+ public ServerSocket createServerSocket()
+ throws IOException
+ {
+ return new ServerSocket();
+ }
+
+ public ServerSocket createServerSocket(int port)
+ throws IOException
+ {
+ return new ServerSocket(port);
+ }
+
+ public ServerSocket createServerSocket(int port, int backlog)
+ throws IOException
+ {
+ return new ServerSocket(port, backlog);
+ }
+
+ public ServerSocket
+ createServerSocket(int port, int backlog, InetAddress ifAddress)
+ throws IOException
+ {
+ return new ServerSocket(port, backlog, ifAddress);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/SocketFactory.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/SocketFactory.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/SocketFactory.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,282 @@
+/*
+ * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+package javax.net;
+
+import java.io.IOException;
+import java.net.*;
+
+
+/**
+ * This class creates sockets. It may be subclassed by other factories,
+ * which create particular subclasses of sockets and thus provide a general
+ * framework for the addition of public socket-level functionality.
+ *
+ * <P> Socket factories are a simple way to capture a variety of policies
+ * related to the sockets being constructed, producing such sockets in
+ * a way which does not require special configuration of the code which
+ * asks for the sockets: <UL>
+ *
+ * <LI> Due to polymorphism of both factories and sockets, different
+ * kinds of sockets can be used by the same application code just
+ * by passing it different kinds of factories.
+ *
+ * <LI> Factories can themselves be customized with parameters used
+ * in socket construction. So for example, factories could be
+ * customized to return sockets with different networking timeouts
+ * or security parameters already configured.
+ *
+ * <LI> The sockets returned to the application can be subclasses
+ * of java.net.Socket, so that they can directly expose new APIs
+ * for features such as compression, security, record marking,
+ * statistics collection, or firewall tunneling.
+ *
+ * </UL>
+ *
+ * <P> Factory classes are specified by environment-specific configuration
+ * mechanisms. For example, the <em>getDefault</em> method could return
+ * a factory that was appropriate for a particular user or applet, and a
+ * framework could use a factory customized to its own purposes.
+ *
+ * @since 1.4
+ * @see ServerSocketFactory
+ *
+ * @version 1.24
+ * @author David Brownell
+ */
+public abstract class SocketFactory
+{
+ //
+ // NOTE: JDK 1.1 bug in class GC, this can get collected
+ // even though it's always accessible via getDefault().
+ //
+ private static SocketFactory theFactory;
+
+ /**
+ * Creates a <code>SocketFactory</code>.
+ */
+ protected SocketFactory() { /* NOTHING */ }
+
+
+ /**
+ * Returns a copy of the environment's default socket factory.
+ *
+ * @return the default <code>SocketFactory</code>
+ */
+ public static SocketFactory getDefault()
+ {
+ synchronized (SocketFactory.class) {
+ if (theFactory == null) {
+ //
+ // Different implementations of this method SHOULD
+ // work rather differently. For example, driving
+ // this from a system property, or using a different
+ // implementation than JavaSoft's.
+ //
+ theFactory = new DefaultSocketFactory();
+ }
+ }
+
+ return theFactory;
+ }
+
+
+ /**
+ * Creates an unconnected socket.
+ *
+ * @return the unconnected socket
+ * @throws IOException if the socket cannot be created
+ * @see java.net.Socket#connect(java.net.SocketAddress)
+ * @see java.net.Socket#connect(java.net.SocketAddress, int)
+ * @see java.net.Socket#Socket()
+ */
+ public Socket createSocket() throws IOException {
+ throw new SocketException("Unconnected sockets not implemented");
+ }
+
+
+ /**
+ * Creates a socket and connects it to the specified remote host
+ * at the specified remote port. This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host name with which to connect, or
+ * <code>null</code> for the loopback address.
+ * @param port the server port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws UnknownHostException if the host is not known
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(String, int)
+ */
+ public abstract Socket createSocket(String host, int port)
+ throws IOException, UnknownHostException;
+
+
+ /**
+ * Creates a socket and connects it to the specified remote host
+ * on the specified remote port.
+ * The socket will also be bound to the local address and port supplied.
+ * This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host name with which to connect, or
+ * <code>null</code> for the loopback address.
+ * @param port the server port
+ * @param localHost the local address the socket is bound to
+ * @param localPort the local port the socket is bound to
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws UnknownHostException if the host is not known
+ * @throws IllegalArgumentException if the port parameter or localPort
+ * parameter is outside the specified range of valid port values,
+ * which is between 0 and 65535, inclusive.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(String, int, java.net.InetAddress, int)
+ */
+ public abstract Socket
+ createSocket(String host, int port, InetAddress localHost, int localPort)
+ throws IOException, UnknownHostException;
+
+
+ /**
+ * Creates a socket and connects it to the specified port number
+ * at the specified address. This socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param host the server host
+ * @param port the server port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter is outside the
+ * specified range of valid port values, which is between 0 and
+ * 65535, inclusive.
+ * @throws NullPointerException if <code>host</code> is null.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(java.net.InetAddress, int)
+ */
+ public abstract Socket createSocket(InetAddress host, int port)
+ throws IOException;
+
+
+ /**
+ * Creates a socket and connect it to the specified remote address
+ * on the specified remote port. The socket will also be bound
+ * to the local address and port suplied. The socket is configured using
+ * the socket options established for this factory.
+ * <p>
+ * If there is a security manager, its <code>checkConnect</code>
+ * method is called with the host address and <code>port</code>
+ * as its arguments. This could result in a SecurityException.
+ *
+ * @param address the server network address
+ * @param port the server port
+ * @param localAddress the client network address
+ * @param localPort the client port
+ * @return the <code>Socket</code>
+ * @throws IOException if an I/O error occurs when creating the socket
+ * @throws SecurityException if a security manager exists and its
+ * <code>checkConnect</code> method doesn't allow the operation.
+ * @throws IllegalArgumentException if the port parameter or localPort
+ * parameter is outside the specified range of valid port values,
+ * which is between 0 and 65535, inclusive.
+ * @throws NullPointerException if <code>address</code> is null.
+ * @see SecurityManager#checkConnect
+ * @see java.net.Socket#Socket(java.net.InetAddress, int,
+ * java.net.InetAddress, int)
+ */
+ public abstract Socket
+ createSocket(InetAddress address, int port,
+ InetAddress localAddress, int localPort)
+ throws IOException;
+}
+
+
+//
+// The default factory has NO intelligence about policies like tunneling
+// out through firewalls (e.g. SOCKS V4 or V5) or in through them
+// (e.g. using SSL), or that some ports are reserved for use with SSL.
+//
+// Note that at least JDK 1.1 has a low level "plainSocketImpl" that
+// knows about SOCKS V4 tunneling, so this isn't a totally bogus default.
+//
+// ALSO: we may want to expose this class somewhere so other folk
+// can reuse it, particularly if we start to add highly useful features
+// such as ability to set connect timeouts.
+//
+class DefaultSocketFactory extends SocketFactory {
+
+ public Socket createSocket() {
+ return new Socket();
+ }
+
+ public Socket createSocket(String host, int port)
+ throws IOException, UnknownHostException
+ {
+ return new Socket(host, port);
+ }
+
+ public Socket createSocket(InetAddress address, int port)
+ throws IOException
+ {
+ return new Socket(address, port);
+ }
+
+ public Socket createSocket(String host, int port,
+ InetAddress clientAddress, int clientPort)
+ throws IOException, UnknownHostException
+ {
+ return new Socket(host, port, clientAddress, clientPort);
+ }
+
+ public Socket createSocket(InetAddress address, int port,
+ InetAddress clientAddress, int clientPort)
+ throws IOException
+ {
+ return new Socket(address, port, clientAddress, clientPort);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/net/package.html
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/package.html (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/package.html 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Sun designates this
+particular file as subject to the "Classpath" exception as provided
+by Sun in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+CA 95054 USA or visit www.sun.com if you need additional information or
+have any questions.
+-->
+
+</head>
+<body bgcolor="white">
+
+Provides classes for networking applications. These classes include
+factories for creating sockets. Using socket factories you can encapsulate
+socket creation and configuration behavior.
+<!--
+<h2>Package Specification</h2>
+
+##### FILL IN ANY SPECS NEEDED BY JAVA COMPATIBILITY KIT #####
+<ul>
+ <li><a href="">##### REFER TO ANY FRAMEMAKER SPECIFICATION HERE #####</a>
+</ul>
+
+<h2>Related Documentation</h2>
+
+For overviews, tutorials, examples, guides, and tool documentation, please see:
+<ul>
+ <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
+</ul>
+
+-->
+
+@since 1.4
+</body>
+</html>
Added: trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/CertPathTrustManagerParameters.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.net.ssl;
+
+import java.security.cert.CertPathParameters;
+
+/**
+ * A wrapper for CertPathParameters. This class is used to pass validation
+ * settings to CertPath based {@link TrustManager}s using the
+ * {@link TrustManagerFactory#init(ManagerFactoryParameters)
+ * TrustManagerFactory.init()} method.
+ *
+ * <p>Instances of this class are immutable.
+ *
+ * @see X509TrustManager
+ * @see TrustManagerFactory
+ * @see java.security.cert.CertPathParameters
+ *
+ * @since 1.5
+ * @version 1.8, 05/05/07
+ * @author Andreas Sterbenz
+ */
+public class CertPathTrustManagerParameters implements ManagerFactoryParameters {
+
+ private final CertPathParameters parameters;
+
+ /**
+ * Construct new CertPathTrustManagerParameters from the specified
+ * parameters. The parameters are cloned to protect against subsequent
+ * modification.
+ *
+ * @param parameters the CertPathParameters to be used
+ *
+ * @throws NullPointerException if parameters is null
+ */
+ public CertPathTrustManagerParameters(CertPathParameters parameters) {
+ this.parameters = (CertPathParameters)parameters.clone();
+ }
+
+ /**
+ * Return a clone of the CertPathParameters encapsulated by this class.
+ *
+ * @return a clone of the CertPathParameters encapsulated by this class.
+ */
+ public CertPathParameters getParameters() {
+ return (CertPathParameters)parameters.clone();
+ }
+
+}
Added: trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/net/ssl/HandshakeCompletedEvent.java 2007-11-18 15:16:56 UTC (rev 3597)
@@ -0,0 +1,238 @@
+/*
+ * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANT...
[truncated message content] |
|
From: <ls...@us...> - 2007-11-18 16:23:30
|
Revision: 3598
http://jnode.svn.sourceforge.net/jnode/?rev=3598&view=rev
Author: lsantha
Date: 2007-11-18 08:23:27 -0800 (Sun, 18 Nov 2007)
Log Message:
-----------
OpenJDK integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/security/auth/AuthPermission.java
trunk/core/src/openjdk/javax/javax/security/auth/DestroyFailedException.java
trunk/core/src/openjdk/javax/javax/security/auth/Destroyable.java
trunk/core/src/openjdk/javax/javax/security/auth/Policy.java
trunk/core/src/openjdk/javax/javax/security/auth/PrivateCredentialPermission.java
trunk/core/src/openjdk/javax/javax/security/auth/RefreshFailedException.java
trunk/core/src/openjdk/javax/javax/security/auth/Refreshable.java
trunk/core/src/openjdk/javax/javax/security/auth/Subject.java
trunk/core/src/openjdk/javax/javax/security/auth/SubjectDomainCombiner.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/
trunk/core/src/openjdk/javax/javax/security/auth/callback/Callback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/CallbackHandler.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/ChoiceCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/ConfirmationCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/LanguageCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/NameCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/PasswordCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/TextInputCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/TextOutputCallback.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/UnsupportedCallbackException.java
trunk/core/src/openjdk/javax/javax/security/auth/callback/package.html
trunk/core/src/openjdk/javax/javax/security/auth/kerberos/DelegationPermission.java
trunk/core/src/openjdk/javax/javax/security/auth/kerberos/KerberosPrincipal.java
trunk/core/src/openjdk/javax/javax/security/auth/kerberos/ServicePermission.java
trunk/core/src/openjdk/javax/javax/security/auth/kerberos/package.html
trunk/core/src/openjdk/javax/javax/security/auth/login/AccountException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/AccountExpiredException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/AccountLockedException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/AccountNotFoundException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/AppConfigurationEntry.java
trunk/core/src/openjdk/javax/javax/security/auth/login/CredentialException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/CredentialExpiredException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/CredentialNotFoundException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/FailedLoginException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/LoginException.java
trunk/core/src/openjdk/javax/javax/security/auth/login/package.html
trunk/core/src/openjdk/javax/javax/security/auth/package.html
trunk/core/src/openjdk/javax/javax/security/auth/spi/
trunk/core/src/openjdk/javax/javax/security/auth/spi/LoginModule.java
trunk/core/src/openjdk/javax/javax/security/auth/spi/package.html
trunk/core/src/openjdk/javax/javax/security/auth/x500/
trunk/core/src/openjdk/javax/javax/security/auth/x500/X500Principal.java
trunk/core/src/openjdk/javax/javax/security/auth/x500/X500PrivateCredential.java
trunk/core/src/openjdk/javax/javax/security/auth/x500/package.html
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/security/auth/
Added: trunk/core/src/openjdk/javax/javax/security/auth/AuthPermission.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/auth/AuthPermission.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/auth/AuthPermission.java 2007-11-18 16:23:27 UTC (rev 3598)
@@ -0,0 +1,173 @@
+/*
+ * Copyright 1998-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.security.auth;
+
+/**
+ * This class is for authentication permissions.
+ * An AuthPermission contains a name
+ * (also referred to as a "target name")
+ * but no actions list; you either have the named permission
+ * or you don't.
+ *
+ * <p> The target name is the name of a security configuration parameter
+ * (see below). Currently the AuthPermission object is used to
+ * guard access to the Policy, Subject, LoginContext,
+ * and Configuration objects.
+ *
+ * <p> The possible target names for an Authentication Permission are:
+ *
+ * <pre>
+ * doAs - allow the caller to invoke the
+ * <code>Subject.doAs</code> methods.
+ *
+ * doAsPrivileged - allow the caller to invoke the
+ * <code>Subject.doAsPrivileged</code> methods.
+ *
+ * getSubject - allow for the retrieval of the
+ * Subject(s) associated with the
+ * current Thread.
+ *
+ * getSubjectFromDomainCombiner - allow for the retrieval of the
+ * Subject associated with the
+ * a <code>SubjectDomainCombiner</code>.
+ *
+ * setReadOnly - allow the caller to set a Subject
+ * to be read-only.
+ *
+ * modifyPrincipals - allow the caller to modify the <code>Set</code>
+ * of Principals associated with a
+ * <code>Subject</code>
+ *
+ * modifyPublicCredentials - allow the caller to modify the
+ * <code>Set</code> of public credentials
+ * associated with a <code>Subject</code>
+ *
+ * modifyPrivateCredentials - allow the caller to modify the
+ * <code>Set</code> of private credentials
+ * associated with a <code>Subject</code>
+ *
+ * refreshCredential - allow code to invoke the <code>refresh</code>
+ * method on a credential which implements
+ * the <code>Refreshable</code> interface.
+ *
+ * destroyCredential - allow code to invoke the <code>destroy</code>
+ * method on a credential <code>object</code>
+ * which implements the <code>Destroyable</code>
+ * interface.
+ *
+ * createLoginContext.{name} - allow code to instantiate a
+ * <code>LoginContext</code> with the
+ * specified <i>name</i>. <i>name</i>
+ * is used as the index into the installed login
+ * <code>Configuration</code>
+ * (that returned by
+ * <code>Configuration.getConfiguration()</code>).
+ * <i>name</i> can be wildcarded (set to '*')
+ * to allow for any name.
+ *
+ * getLoginConfiguration - allow for the retrieval of the system-wide
+ * login Configuration.
+ *
+ * createLoginConfiguration.{type} - allow code to obtain a Configuration
+ * object via
+ * <code>Configuration.getInstance</code>.
+ *
+ * setLoginConfiguration - allow for the setting of the system-wide
+ * login Configuration.
+ *
+ * refreshLoginConfiguration - allow for the refreshing of the system-wide
+ * login Configuration.
+ * </pre>
+ *
+ * <p> The following target name has been deprecated in favor of
+ * <code>createLoginContext.{name}</code>.
+ *
+ * <pre>
+ * createLoginContext - allow code to instantiate a
+ * <code>LoginContext</code>.
+ * </pre>
+ *
+ * <p> <code>javax.security.auth.Policy</code> has been
+ * deprecated in favor of <code>java.security.Policy</code>.
+ * Therefore, the following target names have also been deprecated:
+ *
+ * <pre>
+ * getPolicy - allow the caller to retrieve the system-wide
+ * Subject-based access control policy.
+ *
+ * setPolicy - allow the caller to set the system-wide
+ * Subject-based access control policy.
+ *
+ * refreshPolicy - allow the caller to refresh the system-wide
+ * Subject-based access control policy.
+ * </pre>
+ *
+ * @version 1.61, 05/05/07
+ */
+public final class AuthPermission extends
+java.security.BasicPermission {
+
+ private static final long serialVersionUID = 5806031445061587174L;
+
+ /**
+ * Creates a new AuthPermission with the specified name.
+ * The name is the symbolic name of the AuthPermission.
+ *
+ * <p>
+ *
+ * @param name the name of the AuthPermission
+ *
+ * @throws NullPointerException if <code>name</code> is <code>null</code>.
+ * @throws IllegalArgumentException if <code>name</code> is empty.
+ */
+ public AuthPermission(String name) {
+ // for backwards compatibility --
+ // createLoginContext is deprecated in favor of createLoginContext.*
+ super("createLoginContext".equals(name) ?
+ "createLoginContext.*" : name);
+ }
+
+ /**
+ * Creates a new AuthPermission object with the specified name.
+ * The name is the symbolic name of the AuthPermission, and the
+ * actions String is currently unused and should be null.
+ *
+ * <p>
+ *
+ * @param name the name of the AuthPermission <p>
+ *
+ * @param actions should be null.
+ *
+ * @throws NullPointerException if <code>name</code> is <code>null</code>.
+ * @throws IllegalArgumentException if <code>name</code> is empty.
+ */
+ public AuthPermission(String name, String actions) {
+ // for backwards compatibility --
+ // createLoginContext is deprecated in favor of createLoginContext.*
+ super("createLoginContext".equals(name) ?
+ "createLoginContext.*" : name, actions);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/auth/DestroyFailedException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/auth/DestroyFailedException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/auth/DestroyFailedException.java 2007-11-18 16:23:27 UTC (rev 3598)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1999-2003 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.security.auth;
+
+/**
+ * Signals that a <code>destroy</code> operation failed.
+ *
+ * <p> This exception is thrown by credentials implementing
+ * the <code>Destroyable</code> interface when the <code>destroy</code>
+ * method fails.
+ *
+ * @version 1.15, 05/05/07
+ */
+public class DestroyFailedException extends Exception {
+
+ private static final long serialVersionUID = -7790152857282749162L;
+
+ /**
+ * Constructs a DestroyFailedException with no detail message. A detail
+ * message is a String that describes this particular exception.
+ */
+ public DestroyFailedException() {
+ super();
+ }
+
+ /**
+ * Constructs a DestroyFailedException with the specified detail
+ * message. A detail message is a String that describes this particular
+ * exception.
+ *
+ * <p>
+ *
+ * @param msg the detail message.
+ */
+ public DestroyFailedException(String msg) {
+ super(msg);
+ }
+}
Added: trunk/core/src/openjdk/javax/javax/security/auth/Destroyable.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/auth/Destroyable.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/auth/Destroyable.java 2007-11-18 16:23:27 UTC (rev 3598)
@@ -0,0 +1,63 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.security.auth;
+
+/**
+ * Objects such as credentials may optionally implement this interface
+ * to provide the capability to destroy its contents.
+ *
+ * @version 1.18, 05/05/07
+ * @see javax.security.auth.Subject
+ */
+public interface Destroyable {
+
+ /**
+ * Destroy this <code>Object</code>.
+ *
+ * <p> Sensitive information associated with this <code>Object</code>
+ * is destroyed or cleared. Subsequent calls to certain methods
+ * on this <code>Object</code> will result in an
+ * <code>IllegalStateException</code> being thrown.
+ *
+ * <p>
+ *
+ * @exception DestroyFailedException if the destroy operation fails. <p>
+ *
+ * @exception SecurityException if the caller does not have permission
+ * to destroy this <code>Object</code>.
+ */
+ void destroy() throws DestroyFailedException;
+
+ /**
+ * Determine if this <code>Object</code> has been destroyed.
+ *
+ * <p>
+ *
+ * @return true if this <code>Object</code> has been destroyed,
+ * false otherwise.
+ */
+ boolean isDestroyed();
+}
Added: trunk/core/src/openjdk/javax/javax/security/auth/Policy.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/auth/Policy.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/auth/Policy.java 2007-11-18 16:23:27 UTC (rev 3598)
@@ -0,0 +1,313 @@
+/*
+ * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.security.auth;
+
+/**
+ * <p> This is an abstract class for representing the system policy for
+ * Subject-based authorization. A subclass implementation
+ * of this class provides a means to specify a Subject-based
+ * access control <code>Policy</code>.
+ *
+ * <p> A <code>Policy</code> object can be queried for the set of
+ * Permissions granted to code running as a
+ * <code>Principal</code> in the following manner:
+ *
+ * <pre>
+ * policy = Policy.getPolicy();
+ * PermissionCollection perms = policy.getPermissions(subject,
+ * codeSource);
+ * </pre>
+ *
+ * The <code>Policy</code> object consults the local policy and returns
+ * and appropriate <code>Permissions</code> object with the
+ * Permissions granted to the Principals associated with the
+ * provided <i>subject</i>, and granted to the code specified
+ * by the provided <i>codeSource</i>.
+ *
+ * <p> A <code>Policy</code> contains the following information.
+ * Note that this example only represents the syntax for the default
+ * <code>Policy</code> implementation. Subclass implementations of this class
+ * may implement alternative syntaxes and may retrieve the
+ * <code>Policy</code> from any source such as files, databases,
+ * or servers.
+ *
+ * <p> Each entry in the <code>Policy</code> is represented as
+ * a <b><i>grant</i></b> entry. Each <b><i>grant</i></b> entry
+ * specifies a codebase, code signers, and Principals triplet,
+ * as well as the Permissions granted to that triplet.
+ *
+ * <pre>
+ * grant CodeBase ["URL"], Signedby ["signers"],
+ * Principal [Principal_Class] "Principal_Name" {
+ * Permission Permission_Class ["Target_Name"]
+ * [, "Permission_Actions"]
+ * [, signedBy "SignerName"];
+ * };
+ * </pre>
+ *
+ * The CodeBase and Signedby components of the triplet name/value pairs
+ * are optional. If they are not present, then any any codebase will match,
+ * and any signer (including unsigned code) will match.
+ * For Example,
+ *
+ * <pre>
+ * grant CodeBase "foo.com", Signedby "foo",
+ * Principal com.sun.security.auth.SolarisPrincipal "duke" {
+ * permission java.io.FilePermission "/home/duke", "read, write";
+ * };
+ * </pre>
+ *
+ * This <b><i>grant</i></b> entry specifies that code from "foo.com",
+ * signed by "foo', and running as a <code>SolarisPrincipal</code> with the
+ * name, duke, has one <code>Permission</code>. This <code>Permission</code>
+ * permits the executing code to read and write files in the directory,
+ * "/home/duke".
+ *
+ * <p> To "run" as a particular <code>Principal</code>,
+ * code invokes the <code>Subject.doAs(subject, ...)</code> method.
+ * After invoking that method, the code runs as all the Principals
+ * associated with the specified <code>Subject</code>.
+ * Note that this <code>Policy</code> (and the Permissions
+ * granted in this <code>Policy</code>) only become effective
+ * after the call to <code>Subject.doAs</code> has occurred.
+ *
+ * <p> Multiple Principals may be listed within one <b><i>grant</i></b> entry.
+ * All the Principals in the grant entry must be associated with
+ * the <code>Subject</code> provided to <code>Subject.doAs</code>
+ * for that <code>Subject</code> to be granted the specified Permissions.
+ *
+ * <pre>
+ * grant Principal com.sun.security.auth.SolarisPrincipal "duke",
+ * Principal com.sun.security.auth.SolarisNumericUserPrincipal "0" {
+ * permission java.io.FilePermission "/home/duke", "read, write";
+ * permission java.net.SocketPermission "duke.com", "connect";
+ * };
+ * </pre>
+ *
+ * This entry grants any code running as both "duke" and "0"
+ * permission to read and write files in duke's home directory,
+ * as well as permission to make socket connections to "duke.com".
+ *
+ * <p> Note that non Principal-based grant entries are not permitted
+ * in this <code>Policy</code>. Therefore, grant entries such as:
+ *
+ * <pre>
+ * grant CodeBase "foo.com", Signedby "foo" {
+ * permission java.io.FilePermission "/tmp/scratch", "read, write";
+ * };
+ * </pre>
+ *
+ * are rejected. Such permission must be listed in the
+ * <code>java.security.Policy</code>.
+ *
+ * <p> The default <code>Policy</code> implementation can be changed by
+ * setting the value of the "auth.policy.provider" security property
+ * (in the Java security properties file) to the fully qualified name of
+ * the desired <code>Policy</code> implementation class.
+ * The Java security properties file is located in the file named
+ * <JAVA_HOME>/lib/security/java.security.
+ * <JAVA_HOME> refers to the value of the java.home system property,
+ * and specifies the directory where the JRE is installed.
+ *
+ * @deprecated as of JDK version 1.4 -- Replaced by java.security.Policy.
+ * java.security.Policy has a method:
+ * <pre>
+ * public PermissionCollection getPermissions
+ * (java.security.ProtectionDomain pd)
+ *
+ * </pre>
+ * and ProtectionDomain has a constructor:
+ * <pre>
+ * public ProtectionDomain
+ * (CodeSource cs,
+ * PermissionCollection permissions,
+ * ClassLoader loader,
+ * Principal[] principals)
+ * </pre>
+ *
+ * These two APIs provide callers the means to query the
+ * Policy for Principal-based Permission entries.
+ *
+ *
+ * @version 1.59, 05/05/07
+ */
+@Deprecated
+public abstract class Policy {
+
+ private static Policy policy;
+ private static ClassLoader contextClassLoader;
+
+ static {
+ contextClassLoader = java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ };
+
+ /**
+ * Sole constructor. (For invocation by subclass constructors, typically
+ * implicit.)
+ */
+ protected Policy() { }
+
+ /**
+ * Returns the installed Policy object.
+ * This method first calls
+ * <code>SecurityManager.checkPermission</code> with the
+ * <code>AuthPermission("getPolicy")</code> permission
+ * to ensure the caller has permission to get the Policy object.
+ *
+ * <p>
+ *
+ * @return the installed Policy. The return value cannot be
+ * <code>null</code>.
+ *
+ * @exception java.lang.SecurityException if the current thread does not
+ * have permission to get the Policy object.
+ *
+ * @see #setPolicy
+ */
+ public static Policy getPolicy() {
+ java.lang.SecurityManager sm = System.getSecurityManager();
+ if (sm != null) sm.checkPermission(new AuthPermission("getPolicy"));
+ return getPolicyNoCheck();
+ }
+
+ /**
+ * Returns the installed Policy object, skipping the security check.
+ *
+ * @return the installed Policy.
+ *
+ */
+ static Policy getPolicyNoCheck() {
+ if (policy == null) {
+
+ synchronized(Policy.class) {
+
+ if (policy == null) {
+ String policy_class = null;
+ policy_class = java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedAction<String>() {
+ public String run() {
+ return java.security.Security.getProperty
+ ("auth.policy.provider");
+ }
+ });
+ if (policy_class == null) {
+ policy_class = "com.sun.security.auth.PolicyFile";
+ }
+
+ try {
+ final String finalClass = policy_class;
+ policy = java.security.AccessController.doPrivileged
+ (new java.security.PrivilegedExceptionAction<Policy>() {
+ public Policy run() throws ClassNotFoundException,
+ InstantiationException,
+ IllegalAccessException {
+ return (Policy) Class.forName
+ (finalClass,
+ true,
+ contextClassLoader).newInstance();
+ }
+ });
+ } catch (Exception e) {
+ throw new SecurityException
+ (sun.security.util.ResourcesMgr.getString
+ ("unable to instantiate Subject-based policy"));
+ }
+ }
+ }
+ }
+ return policy;
+ }
+
+
+ /**
+ * Sets the system-wide Policy object. This method first calls
+ * <code>SecurityManager.checkPermission</code> with the
+ * <code>AuthPermission("setPolicy")</code>
+ * permission to ensure the caller has permission to set the Policy.
+ *
+ * <p>
+ *
+ * @param policy the new system Policy object.
+ *
+ * @exception java.lang.SecurityException if the current thread does not
+ * have permission to set the Policy.
+ *
+ * @see #getPolicy
+ */
+ public static void setPolicy(Policy policy) {
+ java.lang.SecurityManager sm = System.getSecurityManager();
+ if (sm != null) sm.checkPermission(new AuthPermission("setPolicy"));
+ Policy.policy = policy;
+ }
+
+ /**
+ * Retrieve the Permissions granted to the Principals associated with
+ * the specified <code>CodeSource</code>.
+ *
+ * <p>
+ *
+ * @param subject the <code>Subject</code>
+ * whose associated Principals,
+ * in conjunction with the provided
+ * <code>CodeSource</code>, determines the Permissions
+ * returned by this method. This parameter
+ * may be <code>null</code>. <p>
+ *
+ * @param cs the code specified by its <code>CodeSource</code>
+ * that determines, in conjunction with the provided
+ * <code>Subject</code>, the Permissions
+ * returned by this method. This parameter may be
+ * <code>null</code>.
+ *
+ * @return the Collection of Permissions granted to all the
+ * <code>Subject</code> and code specified in
+ * the provided <i>subject</i> and <i>cs</i>
+ * parameters.
+ */
+ public abstract java.security.PermissionCollection getPermissions
+ (Subject subject,
+ java.security.CodeSource cs);
+
+ /**
+ * Refresh and reload the Policy.
+ *
+ * <p>This method causes this object to refresh/reload its current
+ * Policy. This is implementation-dependent.
+ * For example, if the Policy object is stored in
+ * a file, calling <code>refresh</code> will cause the file to be re-read.
+ *
+ * <p>
+ *
+ * @exception SecurityException if the caller does not have permission
+ * to refresh the Policy.
+ */
+ public abstract void refresh();
+}
Added: trunk/core/src/openjdk/javax/javax/security/auth/PrivateCredentialPermission.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/security/auth/PrivateCredentialPermission.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/security/auth/PrivateCredentialPermission.java 2007-11-18 16:23:27 UTC (rev 3598)
@@ -0,0 +1,566 @@
+/*
+ * Copyright 1999-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.security.auth;
+
+import java.util.*;
+import java.text.MessageFormat;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Principal;
+import sun.security.util.ResourcesMgr;
+
+/**
+ * This class is used to protect access to private Credentials
+ * belonging to a particular <code>Subject</code>. The <code>Subject</code>
+ * is represented by a Set of Principals.
+ *
+ * <p> The target name of this <code>Permission</code> specifies
+ * a Credential class name, and a Set of Principals.
+ * The only valid value for this Permission's actions is, "read".
+ * The target name must abide by the following syntax:
+ *
+ * <pre>
+ * CredentialClass {PrincipalClass "PrincipalName"}*
+ * </pre>
+ *
+ * For example, the following permission grants access to the
+ * com.sun.PrivateCredential owned by Subjects which have
+ * a com.sun.Principal with the name, "duke". Note that although
+ * this example, as well as al...
[truncated message content] |