You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(97) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(127) |
Feb
(34) |
Mar
(16) |
Apr
(26) |
May
(55) |
Jun
(107) |
Jul
(36) |
Aug
(72) |
Sep
(90) |
Oct
(41) |
Nov
(27) |
Dec
(13) |
| 2008 |
Jan
(37) |
Feb
(39) |
Mar
(98) |
Apr
(115) |
May
(134) |
Jun
(120) |
Jul
(86) |
Aug
(149) |
Sep
(68) |
Oct
(66) |
Nov
(104) |
Dec
(49) |
| 2009 |
Jan
(131) |
Feb
(132) |
Mar
(125) |
Apr
(172) |
May
(161) |
Jun
(43) |
Jul
(47) |
Aug
(38) |
Sep
(18) |
Oct
(6) |
Nov
(1) |
Dec
(15) |
| 2010 |
Jan
(21) |
Feb
(8) |
Mar
(10) |
Apr
(4) |
May
(9) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
(4) |
| 2011 |
Jan
(23) |
Feb
(10) |
Mar
(13) |
Apr
(3) |
May
|
Jun
(19) |
Jul
(11) |
Aug
(22) |
Sep
|
Oct
(4) |
Nov
(2) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(7) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(30) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(8) |
| 2013 |
Jan
(3) |
Feb
(40) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(12) |
Dec
|
| 2021 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
|
From: <ls...@us...> - 2007-08-27 15:48:09
|
Revision: 3414
http://jnode.svn.sourceforge.net/jnode/?rev=3414&view=rev
Author: lsantha
Date: 2007-08-25 12:26:55 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.core.xml
trunk/core/descriptors/org.classpath.ext.xml.xml
trunk/core/descriptors/sun.tools.xml
Modified: trunk/core/descriptors/org.classpath.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.core.xml 2007-08-25 19:25:55 UTC (rev 3413)
+++ trunk/core/descriptors/org.classpath.core.xml 2007-08-25 19:26:55 UTC (rev 3414)
@@ -22,6 +22,7 @@
<export name="sun.reflect.ConstantPool"/>
<export name="sun.reflect.NativeConstantPool"/>
<export name="sun.reflect.annotation.AnnotationType"/>
+ <export name="sun.net.www.ParseUtil"/>
<export name="sun.net.www.protocol.http.InMemoryCookieStore"/>
<export name="sun.nio.ch.Interruptible"/>
<export name="sun.security.util.Debug"/>
@@ -30,6 +31,7 @@
<export name="sun.security.jca.*"/>
<export name="sun.nio.cs.StreamEncoder"/>
<export name="sun.nio.cs.StreamDecoder"/>
+ <export name="sun.nio.cs.ThreadLocalCoders"/>
<export name="gnu.classpath.Configuration"/>
<export name="gnu.classpath.Pointer"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-25 19:25:55 UTC (rev 3413)
+++ trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-25 19:26:55 UTC (rev 3414)
@@ -134,21 +134,6 @@
<export name="com.sun.xml.internal.stream.writers.*"/>
<export name="com.sun.xml.internal.stream.*"/>
- <!--
- <export name="gnu.xml.aelfred2.*"/>
- <export name="gnu.xml.dom.*"/>
- <export name="gnu.xml.dom.html2.*"/>
- <export name="gnu.xml.dom.ls.*"/>
-
- <export name="gnu.xml.pipeline.*"/>
- <export name="gnu.xml.transform.*"/>
- <export name="gnu.xml.util.*"/>
- <export name="gnu.xml.validation.datatype.*"/>
- <export name="gnu.xml.validation.relaxng.*"/>
- <export name="gnu.xml.validation.xmlschema.*"/>
- <export name="gnu.xml.xpath.*"/>
- -->
-
<export name="javax.xml.*"/>
<export name="javax.xml.datatype.*"/>
<export name="javax.xml.namespace.*"/>
Modified: trunk/core/descriptors/sun.tools.xml
===================================================================
--- trunk/core/descriptors/sun.tools.xml 2007-08-25 19:25:55 UTC (rev 3413)
+++ trunk/core/descriptors/sun.tools.xml 2007-08-25 19:26:55 UTC (rev 3414)
@@ -11,6 +11,8 @@
<runtime>
<library name="jnode-core.jar">
+ <export name="sun.applet.*"/>
+ <export name="sun.applet.resources.*"/>
<export name="sun.tools.asm.*"/>
<export name="sun.tools.java.*"/>
<export name="sun.tools.javac.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:48:00
|
Revision: 3402
http://jnode.svn.sourceforge.net/jnode/?rev=3402&view=rev
Author: lsantha
Date: 2007-08-25 01:06:59 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.ext.xml.xml
Modified: trunk/core/descriptors/org.classpath.ext.xml.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-24 16:35:54 UTC (rev 3401)
+++ trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-25 08:06:59 UTC (rev 3402)
@@ -12,10 +12,134 @@
<runtime>
<library name="jnode-core.jar">
- <export name="gnu.xml.aelfred2.*"/>
+ <export name="com.sun.org.apache.bcel.internal.*"/>
+ <export name="com.sun.org.apache.bcel.internal.classfile.*"/>
+ <export name="com.sun.org.apache.bcel.internal.generic.*"/>
+ <export name="com.sun.org.apache.bcel.internal.util.*"/>
+ <export name="com.sun.org.apache.regexp.internal.*"/>
+ <export name="com.sun.org.apache.xalan.internal.*"/>
+ <export name="com.sun.org.apache.xalan.internal.client.*"/>
+ <export name="com.sun.org.apache.xalan.internal.extensions.*"/>
+ <export name="com.sun.org.apache.xalan.internal.lib.*"/>
+ <export name="com.sun.org.apache.xalan.internal.res.*"/>
+ <export name="com.sun.org.apache.xalan.internal.templates.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xslt.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.cmdline.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.compiler.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.compiler.util.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.dom.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.runtime.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.runtime.output.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.trax.*"/>
+ <export name="com.sun.org.apache.xalan.internal.xsltc.util.*"/>
+ <export name="com.sun.org.apache.xerces.internal.dom.*"/>
+ <export name="com.sun.org.apache.xerces.internal.dom.events.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dtd.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dtd.models.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dv.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dv.dtd.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dv.util.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.dv.xs.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.io.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.msg.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.validation.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xpath.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xpath.regex.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.identity.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.models.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.opti.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.traversers.*"/>
+ <export name="com.sun.org.apache.xerces.internal.impl.xs.util.*"/>
+ <export name="com.sun.org.apache.xerces.internal.jaxp.*"/>
+ <export name="com.sun.org.apache.xerces.internal.jaxp.datatype.*"/>
+ <export name="com.sun.org.apache.xerces.internal.jaxp.validation.*"/>
+ <export name="com.sun.org.apache.xerces.internal.parsers.*"/>
+ <export name="com.sun.org.apache.xerces.internal.util.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xinclude.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xni.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xni.grammars.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xni.parser.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xpointer.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xs.*"/>
+ <export name="com.sun.org.apache.xerces.internal.xs.datatypes.*"/>
+ <export name="com.sun.org.apache.xml.internal.dtm.*"/>
+ <export name="com.sun.org.apache.xml.internal.dtm.ref.*"/>
+ <export name="com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.*"/>
+ <export name="com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.*"/>
+ <export name="com.sun.org.apache.xml.internal.res.*"/>
+ <export name="com.sun.org.apache.xml.internal.resolver.*"/>
+ <export name="com.sun.org.apache.xml.internal.resolver.helpers.*"/>
+ <export name="com.sun.org.apache.xml.internal.resolver.readers.*"/>
+ <export name="com.sun.org.apache.xml.internal.resolver.tools.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.algorithms.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.algorithms.implementations.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.c14n.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.c14n.helper.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.c14n.implementations.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.encryption.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.exceptions.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.content.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.content.keyvalues.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.content.x509.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.keyresolver.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.storage.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.keys.storage.implementations.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.resource.schema.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.signature.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.transforms.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.transforms.implementations.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.transforms.params.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.utils.*"/>
+ <export name="com.sun.org.apache.xml.internal.security.utils.resolver.*"/>
+ <export name="com.sun.org.apache.xml.internal.serialize.*"/>
+ <export name="com.sun.org.apache.xml.internal.serializer.*"/>
+ <export name="com.sun.org.apache.xml.internal.serializer.utils.*"/>
+ <export name="com.sun.org.apache.xml.internal.utils.*"/>
+ <export name="com.sun.org.apache.xml.internal.utils.res.*"/>
+ <export name="com.sun.org.apache.xpath.internal.*"/>
+ <export name="com.sun.org.apache.xpath.internal.axes.*"/>
+ <export name="com.sun.org.apache.xpath.internal.compiler.*"/>
+ <export name="com.sun.org.apache.xpath.internal.domapi.*"/>
+ <export name="com.sun.org.apache.xpath.internal.functions.*"/>
+ <export name="com.sun.org.apache.xpath.internal.jaxp.*"/>
+ <export name="com.sun.org.apache.xpath.internal.objects.*"/>
+ <export name="com.sun.org.apache.xpath.internal.operations.*"/>
+ <export name="com.sun.org.apache.xpath.internal.patterns.*"/>
+ <export name="com.sun.org.apache.xpath.internal.res.*"/>
+
+ <!--
+ <export name="com.sun.xml.internal.bind.*"/>
+ <export name="com.sun.xml.internal.bind.annotation.*"/>
+ <export name="com.sun.xml.internal.bind.api.*"/>
+ <export name="com.sun.xml.internal.bind.api.impl.*"/>
+ <export name="com.sun.xml.internal.bind.marshaller.*"/>
+ <export name="com.sun.xml.internal.bind.unmarshaller.*"/>
+ <export name="com.sun.xml.internal.bind.util.*"/>
+ <export name="com.sun.xml.internal.bind.v2.*"/>
+ <export name="com.sun.xml.internal.bind.v2.bytecode.*"/>
+ <export name="com.sun.xml.internal.bind.v2.model.*"/>
+ -->
+ <export name="com.sun.xml.internal.stream.*"/>
+ <export name="com.sun.xml.internal.stream.dtd.*"/>
+ <export name="com.sun.xml.internal.stream.dtd.nonvalidating.*"/>
+ <export name="com.sun.xml.internal.stream.events.*"/>
+ <export name="com.sun.xml.internal.stream.util.*"/>
+ <export name="com.sun.xml.internal.stream.writers.*"/>
+ <export name="com.sun.xml.internal.stream.*"/>
+
+ <!--
+ <export name="gnu.xml.aelfred2.*"/>
<export name="gnu.xml.dom.*"/>
<export name="gnu.xml.dom.html2.*"/>
<export name="gnu.xml.dom.ls.*"/>
+
<export name="gnu.xml.pipeline.*"/>
<export name="gnu.xml.transform.*"/>
<export name="gnu.xml.util.*"/>
@@ -23,6 +147,7 @@
<export name="gnu.xml.validation.relaxng.*"/>
<export name="gnu.xml.validation.xmlschema.*"/>
<export name="gnu.xml.xpath.*"/>
+ -->
<export name="javax.xml.*"/>
<export name="javax.xml.datatype.*"/>
@@ -31,6 +156,7 @@
<export name="javax.xml.transform.*"/>
<export name="javax.xml.transform.dom.*"/>
<export name="javax.xml.transform.sax.*"/>
+ <export name="javax.xml.transform.stax.*"/>
<export name="javax.xml.transform.stream.*"/>
<export name="javax.xml.validation.*"/>
<export name="javax.xml.xpath.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:47:56
|
Revision: 3427
http://jnode.svn.sourceforge.net/jnode/?rev=3427&view=rev
Author: lsantha
Date: 2007-08-25 12:59:39 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.ext.core.xml
trunk/core/descriptors/org.classpath.ext.xml.xml
Modified: trunk/core/descriptors/org.classpath.ext.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.core.xml 2007-08-25 19:57:20 UTC (rev 3426)
+++ trunk/core/descriptors/org.classpath.ext.core.xml 2007-08-25 19:59:39 UTC (rev 3427)
@@ -21,11 +21,6 @@
<export name="gnu.java.awt.image.*"/>
<export name="gnu.java.awt.java2d.*"/>
<export name="gnu.java.awt.print.*"/>
- <export name="gnu.java.beans.*"/>
- <export name="gnu.java.beans.decoder.*"/>
- <export name="gnu.java.beans.editors.*"/>
- <export name="gnu.java.beans.encoder.*"/>
- <export name="gnu.java.beans.encoder.elements.*"/>
<export name="gnu.java.lang.management.*"/>
<export name="gnu.java.lang.reflect.*"/>
<export name="gnu.java.net.protocol.*"/>
Modified: trunk/core/descriptors/org.classpath.ext.xml.xml
===================================================================
--- trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-25 19:57:20 UTC (rev 3426)
+++ trunk/core/descriptors/org.classpath.ext.xml.xml 2007-08-25 19:59:39 UTC (rev 3427)
@@ -150,7 +150,6 @@
<export name="org.relaxng.datatype.helpers.*"/>
<export name="org.w3c.dom.css.*"/>
<export name="org.w3c.dom.events.*"/>
- <export name="org.w3c.dom.html2.*"/>
<export name="org.w3c.dom.ranges.*"/>
<export name="org.w3c.dom.stylesheets.*"/>
<export name="org.w3c.dom.traversal.*"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:47:35
|
Revision: 3420
http://jnode.svn.sourceforge.net/jnode/?rev=3420&view=rev
Author: lsantha
Date: 2007-08-25 12:40:09 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.tools.xml
Modified: trunk/core/descriptors/org.classpath.tools.xml
===================================================================
--- trunk/core/descriptors/org.classpath.tools.xml 2007-08-25 19:36:13 UTC (rev 3419)
+++ trunk/core/descriptors/org.classpath.tools.xml 2007-08-25 19:40:09 UTC (rev 3420)
@@ -13,7 +13,6 @@
<runtime>
<library name="jnode-core.jar">
<export name="gnu.classpath.tools.*"/>
- <export name="gnu.classpath.tools.appletviewer.*"/>
<export name="gnu.classpath.tools.common.*"/>
<export name="gnu.classpath.tools.getopt.*"/>
<export name="gnu.classpath.tools.jar.*"/>
@@ -42,7 +41,6 @@
</runtime>
<extension point="org.jnode.shell.aliases">
- <alias name="appletviewer" class="gnu.classpath.tools.appletviewer.Main"/>
<alias name="jar" class="gnu.classpath.tools.jar.Main"/>
<alias name="jarsigner" class="gnu.classpath.tools.jarsigner.Main"/>
<alias name="keytool" class="gnu.classpath.tools.keytool.Main"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:47:21
|
Revision: 3422
http://jnode.svn.sourceforge.net/jnode/?rev=3422&view=rev
Author: lsantha
Date: 2007-08-25 12:46:50 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/org/org/w3c/dom/html2/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:47:06
|
Revision: 3412
http://jnode.svn.sourceforge.net/jnode/?rev=3412&view=rev
Author: lsantha
Date: 2007-08-25 12:24:26 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/icedtea/com/sun/media/
trunk/core/src/icedtea/com/sun/media/sound/
trunk/core/src/icedtea/com/sun/media/sound/JavaSoundAudioClip.java
Added: trunk/core/src/icedtea/com/sun/media/sound/JavaSoundAudioClip.java
===================================================================
--- trunk/core/src/icedtea/com/sun/media/sound/JavaSoundAudioClip.java (rev 0)
+++ trunk/core/src/icedtea/com/sun/media/sound/JavaSoundAudioClip.java 2007-08-25 19:24:26 UTC (rev 3412)
@@ -0,0 +1,68 @@
+/* JavaSoundAudioClip.java -- stub file.
+ Copyright (C) 2007 Red Hat, Inc.
+
+This file is part of IcedTea.
+
+IcedTea 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, version 2.
+
+IcedTea 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 IcedTea; 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 com.sun.media.sound;
+
+import java.applet.AudioClip;
+import java.io.InputStream;
+
+public class JavaSoundAudioClip implements AudioClip {
+
+ public JavaSoundAudioClip(InputStream in) {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated constructor stub
+ }
+
+ public void loop() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void play() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+ public void stop() {
+ throw new RuntimeException("Not implemented.");
+ // TODO Auto-generated method stub
+
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:45:34
|
Revision: 3417
http://jnode.svn.sourceforge.net/jnode/?rev=3417&view=rev
Author: lsantha
Date: 2007-08-25 12:29:20 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Do not overwrite the existing build file.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/command/ant/AntCommand.java
Modified: trunk/shell/src/shell/org/jnode/shell/command/ant/AntCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/ant/AntCommand.java 2007-08-25 19:28:35 UTC (rev 3416)
+++ trunk/shell/src/shell/org/jnode/shell/command/ant/AntCommand.java 2007-08-25 19:29:20 UTC (rev 3417)
@@ -62,16 +62,20 @@
public static void makeBuildXml(String file) throws Exception
{
- FileOutputStream fos = new FileOutputStream(new File(file));
- PrintWriter pw = new PrintWriter(fos);
- pw.println("<project name=\"JNode\" default=\"help\" basedir=\".\">");
- pw.println("<target name=\"help\">");
- pw.println("<echo>");
- pw.println("echo task is working");
- pw.println("</echo>");
- pw.println("</target>");
- pw.println("</project>");
- pw.close();
- fos.close();
+ File f = new File(file);
+ if(!f.exists()){
+ System.out.println("build.xml not found, creating a template");
+ FileOutputStream fos = new FileOutputStream(f);
+ PrintWriter pw = new PrintWriter(fos);
+ pw.println("<project name=\"JNode\" default=\"help\" basedir=\".\">");
+ pw.println("<target name=\"help\">");
+ pw.println("<echo>");
+ pw.println("echo task is working");
+ pw.println("</echo>");
+ pw.println("</target>");
+ pw.println("</project>");
+ pw.close();
+ fos.close();
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:45:04
|
Revision: 3432
http://jnode.svn.sourceforge.net/jnode/?rev=3432&view=rev
Author: lsantha
Date: 2007-08-25 13:54:26 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/org/org/objectweb/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:44:12
|
Revision: 3426
http://jnode.svn.sourceforge.net/jnode/?rev=3426&view=rev
Author: lsantha
Date: 2007-08-25 12:57:20 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/org/org/w3c/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:40:59
|
Revision: 3418
http://jnode.svn.sourceforge.net/jnode/?rev=3418&view=rev
Author: lsantha
Date: 2007-08-25 12:32:10 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Do not overwrite the existing build file.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/awt/CausedFocusEvent.java
trunk/core/src/openjdk/sun/sun/awt/EmbeddedFrame.java
trunk/core/src/openjdk/sun/sun/awt/NullComponentPeer.java
Added: trunk/core/src/openjdk/sun/sun/awt/CausedFocusEvent.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/awt/CausedFocusEvent.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/awt/CausedFocusEvent.java 2007-08-25 19:32:10 UTC (rev 3418)
@@ -0,0 +1,88 @@
+/*
+ * 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 sun.awt;
+
+import java.awt.event.FocusEvent;
+import java.awt.Component;
+
+/**
+ * This class represents FocusEvents with a known "cause" - reason why this event happened. It can
+ * be mouse press, traversal, activation, and so on - all causes are described as Cause enum. The
+ * event with the cause can be constructed in two ways - explicitly through constructor of
+ * CausedFocusEvent class or implicitly, by calling appropriate requestFocusXXX method with "cause"
+ * parameter. The default cause is UNKNOWN.
+ */
+public class CausedFocusEvent extends FocusEvent {
+ public enum Cause {
+ UNKNOWN,
+ MOUSE_EVENT,
+ TRAVERSAL,
+ TRAVERSAL_UP,
+ TRAVERSAL_DOWN,
+ TRAVERSAL_FORWARD,
+ TRAVERSAL_BACKWARD,
+ MANUAL_REQUEST,
+ AUTOMATIC_TRAVERSE,
+ ROLLBACK,
+ NATIVE_SYSTEM,
+ ACTIVATION,
+ CLEAR_GLOBAL_FOCUS_OWNER,
+ RETARGETED
+ };
+
+ private final Cause cause;
+
+ public Cause getCause() {
+ return cause;
+ }
+
+ public String toString() {
+ return "java.awt.FocusEvent[" + super.paramString() + ",cause=" + cause + "] on " + getSource();
+ }
+
+ public CausedFocusEvent(Component source, int id, boolean temporary,
+ Component opposite, Cause cause) {
+ super(source, id, temporary, opposite);
+ if (cause == null) {
+ cause = Cause.UNKNOWN;
+ }
+ this.cause = cause;
+ }
+
+ /**
+ * Retargets the original focus event to the new target. If the
+ * original focus event is CausedFocusEvent, it remains such and
+ * cause is copied. Otherwise, new CausedFocusEvent is created,
+ * with cause as RETARGETED.
+ * @return retargeted event, or null if e is null
+ */
+ public static FocusEvent retarget(FocusEvent e, Component newSource) {
+ if (e == null) return null;
+
+ return new CausedFocusEvent(newSource, e.getID(), e.isTemporary(), e.getOppositeComponent(),
+ (e instanceof CausedFocusEvent) ? ((CausedFocusEvent)e).getCause() : Cause.RETARGETED);
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/awt/EmbeddedFrame.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/awt/EmbeddedFrame.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/awt/EmbeddedFrame.java 2007-08-25 19:32:10 UTC (rev 3418)
@@ -0,0 +1,608 @@
+/*
+ * 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 sun.awt;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.*;
+import java.awt.peer.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Field;
+import java.beans.PropertyChangeListener;
+import java.beans.PropertyChangeEvent;
+import java.util.Set;
+import java.awt.AWTKeyStroke;
+import java.applet.Applet;
+import sun.applet.AppletPanel;
+
+/**
+ * A generic container used for embedding Java components, usually applets.
+ * An EmbeddedFrame has two related uses:
+ *
+ * . Within a Java-based application, an EmbeddedFrame serves as a sort of
+ * firewall, preventing the contained components or applets from using
+ * getParent() to find parent components, such as menubars.
+ *
+ * . Within a C-based application, an EmbeddedFrame contains a window handle
+ * which was created by the application, which serves as the top-level
+ * Java window. EmbeddedFrames created for this purpose are passed-in a
+ * handle of an existing window created by the application. The window
+ * handle should be of the appropriate native type for a specific
+ * platform, as stored in the pData field of the ComponentPeer.
+ *
+ * @version 1.15, 04/07/00
+ * @author Thomas Ball
+ */
+public abstract class EmbeddedFrame extends Frame
+ implements KeyEventDispatcher, PropertyChangeListener {
+
+ private boolean isCursorAllowed = true;
+ private static Field fieldPeer;
+ private static Field currentCycleRoot;
+ private boolean supportsXEmbed = false;
+ private KeyboardFocusManager appletKFM;
+ // JDK 1.1 compatibility
+ private static final long serialVersionUID = 2967042741780317130L;
+
+ // Use these in traverseOut method to determine directions
+ protected static final boolean FORWARD = true;
+ protected static final boolean BACKWARD = false;
+
+ public boolean supportsXEmbed() {
+ return supportsXEmbed && SunToolkit.needsXEmbed();
+ }
+
+ protected EmbeddedFrame(boolean supportsXEmbed) {
+ this((long)0, supportsXEmbed);
+ }
+
+
+ protected EmbeddedFrame() {
+ this((long)0);
+ }
+
+ /**
+ * @deprecated This constructor will be removed in 1.5
+ */
+ @Deprecated
+ protected EmbeddedFrame(int handle) {
+ this((long)handle);
+ }
+
+ protected EmbeddedFrame(long handle) {
+ this(handle, false);
+ }
+
+ protected EmbeddedFrame(long handle, boolean supportsXEmbed) {
+ this.supportsXEmbed = supportsXEmbed;
+ }
+
+ /**
+ * Block introspection of a parent window by this child.
+ */
+ public Container getParent() {
+ return null;
+ }
+
+ /**
+ * Needed to track which KeyboardFocusManager is current. We want to avoid memory
+ * leaks, so when KFM stops being current, we remove ourselves as listeners.
+ */
+ public void propertyChange(PropertyChangeEvent evt) {
+ // We don't handle any other properties. Skip it.
+ if (!evt.getPropertyName().equals("managingFocus")) {
+ return;
+ }
+
+ // We only do it if it stops being current. Technically, we should
+ // never get an event about KFM starting being current.
+ if (evt.getNewValue() == Boolean.TRUE) {
+ return;
+ }
+
+ // should be the same as appletKFM
+ removeTraversingOutListeners((KeyboardFocusManager)evt.getSource());
+
+ appletKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ if (isVisible()) {
+ addTraversingOutListeners(appletKFM);
+ }
+ }
+
+ /**
+ * Register us as KeyEventDispatcher and property "managingFocus" listeners.
+ */
+ private void addTraversingOutListeners(KeyboardFocusManager kfm) {
+ kfm.addKeyEventDispatcher(this);
+ kfm.addPropertyChangeListener("managingFocus", this);
+ }
+
+ /**
+ * Deregister us as KeyEventDispatcher and property "managingFocus" listeners.
+ */
+ private void removeTraversingOutListeners(KeyboardFocusManager kfm) {
+ kfm.removeKeyEventDispatcher(this);
+ kfm.removePropertyChangeListener("managingFocus", this);
+ }
+
+ /**
+ * Because there may be many AppContexts, and we can't be sure where this
+ * EmbeddedFrame is first created or shown, we can't automatically determine
+ * the correct KeyboardFocusManager to attach to as KeyEventDispatcher.
+ * Those who want to use the functionality of traversing out of the EmbeddedFrame
+ * must call this method on the Applet's AppContext. After that, all the changes
+ * can be handled automatically, including possible replacement of
+ * KeyboardFocusManager.
+ */
+ public void registerListeners() {
+ if (appletKFM != null) {
+ removeTraversingOutListeners(appletKFM);
+ }
+ appletKFM = KeyboardFocusManager.getCurrentKeyboardFocusManager();
+ if (isVisible()) {
+ addTraversingOutListeners(appletKFM);
+ }
+ }
+
+ /**
+ * Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
+ * KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
+ * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
+ * add listeners in show() and remove them in hide().
+ */
+ public void show() {
+ if (appletKFM != null) {
+ addTraversingOutListeners(appletKFM);
+ }
+ super.show();
+ }
+
+ /**
+ * Needed to avoid memory leak: we register this EmbeddedFrame as a listener with
+ * KeyboardFocusManager of applet's AppContext. We don't want the KFM to keep
+ * reference to our EmbeddedFrame forever if the Frame is no longer in use, so we
+ * add listeners in show() and remove them in hide().
+ */
+ public void hide() {
+ if (appletKFM != null) {
+ removeTraversingOutListeners(appletKFM);
+ }
+ super.hide();
+ }
+
+ /**
+ * Need this method to detect when the focus may have chance to leave the
+ * focus cycle root which is EmbeddedFrame. Mostly, the code here is copied
+ * from DefaultKeyboardFocusManager.processKeyEvent with some minor
+ * modifications.
+ */
+ public boolean dispatchKeyEvent(KeyEvent e) {
+
+ // We can't guarantee that this is called on the same AppContext as EmbeddedFrame
+ // belongs to. That's why we can't use public methods to find current focus cycle
+ // root. Instead, we access KFM's private field directly.
+ if (currentCycleRoot == null) {
+ currentCycleRoot = (Field)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ try {
+ Field unaccessibleRoot = KeyboardFocusManager.class.
+ getDeclaredField("currentFocusCycleRoot");
+ if (unaccessibleRoot != null) {
+ unaccessibleRoot.setAccessible(true);
+ }
+ return unaccessibleRoot;
+ } catch (NoSuchFieldException e1) {
+ assert false;
+ } catch (SecurityException e2) {
+ assert false;
+ }
+ return null;
+ }
+ });
+ }
+
+ Container currentRoot = null;
+ if (currentCycleRoot != null) {
+ try {
+ // The field is static, so we can pass null to Field.get() as the argument.
+ currentRoot = (Container)currentCycleRoot.get(null);
+ } catch (IllegalAccessException e3) {
+ // This is impossible: currentCycleRoot would be null if setAccessible failed.
+ assert false;
+ }
+ }
+
+ // if we are not in EmbeddedFrame's cycle, we should not try to leave.
+ if (this != currentRoot) {
+ return false;
+ }
+
+ // KEY_TYPED events cannot be focus traversal keys
+ if (e.getID() == KeyEvent.KEY_TYPED) {
+ return false;
+ }
+
+ if (!getFocusTraversalKeysEnabled() || e.isConsumed()) {
+ return false;
+ }
+
+ AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
+ Set toTest;
+ Component currentFocused = e.getComponent();
+
+ Component last = getFocusTraversalPolicy().getLastComponent(this);
+ toTest = getFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS);
+ if (toTest.contains(stroke) && (currentFocused == last || last == null)) {
+ if (traverseOut(FORWARD)) {
+ e.consume();
+ return true;
+ }
+ }
+
+ Component first = getFocusTraversalPolicy().getFirstComponent(this);
+ toTest = getFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS);
+ if (toTest.contains(stroke) && (currentFocused == first || first == null)) {
+ if (traverseOut(BACKWARD)) {
+ e.consume();
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * This method is called from dispatchKeyEvent in the following two cases:
+ * 1. The focus is on the first Component of this EmbeddedFrame and we are
+ * about to transfer the focus backward.
+ * 2. The focus in on the last Component of this EmbeddedFrame and we are
+ * about to transfer the focus forward.
+ * This is needed to give the opportuity for keyboard focus to leave the
+ * EmbeddedFrame. Override this method, initiate focus transfer in it and
+ * return true if you want the focus to leave EmbeddedFrame's cycle.
+ * The direction parameter specifies which of the two mentioned cases is
+ * happening. Use FORWARD and BACKWARD constants defined in EmbeddedFrame
+ * to avoid confusing boolean values.
+ *
+ * @param direction FORWARD or BACKWARD
+ * @return true, if EmbeddedFrame wants the focus to leave it,
+ * false otherwise.
+ */
+ protected boolean traverseOut(boolean direction) {
+ return false;
+ }
+
+ /**
+ * Block modifying any frame attributes, since they aren't applicable
+ * for EmbeddedFrames.
+ */
+ public void setTitle(String title) {}
+ public void setIconImage(Image image) {}
+ public void setIconImages(java.util.List<? extends Image> icons) {}
+ public void setMenuBar(MenuBar mb) {}
+ public void setResizable(boolean resizable) {}
+ public void remove(MenuComponent m) {}
+
+ public boolean isResizable() {
+ return true;
+ }
+
+ public void addNotify() {
+ synchronized (getTreeLock()) {
+ if (getPeer() == null) {
+ setPeer(new NullEmbeddedFramePeer());
+ }
+ super.addNotify();
+ }
+ }
+
+ // These three functions consitute RFE 4100710. Do not remove.
+ public void setCursorAllowed(boolean isCursorAllowed) {
+ this.isCursorAllowed = isCursorAllowed;
+ getPeer().updateCursorImmediately();
+ }
+ public boolean isCursorAllowed() {
+ return isCursorAllowed;
+ }
+ public Cursor getCursor() {
+ return (isCursorAllowed)
+ ? super.getCursor()
+ : Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
+ }
+
+ protected void setPeer(final ComponentPeer p){
+ if (fieldPeer == null) {
+ fieldPeer = (Field)AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ try {
+ Field lnkPeer = Component.class.getDeclaredField("peer");
+ if (lnkPeer != null) {
+ lnkPeer.setAccessible(true);
+ }
+ return lnkPeer;
+ } catch (NoSuchFieldException e) {
+ assert false;
+ } catch (SecurityException e) {
+ assert false;
+ }
+ return null;
+ }//run
+ });
+ }
+ try{
+ if (fieldPeer !=null){
+ fieldPeer.set(EmbeddedFrame.this, p);
+ }
+ } catch (IllegalAccessException e) {
+ assert false;
+ }
+ }; //setPeer method ends
+
+ /**
+ * Synthesize native message to activate or deactivate EmbeddedFrame window
+ * depending on the value of parameter <code>b</code>.
+ * Peers should override this method if they are to implement
+ * this functionality.
+ * @param doActivate if <code>true</code>, activates the window;
+ * otherwise, deactivates the window
+ */
+ public void synthesizeWindowActivation(boolean doActivate) {}
+
+ /**
+ * Moves this embedded frame to a new location. The top-left corner of
+ * the new location is specified by the <code>x</code> and <code>y</code>
+ * parameters relative to the native parent component.
+ * <p>
+ * setLocation() and setBounds() for EmbeddedFrame really don't move it
+ * within the native parent. These methods always put embedded frame to
+ * (0, 0) for backward compatibility. To allow moving embedded frame
+ * setLocationPrivate() and setBoundsPrivate() were introduced, and they
+ * work just the same way as setLocation() and setBounds() for usual,
+ * non-embedded components.
+ * </p>
+ * <p>
+ * Using usual get/setLocation() and get/setBounds() together with new
+ * get/setLocationPrivate() and get/setBoundsPrivate() is not recommended.
+ * For example, calling getBoundsPrivate() after setLocation() works fine,
+ * but getBounds() after setBoundsPrivate() may return unpredictable value.
+ * </p>
+ * @param x the new <i>x</i>-coordinate relative to the parent component
+ * @param y the new <i>y</i>-coordinate relative to the parent component
+ * @see java.awt.Component#setLocation
+ * @see #getLocationPrivate
+ * @see #setBoundsPrivate
+ * @see #getBoundsPrivate
+ * @since 1.5
+ */
+ protected void setLocationPrivate(int x, int y) {
+ Dimension size = getSize();
+ setBoundsPrivate(x, y, size.width, size.height);
+ }
+
+ /**
+ * Gets the location of this embedded frame as a point specifying the
+ * top-left corner relative to parent component.
+ * <p>
+ * setLocation() and setBounds() for EmbeddedFrame really don't move it
+ * within the native parent. These methods always put embedded frame to
+ * (0, 0) for backward compatibility. To allow getting location and size
+ * of embedded frame getLocationPrivate() and getBoundsPrivate() were
+ * introduced, and they work just the same way as getLocation() and getBounds()
+ * for ususal, non-embedded components.
+ * </p>
+ * <p>
+ * Using usual get/setLocation() and get/setBounds() together with new
+ * get/setLocationPrivate() and get/setBoundsPrivate() is not recommended.
+ * For example, calling getBoundsPrivate() after setLocation() works fine,
+ * but getBounds() after setBoundsPrivate() may return unpredictable value.
+ * </p>
+ * @return a point indicating this embedded frame's top-left corner
+ * @see java.awt.Component#getLocation
+ * @see #setLocationPrivate
+ * @see #setBoundsPrivate
+ * @see #getBoundsPrivate
+ * @since 1.6
+ */
+ protected Point getLocationPrivate() {
+ Rectangle bounds = getBoundsPrivate();
+ return new Point(bounds.x, bounds.y);
+ }
+
+ /**
+ * Moves and resizes this embedded frame. The new location of the top-left
+ * corner is specified by <code>x</code> and <code>y</code> parameters
+ * relative to the native parent component. The new size is specified by
+ * <code>width</code> and <code>height</code>.
+ * <p>
+ * setLocation() and setBounds() for EmbeddedFrame really don't move it
+ * within the native parent. These methods always put embedded frame to
+ * (0, 0) for backward compatibility. To allow moving embedded frames
+ * setLocationPrivate() and setBoundsPrivate() were introduced, and they
+ * work just the same way as setLocation() and setBounds() for usual,
+ * non-embedded components.
+ * </p>
+ * <p>
+ * Using usual get/setLocation() and get/setBounds() together with new
+ * get/setLocationPrivate() and get/setBoundsPrivate() is not recommended.
+ * For example, calling getBoundsPrivate() after setLocation() works fine,
+ * but getBounds() after setBoundsPrivate() may return unpredictable value.
+ * </p>
+ * @param x the new <i>x</i>-coordinate relative to the parent component
+ * @param y the new <i>y</i>-coordinate relative to the parent component
+ * @param width the new <code>width</code> of this embedded frame
+ * @param height the new <code>height</code> of this embedded frame
+ * @see java.awt.Component#setBounds
+ * @see #setLocationPrivate
+ * @see #getLocationPrivate
+ * @see #getBoundsPrivate
+ * @since 1.5
+ */
+ protected void setBoundsPrivate(int x, int y, int width, int height) {
+ final FramePeer peer = (FramePeer)getPeer();
+ if (peer != null) {
+ peer.setBoundsPrivate(x, y, width, height);
+ }
+ }
+
+ /**
+ * Gets the bounds of this embedded frame as a rectangle specifying the
+ * width, height and location relative to the native parent component.
+ * <p>
+ * setLocation() and setBounds() for EmbeddedFrame really don't move it
+ * within the native parent. These methods always put embedded frame to
+ * (0, 0) for backward compatibility. To allow getting location and size
+ * of embedded frames getLocationPrivate() and getBoundsPrivate() were
+ * introduced, and they work just the same way as getLocation() and getBounds()
+ * for ususal, non-embedded components.
+ * </p>
+ * <p>
+ * Using usual get/setLocation() and get/setBounds() together with new
+ * get/setLocationPrivate() and get/setBoundsPrivate() is not recommended.
+ * For example, calling getBoundsPrivate() after setLocation() works fine,
+ * but getBounds() after setBoundsPrivate() may return unpredictable value.
+ * </p>
+ * @return a rectangle indicating this embedded frame's bounds
+ * @see java.awt.Component#getBounds
+ * @see #setLocationPrivate
+ * @see #getLocationPrivate
+ * @see #setBoundsPrivate
+ * @since 1.6
+ */
+ protected Rectangle getBoundsPrivate() {
+ final FramePeer peer = (FramePeer)getPeer();
+ if (peer != null) {
+ return peer.getBoundsPrivate();
+ }
+ else {
+ return getBounds();
+ }
+ }
+
+ public void toFront() {}
+ public void toBack() {}
+
+ public abstract void registerAccelerator(AWTKeyStroke stroke);
+ public abstract void unregisterAccelerator(AWTKeyStroke stroke);
+
+ /**
+ * Checks if the component is in an EmbeddedFrame. If so,
+ * returns the applet found in the hierarchy or null if
+ * not found.
+ * @return the parent applet or {@ null}
+ * @since 1.6
+ */
+ public static Applet getAppletIfAncestorOf(Component comp) {
+ Container parent = comp.getParent();
+ Applet applet = null;
+ while (parent != null && !(parent instanceof EmbeddedFrame)) {
+ if (parent instanceof Applet) {
+ applet = (Applet)parent;
+ }
+ parent = parent.getParent();
+ }
+ return parent == null ? null : applet;
+ }
+
+ /**
+ * This method should be overriden in subclasses. It is
+ * called when window this frame is within should be blocked
+ * by some modal dialog.
+ */
+ public void notifyModalBlocked(Dialog blocker, boolean blocked) {
+ }
+
+ private static class NullEmbeddedFramePeer
+ extends NullComponentPeer implements FramePeer {
+
+ //jnode remove these methods after java.awt.peer integration
+ public void requestFocus() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean requestFocus(Component request, boolean temporary, boolean allowWindowFocus, long time) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setBounds(int x, int y, int width, int height) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setEventMask(long mask) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void cancelPendingPaint(int x, int y, int width, int height) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ //jnode
+
+
+ public void setTitle(String title) {}
+ public void setIconImage(Image im) {}
+ public void updateIconImages() {}
+ public void setMenuBar(MenuBar mb) {}
+ public void setResizable(boolean resizeable) {}
+ public void setState(int state) {}
+ public int getState() { return Frame.NORMAL; }
+ public void setMaximizedBounds(Rectangle b) {}
+ public void toFront() {}
+ public void toBack() {}
+ public void updateFocusableWindowState() {}
+ public void updateAlwaysOnTop() {}
+ public void setAlwaysOnTop(boolean alwaysOnTop) {}
+ public Component getGlobalHeavyweightFocusOwner() { return null; }
+ public void setBoundsPrivate(int x, int y, int width, int height) {
+ setBounds(x, y, width, height, SET_BOUNDS);
+ }
+ public Rectangle getBoundsPrivate() {
+ return getBounds();
+ }
+ public void setModalBlocked(Dialog blocker, boolean blocked) {}
+
+ /**
+ * @see java.awt.peer.ContainerPeer#restack
+ */
+ public void restack() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.awt.peer.ContainerPeer#isRestackSupported
+ */
+ public boolean isRestackSupported() {
+ return false;
+ }
+ public boolean requestWindowFocus() {
+ return false;
+ }
+ public void updateMinimumSize() {
+ }
+ }
+} // class EmbeddedFrame
Added: trunk/core/src/openjdk/sun/sun/awt/NullComponentPeer.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/awt/NullComponentPeer.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/awt/NullComponentPeer.java 2007-08-25 19:32:10 UTC (rev 3418)
@@ -0,0 +1,321 @@
+/*
+ * Copyright 2000-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 sun.awt;
+
+import java.awt.AWTException;
+import java.awt.BufferCapabilities;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Insets;
+import java.awt.MenuBar;
+import java.awt.Point;
+import java.awt.Event;
+import java.awt.event.PaintEvent;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.VolatileImage;
+import java.awt.peer.CanvasPeer;
+import java.awt.peer.LightweightPeer;
+import java.awt.peer.PanelPeer;
+import java.awt.peer.ComponentPeer;
+import java.awt.peer.ContainerPeer;
+import java.awt.Rectangle;
+
+/**
+ * Implements the LightweightPeer interface for use in lightweight components
+ * that have no native window associated with them. This gets created by
+ * default in Component so that Component and Container can be directly
+ * extended to create useful components written entirely in java. These
+ * components must be hosted somewhere higher up in the component tree by a
+ * native container (such as a Frame).
+ *
+ * This implementation provides no useful semantics and serves only as a
+ * marker. One could provide alternative implementations in java that do
+ * something useful for some of the other peer interfaces to minimize the
+ * native code.
+ *
+ * This was renamed from java.awt.LightweightPeer (a horrible and confusing
+ * name) and moved from java.awt.Toolkit into sun.awt as a public class in
+ * its own file.
+ *
+ * @author Timothy Prinzing
+ * @author Michael Martak
+ */
+
+public class NullComponentPeer implements LightweightPeer,
+ CanvasPeer, PanelPeer {
+
+ public boolean isObscured() {
+ return false;
+ }
+
+ public boolean canDetermineObscurity() {
+ return false;
+ }
+
+ public boolean isFocusable() {
+ return false;
+ }
+
+ public void setVisible(boolean b) {
+ }
+
+ public void show() {
+ }
+
+ public void hide() {
+ }
+
+ public void setEnabled(boolean b) {
+ }
+
+ public void enable() {
+ }
+
+ public void disable() {
+ }
+
+ public void paint(Graphics g) {
+ }
+
+ public void repaint(long tm, int x, int y, int width, int height) {
+ }
+
+ public void print(Graphics g) {
+ }
+
+ public void setBounds(int x, int y, int width, int height, int op) {
+ }
+
+ public void reshape(int x, int y, int width, int height) {
+ }
+
+ public void coalescePaintEvent(PaintEvent e) {
+ }
+
+ public boolean handleEvent(Event e) {
+ return false;
+ }
+
+ public void handleEvent(java.awt.AWTEvent arg0) {
+ }
+
+ public Dimension getPreferredSize() {
+ return new Dimension(1,1);
+ }
+
+ public Dimension getMinimumSize() {
+ return new Dimension(1,1);
+ }
+
+ public java.awt.Toolkit getToolkit() {
+ return null;
+ }
+
+ public ColorModel getColorModel() {
+ return null;
+ }
+
+ public Graphics getGraphics() {
+ return null;
+ }
+
+ public GraphicsConfiguration getGraphicsConfiguration() {
+ return null;
+ }
+
+ public FontMetrics getFontMetrics(Font font) {
+ return null;
+ }
+
+ public void dispose() {
+ // no native code
+ }
+
+ public void setForeground(Color c) {
+ }
+
+ public void setBackground(Color c) {
+ }
+
+ public void setFont(Font f) {
+ }
+
+ public void updateCursorImmediately() {
+ }
+
+ public void setCursor(Cursor cursor) {
+ }
+
+ public boolean requestFocus
+ (Component lightweightChild, boolean temporary,
+ boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) {
+ return false;
+ }
+
+ public Image createImage(ImageProducer producer) {
+ return null;
+ }
+
+ public Image createImage(int width, int height) {
+ return null;
+ }
+
+ public boolean prepareImage(Image img, int w, int h, ImageObserver o) {
+ return false;
+ }
+
+ public int checkImage(Image img, int w, int h, ImageObserver o) {
+ return 0;
+ }
+
+ public Dimension preferredSize() {
+ return getPreferredSize();
+ }
+
+ public Dimension minimumSize() {
+ return getMinimumSize();
+ }
+
+ public Point getLocationOnScreen() {
+ return new Point(0,0);
+ }
+
+ public Insets getInsets() {
+ return insets();
+ }
+
+ public void beginValidate() {
+ }
+
+ public void endValidate() {
+ }
+
+ public Insets insets() {
+ return new Insets(0, 0, 0, 0);
+ }
+
+ public boolean isPaintPending() {
+ return false;
+ }
+
+ public boolean handlesWheelScrolling() {
+ return false;
+ }
+
+ public VolatileImage createVolatileImage(int width, int height) {
+ return null;
+ }
+
+ public void beginLayout() {
+ }
+
+ public void endLayout() {
+ }
+
+ public void createBuffers(int numBuffers, BufferCapabilities caps)
+ throws AWTException {
+ throw new AWTException(
+ "Page-flipping is not allowed on a lightweight component");
+ }
+ public Image getBackBuffer() {
+ throw new IllegalStateException(
+ "Page-flipping is not allowed on a lightweight component");
+ }
+ public void flip(BufferCapabilities.FlipContents flipAction) {
+ throw new IllegalStateException(
+ "Page-flipping is not allowed on a lightweight component");
+ }
+ public void destroyBuffers() {
+ }
+
+ /**
+ * @see java.awt.peer.ComponentPeer#isReparentSupported
+ */
+ public boolean isReparentSupported() {
+ return false;
+ }
+
+ /**
+ * @see java.awt.peer.ComponentPeer#reparent
+ */
+ public void reparent(ContainerPeer newNativeParent) {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.awt.peer.ContainerPeer#restack
+ */
+ public void restack() {
+ throw new UnsupportedOperationException();
+ }
+
+ /**
+ * @see java.awt.peer.ContainerPeer#isRestackSupported
+ */
+ public boolean isRestackSupported() {
+ return false;
+ }
+ public void layout() {
+ }
+
+ public Rectangle getBounds() {
+ return new Rectangle(0, 0, 0, 0);
+ }
+
+ //jnode
+ //remove these methods after java.awt.peer integration
+ public void requestFocus() {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public boolean requestFocus(Component request, boolean temporary, boolean allowWindowFocus, long time) {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setBounds(int x, int y, int width, int height) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void setEventMask(long mask) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public void cancelPendingPaint(int x, int y, int width, int height) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ //jnode
+}
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:40:22
|
Revision: 3430
http://jnode.svn.sourceforge.net/jnode/?rev=3430&view=rev
Author: lsantha
Date: 2007-08-25 13:15:42 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.tools.xml
Modified: trunk/core/descriptors/org.classpath.tools.xml
===================================================================
--- trunk/core/descriptors/org.classpath.tools.xml 2007-08-25 20:15:27 UTC (rev 3429)
+++ trunk/core/descriptors/org.classpath.tools.xml 2007-08-25 20:15:42 UTC (rev 3430)
@@ -22,8 +22,6 @@
<export name="gnu.classpath.tools.orbd.*"/>
<export name="gnu.classpath.tools.rmid.*"/>
<export name="gnu.classpath.tools.rmiregistry.*"/>
- <export name="gnu.classpath.tools.rmic.*"/>
- <export name="gnu.classpath.tools.rmic.templates.*"/>
<export name="gnu.classpath.tools.serialver.*"/>
<export name="gnu.classpath.tools.tnameserv.*"/>
@@ -46,7 +44,6 @@
<alias name="keytool" class="gnu.classpath.tools.keytool.Main"/>
<alias name="native2ascii" class="gnu.classpath.tools.native2ascii.Native2ASCII"/>
<alias name="orbd" class="gnu.classpath.tools.orbd.Main"/>
- <alias name="rmic" class="gnu.classpath.tools.rmic.Main"/>
<alias name="rmid" class="gnu.classpath.tools.rmid.Main"/>
<alias name="rmiregistry" class="gnu.classpath.tools.rmiregistry.Main"/>
<alias name="serialver" class="gnu.classpath.tools.serialver.SerialVer"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:39:53
|
Revision: 3416
http://jnode.svn.sourceforge.net/jnode/?rev=3416&view=rev
Author: lsantha
Date: 2007-08-25 12:28:35 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java
trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java 2007-08-25 19:27:54 UTC (rev 3415)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/DesktopFramePeer.java 2007-08-25 19:28:35 UTC (rev 3416)
@@ -383,13 +383,6 @@
}
/**
- * @see java.awt.peer.ComponentPeer#isFocusTraversable()
- */
- public boolean isFocusTraversable() {
- return false;
- }
-
- /**
* @see java.awt.peer.ComponentPeer#isObscured()
*/
public boolean isObscured() {
@@ -602,6 +595,13 @@
//TODO implement it
}
+
+ //jnode openjdk
+ public Rectangle getBoundsPrivate() {
+ //TODO implement it
+ return null;
+ }
+
protected final void paintAWTComponent() {
if (targetComponent != null) {
toolkit.postEvent(new PaintEvent(targetComponent, PaintEvent.PAINT, targetComponent
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2007-08-25 19:27:54 UTC (rev 3415)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingComponentPeer.java 2007-08-25 19:28:35 UTC (rev 3416)
@@ -272,14 +272,6 @@
return peerComponent.isFocusable();
}
- /**
- * @see java.awt.peer.ComponentPeer#isFocusTraversable()
- */
- @SuppressWarnings("deprecation")
- public final boolean isFocusTraversable() {
- return peerComponent.isFocusTraversable();
- }
-
// Obscurity
public boolean isObscured() {
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java 2007-08-25 19:27:54 UTC (rev 3415)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingFramePeer.java 2007-08-25 19:28:35 UTC (rev 3416)
@@ -110,4 +110,11 @@
public void setBoundsPrivate(int x, int y, int width, int height) {
//TODO implement it
}
+
+
+ //jnode openjdk
+ public Rectangle getBoundsPrivate() {
+ //TODO implement it
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
}
Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java
===================================================================
--- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java 2007-08-25 19:27:54 UTC (rev 3415)
+++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingJFramePeer.java 2007-08-25 19:28:35 UTC (rev 3416)
@@ -398,4 +398,11 @@
public void setBoundsPrivate(int x, int y, int width, int height) {
}
+
+
+ //jnode openjdk
+ public Rectangle getBoundsPrivate() {
+ //todo implement it
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:39:53
|
Revision: 3429
http://jnode.svn.sourceforge.net/jnode/?rev=3429&view=rev
Author: lsantha
Date: 2007-08-25 13:15:27 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/org/org/objectweb/asm/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:36:02
|
Revision: 3403
http://jnode.svn.sourceforge.net/jnode/?rev=3403&view=rev
Author: lsantha
Date: 2007-08-25 01:08:47 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Trivial support for file renaming.
Modified Paths:
--------------
trunk/core/src/classpath/vm/java/io/VMFile.java
Modified: trunk/core/src/classpath/vm/java/io/VMFile.java
===================================================================
--- trunk/core/src/classpath/vm/java/io/VMFile.java 2007-08-25 08:06:59 UTC (rev 3402)
+++ trunk/core/src/classpath/vm/java/io/VMFile.java 2007-08-25 08:08:47 UTC (rev 3403)
@@ -88,8 +88,21 @@
* This native method actually performs the rename.
*/
static boolean renameTo(String targetpath, String destpath) {
- // TODO: implement VMFile.renameTo
- return false;
+ try{
+ //todo improve it
+ FileInputStream fis = new FileInputStream(targetpath);
+ FileOutputStream fos = new FileOutputStream(destpath);
+ byte[] buf = new byte[64*1024];
+ int c = 0;
+ while((c = fis.read(buf)) >= 0){
+ fos.write(buf, 0, c);
+ }
+ fis.close();
+ fos.close();
+ return new File(targetpath).delete();
+ } catch(Exception e){
+ return false;
+ }
}
/*
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-27 15:33:51
|
Revision: 3413
http://jnode.svn.sourceforge.net/jnode/?rev=3413&view=rev
Author: lsantha
Date: 2007-08-25 12:25:55 -0700 (Sat, 25 Aug 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/sun/sun/applet/
trunk/core/src/openjdk/sun/sun/applet/AppletAudioClip.java
trunk/core/src/openjdk/sun/sun/applet/AppletClassLoader.java
trunk/core/src/openjdk/sun/sun/applet/AppletEvent.java
trunk/core/src/openjdk/sun/sun/applet/AppletEventMulticaster.java
trunk/core/src/openjdk/sun/sun/applet/AppletIOException.java
trunk/core/src/openjdk/sun/sun/applet/AppletIllegalArgumentException.java
trunk/core/src/openjdk/sun/sun/applet/AppletImageRef.java
trunk/core/src/openjdk/sun/sun/applet/AppletListener.java
trunk/core/src/openjdk/sun/sun/applet/AppletMessageHandler.java
trunk/core/src/openjdk/sun/sun/applet/AppletObjectInputStream.java
trunk/core/src/openjdk/sun/sun/applet/AppletPanel.java
trunk/core/src/openjdk/sun/sun/applet/AppletProps.java
trunk/core/src/openjdk/sun/sun/applet/AppletResourceLoader.java
trunk/core/src/openjdk/sun/sun/applet/AppletSecurity.java
trunk/core/src/openjdk/sun/sun/applet/AppletSecurityException.java
trunk/core/src/openjdk/sun/sun/applet/AppletThreadGroup.java
trunk/core/src/openjdk/sun/sun/applet/AppletViewer.java
trunk/core/src/openjdk/sun/sun/applet/AppletViewerFactory.java
trunk/core/src/openjdk/sun/sun/applet/AppletViewerPanel.java
trunk/core/src/openjdk/sun/sun/applet/Main.java
trunk/core/src/openjdk/sun/sun/applet/resources/
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_de.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_es.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_fr.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_it.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_ja.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_ko.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_sv.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_zh_CN.java
trunk/core/src/openjdk/sun/sun/applet/resources/MsgAppletViewer_zh_TW.java
Added: trunk/core/src/openjdk/sun/sun/applet/AppletAudioClip.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletAudioClip.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletAudioClip.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,152 @@
+/*
+ * Copyright 1995-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 sun.applet;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.net.URL;
+import java.net.URLConnection;
+import java.applet.AudioClip;
+
+import com.sun.media.sound.JavaSoundAudioClip;
+
+
+/**
+ * Applet audio clip;
+ *
+ * @version 1.40 07/05/05
+ * @author Arthur van Hoff, Kara Kytle
+ */
+
+public class AppletAudioClip implements AudioClip {
+
+ // url that this AudioClip is based on
+ private URL url = null;
+
+ // the audio clip implementation
+ private AudioClip audioClip = null;
+
+ boolean DEBUG = false /*true*/;
+
+ /**
+ * Constructs an AppletAudioClip from an URL.
+ */
+ public AppletAudioClip(URL url) {
+
+ // store the url
+ this.url = url;
+
+ try {
+ // create a stream from the url, and use it
+ // in the clip.
+ InputStream in = url.openStream();
+ createAppletAudioClip(in);
+
+ } catch (IOException e) {
+ /* just quell it */
+ if (DEBUG) {
+ System.err.println("IOException creating AppletAudioClip" + e);
+ }
+ }
+ }
+
+ /**
+ * Constructs an AppletAudioClip from a URLConnection.
+ */
+ public AppletAudioClip(URLConnection uc) {
+
+ try {
+ // create a stream from the url, and use it
+ // in the clip.
+ createAppletAudioClip(uc.getInputStream());
+
+ } catch (IOException e) {
+ /* just quell it */
+ if (DEBUG) {
+ System.err.println("IOException creating AppletAudioClip" + e);
+ }
+ }
+ }
+
+
+ /**
+ * For constructing directly from Jar entries, or any other
+ * raw Audio data. Note that the data provided must include the format
+ * header.
+ */
+ public AppletAudioClip(byte [] data) {
+
+ try {
+
+ // construct a stream from the byte array
+ InputStream in = new ByteArrayInputStream(data);
+
+ createAppletAudioClip(in);
+
+ } catch (IOException e) {
+ /* just quell it */
+ if (DEBUG) {
+ System.err.println("IOException creating AppletAudioClip " + e);
+ }
+ }
+ }
+
+
+ /*
+ * Does the real work of creating an AppletAudioClip from an InputStream.
+ * This function is used by both constructors.
+ */
+ void createAppletAudioClip(InputStream in) throws IOException {
+
+ try {
+ audioClip = new JavaSoundAudioClip(in);
+ } catch (Exception e3) {
+ // no matter what happened, we throw an IOException to avoid changing the interfaces....
+ throw new IOException("Failed to construct the AudioClip: " + e3);
+ }
+ }
+
+
+ public synchronized void play() {
+
+ if (audioClip != null)
+ audioClip.play();
+ }
+
+
+ public synchronized void loop() {
+
+ if (audioClip != null)
+ audioClip.loop();
+ }
+
+ public synchronized void stop() {
+
+ if (audioClip != null)
+ audioClip.stop();
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletClassLoader.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletClassLoader.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletClassLoader.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,861 @@
+/*
+ * Copyright 1995-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 sun.applet;
+
+import java.lang.NullPointerException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.net.SocketPermission;
+import java.net.URLConnection;
+import java.net.MalformedURLException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.BufferedInputStream;
+import java.io.InputStream;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.NoSuchElementException;
+import java.security.AccessController;
+import java.security.AccessControlContext;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+import sun.net.www.ParseUtil;
+import sun.security.util.SecurityConstants;
+
+/**
+ * This class defines the class loader for loading applet classes and
+ * resources. It extends URLClassLoader to search the applet code base
+ * for the class or resource after checking any loaded JAR files.
+ */
+public class AppletClassLoader extends URLClassLoader {
+ private URL base; /* applet code base URL */
+ private CodeSource codesource; /* codesource for the base URL */
+ private AccessControlContext acc;
+ private boolean exceptionStatus = false;
+
+ private final Object threadGroupSynchronizer = new Object();
+ private final Object grabReleaseSynchronizer = new Object();
+
+ private boolean codebaseLookup = true;
+
+ /*
+ * Creates a new AppletClassLoader for the specified base URL.
+ */
+ protected AppletClassLoader(URL base) {
+ super(new URL[0]);
+ this.base = base;
+ this.codesource =
+ new CodeSource(base, (java.security.cert.Certificate[]) null);
+ acc = AccessController.getContext();
+ }
+
+ /**
+ * Set the codebase lookup flag.
+ */
+ void setCodebaseLookup(boolean codebaseLookup) {
+ this.codebaseLookup = codebaseLookup;
+ }
+
+ /*
+ * Returns the applet code base URL.
+ */
+ URL getBaseURL() {
+ return base;
+ }
+
+ /*
+ * Returns the URLs used for loading classes and resources.
+ */
+ public URL[] getURLs() {
+ URL[] jars = super.getURLs();
+ URL[] urls = new URL[jars.length + 1];
+ System.arraycopy(jars, 0, urls, 0, jars.length);
+ urls[urls.length - 1] = base;
+ return urls;
+ }
+
+ /*
+ * Adds the specified JAR file to the search path of loaded JAR files.
+ * Changed modifier to protected in order to be able to overwrite addJar()
+ * in PluginClassLoader.java
+ */
+ protected void addJar(String name) throws IOException {
+ URL url;
+ try {
+ url = new URL(base, name);
+ } catch (MalformedURLException e) {
+ throw new IllegalArgumentException("name");
+ }
+ addURL(url);
+ // DEBUG
+ //URL[] urls = getURLs();
+ //for (int i = 0; i < urls.length; i++) {
+ // System.out.println("url[" + i + "] = " + urls[i]);
+ //}
+ }
+
+ /*
+ * Override loadClass so that class loading errors can be caught in
+ * order to print better error messages.
+ */
+ public synchronized Class loadClass(String name, boolean resolve)
+ throws ClassNotFoundException
+ {
+ // First check if we have permission to access the package. This
+ // should go away once we've added support for exported packages.
+ int i = name.lastIndexOf('.');
+ if (i != -1) {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null)
+ sm.checkPackageAccess(name.substring(0, i));
+ }
+ try {
+ return super.loadClass(name, resolve);
+ } catch (ClassNotFoundException e) {
+ //printError(name, e.getException());
+ throw e;
+ } catch (RuntimeException e) {
+ //printError(name, e);
+ throw e;
+ } catch (Error e) {
+ //printError(name, e);
+ throw e;
+ }
+ }
+
+ /*
+ * Finds the applet class with the specified name. First searches
+ * loaded JAR files then the applet code base for the class.
+ */
+ protected Class findClass(String name) throws ClassNotFoundException {
+
+ int index = name.indexOf(";");
+ String cookie = "";
+ if(index != -1) {
+ cookie = name.substring(index, name.length());
+ name = name.substring(0, index);
+ }
+
+ // check loaded JAR files
+ try {
+ return super.findClass(name);
+ } catch (ClassNotFoundException e) {
+ }
+
+ // Otherwise, try loading the class from the code base URL
+
+ // 4668479: Option to turn off codebase lookup in AppletClassLoader
+ // during resource requests. [stanley.ho]
+ if (codebaseLookup == false)
+ throw new ClassNotFoundException(name);
+
+// final String path = name.replace('.', '/').concat(".class").concat(cookie);
+ String encodedName = ParseUtil.encodePath(name.replace('.', '/'), false);
+ final String path = (new StringBuffer(encodedName)).append(".class").append(cookie).toString();
+ try {
+ byte[] b = (byte[]) AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run() throws IOException {
+ return getBytes(new URL(base, path));
+ }
+ }, acc);
+
+ if (b != null) {
+ return defineClass(name, b, 0, b.length, codesource);
+ } else {
+ throw new ClassNotFoundException(name);
+ }
+ } catch (PrivilegedActionException e) {
+ throw new ClassNotFoundException(name, e.getException());
+ }
+ }
+
+ /**
+ * Returns the permissions for the given codesource object.
+ * The implementation of this method first calls super.getPermissions,
+ * to get the permissions
+ * granted by the super class, and then adds additional permissions
+ * based on the URL of the codesource.
+ * <p>
+ * If the protocol is "file"
+ * and the path specifies a file, permission is granted to read all files
+ * and (recursively) all files and subdirectories contained in
+ * that directory. This is so applets with a codebase of
+ * file:/blah/some.jar can read in file:/blah/, which is needed to
+ * be backward compatible. We also add permission to connect back to
+ * the "localhost".
+ *
+ * @param codesource the codesource
+ * @return the permissions granted to the codesource
+ */
+ protected PermissionCollection getPermissions(CodeSource codesource)
+ {
+ final PermissionCollection perms = super.getPermissions(codesource);
+
+ URL url = codesource.getLocation();
+
+ String path = null;
+ Permission p;
+
+ try {
+ p = url.openConnection().getPermission();
+ } catch (java.io.IOException ioe) {
+ p = null;
+ }
+
+ if (p instanceof FilePermission) {
+ path = p.getName();
+ } else if ((p == null) && (url.getProtocol().equals("file"))) {
+ path = url.getFile().replace('/', File.separatorChar);
+ path = ParseUtil.decode(path);
+ }
+
+ if (path != null) {
+ if (!path.endsWith(File.separator)) {
+ int endIndex = path.lastIndexOf(File.separatorChar);
+ if (endIndex != -1) {
+ path = path.substring(0, endIndex+1) + "-";
+ perms.add(new FilePermission(path,
+ SecurityConstants.FILE_READ_ACTION));
+ }
+ }
+ perms.add(new SocketPermission("localhost",
+ SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION));
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ try {
+ String host = InetAddress.getLocalHost().getHostName();
+ perms.add(new SocketPermission(host,
+ SecurityConstants.SOCKET_CONNECT_ACCEPT_ACTION));
+ } catch (UnknownHostException uhe) {
+
+ }
+ return null;
+ }
+ });
+
+ Permission bperm;
+ try {
+ bperm = base.openConnection().getPermission();
+ } catch (java.io.IOException ioe) {
+ bperm = null;
+ }
+ if (bperm instanceof FilePermission) {
+ String bpath = bperm.getName();
+ if (bpath.endsWith(File.separator)) {
+ bpath += "-";
+ }
+ perms.add(new FilePermission(bpath,
+ SecurityConstants.FILE_READ_ACTION));
+ } else if ((bperm == null) && (base.getProtocol().equals("file"))) {
+ String bpath = base.getFile().replace('/', File.separatorChar);
+ bpath = ParseUtil.decode(bpath);
+ if (bpath.endsWith(File.separator)) {
+ bpath += "-";
+ }
+ perms.add(new FilePermission(bpath, SecurityConstants.FILE_READ_ACTION));
+ }
+
+ }
+ return perms;
+ }
+
+ /*
+ * Returns the contents of the specified URL as an array of bytes.
+ */
+ private static byte[] getBytes(URL url) throws IOException {
+ URLConnection uc = url.openConnection();
+ if (uc instanceof java.net.HttpURLConnection) {
+ java.net.HttpURLConnection huc = (java.net.HttpURLConnection) uc;
+ int code = huc.getResponseCode();
+ if (code >= java.net.HttpURLConnection.HTTP_BAD_REQUEST) {
+ throw new IOException("open HTTP connection failed.");
+ }
+ }
+ int len = uc.getContentLength();
+
+ // Fixed #4507227: Slow performance to load
+ // class and resources. [stanleyh]
+ //
+ // Use buffered input stream [stanleyh]
+ InputStream in = new BufferedInputStream(uc.getInputStream());
+
+ byte[] b;
+ try {
+ if (len != -1) {
+ // Read exactly len bytes from the input stream
+ b = new byte[len];
+ while (len > 0) {
+ int n = in.read(b, b.length - len, len);
+ if (n == -1) {
+ throw new IOException("unexpected EOF");
+ }
+ len -= n;
+ }
+ } else {
+ // Read until end of stream is reached - use 8K buffer
+ // to speed up performance [stanleyh]
+ b = new byte[8192];
+ int total = 0;
+ while ((len = in.read(b, total, b.length - total)) != -1) {
+ total += len;
+ if (total >= b.length) {
+ byte[] tmp = new byte[total * 2];
+ System.arraycopy(b, 0, tmp, 0, total);
+ b = tmp;
+ }
+ }
+ // Trim array to correct size, if necessary
+ if (total != b.length) {
+ byte[] tmp = new byte[total];
+ System.arraycopy(b, 0, tmp, 0, total);
+ b = tmp;
+ }
+ }
+ } finally {
+ in.close();
+ }
+ return b;
+ }
+
+ // Object for synchronization around getResourceAsStream()
+ private Object syncResourceAsStream = new Object();
+ private Object syncResourceAsStreamFromJar = new Object();
+
+ // Flag to indicate getResourceAsStream() is in call
+ private boolean resourceAsStreamInCall = false;
+ private boolean resourceAsStreamFromJarInCall = false;
+
+ /**
+ * Returns an input stream for reading the specified resource.
+ *
+ * The search order is described in the documentation for {@link
+ * #getResource(String)}.<p>
+ *
+ * @param name the resource name
+ * @return an input stream for reading the resource, or <code>null</code>
+ * if the resource could not be found
+ * @since JDK1.1
+ */
+ public InputStream getResourceAsStream(String name)
+ {
+
+ if (name == null) {
+ throw new NullPointerException("name");
+ }
+
+ try
+ {
+ InputStream is = null;
+
+ // Fixed #4507227: Slow performance to load
+ // class and resources. [stanleyh]
+ //
+ // The following is used to avoid calling
+ // AppletClassLoader.findResource() in
+ // super.getResourceAsStream(). Otherwise,
+ // unnecessary connection will be made.
+ //
+ synchronized(syncResourceAsStream)
+ {
+ resourceAsStreamInCall = true;
+
+ // Call super class
+ is = super.getResourceAsStream(name);
+
+ resourceAsStreamInCall = false;
+ }
+
+ // 4668479: Option to turn off codebase lookup in AppletClassLoader
+ // during resource requests. [stanley.ho]
+ if (codebaseLookup == true && is == null)
+ {
+ // If resource cannot be obtained,
+ // try to download it from codebase
+ URL url = new URL(base, ParseUtil.encodePath(name, false));
+ is = url.openStream();
+ }
+
+ return is;
+ }
+ catch (Exception e)
+ {
+ return null;
+ }
+ }
+
+
+ /**
+ * Returns an input stream for reading the specified resource from the
+ * the loaded jar files.
+ *
+ * The search order is described in the documentation for {@link
+ * #getResource(String)}.<p>
+ *
+ * @param name the resource name
+ * @return an input stream for reading the resource, or <code>null</code>
+ * if the resource could not be found
+ * @since JDK1.1
+ */
+ public InputStream getResourceAsStreamFromJar(String name) {
+
+ if (name == null) {
+ throw new NullPointerException("name");
+ }
+
+ try {
+ InputStream is = null;
+ synchronized(syncResourceAsStreamFromJar) {
+ resourceAsStreamFromJarInCall = true;
+ // Call super class
+ is = super.getResourceAsStream(name);
+ resourceAsStreamFromJarInCall = false;
+ }
+
+ return is;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+
+ /*
+ * Finds the applet resource with the specified name. First checks
+ * loaded JAR files then the applet code base for the resource.
+ */
+ public URL findResource(String name) {
+ // check loaded JAR files
+ URL url = super.findResource(name);
+
+ // 6215746: Disable META-INF/* lookup from codebase in
+ // applet/plugin classloader. [stanley.ho]
+ if (name.startsWith("META-INF/"))
+ return url;
+
+ // 4668479: Option to turn off codebase lookup in AppletClassLoader
+ // during resource requests. [stanley.ho]
+ if (codebaseLookup == false)
+ return url;
+
+ if (url == null)
+ {
+ //#4805170, if it is a call from Applet.getImage()
+ //we should check for the image only in the archives
+ boolean insideGetResourceAsStreamFromJar = false;
+ synchronized(syncResourceAsStreamFromJar) {
+ insideGetResourceAsStreamFromJar = resourceAsStreamFromJarInCall;
+ }
+
+ if (insideGetResourceAsStreamFromJar) {
+ return null;
+ }
+
+ // Fixed #4507227: Slow performance to load
+ // class and resources. [stanleyh]
+ //
+ // Check if getResourceAsStream is called.
+ //
+ boolean insideGetResourceAsStream = false;
+
+ synchronized(syncResourceAsStream)
+ {
+ insideGetResourceAsStream = resourceAsStreamInCall;
+ }
+
+ // If getResourceAsStream is called, don't
+ // trigger the following code. Otherwise,
+ // unnecessary connection will be made.
+ //
+ if (insideGetResourceAsStream == false)
+ {
+ // otherwise, try the code base
+ try {
+ url = new URL(base, ParseUtil.encodePath(name, false));
+ // check if resource exists
+ if(!resourceExists(url))
+ url = null;
+ } catch (Exception e) {
+ // all exceptions, including security exceptions, are caught
+ url = null;
+ }
+ }
+ }
+ return url;
+ }
+
+
+ private boolean resourceExists(URL url) {
+ // Check if the resource exists.
+ // It almost works to just try to do an openConnection() but
+ // HttpURLConnection will return true on HTTP_BAD_REQUEST
+ // when the requested name ends in ".html", ".htm", and ".txt"
+ // and we want to be able to handle these
+ //
+ // Also, cannot just open a connection for things like FileURLConnection,
+ // because they succeed when connecting to a nonexistent file.
+ // So, in those cases we open and close an input stream.
+ boolean ok = true;
+ try {
+ URLConnection conn = url.openConnection();
+ if (conn instanceof java.net.HttpURLConnection) {
+ java.net.HttpURLConnection hconn =
+ (java.net.HttpURLConnection) conn;
+
+ // To reduce overhead, using http HEAD method instead of GET method
+ hconn.setRequestMethod("HEAD");
+
+ int code = hconn.getResponseCode();
+ if (code == java.net.HttpURLConnection.HTTP_OK) {
+ return true;
+ }
+ if (code >= java.net.HttpURLConnection.HTTP_BAD_REQUEST) {
+ return false;
+ }
+ } else {
+ /**
+ * Fix for #4182052 - stanleyh
+ *
+ * The same connection should be reused to avoid multiple
+ * HTTP connections
+ */
+
+ // our best guess for the other cases
+ InputStream is = conn.getInputStream();
+ is.close();
+ }
+ } catch (Exception ex) {
+ ok = false;
+ }
+ return ok;
+ }
+
+ /*
+ * Returns an enumeration of all the applet resources with the specified
+ * name. First checks loaded JAR files then the applet code base for all
+ * available resources.
+ */
+ public Enumeration findResources(String name) throws IOException {
+
+ final Enumeration e = super.findResources(name);
+
+ // 6215746: Disable META-INF/* lookup from codebase in
+ // applet/plugin classloader. [stanley.ho]
+ if (name.startsWith("META-INF/"))
+ return e;
+
+ // 4668479: Option to turn off codebase lookup in AppletClassLoader
+ // during resource requests. [stanley.ho]
+ if (codebaseLookup == false)
+ return e;
+
+ URL u = new URL(base, ParseUtil.encodePath(name, false));
+ if (!resourceExists(u)) {
+ u = null;
+ }
+
+ final URL url = u;
+ return new Enumeration() {
+ private boolean done;
+ public Object nextElement() {
+ if (!done) {
+ if (e.hasMoreElements()) {
+ return e.nextElement();
+ }
+ done = true;
+ if (url != null) {
+ return url;
+ }
+ }
+ throw new NoSuchElementException();
+ }
+ public boolean hasMoreElements() {
+ return !done && (e.hasMoreElements() || url != null);
+ }
+ };
+ }
+
+ /*
+ * Load and resolve the file specified by the applet tag CODE
+ * attribute. The argument can either be the relative path
+ * of the class file itself or just the name of the class.
+ */
+ Class loadCode(String name) throws ClassNotFoundException {
+ // first convert any '/' or native file separator to .
+ name = name.replace('/', '.');
+ name = name.replace(File.separatorChar, '.');
+
+ // deal with URL rewriting
+ String cookie = null;
+ int index = name.indexOf(";");
+ if(index != -1) {
+ cookie = name.substring(index, name.length());
+ name = name.substring(0, index);
+ }
+
+ // save that name for later
+ String fullName = name;
+ // then strip off any suffixes
+ if (name.endsWith(".class") || name.endsWith(".java")) {
+ name = name.substring(0, name.lastIndexOf('.'));
+ }
+ try {
+ if(cookie != null)
+ name = (new StringBuffer(name)).append(cookie).toString();
+ return loadClass(name);
+ } catch (ClassNotFoundException e) {
+ }
+ // then if it didn't end with .java or .class, or in the
+ // really pathological case of a class named class or java
+ if(cookie != null)
+ fullName = (new StringBuffer(fullName)).append(cookie).toString();
+
+ return loadClass(fullName);
+ }
+
+ /*
+ * The threadgroup that the applets loaded by this classloader live
+ * in. In the sun.* implementation of applets, the security manager's
+ * (AppletSecurity) getThreadGroup returns the thread group of the
+ * first applet on the stack, which is the applet's thread group.
+ */
+ private AppletThreadGroup threadGroup;
+ private AppContext appContext;
+
+ ThreadGroup getThreadGroup() {
+ synchronized (threadGroupSynchronizer) {
+ if (threadGroup == null || threadGroup.isDestroyed()) {
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ threadGroup = new AppletThreadGroup(base + "-threadGroup");
+ // threadGroup.setDaemon(true);
+ // threadGroup is now destroyed by AppContext.dispose()
+
+ // Create the new AppContext from within a Thread belonging
+ // to the newly created ThreadGroup, and wait for the
+ // creation to complete before returning from this method.
+ AppContextCreator creatorThread = new AppContextCreator(threadGroup);
+
+ // Since this thread will later be used to launch the
+ // applet's AWT-event dispatch thread and we want the applet
+ // code executing the AWT callbacks to use their own class
+ // loader rather than the system class loader, explicitly
+ // set the context class loader to the AppletClassLoader.
+ creatorThread.setContextClassLoader(AppletClassLoader.this);
+
+ synchronized(creatorThread.syncObject) {
+ creatorThread.start();
+ try {
+ creatorThread.syncObject.wait();
+ } catch (InterruptedException e) { }
+ appContext = creatorThread.appContext;
+ }
+ return null;
+ }
+ });
+ }
+ return threadGroup;
+ }
+ }
+
+ /*
+ * Get the AppContext, if any, corresponding to this AppletClassLoader.
+ */
+ AppContext getAppContext() {
+ return appContext;
+ }
+
+ int usageCount = 0;
+
+ /**
+ * Grab this AppletClassLoader and its ThreadGroup/AppContext, so they
+ * won't be destroyed.
+ */
+ void grab() {
+ synchronized(grabReleaseSynchronizer) {
+ usageCount++;
+ }
+ getThreadGroup(); // Make sure ThreadGroup/AppContext exist
+ }
+
+ protected void setExceptionStatus()
+ {
+ exceptionStatus = true;
+ }
+
+ public boolean getExceptionStatus()
+ {
+ return exceptionStatus;
+ }
+
+ /**
+ * Release this AppletClassLoader and its ThreadGroup/AppContext.
+ * If nothing else has grabbed this AppletClassLoader, its ThreadGroup
+ * and AppContext will be destroyed.
+ *
+ * Because this method may destroy the AppletClassLoader's ThreadGroup,
+ * this method should NOT be called from within the AppletClassLoader's
+ * ThreadGroup.
+ *
+ * Changed modifier to protected in order to be able to overwrite this
+ * function in PluginClassLoader.java
+ */
+ protected void release() {
+
+ AppContext tempAppContext = null;
+
+ synchronized(grabReleaseSynchronizer) {
+ if (usageCount > 1) {
+ --usageCount;
+ } else {
+ synchronized(threadGroupSynchronizer) {
+ // Store app context in temp variable
+ tempAppContext = appContext;
+ usageCount = 0;
+ appContext = null;
+ threadGroup = null;
+ }
+ }
+ }
+
+ // Dispose appContext outside any sync block to
+ // prevent potential deadlock.
+ if (tempAppContext != null) {
+ try {
+ tempAppContext.dispose(); // nuke the world!
+ } catch (IllegalThreadStateException e) { }
+ }
+ }
+
+ // Hash map to store applet compatibility info
+ private HashMap jdk11AppletInfo = new HashMap();
+ private HashMap jdk12AppletInfo = new HashMap();
+
+ /**
+ * Set applet target level as JDK 1.1.
+ *
+ * @param clazz Applet class.
+ * @param bool true if JDK is targeted for JDK 1.1;
+ * false otherwise.
+ */
+ void setJDK11Target(Class clazz, boolean bool)
+ {
+ jdk11AppletInfo.put(clazz.toString(), Boolean.valueOf(bool));
+ }
+
+ /**
+ * Set applet target level as JDK 1.2.
+ *
+ * @param clazz Applet class.
+ * @param bool true if JDK is targeted for JDK 1.2;
+ * false otherwise.
+ */
+ void setJDK12Target(Class clazz, boolean bool)
+ {
+ jdk12AppletInfo.put(clazz.toString(), Boolean.valueOf(bool));
+ }
+
+ /**
+ * Determine if applet is targeted for JDK 1.1.
+ *
+ * @param applet Applet class.
+ * @return TRUE if applet is targeted for JDK 1.1;
+ * FALSE if applet is not;
+ * null if applet is unknown.
+ */
+ Boolean isJDK11Target(Class clazz)
+ {
+ return (Boolean) jdk11AppletInfo.get(clazz.toString());
+ }
+
+ /**
+ * Determine if applet is targeted for JDK 1.2.
+ *
+ * @param applet Applet class.
+ * @return TRUE if applet is targeted for JDK 1.2;
+ * FALSE if applet is not;
+ * null if applet is unknown.
+ */
+ Boolean isJDK12Target(Class clazz)
+ {
+ return (Boolean) jdk12AppletInfo.get(clazz.toString());
+ }
+
+ private static AppletMessageHandler mh =
+ new AppletMessageHandler("appletclassloader");
+
+ /*
+ * Prints a class loading error message.
+ */
+ private static void printError(String name, Throwable e) {
+ String s = null;
+ if (e == null) {
+ s = mh.getMessage("filenotfound", name);
+ } else if (e instanceof IOException) {
+ s = mh.getMessage("fileioexception", name);
+ } else if (e instanceof ClassFormatError) {
+ s = mh.getMessage("fileformat", name);
+ } else if (e instanceof ThreadDeath) {
+ s = mh.getMessage("filedeath", name);
+ } else if (e instanceof Error) {
+ s = mh.getMessage("fileerror", e.toString(), name);
+ }
+ if (s != null) {
+ System.err.println(s);
+ }
+ }
+}
+
+/*
+ * The AppContextCreator class is used to create an AppContext from within
+ * a Thread belonging to the new AppContext's ThreadGroup. To wait for
+ * this operation to complete before continuing, wait for the notifyAll()
+ * operation on the syncObject to occur.
+ */
+class AppContextCreator extends Thread {
+ Object syncObject = new Object();
+ AppContext appContext = null;
+
+ AppContextCreator(ThreadGroup group) {
+ super(group, "AppContextCreator");
+ }
+
+ public void run() {
+ synchronized(syncObject) {
+ appContext = SunToolkit.createNewAppContext();
+ syncObject.notifyAll();
+ }
+ } // run()
+
+} // class AppContextCreator
Added: trunk/core/src/openjdk/sun/sun/applet/AppletEvent.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletEvent.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletEvent.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,68 @@
+/*
+ * Copyright 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 sun.applet;
+
+import java.util.EventObject;
+
+
+/**
+ * AppletEvent class.
+ *
+ * @version 1.20, 05/05/07
+ * @author Sunita Mani
+ */
+
+public class AppletEvent extends EventObject {
+
+ private Object arg;
+ private int id;
+
+
+ public AppletEvent(Object source, int id, Object argument) {
+ super(source);
+ this.arg = argument;
+ this.id = id;
+ }
+
+ public int getID() {
+ return id;
+ }
+
+ public Object getArgument() {
+ return arg;
+ }
+
+ public String toString() {
+ String str = getClass().getName() + "[source=" + source + " + id="+ id;
+ if (arg != null) {
+ str += " + arg=" + arg;
+ }
+ str += " ]";
+ return str;
+ }
+}
+
+
Added: trunk/core/src/openjdk/sun/sun/applet/AppletEventMulticaster.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletEventMulticaster.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletEventMulticaster.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,128 @@
+/*
+ * Copyright 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 sun.applet;
+
+import java.util.EventListener;
+import java.io.Serializable;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+
+/**
+ * AppletEventMulticaster class. This class manages an immutable
+ * structure consisting of a chain of AppletListeners and is
+ * responsible for dispatching events to them.
+ *
+ * @version 1.18, 05/05/07
+ * @author Sunita Mani
+ */
+public class AppletEventMulticaster implements AppletListener {
+
+ private final AppletListener a, b;
+
+ public AppletEventMulticaster(AppletListener a, AppletListener b) {
+ this.a = a; this.b = b;
+ }
+
+ public void appletStateChanged(AppletEvent e) {
+ a.appletStateChanged(e);
+ b.appletStateChanged(e);
+ }
+
+ /**
+ * Adds Applet-listener-a with Applet-listener-b and
+ * returns the resulting multicast listener.
+ * @param a Applet-listener-a
+ * @param b Applet-listener-b
+ */
+ public static AppletListener add(AppletListener a, AppletListener b) {
+ return addInternal(a, b);
+ }
+
+ /**
+ * Removes the old Applet-listener from Applet-listener-l and
+ * returns the resulting multicast listener.
+ * @param l Applet-listener-l
+ * @param oldl the Applet-listener being removed
+ */
+ public static AppletListener remove(AppletListener l, AppletListener oldl) {
+ return removeInternal(l, oldl);
+ }
+
+ /**
+ * Returns the resulting multicast listener from adding listener-a
+ * and listener-b together.
+ * If listener-a is null, it returns listener-b;
+ * If listener-b is null, it returns listener-a
+ * If neither are null, then it creates and returns
+ * a new AppletEventMulticaster instance which chains a with b.
+ * @param a event listener-a
+ * @param b event listener-b
+ */
+ private static AppletListener addInternal(AppletListener a, AppletListener b) {
+ if (a == null) return b;
+ if (b == null) return a;
+ return new AppletEventMulticaster(a, b);
+ }
+
+
+ /**
+ * Removes a listener from this multicaster and returns the
+ * resulting multicast listener.
+ * @param oldl the listener to be removed
+ */
+ protected AppletListener remove(AppletListener oldl) {
+ if (oldl == a) return b;
+ if (oldl == b) return a;
+ AppletListener a2 = removeInternal(a, oldl);
+ AppletListener b2 = removeInternal(b, oldl);
+ if (a2 == a && b2 == b) {
+ return this; // it's not here
+ }
+ return addInternal(a2, b2);
+ }
+
+
+ /**
+ * Returns the resulting multicast listener after removing the
+ * old listener from listener-l.
+ * If listener-l equals the old listener OR listener-l is null,
+ * returns null.
+ * Else if listener-l is an instance of AppletEventMulticaster
+ * then it removes the old listener from it.
+ * Else, returns listener l.
+ * @param l the listener being removed from
+ * @param oldl the listener being removed
+ */
+ private static AppletListener removeInternal(AppletListener l, AppletListener oldl) {
+ if (l == oldl || l == null) {
+ return null;
+ } else if (l instanceof AppletEventMulticaster) {
+ return ((AppletEventMulticaster)l).remove(oldl);
+ } else {
+ return l; // it's not here
+ }
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletIOException.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletIOException.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletIOException.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1996 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 sun.applet;
+
+import java.io.IOException;
+
+/**
+ * An applet IO exception.
+ *
+ * @version 07/05/05
+ * @author Koji Uno
+ */
+public
+class AppletIOException extends IOException {
+ private String key = null;
+ private Object msgobj = null;
+
+ public AppletIOException(String key) {
+ super(key);
+ this.key = key;
+
+ }
+ public AppletIOException(String key, Object arg) {
+ this(key);
+ msgobj = arg;
+ }
+
+ public String getLocalizedMessage() {
+ if( msgobj != null)
+ return amh.getMessage(key, msgobj);
+ else
+ return amh.getMessage(key);
+ }
+
+ private static AppletMessageHandler amh = new AppletMessageHandler("appletioexception");
+
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletIllegalArgumentException.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletIllegalArgumentException.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletIllegalArgumentException.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,49 @@
+/*
+ * Copyright 1996 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 sun.applet;
+
+/**
+ * An applet security exception.
+ *
+ * @version 07/05/05
+ * @author Arthur van Hoff
+ */
+public
+class AppletIllegalArgumentException extends IllegalArgumentException {
+ private String key = null;
+
+ public AppletIllegalArgumentException(String key) {
+ super(key);
+ this.key = key;
+
+ }
+
+ public String getLocalizedMessage() {
+ return amh.getMessage(key);
+ }
+
+ private static AppletMessageHandler amh = new AppletMessageHandler("appletillegalargumentexception");
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletImageRef.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletImageRef.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletImageRef.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,54 @@
+/*
+ * Copyright 1996 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 sun.applet;
+
+import java.awt.Toolkit;
+import java.awt.Image;
+import sun.awt.image.URLImageSource;
+import java.net.URL;
+
+class AppletImageRef extends sun.misc.Ref {
+ URL url;
+
+ /**
+ * Create the Ref
+ */
+ AppletImageRef(URL url) {
+ this.url = url;
+ }
+
+ public void flush() {
+ super.flush();
+ }
+
+ /**
+ * Reconsitute the image. Only called when the ref has been flushed.
+ */
+ public Object reconstitute() {
+ Image img = Toolkit.getDefaultToolkit().createImage(new URLImageSource(url));
+ return img;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletListener.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletListener.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletListener.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,42 @@
+/*
+ * Copyright 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 sun.applet;
+
+import java.util.EventListener;
+
+/**
+ * Applet Listener interface. This interface is to be implemented
+ * by objects interested in AppletEvents.
+ *
+ * @version 1.16, 05/05/07
+ * @author Sunita Mani
+ */
+
+public interface AppletListener extends EventListener {
+ public void appletStateChanged(AppletEvent e);
+}
+
+
Added: trunk/core/src/openjdk/sun/sun/applet/AppletMessageHandler.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletMessageHandler.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletMessageHandler.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,114 @@
+/*
+ * 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 sun.applet;
+
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+import java.text.MessageFormat;
+
+/**
+ * An hanlder of localized messages.
+ *
+ * @version 1.24, 05/05/07
+ * @author Koji Uno
+ */
+class AppletMessageHandler {
+ private static ResourceBundle rb;
+ private String baseKey = null;
+
+ static {
+ try {
+ rb = ResourceBundle.getBundle
+ ("sun.applet.resources.MsgAppletViewer");
+ } catch (MissingResourceException e) {
+ System.out.println(e.getMessage());
+ System.exit(1);
+ }
+ }
+
+ AppletMessageHandler(String baseKey) {
+ this.baseKey = baseKey;
+ }
+
+ String getMessage(String key) {
+ return (String)rb.getString(getQualifiedKey(key));
+ }
+
+ String getMessage(String key, Object arg){
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[1];
+ if (arg == null) {
+ arg = "null"; // mimic java.io.PrintStream.print(String)
+ }
+ msgobj[0] = arg;
+ return msgfmt.format(msgobj);
+ }
+
+ String getMessage(String key, Object arg1, Object arg2) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[2];
+ if (arg1 == null) {
+ arg1 = "null";
+ }
+ if (arg2 == null) {
+ arg2 = "null";
+ }
+ msgobj[0] = arg1;
+ msgobj[1] = arg2;
+ return msgfmt.format(msgobj);
+ }
+
+ String getMessage(String key, Object arg1, Object arg2, Object arg3) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ Object msgobj[] = new Object[3];
+ if (arg1 == null) {
+ arg1 = "null";
+ }
+ if (arg2 == null) {
+ arg2 = "null";
+ }
+ if (arg3 == null) {
+ arg3 = "null";
+ }
+ msgobj[0] = arg1;
+ msgobj[1] = arg2;
+ msgobj[2] = arg3;
+ return msgfmt.format(msgobj);
+ }
+
+ String getMessage(String key, Object arg[]) {
+ String basemsgfmt = (String)rb.getString(getQualifiedKey(key));
+ MessageFormat msgfmt = new MessageFormat(basemsgfmt);
+ return msgfmt.format(arg);
+ }
+
+ String getQualifiedKey(String subKey) {
+ return baseKey + "." + subKey;
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletObjectInputStream.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletObjectInputStream.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletObjectInputStream.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,106 @@
+/*
+ * 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.
+ */
+/*
+ * COPYRIGHT goes here
+ */
+
+package sun.applet;
+
+import java.io.*;
+import java.lang.reflect.Array;
+
+/**
+ * This subclass of ObjectInputStream delegates loading of classes to
+ * an existing ClassLoader.
+ */
+
+class AppletObjectInputStream extends ObjectInputStream
+{
+ private AppletClassLoader loader;
+
+ /**
+ * Loader must be non-null;
+ */
+
+ public AppletObjectInputStream(InputStream in, AppletClassLoader loader)
+ throws IOException, StreamCorruptedException {
+
+ super(in);
+ if (loader == null) {
+ throw new AppletIllegalArgumentException("appletillegalargumentexception.objectinputstream");
+
+ }
+ this.loader = loader;
+ }
+
+ /**
+ * Make a primitive array class
+ */
+
+ private Class primitiveType(char type) {
+ switch (type) {
+ case 'B': return byte.class;
+ case 'C': return char.class;
+ case 'D': return double.class;
+ case 'F': return float.class;
+ case 'I': return int.class;
+ case 'J': return long.class;
+ case 'S': return short.class;
+ case 'Z': return boolean.class;
+ default: return null;
+ }
+ }
+
+ /**
+ * Use the given ClassLoader rather than using the system class
+ */
+ protected Class resolveClass(ObjectStreamClass classDesc)
+ throws IOException, ClassNotFoundException {
+
+ String cname = classDesc.getName();
+ if (cname.startsWith("[")) {
+ // An array
+ Class component; // component class
+ int dcount; // dimension
+ for (dcount=1; cname.charAt(dcount)=='['; dcount++) ;
+ if (cname.charAt(dcount) == 'L') {
+ component = loader.loadClass(cname.substring(dcount+1,
+ cname.length()-1));
+ } else {
+ if (cname.length() != dcount+1) {
+ throw new ClassNotFoundException(cname);// malformed
+ }
+ component = primitiveType(cname.charAt(dcount));
+ }
+ int dim[] = new int[dcount];
+ for (int i=0; i<dcount; i++) {
+ dim[i]=0;
+ }
+ return Array.newInstance(component, dim).getClass();
+ } else {
+ return loader.loadClass(cname);
+ }
+ }
+}
Added: trunk/core/src/openjdk/sun/sun/applet/AppletPanel.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/applet/AppletPanel.java (rev 0)
+++ trunk/core/src/openjdk/sun/sun/applet/AppletPanel.java 2007-08-25 19:25:55 UTC (rev 3413)
@@ -0,0 +1,1320 @@
+/*
+ * Copyright 1995-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 sun.applet;
+
+import java.applet.*;
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.ColorModel;
+import java.awt.image.MemoryImageSource;
+import java.io.*;
+import java.lang.ref.WeakReference;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.InetAddress;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.SocketPermission;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.security.*;
+import java.util.*;
+import java.util.Collections;
+import java.util.Locale;
+import java.util.WeakHashMap;
+import javax.swing.SwingUtilities;
+import sun.awt.AppContext;
+import sun.awt.EmbeddedFrame;
+import sun.awt.SunToolkit;
+import sun.misc.MessageUtils;
+import sun.misc.PerformanceLogger;
+import sun.misc.Queue;
+import sun.security.util.SecurityConstants;
+
+/**
+ * Applet panel class. The panel manages and manip...
[truncated message content] |
|
From: <fd...@us...> - 2007-08-26 11:13:47
|
Revision: 3434
http://jnode.svn.sourceforge.net/jnode/?rev=3434&view=rev
Author: fduminy
Date: 2007-08-26 02:11:46 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
openjdk integration
Modified Paths:
--------------
trunk/core/descriptors/org.classpath.core.xml
Modified: trunk/core/descriptors/org.classpath.core.xml
===================================================================
--- trunk/core/descriptors/org.classpath.core.xml 2007-08-26 07:53:04 UTC (rev 3433)
+++ trunk/core/descriptors/org.classpath.core.xml 2007-08-26 09:11:46 UTC (rev 3434)
@@ -13,6 +13,8 @@
<library name="jnode-core.jar">
<export name="com.sun.*" />
<export name="com.sun.naming.internal.*"/>
+
+ <export name="com.sun.tools.java.*"/>
<export name="sun.*" />
<export name="sun.awt.EventListenerAggregate" />
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2007-08-26 11:11:51
|
Revision: 3433
http://jnode.svn.sourceforge.net/jnode/?rev=3433&view=rev
Author: fduminy
Date: 2007-08-26 00:53:04 -0700 (Sun, 26 Aug 2007)
Log Message:
-----------
openjdk integration
Modified Paths:
--------------
trunk/all/conf/full-plugin-list.xml
trunk/core/.classpath
Added Paths:
-----------
trunk/core/descriptors/com.sun.tools.jdi.xml
trunk/core/src/openjdk/com/com/sun/jdi/
trunk/core/src/openjdk/com/com/sun/jdi/AbsentInformationException.java
trunk/core/src/openjdk/com/com/sun/jdi/Accessible.java
trunk/core/src/openjdk/com/com/sun/jdi/ArrayReference.java
trunk/core/src/openjdk/com/com/sun/jdi/ArrayType.java
trunk/core/src/openjdk/com/com/sun/jdi/BooleanType.java
trunk/core/src/openjdk/com/com/sun/jdi/BooleanValue.java
trunk/core/src/openjdk/com/com/sun/jdi/Bootstrap.java
trunk/core/src/openjdk/com/com/sun/jdi/ByteType.java
trunk/core/src/openjdk/com/com/sun/jdi/ByteValue.java
trunk/core/src/openjdk/com/com/sun/jdi/CharType.java
trunk/core/src/openjdk/com/com/sun/jdi/CharValue.java
trunk/core/src/openjdk/com/com/sun/jdi/ClassLoaderReference.java
trunk/core/src/openjdk/com/com/sun/jdi/ClassNotLoadedException.java
trunk/core/src/openjdk/com/com/sun/jdi/ClassNotPreparedException.java
trunk/core/src/openjdk/com/com/sun/jdi/ClassObjectReference.java
trunk/core/src/openjdk/com/com/sun/jdi/ClassType.java
trunk/core/src/openjdk/com/com/sun/jdi/DoubleType.java
trunk/core/src/openjdk/com/com/sun/jdi/DoubleValue.java
trunk/core/src/openjdk/com/com/sun/jdi/Field.java
trunk/core/src/openjdk/com/com/sun/jdi/FloatType.java
trunk/core/src/openjdk/com/com/sun/jdi/FloatValue.java
trunk/core/src/openjdk/com/com/sun/jdi/IncompatibleThreadStateException.java
trunk/core/src/openjdk/com/com/sun/jdi/InconsistentDebugInfoException.java
trunk/core/src/openjdk/com/com/sun/jdi/IntegerType.java
trunk/core/src/openjdk/com/com/sun/jdi/IntegerValue.java
trunk/core/src/openjdk/com/com/sun/jdi/InterfaceType.java
trunk/core/src/openjdk/com/com/sun/jdi/InternalException.java
trunk/core/src/openjdk/com/com/sun/jdi/InvalidCodeIndexException.java
trunk/core/src/openjdk/com/com/sun/jdi/InvalidLineNumberException.java
trunk/core/src/openjdk/com/com/sun/jdi/InvalidStackFrameException.java
trunk/core/src/openjdk/com/com/sun/jdi/InvalidTypeException.java
trunk/core/src/openjdk/com/com/sun/jdi/InvocationException.java
trunk/core/src/openjdk/com/com/sun/jdi/JDIPermission.java
trunk/core/src/openjdk/com/com/sun/jdi/LocalVariable.java
trunk/core/src/openjdk/com/com/sun/jdi/Locatable.java
trunk/core/src/openjdk/com/com/sun/jdi/Location.java
trunk/core/src/openjdk/com/com/sun/jdi/LongType.java
trunk/core/src/openjdk/com/com/sun/jdi/LongValue.java
trunk/core/src/openjdk/com/com/sun/jdi/Method.java
trunk/core/src/openjdk/com/com/sun/jdi/Mirror.java
trunk/core/src/openjdk/com/com/sun/jdi/MonitorInfo.java
trunk/core/src/openjdk/com/com/sun/jdi/NativeMethodException.java
trunk/core/src/openjdk/com/com/sun/jdi/ObjectCollectedException.java
trunk/core/src/openjdk/com/com/sun/jdi/ObjectReference.java
trunk/core/src/openjdk/com/com/sun/jdi/PathSearchingVirtualMachine.java
trunk/core/src/openjdk/com/com/sun/jdi/PrimitiveType.java
trunk/core/src/openjdk/com/com/sun/jdi/PrimitiveValue.java
trunk/core/src/openjdk/com/com/sun/jdi/ReferenceType.java
trunk/core/src/openjdk/com/com/sun/jdi/ShortType.java
trunk/core/src/openjdk/com/com/sun/jdi/ShortValue.java
trunk/core/src/openjdk/com/com/sun/jdi/StackFrame.java
trunk/core/src/openjdk/com/com/sun/jdi/StringReference.java
trunk/core/src/openjdk/com/com/sun/jdi/ThreadGroupReference.java
trunk/core/src/openjdk/com/com/sun/jdi/ThreadReference.java
trunk/core/src/openjdk/com/com/sun/jdi/Type.java
trunk/core/src/openjdk/com/com/sun/jdi/TypeComponent.java
trunk/core/src/openjdk/com/com/sun/jdi/VMCannotBeModifiedException.java
trunk/core/src/openjdk/com/com/sun/jdi/VMDisconnectedException.java
trunk/core/src/openjdk/com/com/sun/jdi/VMMismatchException.java
trunk/core/src/openjdk/com/com/sun/jdi/VMOutOfMemoryException.java
trunk/core/src/openjdk/com/com/sun/jdi/Value.java
trunk/core/src/openjdk/com/com/sun/jdi/VirtualMachine.java
trunk/core/src/openjdk/com/com/sun/jdi/VirtualMachineManager.java
trunk/core/src/openjdk/com/com/sun/jdi/VoidType.java
trunk/core/src/openjdk/com/com/sun/jdi/VoidValue.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/
trunk/core/src/openjdk/com/com/sun/jdi/connect/AttachingConnector.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/Connector.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/IllegalConnectorArgumentsException.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/LaunchingConnector.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/ListeningConnector.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/Transport.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/TransportTimeoutException.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/VMStartException.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/package.html
trunk/core/src/openjdk/com/com/sun/jdi/connect/spi/
trunk/core/src/openjdk/com/com/sun/jdi/connect/spi/ClosedConnectionException.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/spi/Connection.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/spi/TransportService.java
trunk/core/src/openjdk/com/com/sun/jdi/connect/spi/package.html
trunk/core/src/openjdk/com/com/sun/jdi/doc-files/
trunk/core/src/openjdk/com/com/sun/jdi/doc-files/signature.html
trunk/core/src/openjdk/com/com/sun/jdi/event/
trunk/core/src/openjdk/com/com/sun/jdi/event/AccessWatchpointEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/BreakpointEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ClassPrepareEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ClassUnloadEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/Event.java
trunk/core/src/openjdk/com/com/sun/jdi/event/EventIterator.java
trunk/core/src/openjdk/com/com/sun/jdi/event/EventQueue.java
trunk/core/src/openjdk/com/com/sun/jdi/event/EventSet.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ExceptionEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/LocatableEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MethodEntryEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MethodExitEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ModificationWatchpointEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MonitorContendedEnterEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MonitorContendedEnteredEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MonitorWaitEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/MonitorWaitedEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/StepEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ThreadDeathEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/ThreadStartEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/VMDeathEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/VMDisconnectEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/VMStartEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/WatchpointEvent.java
trunk/core/src/openjdk/com/com/sun/jdi/event/package.html
trunk/core/src/openjdk/com/com/sun/jdi/package.html
trunk/core/src/openjdk/com/com/sun/jdi/request/
trunk/core/src/openjdk/com/com/sun/jdi/request/AccessWatchpointRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/BreakpointRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ClassPrepareRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ClassUnloadRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/DuplicateRequestException.java
trunk/core/src/openjdk/com/com/sun/jdi/request/EventRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/EventRequestManager.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ExceptionRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/InvalidRequestStateException.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MethodEntryRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MethodExitRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ModificationWatchpointRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MonitorContendedEnterRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MonitorContendedEnteredRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MonitorWaitRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/MonitorWaitedRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/StepRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ThreadDeathRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/ThreadStartRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/VMDeathRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/WatchpointRequest.java
trunk/core/src/openjdk/com/com/sun/jdi/request/package.html
trunk/core/src/openjdk/com/com/sun/tools/attach/
trunk/core/src/openjdk/com/com/sun/tools/attach/AgentInitializationException.java
trunk/core/src/openjdk/com/com/sun/tools/attach/AgentLoadException.java
trunk/core/src/openjdk/com/com/sun/tools/attach/AttachNotSupportedException.java
trunk/core/src/openjdk/com/com/sun/tools/attach/AttachPermission.java
trunk/core/src/openjdk/com/com/sun/tools/attach/VirtualMachine.java
trunk/core/src/openjdk/com/com/sun/tools/attach/VirtualMachineDescriptor.java
trunk/core/src/openjdk/com/com/sun/tools/attach/package.html
trunk/core/src/openjdk/com/com/sun/tools/attach/spi/
trunk/core/src/openjdk/com/com/sun/tools/attach/spi/AttachProvider.java
trunk/core/src/openjdk/com/com/sun/tools/attach/spi/package.html
trunk/core/src/openjdk/com/com/sun/tools/jdi/JDWP.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractCommandNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractGroupNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractNamedNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractSimpleNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractSimpleTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractTypeListNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AbstractTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/AltNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ArrayObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ArrayRegionTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ArrayTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/BooleanTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ByteTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ClassLoaderObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ClassObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ClassTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/CommandNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/CommandSetNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/CommentNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ConstantNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ConstantSetNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/Context.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ErrorNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ErrorSetNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/EventNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/FieldTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/FrameTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/GroupNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/IntTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/InterfaceTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/LocationTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/LongTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/Main.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/MethodTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/NameNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/NameValueNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/Node.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/OutNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/Parse.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ReferenceIDTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ReferenceTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/RepeatNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ReplyNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/RootNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/SelectNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/StringObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/StringTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/TaggedObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ThreadGroupObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ThreadObjectTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/TypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/UntaggedValueTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/ValueTypeNode.java
trunk/core/src/openjdk/com/com/sun/tools/jdwpgen/jdwp.spec
Modified: trunk/all/conf/full-plugin-list.xml
===================================================================
--- trunk/all/conf/full-plugin-list.xml 2007-08-25 20:54:26 UTC (rev 3432)
+++ trunk/all/conf/full-plugin-list.xml 2007-08-26 07:53:04 UTC (rev 3433)
@@ -10,6 +10,7 @@
<plugin id="sun.tools"/>
<plugin id="javax.ext.tools"/>
<plugin id="com.sun.tools.javac"/>
+ <plugin id="com.sun.tools.jdi"/>
<plugin id="org.jnode.install"/>
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-08-25 20:54:26 UTC (rev 3432)
+++ trunk/core/.classpath 2007-08-26 07:53:04 UTC (rev 3433)
@@ -7,7 +7,7 @@
<classpathentry kind="src" path="src/classpath/gnu"/>
<classpathentry kind="src" path="src/openjdk/java"/>
<classpathentry kind="src" path="src/openjdk/javax"/>
- <classpathentry kind="src" path="src/openjdk/sun"/>
+ <classpathentry excluding="**/*-template.java" kind="src" path="src/openjdk/sun"/>
<classpathentry kind="src" path="src/classpath/tools"/>
<classpathentry kind="src" path="src/classpath/java"/>
<classpathentry kind="src" path="src/classpath/javax"/>
Added: trunk/core/descriptors/com.sun.tools.jdi.xml
===================================================================
--- trunk/core/descriptors/com.sun.tools.jdi.xml (rev 0)
+++ trunk/core/descriptors/com.sun.tools.jdi.xml 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="com.sun.tools.jdi"
+ name="The Java Debugger Interface from Sun"
+ version="@VERSION@"
+ plugin-version="@VERSION@"
+ provider-name="Sun Microsystems"
+ provider-url="http://sun.com"
+ license-name="classpath">
+
+ <runtime>
+ <library name="jnode-core.jar">
+ <export name="com.sun.jdi.*"/>
+ <export name="com.sun.jdi.connect.*"/>
+ <export name="com.sun.jdi.connect.spi.*"/>
+ <export name="com.sun.jdi.event.*"/>
+ <export name="com.sun.jdi.request.*"/>
+
+ <export name="com.sun.tools.attach.*"/>
+ <export name="com.sun.tools.attach.spi.*"/>
+ <export name="com.sun.tools.jdi.*"/>
+ </library>
+ </runtime>
+</plugin>
Added: trunk/core/src/openjdk/com/com/sun/jdi/AbsentInformationException.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/AbsentInformationException.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/AbsentInformationException.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * Thrown to indicate line number or variable information is not available.
+ *
+ * @author Gordon Hirsch
+ * @since 1.3
+ */
+public class AbsentInformationException extends Exception
+{
+ public AbsentInformationException()
+ {
+ super();
+ }
+
+ public AbsentInformationException(String s)
+ {
+ super(s);
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/jdi/Accessible.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/Accessible.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/Accessible.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,110 @@
+/*
+ * Copyright 1998-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.
+ */
+
+package com.sun.jdi;
+
+/**
+ * Provides information on the accessibility of a type or type component.
+ * Mirrors for program elements which allow an
+ * an access specifier (private, protected, public) provide information
+ * on that part of the declaration through this interface.
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface Accessible {
+
+ /**
+ * Returns the Java<sup><font size=-2>TM</font></sup>
+ * programming language modifiers, encoded in an integer.
+ * <p>
+ * The modifier encodings are defined in the
+ * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual Machine
+ * Specification</a>, in the <code>access_flag</code> tables for
+ * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75734">classes</a>,
+ * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#88358">fields</a>, and
+ * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#75568">methods</a>.
+ */
+ public int modifiers();
+
+ /**
+ * Determines if this object mirrors a private item.
+ * For {@link ArrayType}, the return value depends on the
+ * array component type. For primitive arrays the return value
+ * is always false. For object arrays, the return value is the
+ * same as would be returned for the component type.
+ * For primitive classes, such as {@link java.lang.Integer#TYPE},
+ * the return value is always false.
+ *
+ * @return <code>true</code> for items with private access;
+ * <code>false</code> otherwise.
+ */
+ boolean isPrivate();
+
+ /**
+ * Determines if this object mirrors a package private item.
+ * A package private item is declared with no access specifier.
+ * For {@link ArrayType}, the return value depends on the
+ * array component type. For primitive arrays the return value
+ * is always false. For object arrays, the return value is the
+ * same as would be returned for the component type.
+ * For primitive classes, such as {@link java.lang.Integer#TYPE},
+ * the return value is always false.
+ *
+ * @return <code>true</code> for items with package private access;
+ * <code>false</code> otherwise.
+ */
+ boolean isPackagePrivate();
+
+ /**
+ * Determines if this object mirrors a protected item.
+ * For {@link ArrayType}, the return value depends on the
+ * array component type. For primitive arrays the return value
+ * is always false. For object arrays, the return value is the
+ * same as would be returned for the component type.
+ * For primitive classes, such as {@link java.lang.Integer#TYPE},
+ * the return value is always false.
+ *
+ * @return <code>true</code> for items with private access;
+ * <code>false</code> otherwise.
+ */
+ boolean isProtected();
+
+ /**
+ * Determines if this object mirrors a public item.
+ * For {@link ArrayType}, the return value depends on the
+ * array component type. For primitive arrays the return value
+ * is always true. For object arrays, the return value is the
+ * same as would be returned for the component type.
+ * For primitive classes, such as {@link java.lang.Integer#TYPE},
+ * the return value is always true.
+ *
+ * @return <code>true</code> for items with public access;
+ * <code>false</code> otherwise.
+ */
+ boolean isPublic();
+}
Added: trunk/core/src/openjdk/com/com/sun/jdi/ArrayReference.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ArrayReference.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ArrayReference.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,210 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+import java.util.List;
+
+/**
+ * Provides access to an array object and its components in the target VM.
+ * Each array component is mirrored by a {@link Value} object.
+ * The array components, in aggregate, are placed in {@link java.util.List}
+ * objects instead of arrays for consistency with the rest of the API and
+ * for interoperability with other APIs.
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface ArrayReference extends ObjectReference {
+
+ /**
+ * Returns the number of components in this array.
+ *
+ * @return the integer count of components in this array.
+ */
+ int length();
+
+ /**
+ * Returns an array component value.
+ *
+ * @param index the index of the component to retrieve
+ * @return the {@link Value} at the given index.
+ * @throws java.lang.IndexOutOfBoundsException if
+ * <CODE><I>index</I></CODE> is outside the range of this array,
+ * that is, if either of the following are true:
+ * <PRE>
+ * <I>index</I> < 0
+ * <I>index</I> >= {@link #length() length()} </PRE>
+ */
+ Value getValue(int index);
+
+ /**
+ * Returns all of the components in this array.
+ *
+ * @return a list of {@link Value} objects, one for each array
+ * component ordered by array index. For zero length arrays,
+ * an empty list is returned.
+ */
+ List<Value> getValues();
+
+ /**
+ * Returns a range of array components.
+ *
+ * @param index the index of the first component to retrieve
+ * @param length the number of components to retrieve, or -1 to
+ * retrieve all components to the end of this array.
+ * @return a list of {@link Value} objects, one for each requested
+ * array component ordered by array index. When there are
+ * no elements in the specified range (e.g.
+ * <CODE><I>length</I></CODE> is zero) an empty list is returned
+ *
+ * @throws java.lang.IndexOutOfBoundsException if the range
+ * specified with <CODE><I>index</I></CODE> and
+ * <CODE><I>length</I></CODE> is not within the range of the array,
+ * that is, if either of the following are true:
+ * <PRE>
+ * <I>index</I> < 0
+ * <I>index</I> > {@link #length() length()} </PRE>
+ * or if <CODE><I>length</I> != -1</CODE> and
+ * either of the following are true:
+ * <PRE>
+ * <I>length</I> < 0
+ * <I>index</I> + <I>length</I> > {@link #length() length()}</PRE>
+ */
+ List<Value> getValues(int index, int length);
+
+ /**
+ * Replaces an array component with another value.
+ * <p>
+ * Object values must be assignment compatible with the component type
+ * (This implies that the component type must be loaded through the
+ * declaring class's class loader). Primitive values must be
+ * either assignment compatible with the component type or must be
+ * convertible to the component type without loss of information.
+ * See JLS section 5.2 for more information on assignment
+ * compatibility.
+ *
+ * @param value the new value
+ * @param index the index of the component to set
+ * @throws java.lang.IndexOutOfBoundsException if
+ * <CODE><I>index</I></CODE> is outside the range of this array,
+ * that is, if either of the following are true:
+ * <PRE>
+ * <I>index</I> < 0
+ * <I>index</I> >= {@link #length() length()} </PRE>
+ * @throws InvalidTypeException if the type of <CODE><I>value</I></CODE>
+ * is not compatible with the declared type of array components.
+ * @throws ClassNotLoadedException if the array component type
+ * has not yet been loaded
+ * through the appropriate class loader.
+ * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+ *
+ * @see ArrayType#componentType()
+ */
+ void setValue(int index, Value value)
+ throws InvalidTypeException,
+ ClassNotLoadedException;
+
+ /**
+ * Replaces all array components with other values. If the given
+ * list is larger in size than the array, the values at the
+ * end of the list are ignored.
+ * <p>
+ * Object values must be assignment compatible with the element type
+ * (This implies that the component type must be loaded through the
+ * enclosing class's class loader). Primitive values must be
+ * either assignment compatible with the component type or must be
+ * convertible to the component type without loss of information.
+ * See JLS section 5.2 for more information on assignment
+ * compatibility.
+ *
+ * @param values a list of {@link Value} objects to be placed
+ * in this array. If <CODE><I>values</I>.size()</CODE> is
+ * less that the length of the array, the first
+ * <CODE><I>values</I>.size()</CODE> elements are set.
+ * @throws InvalidTypeException if any of the
+ * new <CODE><I>values</I></CODE>
+ * is not compatible with the declared type of array components.
+ * @throws ClassNotLoadedException if the array component
+ * type has not yet been loaded
+ * through the appropriate class loader.
+ * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+ *
+ * @see ArrayType#componentType()
+ */
+ void setValues(List<? extends Value> values)
+ throws InvalidTypeException,
+ ClassNotLoadedException;
+
+ /**
+ * Replaces a range of array components with other values.
+ * <p>
+ * Object values must be assignment compatible with the component type
+ * (This implies that the component type must be loaded through the
+ * enclosing class's class loader). Primitive values must be
+ * either assignment compatible with the component type or must be
+ * convertible to the component type without loss of information.
+ * See JLS section 5.2 for more information on assignment
+ * compatibility.
+ *
+ * @param index the index of the first component to set.
+ * @param values a list of {@link Value} objects to be placed
+ * in this array.
+ * @param srcIndex the index of the first source value to use.
+ * @param length the number of components to set, or -1 to set
+ * all components to the end of this array or the end of
+ * <CODE><I>values</I></CODE> (whichever comes first).
+ * @throws InvalidTypeException if any element of
+ * <CODE><I>values</I></CODE>
+ * is not compatible with the declared type of array components.
+ * @throws java.lang.IndexOutOfBoundsException if the
+ * array range specified with
+ * <CODE><I>index</I></CODE> and <CODE><I>length</I></CODE>
+ * is not within the range of the array,
+ * or if the source range specified with
+ * <CODE><I>srcIndex</I></CODE> and <CODE><I>length</I></CODE>
+ * is not within <CODE><I>values</I></CODE>,
+ * that is, if any of the following are true:
+ * <PRE>
+ * <I>index</I> < 0
+ * <I>index</I> > {@link #length() length()}
+ * <I>srcIndex</I> < 0
+ * <I>srcIndex</I> > <I>values</I>.size() </PRE>
+ * or if <CODE><I>length</I> != -1</CODE> and any of the
+ * following are true:
+ * <PRE>
+ * <I>length</I> < 0
+ * <I>index</I> + <I>length</I> > {@link #length() length()}
+ * <I>srcIndex</I> + <I>length</I> > <I>values</I>.size() </PRE>
+ * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+ * @see ArrayType#componentType()
+ */
+ void setValues(int index, List<? extends Value> values, int srcIndex, int length)
+ throws InvalidTypeException,
+ ClassNotLoadedException;
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/ArrayType.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ArrayType.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ArrayType.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,99 @@
+/*
+ * 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 com.sun.jdi;
+
+import java.util.List;
+
+/**
+ * Provides access to the class of an array and the type of
+ * its components in the target VM.
+ *
+ * @see ArrayReference
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface ArrayType extends ReferenceType {
+
+ /**
+ * Creates a new instance of this array class in the target VM.
+ * The array is created with the given length and each component
+ * is initialized to is standard default value.
+ *
+ * @param length the number of components in the new array
+ * @return the newly created {@link ArrayReference} mirroring
+ * the new object in the target VM.
+ *
+ * @throws VMCannotBeModifiedException if the VirtualMachine is read-only - see {@link VirtualMachine#canBeModified()}.
+ */
+ ArrayReference newInstance(int length);
+
+ /**
+ * Gets the JNI signature of the components of this
+ * array class. The signature
+ * describes the declared type of the components. If the components
+ * are objects, their actual type in a particular run-time context
+ * may be a subclass of the declared class.
+ *
+ * @return a string containing the JNI signature of array components.
+ */
+ String componentSignature();
+
+ /**
+ * Returns a text representation of the component
+ * type of this array.
+ *
+ * @return a text representation of the component type.
+ */
+ String componentTypeName();
+
+ /**
+ * Returns the component type of this array,
+ * as specified in the array declaration.
+ * <P>
+ * Note: The component type of a array will always be
+ * created or loaded before the array - see the
+ * <a href="http://java.sun.com/docs/books/vmspec/">Java Virtual
+ * Machine Specification</a>, section
+ * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#79473">5.3.3
+ * Creating Array Classes</a>.
+ * However, although the component type will be loaded it may
+ * not yet be prepared, in which case the type will be returned
+ * but attempts to perform some operations on the returned type
+ * (e.g. {@link ReferenceType#fields() fields()}) will throw
+ * a {@link ClassNotPreparedException}.
+ * Use {@link ReferenceType#isPrepared()} to determine if
+ * a reference type is prepared.
+ *
+ * @see Type
+ * @see Field#type() Field.type() - for usage examples
+ * @return the {@link Type} of this array's components.
+ */
+ Type componentType() throws ClassNotLoadedException;
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/BooleanType.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/BooleanType.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/BooleanType.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * The type of all primitive <code>boolean</code> values
+ * accessed in the target VM. Calls to {@link Value#type} will return an
+ * implementor of this interface.
+ *
+ * @see BooleanValue
+ *
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface BooleanType extends PrimitiveType {
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/BooleanValue.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/BooleanValue.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/BooleanValue.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * Provides access to a primitive <code>boolean</code> value in
+ * the target VM.
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface BooleanValue extends PrimitiveValue
+{
+ /**
+ * Returns this BooleanValue as a boolean.
+ *
+ * @return the <code>boolean</code> mirrored by this object.
+ */
+ boolean value();
+
+ /**
+ * Compares the specified Object with this BooleanValue for equality.
+ *
+ * @return true if the Object is a BooleanValue and if applying "=="
+ * to the two mirrored primitives would evaluate to true; false
+ * otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hash code value for this BooleanValue.
+ *
+ * @return the integer hash code
+ */
+ int hashCode();
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/Bootstrap.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/Bootstrap.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/Bootstrap.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,56 @@
+/*
+ * 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 com.sun.jdi;
+
+/**
+ * Initial class that provides access to the default implementation
+ * of JDI interfaces. A debugger application uses this class to access the
+ * single instance of the {@link VirtualMachineManager} interface.
+ *
+ * @author Gordon Hirsch
+ * @since 1.3
+ */
+
+public class Bootstrap extends Object {
+
+ /**
+ * Returns the virtual machine manager.
+ *
+ * <p> May throw an unspecified error if initialization of the
+ * {@link com.sun.jdi.VirtualMachineManager} fails or if
+ * the virtual machine manager is unable to locate or create
+ * any {@link com.sun.jdi.connect.Connector Connectors}. </p>
+ * <p>
+ * @throws java.lang.SecurityException if a security manager has been
+ * installed and it denies {@link JDIPermission}
+ * <tt>("virtualMachineManager")</tt> or other unspecified
+ * permissions required by the implementation.
+ * </p>
+ */
+ static public synchronized VirtualMachineManager virtualMachineManager() {
+ return com.sun.tools.jdi.VirtualMachineManagerImpl.virtualMachineManager();
+ }
+}
Added: trunk/core/src/openjdk/com/com/sun/jdi/ByteType.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ByteType.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ByteType.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * The type of all primitive byte values accessed in
+ * the target VM. Calls to {@link Value#type} will return an
+ * implementor of this interface.
+ *
+ * @see ByteValue
+ *
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface ByteType extends PrimitiveType
+{
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/ByteValue.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ByteValue.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ByteValue.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,61 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * Provides access to a primitive <code>byte</code> value in the target VM.
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface ByteValue extends PrimitiveValue, Comparable<ByteValue>
+{
+ /**
+ * Returns this ByteValue as a <code>byte</code>.
+ *
+ * @return the <code>byte</code> mirrored by this object.
+ */
+ byte value();
+
+ /**
+ * Compares the specified Object with this ByteValue for equality.
+ *
+ * @return true if the Object is a ByteValue and if applying "=="
+ * to the two mirrored primitives would evaluate to true; false
+ * otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hash code value for this BooleanValue.
+ *
+ * @return the integer hash code
+ */
+ int hashCode();
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/CharType.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/CharType.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/CharType.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,41 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * The type of all primitive char values accessed in
+ * the target VM. Calls to {@link Value#type} will return an
+ * implementor of this interface.
+ *
+ * @see CharValue
+ *
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface CharType extends PrimitiveType
+{
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/CharValue.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/CharValue.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/CharValue.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,62 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+/**
+ * Provides access to a primitive <code>char</code> value in
+ * the target VM.
+ *
+ * @author Robert Field
+ * @author Gordon Hirsch
+ * @author James McIlree
+ * @since 1.3
+ */
+public interface CharValue extends PrimitiveValue, Comparable<CharValue>
+{
+ /**
+ * Returns this CharValue as a <code>char</code>.
+ *
+ * @return the <code>char</code> mirrored by this object.
+ */
+ char value();
+
+ /**
+ * Compares the specified Object with this CharValue for equality.
+ *
+ * @return true if the Object is a CharValue and if applying "=="
+ * to the two mirrored primitives would evaluate to true; false
+ * otherwise.
+ */
+ boolean equals(Object obj);
+
+ /**
+ * Returns the hash code value for this CharValue.
+ *
+ * @return the integer hash code
+ */
+ int hashCode();
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/ClassLoaderReference.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ClassLoaderReference.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ClassLoaderReference.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,96 @@
+/*
+ * Copyright 1998-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 com.sun.jdi;
+
+import java.util.List;
+
+/**
+ * A class loader object from the target VM.
+ * A ClassLoaderReference is an {@link ObjectReference} with additional
+ * access to classloader-specific information from the target VM. Instances
+ * ClassLoaderReference are obtained through calls to
+ * {@link ReferenceType#classLoader}
+ *
+ * @see ObjectReference
+ *
+ * @author Gordon Hirsch
+ * @since 1.3
+ */
+public interface ClassLoaderReference extends ObjectReference {
+
+ /**
+ * Returns a list of all loaded classes that were defined by this
+ * class loader. No ordering of this list guaranteed.
+ * <P>
+ * The returned list will include reference types
+ * loaded at least to the point of preparation and
+ * types (like array) for which preparation is
+ * not defined.
+ *
+ * @return a List of {@link ReferenceType} objects mirroring types
+ * loaded by this class loader. The list has length 0 if no types
+ * have been defined by this classloader.
+ */
+ List<ReferenceType> definedClasses();
+
+ /**
+ * Returns a list of all classes for which this class loader has
+ * been recorded as the initiating loader in the target VM.
+ * The list contains ReferenceTypes defined directly by this loader
+ * (as returned by {@link #definedClasses}) and any types for which
+ * loading was delegated by this class loader to another class loader.
+ * <p>
+ * The visible class list has useful properties with respect to
+ * the type namespace. A particular type name will occur at most
+ * once in the list. Each field or variable declared with that
+ * type name in a class defined by
+ * this class loader must be resolved to that single type.
+ * <p>
+ * No ordering of the returned list is guaranteed.
+ * <p>
+ * See the revised
+ * <a href="http://java.sun.com/docs/books/vmspec/">Java
+ * Virtual Machine Specification</a> section
+ * <a href="http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#72007">5.3
+ * Creation and Loading</a>
+ * for more information on the initiating classloader.
+ * <p>
+ * Note that unlike {@link #definedClasses()}
+ * and {@link VirtualMachine#allClasses()},
+ * some of the returned reference types may not be prepared.
+ * Attempts to perform some operations on unprepared reference types
+ * (e.g. {@link ReferenceType#fields() fields()}) will throw
+ * a {@link ClassNotPreparedException}.
+ * Use {@link ReferenceType#isPrepared()} to determine if
+ * a reference type is prepared.
+ *
+ * @return a List of {@link ReferenceType} objects mirroring classes
+ * initiated by this class loader. The list has length 0 if no classes
+ * are visible to this classloader.
+ */
+ List<ReferenceType> visibleClasses();
+}
+
Added: trunk/core/src/openjdk/com/com/sun/jdi/ClassNotLoadedException.java
===================================================================
--- trunk/core/src/openjdk/com/com/sun/jdi/ClassNotLoadedException.java (rev 0)
+++ trunk/core/src/openjdk/com/com/sun/jdi/ClassNotLoadedException.java 2007-08-26 07:53:04 UTC (rev 3433)
@@ -0,0 +1,87 @@
+/*
+ * Copyright 1998-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.
+ */
+
+package com.sun.jdi;
+
+/**
+ * Thrown to indicate that the requested class has
+ * not yet been loaded through the appropriate class loader.
+ * <p>
+ * Due to the lazy class linking performed by many VMs, it is
+ * possible for a field or variable to be visible in a program
+ * before the associated class is loaded. Until the class is loaded
+ * all that is available is a signature string. If an attempt is made to
+ * set the value of such a field or variable from JDI, the appropriate
+ * type checking cannot be done because the destination class has not been
+ * loaded. The same is true for the element class of array elements.
+ * <p>
+ * It is not advisable to solve this problem by attempting a class load on
+ * the fly in this case. There are two problems in having the debugger load
+ * a class instead of waiting for it to load over the normal course
+ * of events.
+ * <ul>
+ * <li>There can be no guarantee that running the appropriate class
+ * loader won't cause a deadlock in loading the
+ * class. Class loaders can consist of arbitrary
+ * Java<sup><font size=-2>TM</font></sup> programming language code and the
+ * class loading methods are usually synchronized. Most of the work
+ * done by a debugger happens when threads are suspended. If another
+ * application thread is suspended within the same class loader,
+ * a deadlock is very possible.
+ * <li>Changi...
[truncated message content] |
|
From: <ls...@us...> - 2007-08-24 16:36:01
|
Revision: 3401
http://jnode.svn.sourceforge.net/jnode/?rev=3401&view=rev
Author: lsantha
Date: 2007-08-24 09:35:54 -0700 (Fri, 24 Aug 2007)
Log Message:
-----------
Disabled the oj-annotate task in build by FabienD since it is still buggy.
Modified Paths:
--------------
trunk/all/build.xml
trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2007-08-23 20:59:27 UTC (rev 3400)
+++ trunk/all/build.xml 2007-08-24 16:35:54 UTC (rev 3401)
@@ -166,7 +166,7 @@
</target>
<!-- Assemble all plugins -->
- <target name="assemble-plugins" depends="assemble-projects,openjdk-annotate">
+ <target name="assemble-plugins" depends="assemble-projects">
<!-- Now assemble all plugins -->
<taskdef name="plugin" classname="org.jnode.build.PluginTask" classpathref="cp-jnode"/>
<plugin todir="${plugins.dir}" tmpdir="${build.dir}/tmp/plugins" pluginDir="${descriptors.dir}">
Modified: trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java 2007-08-23 20:59:27 UTC (rev 3400)
+++ trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java 2007-08-24 16:35:54 UTC (rev 3401)
@@ -28,6 +28,7 @@
import java.util.jar.JarFile;
import java.io.Console;
import java.io.File;
+import org.jnode.vm.annotation.SharedStatics;
/** A repository of "shared secrets", which are a mechanism for
calling implementation-private methods in another package without
@@ -38,6 +39,7 @@
This framework avoids the primary disadvantage of using reflection
for this purpose, namely the loss of compile-time checking. */
+@SharedStatics
public class SharedSecrets {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private static JavaUtilJarAccess javaUtilJarAccess;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-08-23 20:59:29
|
Revision: 3400
http://jnode.svn.sourceforge.net/jnode/?rev=3400&view=rev
Author: lsantha
Date: 2007-08-23 13:59:27 -0700 (Thu, 23 Aug 2007)
Log Message:
-----------
Reworked the patch sent by crawley for proclet support in jnode, to factor out proclets from the vm into org.jnode.shell.proclet package under the shell project.
Modified Paths:
--------------
trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
trunk/core/src/core/org/jnode/vm/VmSystem.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
trunk/fs/descriptors/org.jnode.fs.command.xml
trunk/fs/descriptors/org.jnode.fs.xml
trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml
trunk/shell/descriptors/org.jnode.shell.xml
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java
Added Paths:
-----------
trunk/core/src/core/org/jnode/vm/IOContext.java
trunk/core/src/core/org/jnode/vm/VmIOContext.java
trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java
trunk/shell/src/shell/org/jnode/shell/proclet/
trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletException.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyInputStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyPrintStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletProxyStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProxyStreamException.java
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -229,13 +229,11 @@
ClassWriter cw = new ClassWriter(false);
try {
ClassReader cr = new ClassReader(inputClass);
- cr.accept(new MarkerClassVisitor(cw),
- AbstractVisitor.getDefaultAttributes(), false);
-
+ cr.accept(new MarkerClassVisitor(cw), AbstractVisitor.getDefaultAttributes(), false);
byte[] b = cw.toByteArray();
outputClass.write(b);
} catch (Exception ex) {
- throw new BuildException("Unable to load class in file "+fileName);
+ throw new BuildException("Unable to load class in file "+fileName, ex);
}
}
Added: trunk/core/src/core/org/jnode/vm/IOContext.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/IOContext.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/IOContext.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,24 @@
+/*
+ * $Id$
+ */
+package org.jnode.vm;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+public interface IOContext {
+ void setGlobalInStream(InputStream in);
+ InputStream getGlobalInStream();
+ void setGlobalOutStream(PrintStream out);
+ PrintStream getGlobalOutStream();
+ void setGlobalErrStream(PrintStream err);
+ PrintStream getGlobalErrStream();
+ void setSystemIn(InputStream in);
+ void setSystemOut(PrintStream out);
+ void setSystemErr(PrintStream err);
+ void enterContext();
+ void exitContext();
+}
Added: trunk/core/src/core/org/jnode/vm/VmIOContext.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmIOContext.java (rev 0)
+++ trunk/core/src/core/org/jnode/vm/VmIOContext.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,63 @@
+/*
+ * $Id$
+ */
+package org.jnode.vm;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+
+/**
+ * @author Levente S\xE1ntha
+ */
+class VmIOContext implements IOContext {
+ private static InputStream globalInStream;
+ private static PrintStream globalOutStream;
+ private static PrintStream globalErrStream;
+
+ public void setGlobalInStream(InputStream in) {
+ globalInStream = in;
+ }
+
+ public void setGlobalOutStream(PrintStream out) {
+ globalOutStream = out;
+ }
+
+ public PrintStream getGlobalOutStream() {
+ return globalOutStream;
+ }
+
+ public void setGlobalErrStream(PrintStream err) {
+ globalErrStream = err;
+ }
+
+ public PrintStream getGlobalErrStream(){
+ return globalErrStream;
+ }
+
+ public InputStream getGlobalInStream() {
+ return globalInStream;
+ }
+
+ public void setSystemIn(InputStream in) {
+ globalInStream = in;
+ VmSystem.setStaticField(System.class, "in", in);
+ }
+
+ public void setSystemOut(PrintStream out) {
+ globalOutStream = out;
+ VmSystem.setStaticField(System.class, "out", out);
+ }
+
+ public void setSystemErr(PrintStream err) {
+ globalErrStream = err;
+ VmSystem.setStaticField(System.class, "err", err);
+ }
+
+ public void enterContext() {
+
+ }
+
+ public void exitContext() {
+
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/VmSystem.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/core/src/core/org/jnode/vm/VmSystem.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -43,7 +43,6 @@
import org.jnode.system.ResourceNotFreeException;
import org.jnode.system.ResourceOwner;
import org.jnode.system.SimpleResourceOwner;
-import org.jnode.util.SystemInputStream;
import org.jnode.vm.annotation.Internal;
import org.jnode.vm.annotation.KernelSpace;
import org.jnode.vm.annotation.MagicPermission;
@@ -213,6 +212,10 @@
if (bootOut == null) {
bootOut = new SystemOutputStream();
bootOutStream = new PrintStream(bootOut, true);
+ //globalOutStream = globalErrStream = bootOutStream;
+ ioContext.setGlobalOutStream(bootOutStream);
+ ioContext.setGlobalErrStream(bootOutStream);
+
}
return bootOutStream;
}
@@ -969,42 +972,50 @@
}
/**
- * Set in to a new InputStream.
+ * Set the effective System.in to a different InputStream. The actual behavior depends
+ * on whether we're in proclet mode or not. If we are, we set the appropriate proxied stream,
+ * to the new stream, depending on whether the current thread is a ProcletContext or not.
+ * Otherwise, we update the System.in field.
*
- * @param in
- * the new InputStream
+ * @param in the new InputStream
* @see #setIn(InputStream)
*/
+ @PrivilegedActionPragma
public static void setIn(InputStream in) {
- SystemInputStream.getInstance().setIn(in);
+ ioContext.setSystemIn(in);
}
/**
- * Set {@link #out}to a new PrintStream.
+ * Set the effective System.out to a different PrintStream. The actual behavior depends
+ * on whether we're in proclet mode or not. If we are, we set the appropriate proxied stream,
+ * to the new stream, depending on whether the current thread is a ProcletContext or not.
+ * Otherwise, we update the System.out field.
*
- * @param out
- * the new PrintStream
- * @see #setOut(PrintStream)
+ * @param out the new PrintStream
+ * @see java.lang.System#setOut(PrintStream)
*/
@PrivilegedActionPragma
public static void setOut(PrintStream out) {
- setStaticField(System.class, "out", out);
+ ioContext.setSystemOut(out);
}
/**
- * Set err to a new PrintStream.
+ * Set the effective System.err to a different PrintStream. The actual behavior depends
+ * on whether we're in proclet mode or not. If we are, we set the appropriate proxied stream,
+ * to the new stream, depending on whether the current thread is a ProcletContext or not.
+ * Otherwise, we update the System.err field.
*
- * @param err
- * the new PrintStream
- * @see #setErr(PrintStream)
+ * @param err the new PrintStream
+ * @see java.lang.System#setErr(PrintStream)
*/
@PrivilegedActionPragma
public static void setErr(PrintStream err) {
- setStaticField(System.class, "err", err);
+ ioContext.setSystemErr(err);
}
+ //todo protect this method from arbitrary access
@PrivilegedActionPragma
- private static void setStaticField(Class< ? > clazz, String fieldName,
+ public static void setStaticField(Class< ? > clazz, String fieldName,
Object value) {
final VmStaticField f = (VmStaticField) clazz.getVmClass().getField(
fieldName);
@@ -1020,4 +1031,56 @@
final Address ptr = VmMagic.getArrayData(staticsTable);
ptr.store(ObjectReference.fromObject(value), offset);
}
+
+ //io context related
+ private static final IOContext vmIoContext = new VmIOContext();
+ private static IOContext ioContext = vmIoContext;
+
+ public static boolean hasVmIOContext(){
+ return ioContext instanceof VmIOContext;
+ }
+
+
+ /**
+ * Get the current global (i.e. non-ProcletContext) flavor of System.err.
+ *
+ * @return the global 'err' stream.
+ */
+ public static PrintStream getGlobalErrStream() {
+ return ioContext.getGlobalErrStream();
+ }
+
+ /**
+ * Get the current global (i.e. non-ProcletContext) flavor of System.in.
+ *
+ * @return the global 'in' stream.
+ */
+ public static InputStream getGlobalInStream() {
+ return ioContext.getGlobalInStream();
+ }
+
+ /**
+ * Get the current global (i.e. non-ProcletContext) flavor of System.out.
+ *
+ * @return the global 'out' stream.
+ */
+ public static PrintStream getGlobalOutStream() {
+ return ioContext.getGlobalOutStream();
+ }
+
+ public static void switchToExternalIOContext(IOContext context){
+ if (hasVmIOContext()){
+ ioContext = context;
+ context.enterContext();
+ }
+ }
+
+ public static void resetIOContext(){
+ if (!hasVmIOContext()){
+ ioContext.exitContext();
+ ioContext = vmIoContext;
+ } else {
+ throw new RuntimeException("IO Context cannot be reset");
+ }
+ }
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -35,6 +35,7 @@
import org.jnode.driver.textscreen.TextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
+import org.jnode.vm.VmSystem;
import org.jnode.vm.isolate.VmIsolate;
/**
@@ -363,7 +364,7 @@
if (in instanceof FocusListener) {
((FocusListener) in).focusGained(event);
}
- if (claimSystemOutErr) {
+ if (claimSystemOutErr && VmSystem.hasVmIOContext()) {
myIsolate.invokeAndWait(new Runnable() {
public void run() {
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@@ -385,7 +386,7 @@
if (in instanceof FocusListener) {
((FocusListener) in).focusLost(event);
}
- if (claimSystemOutErr) {
+ if (claimSystemOutErr && VmSystem.hasVmIOContext()) {
myIsolate.invokeAndWait(new Runnable() {
public void run() {
savedOut = System.out;
Modified: trunk/fs/descriptors/org.jnode.fs.command.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.fs.command.xml 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/fs/descriptors/org.jnode.fs.command.xml 2007-08-23 20:59:27 UTC (rev 3400)
@@ -39,7 +39,8 @@
<permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve"/>
<permission class="java.util.PropertyPermission" name="user.dir" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
- <permission class="java.net.NetPermission" name="specifyStreamHandler"/>
+ <permission class="java.net.NetPermission" name="specifyStreamHandler"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
</extension>
</plugin>
Modified: trunk/fs/descriptors/org.jnode.fs.xml
===================================================================
--- trunk/fs/descriptors/org.jnode.fs.xml 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/fs/descriptors/org.jnode.fs.xml 2007-08-23 20:59:27 UTC (rev 3400)
@@ -32,6 +32,7 @@
<permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve"/>
<permission class="java.net.NetPermission" name="specifyStreamHandler"/>
<permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
</extension>
</plugin>
Modified: trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/shell/descriptors/org.jnode.shell.command.driver.console.xml 2007-08-23 20:59:27 UTC (rev 3400)
@@ -23,6 +23,15 @@
</extension>
<extension point="org.jnode.security.permissions">
- <permission class="java.util.PropertyPermission" name="jnode.prompt" actions="read"/>
+ <permission class="java.io.FilePermission" name="<<ALL FILES>>" actions="read,write"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThreadGroup"/>
+ <permission class="java.lang.RuntimePermission" name="modifyThread"/>
+ <permission class="java.lang.RuntimePermission" name="setIO"/>
+ <permission class="java.net.SocketPermission" name="*" actions="resolve,listen,connect"/>
+ <permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve,listen"/>
+ <permission class="java.util.PropertyPermission" name="jnode.cmdline" actions="read"/>
+ <permission class="java.util.PropertyPermission" name="jnode.invoker" actions="read"/>
+ <permission class="java.util.PropertyPermission" name="jnode.prompt" actions="read,write"/>
+ <permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
</extension>
</plugin>
\ No newline at end of file
Modified: trunk/shell/descriptors/org.jnode.shell.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.shell.xml 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/shell/descriptors/org.jnode.shell.xml 2007-08-23 20:59:27 UTC (rev 3400)
@@ -23,6 +23,7 @@
<export name="org.jnode.shell.help.*"/>
<export name="org.jnode.shell.help.argument.*"/>
<export name="org.jnode.shell.help.def.*"/>
+ <export name="org.jnode.shell.proclet.*"/>
</library>
</runtime>
@@ -36,7 +37,9 @@
<permission class="java.net.SocketPermission" name="*" actions="resolve,listen,connect"/>
<permission class="java.net.SocketPermission" name="*:0-" actions="connect,resolve,listen"/>
<permission class="java.util.PropertyPermission" name="jnode.cmdline" actions="read"/>
+ <permission class="java.util.PropertyPermission" name="jnode.invoker" actions="read"/>
<permission class="java.util.PropertyPermission" name="jnode.prompt" actions="read,write"/>
+ <permission class="java.util.PropertyPermission" name="*" actions="read,write"/>
<permission class="java.util.PropertyPermission" name="user.dir" actions="read"/>
</extension>
Added: trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/AsyncCommandInvoker.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,281 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * 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.shell;
+
+import gnu.java.security.action.InvokeAction;
+
+import java.awt.event.KeyEvent;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+
+import org.jnode.driver.input.KeyboardEvent;
+import org.jnode.driver.input.KeyboardListener;
+import org.jnode.shell.help.Help;
+import org.jnode.shell.help.HelpException;
+import org.jnode.shell.help.SyntaxErrorException;
+import org.jnode.vm.VmExit;
+
+/**
+ * User: Sam Reid Date: Dec 20, 2003 Time: 1:20:33 AM Copyright (c) Dec 20, 2003
+ * by Sam Reid
+ *
+ * @author Sam Reid
+ * @author Martin Husted Hartvig (ha...@jn...)
+ * @author cr...@jn...
+ */
+public abstract class AsyncCommandInvoker implements CommandInvoker, KeyboardListener {
+
+ PrintStream err;
+
+ CommandShell commandShell;
+
+ static final Class[] MAIN_ARG_TYPES = new Class[] { String[].class };
+
+ static final Class[] EXECUTE_ARG_TYPES = new Class[] {
+ CommandLine.class, InputStream.class, PrintStream.class,
+ PrintStream.class };
+
+ static final String MAIN_METHOD = "main";
+
+ static final String EXECUTE_METHOD = "execute";
+
+ boolean blocking;
+
+ Thread blockingThread;
+
+ Thread threadProcess = null;
+
+ String cmdName;
+
+ public AsyncCommandInvoker(CommandShell commandShell) {
+ this.commandShell = commandShell;
+ this.err = commandShell.getErrorStream();
+ commandShell.getConsole().addKeyboardListener(this);// listen for
+ // ctrl-c
+ }
+
+ public void invoke(String cmdLineStr) {
+ commandShell.addCommandToHistory(cmdLineStr);
+
+ InputStream inputStream = commandShell.getInputStream();
+ InputStream nextInputStream = null;
+ PrintStream errStream = commandShell.getErrorStream();
+ PrintStream outputStream = null;
+ boolean mustCloseOutputStream = false;
+
+ CommandLine cmdLine;
+ Method method;
+ Runnable cr;
+ CommandInfo cmdInfo;
+
+ String[] commands = cmdLineStr.split("\\|");
+ String command;
+ ByteArrayOutputStream byteArrayOutputStream = null;
+
+ for (int i = 0; i < commands.length; i++) {
+ command = commands[i].trim();
+ cmdLine = new CommandLine(command);
+
+ if (!cmdLine.hasNext())
+ continue;
+
+ cmdName = cmdLine.next();
+
+ try {
+ cmdInfo = commandShell.getCommandClass(cmdName);
+
+ if (cmdLine.sendToOutFile()) {
+ File file = new File(cmdLine.getOutFileName());
+
+ try {
+ FileOutputStream fileOutputStream = new FileOutputStream(
+ file);
+ outputStream = new PrintStream(fileOutputStream);
+ mustCloseOutputStream = true;
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ return; // FIXME
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ return; // FIXME
+ }
+ } else if (i + 1 < commands.length) {
+ byteArrayOutputStream = new ByteArrayOutputStream();
+ outputStream = new PrintStream(byteArrayOutputStream);
+ } else {
+ outputStream = commandShell.getOutputStream();
+ }
+
+ if (byteArrayOutputStream != null) {
+ nextInputStream = new ByteArrayInputStream(
+ byteArrayOutputStream.toByteArray());
+ }
+
+ if (nextInputStream != null)
+ inputStream = nextInputStream;
+
+ CommandLine commandLine = null;
+
+ if (inputStream.available() > 0) {
+ // FIXME we shouldn't do this. It consumes keyboard typeahead
+ // that should be delivered to the command's standard input!!
+ commandLine = new CommandLine(inputStream);
+ } else {
+ commandLine = cmdLine.getRemainder();
+ }
+
+ commandLine.setOutFileName(cmdLine.getOutFileName());
+ try {
+ method = cmdInfo.getCommandClass().getMethod(
+ EXECUTE_METHOD, EXECUTE_ARG_TYPES);
+
+ cr = createRunner(cmdInfo.getCommandClass(), method,
+ new Object[] { commandLine, inputStream,
+ outputStream, errStream },
+ inputStream, outputStream, errStream);
+ } catch (NoSuchMethodException e) {
+ method = cmdInfo.getCommandClass().getMethod(MAIN_METHOD,
+ MAIN_ARG_TYPES);
+ cr = createRunner(cmdInfo.getCommandClass(), method,
+ new Object[] { cmdLine.getRemainder().toStringArray() },
+ commandShell.getInputStream(), commandShell.getOutputStream(),
+ commandShell.getErrorStream());
+ }
+ try {
+ if (cmdInfo.isInternal()) {
+ cr.run();
+ } else {
+ threadProcess = createThread(cr, inputStream,
+ outputStream, errStream);
+ threadProcess.start();
+
+ this.blocking = true;
+ this.blockingThread = Thread.currentThread();
+ while (blocking) {
+ try {
+ Thread.sleep(6000);
+ } catch (InterruptedException interrupted) {
+ if (!blocking) {
+ // interruption was okay, break normally.
+ } else {
+ // abnormal interruption
+ interrupted.printStackTrace();
+ return; // FIXME
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ err.println("Exception in command");
+ ex.printStackTrace(err);
+ return; // FIXME
+ } catch (Error ex) {
+ err.println("Fatal error in command");
+ ex.printStackTrace(err);
+ return; // FIXME
+ }
+ } catch (NoSuchMethodException ex) {
+ err.println("Alias class has no main method " + cmdName);
+ return; // FIXME
+ } catch (ClassNotFoundException ex) {
+ err.println("Unknown alias class " + ex.getMessage());
+ return; // FIXME
+ } catch (ClassCastException ex) {
+ err.println("Invalid command " + cmdName);
+ return; // FIXME
+ } catch (Exception ex) {
+ err.println("Unknown error: " + ex.getMessage());
+ ex.printStackTrace(err);
+ return; // FIXME
+ }
+ finally {
+ if (mustCloseOutputStream) {
+ outputStream.close();
+ mustCloseOutputStream = false;
+ }
+ }
+ }
+
+ nextInputStream = null;
+ }
+
+ abstract Thread createThread(Runnable cr, InputStream inputStream,
+ PrintStream outputStream, PrintStream errStream);
+
+ public void keyPressed(KeyboardEvent ke) {
+ if (ke.isControlDown() && ke.getKeyCode() == KeyEvent.VK_C) {
+ doCtrlC();
+ }
+ if (ke.isControlDown() && ke.getKeyCode() == KeyEvent.VK_Z) {
+ doCtrlZ();
+ }
+ }
+
+ private void doCtrlZ() {
+ System.err.println("ctrl-z: Returning focus to console. (" + cmdName
+ + " is still running)");
+ unblock();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void doCtrlC() {
+ System.err.println("ctrl-c: Returning focus to console. (" + cmdName
+ + " has been killed)");
+
+ if (threadProcess != null) {
+ unblock();
+
+ AccessController.doPrivileged(new PrivilegedAction(){
+ public Object run() {
+ threadProcess.stop(new ThreadDeath());
+ return null;
+ }});
+ }
+ }
+
+ final void unblock() {
+ blocking = false;
+ blockingThread.interrupt();
+ }
+
+ final boolean isBlocking() {
+ return blocking;
+ }
+
+ public void keyReleased(KeyboardEvent event) {
+ }
+
+ abstract Runnable createRunner(Class cx, Method method, Object[] args,
+ InputStream commandIn, PrintStream commandOut, PrintStream commandErr);
+
+}
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -131,6 +131,8 @@
private ThreadCommandInvoker threadCommandInvoker;
private DefaultCommandInvoker defaultCommandInvoker;
+
+ private ProcletCommandInvoker procletCommandInvoker;
private boolean historyEnabled = true;
@@ -148,13 +150,26 @@
}
public void setThreadCommandInvoker() {
- this.commandInvoker = threadCommandInvoker;
+ if (this.commandInvoker != threadCommandInvoker) {
+ err.println("Switched to thread invoker");
+ this.commandInvoker = threadCommandInvoker;
+ }
}
public void setDefaultCommandInvoker() {
- this.commandInvoker = defaultCommandInvoker;
+ if (this.commandInvoker != defaultCommandInvoker) {
+ err.println("Switched to default invoker");
+ this.commandInvoker = defaultCommandInvoker;
+ }
}
+ public void setProcletCommandInvoker() {
+ if (this.commandInvoker != procletCommandInvoker) {
+ err.println("Switched to proclet invoker");
+ this.commandInvoker = procletCommandInvoker;
+ }
+ }
+
/**
* Create a new instance
*
@@ -176,6 +191,7 @@
defaultCommandInvoker = new DefaultCommandInvoker(this);
threadCommandInvoker = new ThreadCommandInvoker(this);
+ procletCommandInvoker = new ProcletCommandInvoker(this);
this.commandInvoker = threadCommandInvoker; // default to separate
this.console.addConsoleListener(this);
// threads for commands.
@@ -243,6 +259,18 @@
// Now become interactive
while (!isExitted()) {
try {
+ // Temporary mechanism for switching invokers
+ String invokerName = System.getProperty("jnode.invoker", "");
+ if (invokerName.equalsIgnoreCase("default")) {
+ setDefaultCommandInvoker();
+ }
+ else if (invokerName.equalsIgnoreCase("thread")) {
+ setThreadCommandInvoker();
+ }
+ else if (invokerName.equalsIgnoreCase("proclet")) {
+ setProcletCommandInvoker();
+ }
+
clearEof();
out.print(prompt());
readingCommand = true;
Added: trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/ProcletCommandInvoker.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,133 @@
+/*
+ * $Id: ThreadCommandInvoker.java 3374 2007-08-02 18:15:27Z lsantha $
+ *
+ * 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.shell;
+
+import gnu.java.security.action.InvokeAction;
+
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+
+import org.jnode.shell.help.Help;
+import org.jnode.shell.help.HelpException;
+import org.jnode.shell.help.SyntaxErrorException;
+import org.jnode.shell.proclet.ProcletContext;
+import org.jnode.shell.proclet.ProcletIOContext;
+import org.jnode.vm.VmExit;
+import org.jnode.vm.VmSystem;
+
+/**
+ * User: Sam Reid Date: Dec 20, 2003 Time: 1:20:33 AM Copyright (c) Dec 20, 2003
+ * by Sam Reid
+ *
+ * @author Sam Reid
+ * @author Martin Husted Hartvig (ha...@jn...)
+ * @author cr...@jn...
+ */
+public class ProcletCommandInvoker extends AsyncCommandInvoker {
+
+ public ProcletCommandInvoker(CommandShell commandShell) {
+ super(commandShell);
+ }
+
+ Thread createThread(Runnable cr, InputStream inputStream,
+ PrintStream outputStream, PrintStream errStream) {
+ VmSystem.switchToExternalIOContext(new ProcletIOContext());
+ return ProcletContext.createProclet(
+ cr, null, null,
+ new Object[]{inputStream, outputStream, errStream},
+ cmdName);
+ }
+
+ Runnable createRunner(Class cx, Method method, Object[] args, InputStream commandIn, PrintStream commandOut, PrintStream commandErr) {
+ return new CommandRunner(cx, method, args);
+ }
+
+ class CommandRunner implements Runnable {
+
+ private Class cx;
+
+ Method method;
+
+ Object[] args;
+
+ boolean finished = false;
+
+ public CommandRunner(Class cx, Method method, Object[] args) {
+ this.cx = cx;
+ this.method = method;
+ this.args = args;
+ }
+
+ public void run() {
+ try {
+ try {
+ Object obj = null;
+ if(!Modifier.isStatic(method.getModifiers())) {
+ obj = cx.newInstance();
+ }
+ AccessController.doPrivileged(new InvokeAction(method,
+ obj, args));
+ } catch (PrivilegedActionException ex) {
+ throw ex.getException();
+ }
+ if (!isBlocking()) {
+ // somebody already hit ctrl-c.
+ } else {
+ finished = true;
+ // System.err.println("Finished invocation, notifying
+ // blockers.");
+ // done with invoke, stop waiting for a ctrl-c
+ unblock();
+ }
+ } catch (InvocationTargetException ex) {
+ Throwable tex = ex.getTargetException();
+ if (tex instanceof SyntaxErrorException) {
+ try {
+ Help.getInfo(cx).usage();
+ } catch (HelpException ex1) {
+ // Don't care
+ ex1.printStackTrace();
+ }
+ err.println(tex.getMessage());
+ unblock();
+ } else if (tex instanceof VmExit) {
+ err.println(tex.getMessage());
+ unblock();
+ } else {
+ err.println("Exception in command");
+ tex.printStackTrace(err);
+ unblock();
+ }
+ } catch (Exception ex) {
+ err.println("Exception in command");
+ ex.printStackTrace(err);
+ unblock();
+ }
+ finished = true;
+ }
+ }
+}
Modified: trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2007-08-20 20:44:06 UTC (rev 3399)
+++ trunk/shell/src/shell/org/jnode/shell/ThreadCommandInvoker.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -23,12 +23,6 @@
import gnu.java.security.action.InvokeAction;
-import java.awt.event.KeyEvent;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.PrintStream;
import java.lang.reflect.InvocationTargetException;
@@ -38,8 +32,6 @@
import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
-import org.jnode.driver.input.KeyboardEvent;
-import org.jnode.driver.input.KeyboardListener;
import org.jnode.shell.help.Help;
import org.jnode.shell.help.HelpException;
import org.jnode.shell.help.SyntaxErrorException;
@@ -48,222 +40,28 @@
/**
* User: Sam Reid Date: Dec 20, 2003 Time: 1:20:33 AM Copyright (c) Dec 20, 2003
* by Sam Reid
- *
+ *
* @author Sam Reid
* @author Martin Husted Hartvig (ha...@jn...)
+ * @author cr...@jn...
*/
-public class ThreadCommandInvoker implements CommandInvoker, KeyboardListener {
+public class ThreadCommandInvoker extends AsyncCommandInvoker {
- PrintStream err;
-
- CommandShell commandShell;
-
- private static final Class[] MAIN_ARG_TYPES = new Class[] { String[].class };
-
- private static final Class[] EXECUTE_ARG_TYPES = new Class[] {
- CommandLine.class, InputStream.class, PrintStream.class,
- PrintStream.class };
-
- private static final String MAIN_METHOD = "main";
-
- private static final String EXECUTE_METHOD = "execute";
-
- private boolean blocking;
-
- private Thread blockingThread;
-
- private Thread threadProcess = null;
-
- private String cmdName;
-
public ThreadCommandInvoker(CommandShell commandShell) {
- this.commandShell = commandShell;
- this.err = commandShell.getErrorStream();
- commandShell.getConsole().addKeyboardListener(this);// listen for
- // ctrl-c
+ super(commandShell);
}
+
+ Thread createThread(Runnable cr, InputStream inputStream, PrintStream outputStream, PrintStream errStream) {
+ return new Thread(cr, cmdName);
+ }
+
+ Runnable createRunner(Class cx, Method method, Object[] args, InputStream commandIn, PrintStream commandOut, PrintStream commandErr) {
+ return new CommandRunner(cx, method, args, commandIn, commandOut, commandErr);
+ }
- public void invoke(String cmdLineStr) {
- commandShell.addCommandToHistory(cmdLineStr);
- InputStream inputStream = commandShell.getInputStream();
- InputStream nextInputStream = null;
- PrintStream errStream = commandShell.getErrorStream();
- PrintStream outputStream = null;
- boolean mustCloseOutputStream = false;
+ class CommandRunner implements Runnable {
- CommandLine cmdLine;
- Method method;
- CommandRunner cr;
- CommandInfo cmdInfo;
-
- String[] commands = cmdLineStr.split("\\|");
- String command;
- ByteArrayOutputStream byteArrayOutputStream = null;
-
- for (int i = 0; i < commands.length; i++) {
- command = commands[i].trim();
- cmdLine = new CommandLine(command);
-
- if (!cmdLine.hasNext())
- continue;
-
- cmdName = cmdLine.next();
-
- try {
- cmdInfo = commandShell.getCommandClass(cmdName);
-
- try {
- method = cmdInfo.getCommandClass().getMethod(
- EXECUTE_METHOD, EXECUTE_ARG_TYPES);
-
- if (cmdLine.sendToOutFile()) {
- File file = new File(cmdLine.getOutFileName());
-
- try {
- FileOutputStream fileOutputStream = new FileOutputStream(
- file);
- outputStream = new PrintStream(fileOutputStream);
- mustCloseOutputStream = true;
- } catch (SecurityException e) {
- e.printStackTrace();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- } else if (i + 1 < commands.length) {
- byteArrayOutputStream = new ByteArrayOutputStream();
- outputStream = new PrintStream(byteArrayOutputStream);
- } else {
- outputStream = commandShell.getOutputStream();
- }
-
- if (byteArrayOutputStream != null) {
- nextInputStream = new ByteArrayInputStream(
- byteArrayOutputStream.toByteArray());
- }
-
- if (nextInputStream != null)
- inputStream = nextInputStream;
-
- CommandLine commandLine = null;
-
- if (inputStream.available() > 0) {
- // FIXME we shouldn't do this. It consumes keyboard typeahead
- // that should be delivered to the command's standard input!!
- commandLine = new CommandLine(inputStream);
- } else {
- commandLine = cmdLine.getRemainder();
- }
-
- commandLine.setOutFileName(cmdLine.getOutFileName());
-
- cr = new CommandRunner(cmdInfo.getCommandClass(), method,
- new Object[] { commandLine, inputStream,
- outputStream, errStream },
- inputStream, outputStream, errStream);
- } catch (NoSuchMethodException e) {
- method = cmdInfo.getCommandClass().getMethod(MAIN_METHOD,
- MAIN_ARG_TYPES);
- cr = new CommandRunner(cmdInfo.getCommandClass(), method,
- new Object[] { cmdLine.getRemainder().toStringArray() },
- commandShell.getInputStream(), commandShell.getOutputStream(),
- commandShell.getErrorStream());
- }
- try {
- if (cmdInfo.isInternal()) {
- cr.run();
- } else {
- threadProcess = new Thread(cr, cmdName);
- threadProcess.start();
-
- this.blocking = true;
- this.blockingThread = Thread.currentThread();
- while (blocking) {
- try {
- Thread.sleep(6000);
- } catch (InterruptedException interrupted) {
- if (!blocking) {
- // interruption was okay, break normally.
- } else {
- // abnormal interruption
- interrupted.printStackTrace();
- }
- }
- }
- }
- } catch (Exception ex) {
- err.println("Exception in command");
- ex.printStackTrace(err);
- } catch (Error ex) {
- err.println("Fatal error in command");
- ex.printStackTrace(err);
- }
- } catch (NoSuchMethodException ex) {
- err.println("Alias class has no main method " + cmdName);
- } catch (ClassNotFoundException ex) {
- err.println("Unknown alias class " + ex.getMessage());
- } catch (ClassCastException ex) {
- err.println("Invalid command " + cmdName);
- } catch (Exception ex) {
- err.println("Unknown error: " + ex.getMessage());
- ex.printStackTrace(err);
- }
- finally {
- if (mustCloseOutputStream) {
- outputStream.close();
- mustCloseOutputStream = false;
- }
- }
- }
-
- nextInputStream = null;
- }
-
- public void keyPressed(KeyboardEvent ke) {
- if (ke.isControlDown() && ke.getKeyCode() == KeyEvent.VK_C) {
- doCtrlC();
- }
- if (ke.isControlDown() && ke.getKeyCode() == KeyEvent.VK_Z) {
- doCtrlZ();
- }
- }
-
- private void doCtrlZ() {
- System.err.println("ctrl-z: Returning focus to console. (" + cmdName
- + " is still running)");
- unblock();
- }
-
- @SuppressWarnings("deprecation")
- private void doCtrlC() {
- System.err.println("ctrl-c: Returning focus to console. (" + cmdName
- + " has been killed)");
-
- if (threadProcess != null) {
- unblock();
-
- AccessController.doPrivileged(new PrivilegedAction(){
- public Object run() {
- threadProcess.stop(new ThreadDeath());
- return null;
- }});
- }
- }
-
- final void unblock() {
- blocking = false;
- blockingThread.interrupt();
- }
-
- final boolean isBlocking() {
- return blocking;
- }
-
- public void keyReleased(KeyboardEvent event) {
- }
-
- class CommandRunner implements Runnable {
-
private Class cx;
Method method;
@@ -342,6 +140,5 @@
}
finished = true;
}
-
}
}
Added: trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,265 @@
+/*
+ * $Id$
+ *
+ * JNode.org
+ * Copyright (C) 2003-2007 JNode.org
+ */
+
+/* PrintStream.java -- OutputStream for printing output
+ Copyright (C) 1998, 1999, 2001, 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 org.jnode.shell.proclet;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.Locale;
+import java.util.Formatter;
+
+import gnu.classpath.SystemProperties;
+
+
+/**
+ * This class prints provides infrastructure for PrintStream proxies
+ */
+public abstract class AbstractProxyPrintStream extends PrintStream
+implements ProxyStream<PrintStream>
+{
+ /* Note: the implementation is mostly copied from PrintStream. Blame this on limitations
+ * of the afore-mentioned class's specification ... */
+ private static PrintStream nullStream;
+ private static final char[] line_separator =
+ SystemProperties.getProperty("line.separator", "\n").toCharArray();
+
+ private boolean error_occurred = false;
+
+
+ public AbstractProxyPrintStream() {
+ super((OutputStream) null);
+ }
+
+ public boolean checkError() {
+ flush();
+ return error_occurred || effectiveOutput().checkError();
+ }
+
+ protected void setError() {
+ error_occurred = true;
+ }
+
+ protected abstract PrintStream effectiveOutput();
+
+ public void close() {
+ PrintStream eo = effectiveOutput();
+ eo.flush();
+ eo.close();
+ }
+
+ public void flush() {
+ effectiveOutput().flush();
+ }
+
+ protected synchronized void print (String str, boolean println) {
+ PrintStream eo = effectiveOutput();
+ writeChars(eo, str, 0, str.length());
+ if (println) {
+ writeChars(eo, line_separator, 0, line_separator.length);
+ }
+ flush();
+ }
+
+ protected synchronized void print (char[] chars, int pos, int len,
+ boolean println) {
+ PrintStream eo = effectiveOutput();
+ writeChars(eo, chars, pos, len);
+ if (println) {
+ writeChars(eo, line_separator, 0, line_separator.length);
+ }
+ flush();
+ }
+
+ protected void writeChars(PrintStream eo, char[] buf, int offset, int count) {
+ // This is inefficient, but it ensures that we use the encoding
+ // scheme of the effective stream
+ eo.print(new String(buf, offset, count));
+ }
+
+ protected void writeChars(PrintStream eo, String str, int offset, int count) {
+ // This is inefficient, but it ensures that we use the encoding
+ // scheme of the effective stream
+ eo.print(str.substring(offset, offset + count));
+ }
+
+ public void print (boolean bool) {
+ print(String.valueOf(bool), false);
+ }
+
+ public void print (int inum) {
+ print(String.valueOf(inum), false);
+ }
+
+ public void print (long lnum) {
+ print(String.valueOf(lnum), false);
+ }
+
+ public void print (float fnum) {
+ print(String.valueOf(fnum), false);
+ }
+
+ public void print (double dnum) {
+ print(String.valueOf(dnum), false);
+ }
+
+ public void print (Object obj) {
+ print(obj == null ? "null" : obj.toString(), false);
+ }
+
+ public void print (String str) {
+ print(str == null ? "null" : str, false);
+ }
+
+ public synchronized void print (char ch) {
+ print(new char[]{ch}, 0, 1, false);
+ }
+
+ public void print (char[] charArray) {
+ print(charArray, 0, charArray.length, false);
+ }
+
+ public void println() {
+ print(line_separator, 0, line_separator.length, false);
+ }
+
+ public void println (boolean bool) {
+ print(String.valueOf(bool), true);
+ }
+
+ public void println (int inum) {
+ print(String.valueOf(inum), true);
+ }
+
+ public void println (long lnum) {
+ print(String.valueOf(lnum), true);
+ }
+
+ public void println (float fnum) {
+ print(String.valueOf(fnum), true);
+ }
+
+ public void println (double dnum) {
+ print(String.valueOf(dnum), true);
+ }
+
+ public void println (Object obj) {
+ print(obj == null ? "null" : obj.toString(), true);
+ }
+
+ public void println (String str) {
+ print (str == null ? "null" : str, true);
+ }
+
+ public synchronized void println (char ch) {
+ print(new char[]{ch}, 0, 1, true);
+ }
+
+ public void println (char[] charArray) {
+ print(charArray, 0, charArray.length, true);
+ }
+
+ public void write (int oneByte) {
+ effectiveOutput().write (oneByte & 0xff);
+ if (oneByte == '\n') {
+ flush();
+ }
+ }
+
+ public void write (byte[] buffer, int offset, int len) {
+ effectiveOutput().write (buffer, offset, len);
+ flush();
+ }
+
+ public PrintStream append(char c) {
+ print(c);
+ return this;
+ }
+
+ public PrintStream append(CharSequence cs) {
+ print(cs == null ? "null" : cs.toString());
+ return this;
+ }
+
+ public PrintStream append(CharSequence cs, int start, int end) {
+ print(cs == null ? "null" : cs.subSequence(start, end).toString());
+ return this;
+ }
+
+ public PrintStream printf(String format, Object... args) {
+ return format(format, args);
+ }
+
+ public PrintStream printf(Locale locale, String format, Object... args) {
+ return format(locale, format, args);
+ }
+
+ public PrintStream format(String format, Object... args) {
+ return format(Locale.getDefault(), format, args);
+ }
+
+ public PrintStream format(Locale locale, String format, Object... args) {
+ Formatter f = new Formatter(this, locale);
+ f.format(format, args);
+ return this;
+ }
+
+ /**
+ * Return a print stream that will "deep six" any output.
+ */
+ protected static synchronized PrintStream getNullPrintStream() {
+ if (nullStream == null) {
+ nullStream = new PrintStream(
+ new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ }
+ },
+ false);
+ }
+ return nullStream;
+ }
+}
Added: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java (rev 0)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletContext.java 2007-08-23 20:59:27 UTC (rev 3400)
@@ -0,0 +1,307 @@
+package org.jnode.shell.proclet;
+
+import java.io.Closeable;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import org.jnode.vm.VmSystem;
+import org.jnode.vm.VmExit;
+
+
+/**
+ * This class implements the proclet-specific state used in the JNode proclet mechanism.
+ * <p>
+ * A 'proclet' is group of threads that has its own version of the system properties, streams
+ * and environment and superficially behaves as if it was a self-contained application.
+ *
+ * @author cr...@jn...
+ */
+public class ProcletContext extends ThreadGroup {
+ private Properties properties;
+ private Object[] streams;
+ private Map<String, String> environment;
+ private int threadCount;
+ private final int pid;
+
+ private int exitStatus = 0;
+ private Throwable uncaughtException;
+
+ private static int nextPid = 1;
+
+ private ProcletContext(ThreadGroup parent, Properties properties,
+ Map<String, String> environment, Object[] streams)
+ throws ProcletException {
+ super(parent, nextProcletName());
+ ProcletContext parentContext = getParentContext(parent);
+ if (properties == null) {
+ if (parentContext != null) {
+ properties = parentContext.properties;
+ }
+ if (properties == null) {
+ properties = AccessController.doPrivileged(
+ new PrivilegedAction<Properties>() {
+ public Properties run() {
+ return System.getProperties();
+ }
+ });
+ }
+ properties = (Properties) properties.clone();
+ }
+ if (streams == null) {
+ if (parentContext != null) {
+ streams = parentContext.streams;
+ }
+ if (streams == null) {
+ try {
+ streams = new Object[]{
+ resolve(System.in), resolve(System.out), resolve(System.err)};
+ }
+ catch (ProxyStreamException ex) {
+ throw new ProcletException("Broken streams", ex);
+ }
+ }
+ else {
+ streams = (Object[]) streams.clone();
+ }
+ }
+ if (environment == null) {
+ if (parentContext != null) {
+ environment = new HashMap<String, String>(parentContext.environment);
+ }
+ else {
+ environment = new HashMap<String, String>();
+ }
+ }
+ this.environment = environment;
+ this.properties = properties;
+ this.streams = streams;
+ this.pid = extractPid(getName());
+ }
+
+ private Closeable resolve(Closeable stream) throws ProxyStreamException {
+ return (stream instanceof ProxyStream) ?
+ ((ProxyStream) stream).getProxiedStream() : stream;
+ }
+
+ /**
+ * Get the proclet's unique PID. This value uniquely identifies the proclet.
+ * @return the pid
+ */
+ public int getPid() {
+ return pid;
+ }
+
+ public synchronized Map<String, String> getEnvironment() {
+ return environment;
+ }
+
+ public synchronized Properties getProperties() {
+ return properties;
+ }
+
+ /**
+ * Set the stream object that corresponds to a given 'fd'.
+ *
+ * @param fd a non-negative index into the streams vector.
+ * @param stream the stream object to set.
+ */
+ synchronized void setStream(int fd, Object stream) {
+ if (stream instanceof ProcletProxyStream) {
+ throw new IllegalArgumentException("stream is a proclet proxy stream");
+ }
+ if (fd < 0) {
+ throw new IllegalArgumentException("fd is negative");
+ }
+ if (fd >= streams.length) {
+ Object[] tmp = new Object[fd + 1];
+ System.arraycopy(streams, 0, tmp, 0, streams.length);
+ streams = tmp;
+ }
+ streams[fd] = stream;
+ }
+
+ /**
+ * Get the stream object that corresponds to a given 'fd'.
+ *
+ * @param fd a non-negative index into the streams vector.
+ * @return the stream object, or <code>null</code>
+ */
+ public synchronized Object getStream(int fd) {
+ if (fd < 0) {
+ throw new IllegalArgumentException("fd is negative");
+ }
+ else if (fd > streams.length) {
+ return null;
+ }
+ else {
+ return streams[fd];
+ }
+ }
+
+ public synchronized void setProperties(Properties properties) {
+ this.properties = properties;
+ }
+
+ /**
+ * Get the ProcletContext for the current thread.
+ *
+ * @return the context, or <code>null</code> if the current thread
+ * is not a member of a proclet.
+ */
+ public static ProcletContext currentProcletContext() {
+ if (!VmSystem.hasVmIOContext()) {
+ return getParentContext(Thread.currentThread().getThreadGroup());
+ }
+ else {
+ return null;
+ }
+ }
+
+ /**
+ * Get the ProcletContext for a thread group. This is the thread group
+ * itself, or the innermost enclosing parent thread group that is a
+ * ProcletContect instance.
+ *
+ * @param threadGroup the starting thread group
+ * @return the context, or <code>null</code> if the thread group does
+ * not have an ancestor that is a ProcletContex.
+ */
+ private static ProcletContext getParentContext(ThreadGroup threadGroup) {
+ while (threadGroup != null) {
+ if (threadGroup instanceof ProcletContext) {
+ return (ProcletContext) threadGroup;
+ }
+ threadGroup = threadGroup.getParent();
+ }
+ return null;
+ }
+
+ /**
+ * Create a new Thread as the initial thread for a new proclet. The
+ * proclet context will be initialised from the current thread's
+ * proclet context (if it exists) or from {@link java.lang.System#in},
+ * {@link java.lang.System#out}, {@link java.lang.System#err}, and
+ * {@link java.lang.System#getProperties()}.
+ *
+ * @param target the new Thread's Runnable object.
+ * @return the new Thread
+ */
+ public static Thread createProclet(Runnable target) {
+ return createProclet(target, null, null, null, null, 0);
+ }
+
+ /**
+ * Create a new Thread as the initial thread for a new proclet, using a
+ * supplied set of system properties, and environment and streams vector.
+ * If any of these is null, the corresponding proclet context will be
+ * initialised from the current thread's proclet context (if it exists)
+ * or from {@link java.lang.System#in}, {@link java.lang.System#out},
+ * {@link java.lang.System#err}, and {@link java.lang.System#getProperties()}.
+ *
+ * @param properties the proclet's system properties, or <code>null</code>.
+ * @param environment the proclet's environment, or <code>null</code>.
+ * @param streams the proclet's streams vector, or <code>null</code>.
+ * @param target the new Thread's Runnable object.
+ * @return the new Thread
+ */
+ public static Thread createProclet(Runnable target, Properties properties,
+ Map<String, String> environment, Object[] streams) {
+ return createProclet(target, properties, environment, streams, null, 0);
+ }
+
+ /**
+ * Create a new Thread as the initial thread for a new proclet, using a
+ * supplied set of system properties, and environment and streams vector.
+ * If any of these is null, the corresponding proclet context will be
+ * initialised from the current thread's proclet context (if it exists)
+ * or from {@link java.lang.System#in}, {@link java.lang.System#out},
+ * {@link java.lang.System#err}, and {@link java.lang.System#getProperties()}.
+ * This overload also supplies an optional thread name.
+ *
+ * @param properties the proclet's system properties, or <code>null</code>.
+ * @param environment the proclet's environment, or <code>null</code>.
+ * @param streams the proclet's streams vector, or <code>null</code>.
+ * @param target the new Thread's Runnable object.
+ * @param name an optional Thread name.
+ * @return the new Thread
+ */
+ public static Thread createProclet(Runnable target, Properties properties,
+ Map<String, String> environment, Object[] streams, String name) {
+ return...
[truncated message content] |
|
From: <fd...@us...> - 2007-08-20 20:44:12
|
Revision: 3399
http://jnode.svn.sourceforge.net/jnode/?rev=3399&view=rev
Author: fduminy
Date: 2007-08-20 13:44:06 -0700 (Mon, 20 Aug 2007)
Log Message:
-----------
- refactored some JNode ant tasks around abstract class FileSetTask
- created ant task to add annotations on classes (useful for adding @SharedStatics on openjdk classes without modifying the original source code)
Modified Paths:
--------------
trunk/all/build.xml
trunk/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java
trunk/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java
trunk/core/.classpath
trunk/core/descriptors/org.objectweb.asm.xml
trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java
Added Paths:
-----------
trunk/all/conf/openjdk-annotations.properties
trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
trunk/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java
trunk/core/lib/asm-1.5.3.jar
trunk/core/lib/asm-attrs-1.5.3.jar
Removed Paths:
-------------
trunk/core/lib/asm.jar
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/all/build.xml 2007-08-20 20:44:06 UTC (rev 3399)
@@ -55,9 +55,10 @@
<property name="jmock-cglib.jar" value="${root.dir}/core/lib/jmock-cglib-1.0.1.jar"/>
<property name="jmock.jar" value="${root.dir}/core/lib/jmock-1.0.1.jar"/>
<property name="cglib.jar" value="${root.dir}/core/lib/cglib-2.1.jar"/>
- <property name="asm.jar" value="${root.dir}/core/lib/asm.jar"/>
- <property name="jcfe.jar" value="${root.dir}/core/lib/jcfe.jar"/>
- <property name="jfunc.jar" value="${root.dir}/core/lib/jfunc.jar"/>
+ <property name="asm.jar" value="${root.dir}/core/lib/asm-1.5.3.jar"/>
+ <property name="asm-attrs.jar" value="${root.dir}/core/lib/asm-attrs-1.5.3.jar"/>
+ <property name="jcfe.jar" value="${root.dir}/core/lib/jcfe.jar"/>
+ <property name="jfunc.jar" value="${root.dir}/core/lib/jfunc.jar"/>
<property name="log4j.jar" value="${root.dir}/core/lib/log4j-1.2.8.jar"/>
<property name="gnu-crypto.jar" value="${root.dir}/core/lib/gnu-crypto.jar"/>
@@ -92,6 +93,7 @@
<pathelement location="${jmock.jar}"/>
<pathelement location="${jmock-cglib.jar}"/>
<pathelement location="${asm.jar}"/>
+ <pathelement location="${asm-attrs.jar}"/>
<pathelement location="${cglib.jar}"/>
<pathelement location="${log4j.jar}"/>
<pathelement location="${gnu-crypto.jar}"/>
@@ -164,7 +166,7 @@
</target>
<!-- Assemble all plugins -->
- <target name="assemble-plugins" depends="assemble-projects">
+ <target name="assemble-plugins" depends="assemble-projects,openjdk-annotate">
<!-- Now assemble all plugins -->
<taskdef name="plugin" classname="org.jnode.build.PluginTask" classpathref="cp-jnode"/>
<plugin todir="${plugins.dir}" tmpdir="${build.dir}/tmp/plugins" pluginDir="${descriptors.dir}">
@@ -199,6 +201,7 @@
<libalias name="jmock-1.0.1.jar" alias="${jmock.jar}"/>
<libalias name="jmock-cglib-1.0.1.jar" alias="${jmock-cglib.jar}"/>
<libalias name="asm.jar" alias="${asm.jar}"/>
+ <libalias name="asm-attrs.jar" alias="${asm-attrs.jar}"/>
<libalias name="cglib.jar" alias="${cglib.jar}"/>
<libalias name="mauve.jar" alias="${mauve.jar}"/>
<libalias name="jcfe.jar" alias="${jcfe.jar}"/>
@@ -571,7 +574,6 @@
<patternset id="cp-sources-pattern">
<exclude name="com/sun/demo/**/*"/>
<exclude name="com/sun/tools/hat/**/*"/>
- <exclude name="com/sun/tools/hat/**/*"/>
<exclude name="com/sun/tools/example/**/*"/>
<exclude name="com/sun/tools/javah/**/*"/>
<exclude name="com/sun/tools/internal/txw2/**/*"/>
@@ -621,6 +623,19 @@
</cp-compare>
</target>
+ <!-- add annotations to compiled openjdk classes -->
+ <target name="openjdk-annotate" depends="assemble-projects">
+ <echo message="openjdk-annotate"/>
+ <taskdef name="oj-annotate" classname="org.jnode.ant.taskdefs.AnnotateTask"
+ classpathref="cp-jnode"/>
+
+ <oj-annotate annotationFile="${root.dir}/all/conf/openjdk-annotations.properties">
+ <fileset dir="${root.dir}/core/build/classes">
+ <patternset includes="**/*.class"/>
+ </fileset>
+ </oj-annotate>
+ </target>
+
<!-- Run all tests -->
<target name="tests" depends="assemble">
<ant target="tests" dir="${root.dir}/fs" inheritall="on" inheritrefs="on"/>
Added: trunk/all/conf/openjdk-annotations.properties
===================================================================
--- trunk/all/conf/openjdk-annotations.properties (rev 0)
+++ trunk/all/conf/openjdk-annotations.properties 2007-08-20 20:44:06 UTC (rev 3399)
@@ -0,0 +1 @@
+sun.misc.SharedSecrets=SharedStatics
\ No newline at end of file
Added: trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java (rev 0)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/AnnotateTask.java 2007-08-20 20:44:06 UTC (rev 3399)
@@ -0,0 +1,266 @@
+/*
+ * $Id: HeaderTask.java 3379 2007-08-04 10:19:57Z lsantha $
+ *
+ * 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.ant.taskdefs;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Properties;
+
+import org.apache.tools.ant.BuildException;
+import org.jnode.vm.annotation.SharedStatics;
+import org.objectweb.asm.ClassAdapter;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.ClassWriter;
+import org.objectweb.asm.Type;
+import org.objectweb.asm.attrs.Annotation;
+import org.objectweb.asm.attrs.RuntimeVisibleAnnotations;
+import org.objectweb.asm.util.AbstractVisitor;
+import org.objectweb.asm.util.CheckClassAdapter;
+import org.objectweb.asm.util.TraceClassVisitor;
+
+/**
+ * That ant task will add some annotations to some compiled classes
+ * mentioned in a property file.
+ * For now, it's only necessary to add SharedStatics annotations to some
+ * openjdk classes to avoid modifying the original source code.
+ *
+ * @author Fabien DUMINY (fduminy at jnode.org)
+ *
+ */
+public class AnnotateTask extends FileSetTask {
+
+ private File annotationFile;
+ private String[] classesFiles;
+
+ public void execute() throws BuildException {
+ classesFiles = readProperties(annotationFile);
+ processFiles();
+ }
+
+ public final File getAnnotationFile() {
+ return annotationFile;
+ }
+
+ public final void setAnnotationFile(File annotationFile) {
+ this.annotationFile = annotationFile;
+ }
+
+ /**
+ * Read the properties file. For now, it simply contains a list of
+ * classes that need the SharedStatics annotation.
+ *
+ * @return
+ * @throws BuildException
+ */
+ private static String[] readProperties(File file) throws BuildException
+ {
+ if(file == null)
+ {
+ throw new BuildException("annotationFile is mandatory");
+ }
+
+ Properties props = new Properties();
+ FileInputStream fis = null;
+ try
+ {
+ fis = new FileInputStream(file);
+ props.load(fis);
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ finally
+ {
+ if(fis != null)
+ {
+ try {
+ fis.close();
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+ }
+ if(props.isEmpty())
+ {
+ System.err.println("WARNING: annotationFile is empty");
+ return new String[0];
+ }
+
+ String[] classesFiles = new String[props.size()];
+ int i = 0;
+ for(Object name : props.keySet())
+ {
+ String className = String.valueOf(name);
+ String annotations = props.getProperty(className);
+ if("SharedStatics".equals(annotations))
+ {
+ className = className.replace('.', File.separatorChar);
+ className += ".class";
+ classesFiles[i++] = className;
+ }
+ }
+
+ // we must sort the classes in reverse order so that
+ // classes with longest package name will be used first
+ // (that is only necessary for classes whose name is the same
+ // but package is different ; typical such class name : "Constants")
+ Arrays.sort(classesFiles, Collections.reverseOrder());
+
+ return classesFiles;
+ }
+
+ private static boolean hasFile(String[] files, File file)
+ {
+ boolean found = false;
+ String filePath = file.getAbsolutePath();
+ for(String f : files)
+ {
+ if(filePath.endsWith(f))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ return found;
+ }
+
+ @Override
+ protected void processFile(File file) throws IOException {
+ if(!hasFile(classesFiles, file))
+ {
+ return;
+ }
+
+ System.out.println("adding annotation to file "+file.getAbsolutePath());
+ File tmpFile = new File(file.getParentFile(), file.getName()+".tmp");
+ FileInputStream fis = null;
+ FileOutputStream fos = null;
+
+ try
+ {
+ fis = new FileInputStream(file);
+ fos = new FileOutputStream(tmpFile);
+ addAnnotation(file.getName(), fis, fos);
+ }
+ finally
+ {
+ if(fis != null)
+ {
+ fis.close();
+ }
+ if(fos != null)
+ {
+ fos.close();
+ }
+ }
+
+ if(!file.delete())
+ {
+ throw new IOException("can delete "+file.getAbsolutePath());
+ }
+
+ if(!tmpFile.renameTo(file))
+ {
+ throw new IOException("can rename "+tmpFile.getAbsolutePath());
+ }
+
+ //traceClass(file);
+ }
+
+ /**
+ * Simple debug method that trace a class file.
+ * It can be used to visually check that the annotations has been
+ * properly added
+ *
+ * @param file
+ * @throws IOException
+ */
+ private void traceClass(File file) throws IOException
+ {
+ System.out.println("trace for "+file.getAbsolutePath());
+ FileInputStream fis = null;
+ try
+ {
+ fis = new FileInputStream(file);
+
+ ClassReader cr = new ClassReader(fis);
+ TraceClassVisitor tcv = new TraceClassVisitor(new PrintWriter(System.out));
+ cr.accept(tcv,
+ AbstractVisitor.getDefaultAttributes(), false);
+ }
+ finally
+ {
+ if(fis != null)
+ {
+ fis.close();
+ }
+ }
+ }
+
+ private void addAnnotation(String fileName, InputStream inputClass, OutputStream outputClass) throws BuildException {
+ ClassWriter cw = new ClassWriter(false);
+ try {
+ ClassReader cr = new ClassReader(inputClass);
+ cr.accept(new MarkerClassVisitor(cw),
+ AbstractVisitor.getDefaultAttributes(), false);
+
+ byte[] b = cw.toByteArray();
+ outputClass.write(b);
+ } catch (Exception ex) {
+ throw new BuildException("Unable to load class in file "+fileName);
+ }
+ }
+
+ private static class MarkerClassVisitor extends ClassAdapter {
+
+ public MarkerClassVisitor(ClassVisitor cv) {
+ super(cv);
+ }
+
+ public void visit(int version, int access, String name,
+ String superName, String sourceFile, String[] interfaces) {
+ super.visit(org.objectweb.asm.Constants.V1_5, access, name, superName,
+ sourceFile, interfaces);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void visitEnd() {
+ String t = Type.getDescriptor(SharedStatics.class);
+ Annotation ann = new Annotation(t);
+
+ RuntimeVisibleAnnotations attr = new RuntimeVisibleAnnotations();
+ attr.annotations.add(ann);
+ cv.visitAttribute(attr);
+
+ super.visitEnd();
+ }
+ }
+}
Added: trunk/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java (rev 0)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/FileSetTask.java 2007-08-20 20:44:06 UTC (rev 3399)
@@ -0,0 +1,70 @@
+/*
+ * $Id: HeaderTask.java 3379 2007-08-04 10:19:57Z lsantha $
+ *
+ * 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.ant.taskdefs;
+
+import java.io.*;
+import java.util.ArrayList;
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.FileSet;
+
+/**
+ * Abstract class for ant task that process one or more FileSet
+ * The concrete classes only have to implement the <i>process</i> method
+ * for doing the concrete work on a file.
+ *
+ * @author Fabien DUMINY (fduminy at jnode.org)
+ *
+ */
+abstract public class FileSetTask extends Task {
+
+ private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>();
+
+ public void addFileSet(FileSet fs) {
+ fileSets.add(fs);
+ }
+
+ public void execute() throws BuildException {
+ // default implementation : simply iterate on all files
+ processFiles();
+ }
+
+ final protected void processFiles() throws BuildException
+ {
+ final Project project = getProject();
+ try {
+ for (FileSet fs : fileSets) {
+ final String[] files = fs.getDirectoryScanner(project)
+ .getIncludedFiles();
+ final File projectDir = fs.getDir(project);
+ for (String fname : files) {
+ processFile(new File(projectDir, fname));
+ }
+ }
+ } catch (IOException e) {
+ throw new BuildException(e);
+ }
+ }
+
+ abstract protected void processFile(File file) throws IOException;
+}
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/HeaderTask.java 2007-08-20 20:44:06 UTC (rev 3399)
@@ -30,16 +30,12 @@
/**
* @author Ewout Prangsma (ep...@us...)
*/
-public class HeaderTask extends Task {
+public class HeaderTask extends FileSetTask {
- private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>();
-
private File headerFile;
+ private String[] header;
private boolean update = false;
- public void addFileSet(FileSet fs) {
- fileSets.add(fs);
- }
private boolean compareHeader(String[] lines, String[] header) {
final int linesCnt = lines.length;
@@ -77,18 +73,8 @@
throw new BuildException("HeaderFile must be set");
}
try {
- final String[] header = readFile(headerFile);
-
- for (FileSet fs : fileSets) {
- final String[] files = fs.getDirectoryScanner(getProject())
- .getIncludedFiles();
- final int fileCount = files.length;
- for (int j = 0; j < fileCount; j++) {
- final String fname = files[j];
- processFile(new File(fs.getDir(getProject()), fname), header);
- }
-
- }
+ header = readFile(headerFile);
+ processFiles();
} catch (IOException ex) {
throw new BuildException(ex);
}
@@ -102,7 +88,8 @@
return update;
}
- private void processFile(File file, String[] header) throws IOException {
+ @Override
+ protected void processFile(File file) throws IOException {
final String[] inp = readFile(file);
if (!compareHeader(inp, header)) {
if (update) {
Modified: trunk/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java
===================================================================
--- trunk/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/builder/src/builder/org/jnode/ant/taskdefs/Native2AsciiTask.java 2007-08-20 20:44:06 UTC (rev 3399)
@@ -34,38 +34,16 @@
/**
* @author Ewout Prangsma (ep...@us...)
*/
-public class Native2AsciiTask extends Task {
+public class Native2AsciiTask extends FileSetTask {
- private final ArrayList<FileSet> fileSets = new ArrayList<FileSet>();
-
private boolean update = false;
- public void addFileSet(FileSet fs) {
- fileSets.add(fs);
- }
-
- public void execute() throws BuildException {
- try {
- for (FileSet fs : fileSets) {
- final String[] files = fs.getDirectoryScanner(getProject())
- .getIncludedFiles();
- final int fileCount = files.length;
- for (int j = 0; j < fileCount; j++) {
- final String fname = files[j];
- processFile(new File(fs.getDir(getProject()), fname));
- }
-
- }
- } catch (IOException ex) {
- throw new BuildException(ex);
- }
- }
-
public final boolean isUpdate() {
return update;
}
- private void processFile(File file) throws IOException {
+ @Override
+ protected void processFile(File file) throws IOException {
if (containsNonAscii(file)) {
final File tmp = File.createTempFile("jnode", "n2a");
try {
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/core/.classpath 2007-08-20 20:44:06 UTC (rev 3399)
@@ -24,6 +24,8 @@
<classpathentry kind="lib" path="lib/junit.jar"/>
<classpathentry kind="lib" path="lib/mx4j.jar"/>
<classpathentry kind="lib" path="lib/mmtk/mmtk.jar" sourcepath="D:/epr/cvswork/MMTk/src"/>
+ <classpathentry exported="true" kind="lib" path="lib/asm-1.5.3.jar"/>
+ <classpathentry exported="true" kind="lib" path="lib/asm-attrs-1.5.3.jar"/>
<classpathentry kind="src" path="src/nanoxml"/>
<classpathentry kind="lib" path="lib/mauve.jar"/>
<classpathentry kind="output" path="build/classes"/>
Modified: trunk/core/descriptors/org.objectweb.asm.xml
===================================================================
--- trunk/core/descriptors/org.objectweb.asm.xml 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/core/descriptors/org.objectweb.asm.xml 2007-08-20 20:44:06 UTC (rev 3399)
@@ -3,7 +3,7 @@
<plugin id="org.objectweb.asm"
name="ASM classes"
- version="1"
+ version="1.5.3"
provider-name="Objectweb"
provider-url="http://objectweb.org"
license-name="bsd">
@@ -12,5 +12,8 @@
<library name="asm.jar">
<export name="org.objectweb.asm.*"/>
</library>
+ <library name="asm-attrs.jar">
+ <export name="org.objectweb.asm.*"/>
+ </library>
</runtime>
</plugin>
\ No newline at end of file
Added: trunk/core/lib/asm-1.5.3.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/lib/asm-1.5.3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: trunk/core/lib/asm-attrs-1.5.3.jar
===================================================================
(Binary files differ)
Property changes on: trunk/core/lib/asm-attrs-1.5.3.jar
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: trunk/core/lib/asm.jar
===================================================================
(Binary files differ)
Modified: trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java
===================================================================
--- trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java 2007-08-15 18:21:25 UTC (rev 3398)
+++ trunk/core/src/openjdk/sun/sun/misc/SharedSecrets.java 2007-08-20 20:44:06 UTC (rev 3399)
@@ -38,7 +38,6 @@
This framework avoids the primary disadvantage of using reflection
for this purpose, namely the loss of compile-time checking. */
-@org.jnode.vm.annotation.SharedStatics //jnode
public class SharedSecrets {
private static final Unsafe unsafe = Unsafe.getUnsafe();
private static JavaUtilJarAccess javaUtilJarAccess;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <fd...@us...> - 2007-08-15 18:21:32
|
Revision: 3398
http://jnode.svn.sourceforge.net/jnode/?rev=3398&view=rev
Author: fduminy
Date: 2007-08-15 11:21:25 -0700 (Wed, 15 Aug 2007)
Log Message:
-----------
fixed most of the eclipse build errors (still 4 errors remaining)
Modified Paths:
--------------
trunk/core/.classpath
Modified: trunk/core/.classpath
===================================================================
--- trunk/core/.classpath 2007-08-13 20:40:48 UTC (rev 3397)
+++ trunk/core/.classpath 2007-08-15 18:21:25 UTC (rev 3398)
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/openjdk/vm"/>
+ <classpathentry kind="src" path="src/openjdk/org"/>
+ <classpathentry kind="src" path="src/openjdk/com"/>
+ <classpathentry kind="src" path="src/icedtea"/>
+ <classpathentry kind="src" path="src/classpath/gnu"/>
<classpathentry kind="src" path="src/openjdk/java"/>
<classpathentry kind="src" path="src/openjdk/javax"/>
<classpathentry kind="src" path="src/openjdk/sun"/>
- <classpathentry kind="src" path="src/classpath/gnu"/>
- <classpathentry kind="src" path="src/classpath/sun"/>
<classpathentry kind="src" path="src/classpath/tools"/>
<classpathentry kind="src" path="src/classpath/java"/>
<classpathentry kind="src" path="src/classpath/javax"/>
@@ -17,7 +19,6 @@
<classpathentry kind="src" path="src/mmtk-vm"/>
<classpathentry kind="src" path="src/driver"/>
<classpathentry kind="src" path="src/test"/>
- <classpathentry kind="src" path="src/native/x86"/>
<classpathentry kind="lib" path="lib/ant.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.8.jar"/>
<classpathentry kind="lib" path="lib/junit.jar"/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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 navigable set view of the keys in this map
- */
- NavigableSet<K> descendingKeySet();
-
- /**
- * Returns a view of the portion of this map whose keys range from
- * {@code fromKey} to {@code toKey}. If {@code fromKey} and
- * {@code toKey} are equal, the returned map is empty unless
- * {@code fromExclusive} and {@code toExclusive} are both true. The
- * returned map is backed by this map, so changes in the returned map are
- * reflected in this map, and vice-versa. The returned map supports all
- * optional map operations that this map supports.
- *
- * <p>The returned map will throw an {@code IllegalArgumentException}
- * on an attempt to insert a key outside of its range, or to construct a
- * submap either of whose endpoints lie outside its range.
- *
- * @param fromKey low endpoint of the keys in the returned map
- * @param fromInclusive {@code true} if the low endpoint
- * is to be included in the returned view
- * @param toKey high endpoint of the keys in the returned map
- * @param toInclusive {@code true} if the high endpoint
- * is to be included in the returned view
- * @return a view of the portion of this map whose keys range from
- * {@code fromKey} to {@code toKey}
- * @throws ClassCastException if {@code fromKey} and {@code toKey}
- * cannot be compared to one another using this map's comparator
- * (or, if the map has no comparator, using natural ordering).
- * Implementations may, but are not required to, throw this
- * exception if {@code fromKey} or {@code toKey}
- * cannot be compared to keys currently in the map.
- * @throws NullPointerException if {@code fromKey} or {@code toKey}
- * is null and this map does not permit null keys
- * @throws IllegalArgumentException if {@code fromKey} is greater than
- * {@code toKey}; or if this map itself has a restricted
- * range, and {@code fromKey} or {@code toKey} lies
- * outside the bounds of the range
- */
- NavigableMap<K,V> subMap(K fromKey, boolean fromInclusive,
- K toKey, boolean toInclusive);
-
- /**
- * Returns a view of the portion of this map whose keys are less than (or
- * equal to, if {@code inclusive} is true) {@code toKey}. The returned
- * map is backed by this map, so changes in the returned map are reflected
- * in this map, and vice-versa. The returned map supports all optional
- * map operations that this map supports.
- *
- * <p>The returned map will throw an {@code IllegalArgumentException}
- * on an attempt to insert a key outside its range.
- *
- * @param toKey high endpoint of the keys in the returned map
- * @param inclusive {@code true} if the high endpoint
- * is to be included in the returned view
- * @return a view of the portion of this map whose keys are less than
- * (or equal to, if {@code inclusive} is true) {@code toKey}
- * @throws ClassCastException if {@code toKey} is not compatible
- * with this map's comparator (or, if the map has no comparator,
- * if {@code toKey} does not implement {@link Comparable}).
- * Implementations may, but are not required to, throw this
- * exception if {@code toKey} cannot be compared to keys
- * currently in the map.
- * @throws NullPointerException if {@code toKey} is null
- * and this map does not permit null keys
- * @throws IllegalArgumentException if this map itself has a
- * restricted range, and {@code toKey} lies outside the
- * bounds of the range
- */
- NavigableMap<K,V> headMap(K toKey, boolean inclusive);
-
- /**
- * Returns a view of the portion of this map whose keys are greater than (or
- * equal to, if {@code inclusive} is true) {@code fromKey}. The returned
- * map is backed by this map, so changes in the returned map are reflected
- * in this map, and vice-versa. The returned map supports all optional
- * map operations that this map supports.
- *
- * <p>The returned map will throw an {@code IllegalArgumentException}
- * on an attempt to insert a key outside its range.
- *
- * @param fromKey low endpoint of the keys in the returned map
- * @param inclusive {@code true} if the low endpoint
- * is to be included in the returned view
- * @return a view of the portion of this map whose keys are greater than
- * (or equal to, if {@code inclusive} is true) {@code fromKey}
- * @throws ClassCastException if {@code fromKey} is not compatible
- * with this map's comparator (or, if the map has no comparator,
- * if {@code fromKey} does not implement {@link Comparable}).
- * Implementations may, but are not required to, throw this
- * exception if {@code fromKey} cannot be compared to keys
- * currently in the map.
- * @throws NullPointerException if {@code fromKey} is null
- * and this map does not permit null keys
- * @throws IllegalArgumentException if this map itself has a
- * restricted range, and {@code fromKey} lies outside the
- * bounds of the range
- */
- NavigableMap<K,V> tailMap(K fromKey, boolean inclusive);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code subMap(fromKey, true, toKey, false)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
- */
- SortedMap<K,V> subMap(K fromKey, K toKey);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code headMap(toKey, false)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
- */
- SortedMap<K,V> headMap(K toKey);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code tailMap(fromKey, true)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
- */
- SortedMap<K,V> tailMap(K fromKey);
-}
Deleted: trunk/core/src/classpath/java/java/util/NavigableSet.java
===================================================================
--- trunk/core/src/classpath/java/java/util/NavigableSet.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/NavigableSet.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,290 +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 SortedSet} extended with navigation methods reporting
- * closest matches for given search targets. Methods {@code lower},
- * {@code floor}, {@code ceiling}, and {@code higher} return elements
- * respectively less than, less than or equal, greater than or equal,
- * and greater than a given element, returning {@code null} if there
- * is no such element. A {@code NavigableSet} may be accessed and
- * traversed in either ascending or descending order. The {@code
- * descendingSet} method returns a view of the set 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. This interface additionally defines methods
- * {@code pollFirst} and {@code pollLast} that return and remove the
- * lowest and highest element, if one exists, else returning {@code
- * null}. Methods {@code subSet}, {@code headSet},
- * and {@code tailSet} differ from the like-named {@code
- * SortedSet} methods in accepting additional arguments describing
- * whether lower and upper bounds are inclusive versus exclusive.
- * Subsets of any {@code NavigableSet} must implement the {@code
- * NavigableSet} interface.
- *
- * <p> The return values of navigation methods may be ambiguous in
- * implementations that permit {@code null} elements. However, even
- * in this case the result can be disambiguated by checking
- * {@code contains(null)}. To avoid such issues, implementations of
- * this interface are encouraged to <em>not</em> permit insertion of
- * {@code null} elements. (Note that sorted sets of {@link
- * Comparable} elements intrinsically do not permit {@code null}.)
- *
- * <p>Methods
- * {@link #subSet(Object, Object) subSet(E, E)},
- * {@link #headSet(Object) headSet(E)}, and
- * {@link #tailSet(Object) tailSet(E)}
- * are specified to return {@code SortedSet} to allow existing
- * implementations of {@code SortedSet} to be compatibly retrofitted to
- * implement {@code NavigableSet}, but extensions and implementations
- * of this interface are encouraged to override these methods 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 <E> the type of elements maintained by this set
- * @since 1.6
- */
-public interface NavigableSet<E> extends SortedSet<E> {
- /**
- * Returns the greatest element in this set strictly less than the
- * given element, or {@code null} if there is no such element.
- *
- * @param e the value to match
- * @return the greatest element less than {@code e},
- * or {@code null} if there is no such element
- * @throws ClassCastException if the specified element cannot be
- * compared with the elements currently in the set
- * @throws NullPointerException if the specified element is null
- * and this set does not permit null elements
- */
- E lower(E e);
-
- /**
- * Returns the greatest element in this set less than or equal to
- * the given element, or {@code null} if there is no such element.
- *
- * @param e the value to match
- * @return the greatest element less than or equal to {@code e},
- * or {@code null} if there is no such element
- * @throws ClassCastException if the specified element cannot be
- * compared with the elements currently in the set
- * @throws NullPointerException if the specified element is null
- * and this set does not permit null elements
- */
- E floor(E e);
-
- /**
- * Returns the least element in this set greater than or equal to
- * the given element, or {@code null} if there is no such element.
- *
- * @param e the value to match
- * @return the least element greater than or equal to {@code e},
- * or {@code null} if there is no such element
- * @throws ClassCastException if the specified element cannot be
- * compared with the elements currently in the set
- * @throws NullPointerException if the specified element is null
- * and this set does not permit null elements
- */
- E ceiling(E e);
-
- /**
- * Returns the least element in this set strictly greater than the
- * given element, or {@code null} if there is no such element.
- *
- * @param e the value to match
- * @return the least element greater than {@code e},
- * or {@code null} if there is no such element
- * @throws ClassCastException if the specified element cannot be
- * compared with the elements currently in the set
- * @throws NullPointerException if the specified element is null
- * and this set does not permit null elements
- */
- E higher(E e);
-
- /**
- * Retrieves and removes the first (lowest) element,
- * or returns {@code null} if this set is empty.
- *
- * @return the first element, or {@code null} if this set is empty
- */
- E pollFirst();
-
- /**
- * Retrieves and removes the last (highest) element,
- * or returns {@code null} if this set is empty.
- *
- * @return the last element, or {@code null} if this set is empty
- */
- E pollLast();
-
- /**
- * Returns an iterator over the elements in this set, in ascending order.
- *
- * @return an iterator over the elements in this set, in ascending order
- */
- Iterator<E> iterator();
-
- /**
- * Returns a reverse order view of the elements contained in this set.
- * The descending set is backed by this set, so changes to the set are
- * reflected in the descending set, and vice-versa. If either set is
- * modified while an iteration over either set is in progress (except
- * through the iterator's own {@code remove} operation), the results of
- * the iteration are undefined.
- *
- * <p>The returned set has an ordering equivalent to
- * <tt>{@link Collections#reverseOrder(Comparator) Collections.reverseOrder}(comparator())</tt>.
- * The expression {@code s.descendingSet().descendingSet()} returns a
- * view of {@code s} essentially equivalent to {@code s}.
- *
- * @return a reverse order view of this set
- */
- NavigableSet<E> descendingSet();
-
- /**
- * Returns an iterator over the elements in this set, in descending order.
- * Equivalent in effect to {@code descendingSet().iterator()}.
- *
- * @return an iterator over the elements in this set, in descending order
- */
- Iterator<E> descendingIterator();
-
- /**
- * Returns a view of the portion of this set whose elements range from
- * {@code fromElement} to {@code toElement}. If {@code fromElement} and
- * {@code toElement} are equal, the returned set is empty unless {@code
- * fromExclusive} and {@code toExclusive} are both true. The returned set
- * is backed by this set, so changes in the returned set are reflected in
- * this set, and vice-versa. The returned set supports all optional set
- * operations that this set supports.
- *
- * <p>The returned set will throw an {@code IllegalArgumentException}
- * on an attempt to insert an element outside its range.
- *
- * @param fromElement low endpoint of the returned set
- * @param fromInclusive {@code true} if the low endpoint
- * is to be included in the returned view
- * @param toElement high endpoint of the returned set
- * @param toInclusive {@code true} if the high endpoint
- * is to be included in the returned view
- * @return a view of the portion of this set whose elements range from
- * {@code fromElement}, inclusive, to {@code toElement}, exclusive
- * @throws ClassCastException if {@code fromElement} and
- * {@code toElement} cannot be compared to one another using this
- * set's comparator (or, if the set has no comparator, using
- * natural ordering). Implementations may, but are not required
- * to, throw this exception if {@code fromElement} or
- * {@code toElement} cannot be compared to elements currently in
- * the set.
- * @throws NullPointerException if {@code fromElement} or
- * {@code toElement} is null and this set does
- * not permit null elements
- * @throws IllegalArgumentException if {@code fromElement} is
- * greater than {@code toElement}; or if this set itself
- * has a restricted range, and {@code fromElement} or
- * {@code toElement} lies outside the bounds of the range.
- */
- NavigableSet<E> subSet(E fromElement, boolean fromInclusive,
- E toElement, boolean toInclusive);
-
- /**
- * Returns a view of the portion of this set whose elements are less than
- * (or equal to, if {@code inclusive} is true) {@code toElement}. The
- * returned set is backed by this set, so changes in the returned set are
- * reflected in this set, and vice-versa. The returned set supports all
- * optional set operations that this set supports.
- *
- * <p>The returned set will throw an {@code IllegalArgumentException}
- * on an attempt to insert an element outside its range.
- *
- * @param toElement high endpoint of the returned set
- * @param inclusive {@code true} if the high endpoint
- * is to be included in the returned view
- * @return a view of the portion of this set whose elements are less than
- * (or equal to, if {@code inclusive} is true) {@code toElement}
- * @throws ClassCastException if {@code toElement} is not compatible
- * with this set's comparator (or, if the set has no comparator,
- * if {@code toElement} does not implement {@link Comparable}).
- * Implementations may, but are not required to, throw this
- * exception if {@code toElement} cannot be compared to elements
- * currently in the set.
- * @throws NullPointerException if {@code toElement} is null and
- * this set does not permit null elements
- * @throws IllegalArgumentException if this set itself has a
- * restricted range, and {@code toElement} lies outside the
- * bounds of the range
- */
- NavigableSet<E> headSet(E toElement, boolean inclusive);
-
- /**
- * Returns a view of the portion of this set whose elements are greater
- * than (or equal to, if {@code inclusive} is true) {@code fromElement}.
- * The returned set is backed by this set, so changes in the returned set
- * are reflected in this set, and vice-versa. The returned set supports
- * all optional set operations that this set supports.
- *
- * <p>The returned set will throw an {@code IllegalArgumentException}
- * on an attempt to insert an element outside its range.
- *
- * @param fromElement low endpoint of the returned set
- * @param inclusive {@code true} if the low endpoint
- * is to be included in the returned view
- * @return a view of the portion of this set whose elements are greater
- * than or equal to {@code fromElement}
- * @throws ClassCastException if {@code fromElement} is not compatible
- * with this set's comparator (or, if the set has no comparator,
- * if {@code fromElement} does not implement {@link Comparable}).
- * Implementations may, but are not required to, throw this
- * exception if {@code fromElement} cannot be compared to elements
- * currently in the set.
- * @throws NullPointerException if {@code fromElement} is null
- * and this set does not permit null elements
- * @throws IllegalArgumentException if this set itself has a
- * restricted range, and {@code fromElement} lies outside the
- * bounds of the range
- */
- NavigableSet<E> tailSet(E fromElement, boolean inclusive);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code subSet(fromElement, true, toElement, false)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
- */
- SortedSet<E> subSet(E fromElement, E toElement);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code headSet(toElement, false)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
-na */
- SortedSet<E> headSet(E toElement);
-
- /**
- * {@inheritDoc}
- *
- * <p>Equivalent to {@code tailSet(fromElement, true)}.
- *
- * @throws ClassCastException {@inheritDoc}
- * @throws NullPointerException {@inheritDoc}
- * @throws IllegalArgumentException {@inheritDoc}
- */
- SortedSet<E> tailSet(E fromElement);
-}
Deleted: trunk/core/src/classpath/java/java/util/Observable.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Observable.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/Observable.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,182 +0,0 @@
-/* Observable.java -- an object to be observed
- Copyright (C) 1999, 2000, 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;
-
-/**
- * This class represents an object which is observable. Other objects may
- * register their intent to be notified when this object changes; and when
- * this object does change, it will trigger the <code>update</code> method
- * of each observer.
- *
- * Note that the <code>notifyObservers()</code> method of this class is
- * unrelated to the <code>notify()</code> of Object.
- *
- * @author Warren Levy (wa...@cy...)
- * @author Eric Blake (eb...@em...)
- * @see Observer
- * @status updated to 1.4
- */
-public class Observable
-{
- /** Tracks whether this object has changed. */
- private boolean changed;
-
- /* List of the Observers registered as interested in this Observable. */
- private LinkedHashSet observers;
-
- /**
- * Constructs an Observable with zero Observers.
- */
- public Observable()
- {
- observers = new LinkedHashSet();
- }
-
- /**
- * Adds an Observer. If the observer was already added this method does
- * nothing.
- *
- * @param observer Observer to add
- * @throws NullPointerException if observer is null
- */
- public synchronized void addObserver(Observer observer)
- {
- if (observer == null)
- throw new NullPointerException("can't add null observer");
- observers.add(observer);
- }
-
- /**
- * Reset this Observable's state to unchanged. This is called automatically
- * by <code>notifyObservers</code> once all observers have been notified.
- *
- * @see #notifyObservers()
- */
- protected synchronized void clearChanged()
- {
- changed = false;
- }
-
- /**
- * Returns the number of observers for this object.
- *
- * @return number of Observers for this
- */
- public synchronized int countObservers()
- {
- return observers.size();
- }
-
- /**
- * Deletes an Observer of this Observable.
- *
- * @param victim Observer to delete
- */
- public synchronized void deleteObserver(Observer victim)
- {
- observers.remove(victim);
- }
-
- /**
- * Deletes all Observers of this Observable.
- */
- public synchronized void deleteObservers()
- {
- observers.clear();
- }
-
- /**
- * True if <code>setChanged</code> has been called more recently than
- * <code>clearChanged</code>.
- *
- * @return whether or not this Observable has changed
- */
- public synchronized boolean hasChanged()
- {
- return changed;
- }
-
- /**
- * If the Observable has actually changed then tell all Observers about it,
- * then reset state to unchanged.
- *
- * @see #notifyObservers(Object)
- * @see Observer#update(Observable, Object)
- */
- public void notifyObservers()
- {
- notifyObservers(null);
- }
-
- /**
- * If the Observable has actually changed then tell all Observers about it,
- * then reset state to unchanged. Note that though the order of
- * notification is unspecified in subclasses, in Observable it is in the
- * order of registration.
- *
- * @param obj argument to Observer's update method
- * @see Observer#update(Observable, Object)
- */
- public void notifyObservers(Object obj)
- {
- if (! hasChanged())
- return;
- // Create clone inside monitor, as that is relatively fast and still
- // important to keep threadsafe, but update observers outside of the
- // lock since update() can call arbitrary code.
- Set s;
- synchronized (this)
- {
- s = (Set) observers.clone();
- }
- int i = s.size();
- Iterator iter = s.iterator();
- while (--i >= 0)
- ((Observer) iter.next()).update(this, obj);
- clearChanged();
- }
-
- /**
- * Marks this Observable as having changed.
- */
- protected synchronized void setChanged()
- {
- changed = true;
- }
-}
Deleted: trunk/core/src/classpath/java/java/util/Observer.java
===================================================================
--- trunk/core/src/classpath/java/java/util/Observer.java 2007-08-13 18:27:41 UTC (rev 3396)
+++ trunk/core/src/classpath/java/java/util/Observer.java 2007-08-13 20:40:48 UTC (rev 3397)
@@ -1,60 +0,0 @@
-/* Observer.java -- an object that will be informed of changes in an Observable
- 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;
-
-/**
- * Interface that is implemented when a class wants to be informed of changes
- * in Observable objects.
- *
- * @author Warren Levy (wa...@cy...)
- * @see Observable
- * @status updated to 1.4
- */
-public interface Observer
-{
- /**
- * This method is called whenever the observable object changes, and has
- * called <code>notifyObservers</code>. The Observable object can pass
- * arbitrary information in the second parameter.
- *
- * @param observable the Observable object that changed
- * @param arg arbitrary information, usually relating to the change
- */
- void update(Observable observable, Object arg);
-}
Added: trunk/core/src/openjdk/java/java/util/CurrencyData.properties
===================================================================
--- trunk/core/src/openjdk/java/java/util/CurrencyData.properties (rev 0)
+++ trunk/core/src/openjdk/java/java/util/CurrencyData.properties 2007-08-13 20:40:48 UTC (rev 3397)
@@ -0,0 +1,570 @@
+#
+# Copyright 2000-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, Fi...
[truncated message content] |
|
From: <ls...@us...> - 2007-08-13 18:27:42
|
Revision: 3396
http://jnode.svn.sourceforge.net/jnode/?rev=3396&view=rev
Author: lsantha
Date: 2007-08-13 11:27:41 -0700 (Mon, 13 Aug 2007)
Log Message:
-----------
General input history support for command line applications - by crawley.
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/InputCompleter.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/shell/src/shell/org/jnode/shell/CommandShell.java
trunk/shell/src/shell/org/jnode/shell/Shell.java
trunk/shell/src/shell/org/jnode/shell/command/HistoryCommand.java
Added Paths:
-----------
trunk/core/src/driver/org/jnode/driver/console/InputHistory.java
Modified: trunk/core/src/driver/org/jnode/driver/console/InputCompleter.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/InputCompleter.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/core/src/driver/org/jnode/driver/console/InputCompleter.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -4,5 +4,11 @@
public interface InputCompleter {
CompletionInfo complete(String partial);
- CommandHistory getCommandHistory();
+ /**
+ * Gets the completer's current InputHistory object. If the completer is modal,
+ * different histories may be returned at different times.
+ */
+ public InputHistory getInputHistory();
+
+
}
Added: trunk/core/src/driver/org/jnode/driver/console/InputHistory.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/InputHistory.java (rev 0)
+++ trunk/core/src/driver/org/jnode/driver/console/InputHistory.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -0,0 +1,103 @@
+/*
+ * $Id: CommandHistory.java 2224 2006-01-01 12:49:03Z epr $
+ *
+ * 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.driver.console;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This class is used to manage history lists for command shell and application input.
+ * <p>
+ * TODO - support conventional history list (no removal of duplicates), an optional
+ * upper bound on the history list size, and loading from / saving to a file.
+ *
+ * @author Matt Paine
+ * @author cr...@jn...
+ */
+public class InputHistory {
+
+ /** Holds the history lines. **/
+ private final List<String> history = new ArrayList<String>();
+
+ /** Constructs an InputHistory object. **/
+ public InputHistory() {
+ }
+
+ /**
+ * Adds a line to the end of the history list, removing it if is already present
+ * @param line the input line to be recorded.
+ */
+ public void addLine(String line) {
+ if (history.contains(line)) {
+ history.remove(line);
+ }
+ history.add(line);
+ }
+
+ /**
+ * Returns the current number of history recorded.
+ * @return the number of lines in the history list.
+ */
+ public int size() {
+ return history.size();
+ }
+
+ /**
+ * Gets the history line at a given index in the list
+ * @param index The index (starting at zero) for the history line to be returned.
+ * @return The history line requested or <code>null</code> if the index is out of range.
+ */
+ public String getLineAt(int index) {
+ try {
+ return history.get(index);
+ } catch (IndexOutOfBoundsException ex) {
+ return null;
+ }
+ }
+
+ /**
+ * Searches for the most recent command types starting with the specified
+ * string.
+ * @param start The string to search for.
+ * @return The most recent command matching the search string.
+ */
+ public String getLineWithPrefix(String start) {
+ return getLineAt(findLine(start));
+ }
+
+ /**
+ * Searches the collection for the most recent line starting with the
+ * specified string.
+ * @param start the string to search for.
+ * @return the index number of the specified string (or -1 if not found).
+ */
+ private int findLine(String start) {
+ for (int x = 0; x < history.size(); x++) {
+ String line = history.get(x);
+ if (line != null && line.startsWith(start)) {
+ return x;
+ }
+ }
+ return -1;
+ }
+
+}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -227,6 +227,7 @@
if (completion.needNewPrompt()) {
currentLine.start(true);
}
+ out.print(currentPrompt);
refreshCurrentLine();
}
break;
@@ -273,7 +274,7 @@
// Previous history item
if (completer != null) {
if (historyIndex == -1) {
- historyIndex = completer.getCommandHistory().size();
+ historyIndex = completer.getInputHistory().size();
savedCurrentLine = currentLine.getContent();
}
historyIndex--;
@@ -287,7 +288,7 @@
if (historyIndex == -1)
savedCurrentLine = currentLine.getContent();
- if (historyIndex == completer.getCommandHistory().size() - 1)
+ if (historyIndex == completer.getInputHistory().size() - 1)
historyIndex = -2;
historyIndex++;
@@ -332,7 +333,7 @@
private void updateCurrentLine() {
if (historyIndex > -1) {
- currentLine.setContent(completer.getCommandHistory().getCommand(historyIndex));
+ currentLine.setContent(completer.getInputHistory().getLineAt(historyIndex));
} else {
currentLine.setContent(savedCurrentLine);
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -347,6 +347,7 @@
// ensure that the location of the input cursor is included.
console.ensureVisible(inputCursorY);
}
+ console.setCursorVisible(true);
} catch (Exception e) {
// TODO - why ignore these exceptions? Are they due to the console methods
// not being thread-safe???
Modified: trunk/shell/src/shell/org/jnode/shell/CommandShell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/shell/src/shell/org/jnode/shell/CommandShell.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -25,6 +25,7 @@
import gnu.java.security.action.SetPropertyAction;
import java.io.File;
+import java.io.FilterInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
@@ -42,10 +43,9 @@
import javax.naming.NameNotFoundException;
import org.apache.log4j.Logger;
-import org.jnode.driver.console.CommandHistory;
+import org.jnode.driver.console.InputHistory;
import org.jnode.driver.console.CompletionInfo;
import org.jnode.driver.console.ConsoleManager;
-import org.jnode.driver.console.InputCompleter;
import org.jnode.driver.console.TextConsole;
import org.jnode.driver.console.ConsoleListener;
import org.jnode.driver.console.ConsoleEvent;
@@ -66,8 +66,9 @@
/**
* @author epr
* @author Fabien DUMINY
+ * @authod crawley
*/
-public class CommandShell implements Runnable, Shell, ConsoleListener, InputCompleter {
+public class CommandShell implements Runnable, Shell, ConsoleListener {
public static final String PROMPT_PROPERTY_NAME = "jnode.prompt";
@@ -92,14 +93,27 @@
/**
* Contains the archive of commands. *
*/
- private CommandHistory history = new CommandHistory();
+ private InputHistory commandHistory = new InputHistory();
+
+ /**
+ * Contains the application input history for the current thread.
+ */
+ private static InheritableThreadLocal<InputHistory> applicationHistory =
+ new InheritableThreadLocal<InputHistory> ();
+
+ private boolean readingCommand;
/**
- * Contains the newest command being typed in *
+ * Contains the last command entered
*/
- private String newestLine = "";
+ private String lastCommandLine = "";
/**
+ * Contains the last application input line entered
+ */
+ private String lastInputLine = "";
+
+ /**
* Flag to know when to wait (while input is happening). This is (hopefully)
* a thread safe implementation. *
*/
@@ -205,7 +219,7 @@
if (e.startsWith(command)) {
final String cmd = e.substring(command.length());
out.println(prompt() + cmd);
- processCommand(cmd);
+ processCommand(cmd, false);
}
} catch (Throwable ex) {
ex.printStackTrace(err);
@@ -231,10 +245,10 @@
try {
clearEof();
out.print(prompt());
+ readingCommand = true;
String line = readInputLine().trim();
if (line.length() > 0) {
- clearEof();
- processCommand(line);
+ processCommand(line, true);
}
if (VmSystem.isShuttingDown()) {
@@ -264,63 +278,24 @@
}
}
- protected void processCommand(String cmdLineStr) {
- commandInvoker.invoke(cmdLineStr);
+ protected void processCommand(String cmdLineStr, boolean interactive) {
+ clearEof();
+ if (interactive) {
+ readingCommand = false;
+ // Each interactive command is launched with a fresh history
+ // for input completion
+ applicationHistory.set(new InputHistory());
+ }
+ commandInvoker.invoke(cmdLineStr);
+ if (interactive) {
+ applicationHistory.set(null);
+ }
}
public void invokeCommand(String command) {
- processCommand(command);
+ processCommand(command, false);
}
- // /**
- // * Execute a single command line.
- // *
- // * @param cmdLineStr
- // */
- // protected void processCommand(String cmdLineStr) {
- //
- // final CommandLine cmdLine = new CommandLine(cmdLineStr);
- // if (!cmdLine.hasNext())
- // return;
- // String cmdName = cmdLine.next();
- //
- // // Add this command to the history.
- // if (!cmdLineStr.equals(newestLine))
- // history.addCommand(cmdLineStr);
- //
- // try {
- // Class cmdClass = getCommandClass(cmdName);
- // final Method main = cmdClass.getMethod("main", MAIN_ARG_TYPES);
- // try {
- // main.invoke(null, new Object[] {
- // cmdLine.getRemainder().toStringArray()});
- // } catch (InvocationTargetException ex) {
- // Throwable tex = ex.getTargetException();
- // if (tex instanceof SyntaxError) {
- // Help.getInfo(cmdClass).usage();
- // err.println(tex.getMessage());
- // } else {
- // err.println("Exception in command");
- // tex.printStackTrace(err);
- // }
- // } catch (Exception ex) {
- // err.println("Exception in command");
- // ex.printStackTrace(err);
- // } catch (Error ex) {
- // err.println("Fatal error in command");
- // ex.printStackTrace(err);
- // }
- // } catch (NoSuchMethodException ex) {
- // err.println("Alias class has no main method " + cmdName);
- // } catch (ClassNotFoundException ex) {
- // err.println("Unknown alias class " + ex.getMessage());
- // } catch (ClassCastException ex) {
- // err.println("Invalid command " + cmdName);
- // } catch (Exception ex) {
- // err.println("I FOUND AN ERROR: " + ex);
- // }
- // }
-
protected CommandInfo getCommandClass(String cmd)
throws ClassNotFoundException {
try {
@@ -341,13 +316,25 @@
}
/**
- * Gets the CommandHistory object associated with this shell.
+ * Gets the shell's command InputHistory object.
*/
- public CommandHistory getCommandHistory() {
- return history;
+ public InputHistory getCommandHistory() {
+ return commandHistory;
}
/**
+ * Gets the shell's currently active InputHistory object.
+ */
+ public InputHistory getInputHistory() {
+ if (readingCommand) {
+ return commandHistory;
+ }
+ else {
+ return CommandShell.applicationHistory.get();
+ }
+ }
+
+ /**
* Gets the expanded prompt
*/
protected String prompt() {
@@ -405,14 +392,23 @@
private CompletionInfo completion;
public CompletionInfo complete(String partial) {
+ if (!readingCommand) {
+ // dummy completion behavior for application input.
+ CompletionInfo completion = new CompletionInfo();
+ completion.setCompleted(partial);
+ completion.setNewPrompt(true);
+ return completion;
+ }
+
// workaround to set the currentShell to this shell
try {
ShellUtils.getShellManager().registerShell(this);
} catch (NameNotFoundException ex) {
}
+ // do command completion
+ String result = null;
completion = new CompletionInfo();
- String result = null;
try {
CommandLine cl = new CommandLine(partial);
String cmd = "";
@@ -472,13 +468,73 @@
}
public void addCommandToHistory(String cmdLineStr) {
- // Add this command to the history.
- if (isHistoryEnabled() && !cmdLineStr.equals(newestLine))
- history.addCommand(cmdLineStr);
+ // Add this command to the command history.
+ if (isHistoryEnabled() && !cmdLineStr.equals(lastCommandLine)) {
+ commandHistory.addLine(cmdLineStr);
+ lastCommandLine = cmdLineStr;
+ }
}
+ public void addInputToHistory(String inputLine) {
+ // Add this input to the application input history.
+ if (isHistoryEnabled() && !inputLine.equals(lastInputLine)) {
+ InputHistory history = applicationHistory.get();
+ if (history != null) {
+ history.addLine(inputLine);
+ lastInputLine = inputLine;
+ }
+ }
+ }
+
public InputStream getInputStream() {
- return in;
+ if (isHistoryEnabled()) {
+ // Insert a filter on the input stream that adds completed input lines
+ // to the application input history.
+ // TODO - revisit for support of muilt-byte character encodings.
+ return new FilterInputStream(in) {
+ private StringBuilder line = new StringBuilder();
+
+ @Override
+ public int read() throws IOException {
+ int res = super.read();
+ if (res != -1) {
+ filter((byte) res);
+ }
+ return res;
+ }
+
+ @Override
+ public int read(byte[] buf, int offset, int len) throws IOException {
+ int res = super.read(buf, offset, len);
+ for (int i = 0; i < res; i++) {
+ filter(buf[offset + i]);
+ }
+ return res;
+ }
+
+ @Override
+ public int read(byte[] buf) throws IOException {
+ int res = super.read(buf);
+ for (int i = 0; i < res; i++) {
+ filter(buf[i]);
+ }
+ return res;
+ }
+
+ private void filter(byte b) {
+ if (b == '\n') {
+ addInputToHistory(line.toString());
+ line.setLength(0);
+ }
+ else {
+ line.append((char) b);
+ }
+ }
+ };
+ }
+ else {
+ return in;
+ }
}
public PrintStream getOutputStream() {
Modified: trunk/shell/src/shell/org/jnode/shell/Shell.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/Shell.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/shell/src/shell/org/jnode/shell/Shell.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -22,13 +22,14 @@
package org.jnode.shell;
import org.jnode.shell.alias.AliasManager;
-import org.jnode.driver.console.CommandHistory;
import org.jnode.driver.console.Console;
+import org.jnode.driver.console.InputCompleter;
+import org.jnode.driver.console.InputHistory;
/**
* @author epr
*/
-public interface Shell {
+public interface Shell extends InputCompleter {
/**
* Gets the alias manager of this shell
@@ -36,16 +37,17 @@
public AliasManager getAliasManager();
/**
- * Gets the CommandHistory object associated with this shell.
- */
- public CommandHistory getCommandHistory();
-
- /**
* Prints a list of choices for command line completion.
*/
public void list(String[] items);
/**
+ * Gets the shell's command InputHistory object. Unlike getInputHistory,
+ * this method is not modal.
+ */
+ public InputHistory getCommandHistory();
+
+ /**
* Returns the console where the shell is running.
* @return the console
*/
Modified: trunk/shell/src/shell/org/jnode/shell/command/HistoryCommand.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/command/HistoryCommand.java 2007-08-13 07:38:53 UTC (rev 3395)
+++ trunk/shell/src/shell/org/jnode/shell/command/HistoryCommand.java 2007-08-13 18:27:41 UTC (rev 3396)
@@ -23,7 +23,7 @@
import java.io.PrintStream;
import javax.naming.NameNotFoundException;
-import org.jnode.driver.console.CommandHistory;
+import org.jnode.driver.console.InputHistory;
import org.jnode.shell.help.*;
import org.jnode.shell.help.argument.OptionArgument;
import org.jnode.shell.Shell;
@@ -70,7 +70,7 @@
private PrintStream out;
/** Reference to the CommandHistory to work with. **/
- private CommandHistory history;
+ private InputHistory history;
//********** Constructor **********//
@@ -115,7 +115,7 @@
/** List out every command from the history, with each commands index. **/
public void listCommands() {
for (int x = 0; x < history.size(); x++)
- out.println("" + x + ": " + history.getCommand(x));
+ out.println("" + x + ": " + history.getLineAt(x));
out.println();
}
@@ -178,10 +178,10 @@
private String parseCommandArg(String arg) {
try {
int i = Integer.parseInt(arg);
- return history.getCommand(i);
+ return history.getLineAt(i);
}
catch (NumberFormatException nfex) {
- return history.getCommand(arg);
+ return history.getLineWithPrefix(arg);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
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 Java float value from an input stream. It operates
- * by first reading an <code>int</code> value from the stream by calling the
- * <code>readInt()</code> method in this interface, then converts that
- * <code>int</code> to a <code>float</code> using the
- * <code>intBitsToFloat</code> method in the class
- * <code>java.lang.Float</code>.
- * <p>
- * This method can read a <code>float</code> written by an object
- * implementing
- * the <code>writeFloat()</code> method in the <code>DataOutput</code>
- * interface.
- *
- * @return The <code>float</code> value read
- *
- * @exception EOFException If end of file is reached before reading the
- * float
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeFloat
- * @see java.lang.Float#intBitsToFloat
- */
- float readFloat() throws EOFException, IOException;
-
- /**
- * This method reads a Java double value from an input stream. It operates
- * by first reading a <code>long</code> value from the stream by calling the
- * <code>readLong()</code> method in this interface, then converts that
- * <code>long</code> to a <code>double</code> using the
- * <code>longBitsToDouble</code> method in the class
- * <code>java.lang.Double</code>.
- * <p>
- * This method can read a <code>double</code> written by an object
- * implementing the <code>writeDouble()</code> method in the
- * <code>DataOutput</code> interface.
- *
- * @return The <code>double</code> value read
- *
- * @exception EOFException If end of file is reached before reading the
- * double
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeDouble
- * @see java.lang.Double#longBitsToDouble
- */
- double readDouble() throws EOFException, IOException;
-
- /**
- * This method reads the next line of text data from an input stream.
- * It operates by reading bytes and converting those bytes to
- * <code>char</code>
- * values by treating the byte read as the low eight bits of the
- * <code>char</code> and using 0 as the high eight bits. Because of this,
- * it does not support the full 16-bit Unicode character set.
- * <P>
- * The reading of bytes ends when either the end of file or a line terminator
- * is encountered. The bytes read are then returned as a
- * <code>String</code>.
- * A line terminator is a byte sequence consisting of either
- * <code>\r</code>, <code>\n</code> or <code>\r\n</code>. These termination
- * charaters are discarded and are not returned as part of the string.
- * A line is also terminated by an end of file condition.
- * <p>
- *
- * @return The line read as a <code>String</code>
- *
- * @exception IOException If an error occurs
- */
- String readLine() throws IOException;
-
- /**
- * This method reads a <code>String</code> from an input stream that is
- * encoded in a modified UTF-8 format. This format has a leading two byte
- * sequence that contains the remaining number of bytes to read.
- * This two byte
- * sequence is read using the <code>readUnsignedShort()</code> method of this
- * interface.
- *
- * After the number of remaining bytes have been determined, these bytes
- * are read an transformed into <code>char</code> values. These
- * <code>char</code> values are encoded in the stream using either a one,
- * two, or three byte format.
- * The particular format in use can be determined by examining the first
- * byte read.
- * <p>
- * If the first byte has a high order bit of 0, then
- * that character consists on only one byte. This character value consists
- * of seven bits that are at positions 0 through 6 of the byte. As an
- * example, if <code>byte1</code> is the byte read from the stream, it would
- * be converted to a <code>char</code> like so:
- * <p>
- * <code>(char)byte1</code>
- * <p>
- * If the first byte has 110 as its high order bits, then the
- * character consists of two bytes. The bits that make up the character
- * value are in positions 0 through 4 of the first byte and bit positions
- * 0 through 5 of the second byte. (The second byte should have
- * 10 as its high order bits). These values are in most significant
- * byte first (i.e., "big endian") order.
- * <p>
- * As an example, if <code>byte1</code> and <code>byte2</code> are the first
- * two bytes read respectively, and the high order bits of them match the
- * patterns which indicate a two byte character encoding, then they would be
- * converted to a Java <code>char</code> like so:
- * <p>
- * <code>(char)(((byte1 & 0x1F) << 6) + (byte2 & 0x3F))</code>
- * <p>
- * If the first byte has a 1110 as its high order bits, then the
- * character consists of three bytes. The bits that make up the character
- * value are in positions 0 through 3 of the first byte and bit positions
- * 0 through 5 of the other two bytes. (The second and third bytes should
- * have 10 as their high order bits). These values are in most
- * significant byte first (i.e., "big endian") order.
- * <p>
- * As an example, if <code>byte1</code>, <code>byte2</code>, and
- * <code>byte3</code> are the three bytes read, and the high order bits of
- * them match the patterns which indicate a three byte character encoding,
- * then they would be converted to a Java <code>char</code> like so:
- *
- * <code>
- * (char)(((byte1 & 0x0F) << 12) + ((byte2 & 0x3F) + (byte3 & 0x3F))
- * </code>
- *
- * Note that all characters are encoded in the method that requires the
- * fewest number of bytes with the exception of the character with the
- * value of <code>\<llll>u0000</code> which is encoded as two bytes.
- * This is a modification of the UTF standard used to prevent C language
- * style <code>NUL</code> values from appearing in the byte stream.
- * <p>
- * This method can read data that was written by an object implementing the
- * <code>writeUTF()</code> method in <code>DataOutput</code>.
- *
- * @return The <code>String</code> read
- *
- * @exception EOFException If end of file is reached before reading the
- * String
- * @exception UTFDataFormatException If the data is not in UTF-8 format
- * @exception IOException If any other error occurs
- *
- * @see DataOutput#writeUTF
- */
- String readUTF() throws EOFException, UTFDataFormatException, IOException;
-
- /**
- * This method reads raw bytes into the passed array until the array is
- * full. Note that this method blocks until the data is available and
- * throws an exception if there is not enough data left in the stream to
- * fill the buffer. Note also that zero length buffers are permitted.
- * In this case, the method will return immediately without reading any
- * bytes from the stream.
- *
- * @param buf The buffer into which to read the data
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- void readFully(byte[] buf) throws EOFException, IOException;
-
- /**
- * This method reads raw bytes into the passed array <code>buf</code>
- * starting
- * <code>offset</code> bytes into the buffer. The number of bytes read
- * will be
- * exactly <code>len</code>. Note that this method blocks until the data is
- * available and throws an exception if there is not enough data left in
- * the stream to read <code>len</code> bytes. Note also that zero length
- * buffers are permitted. In this case, the method will return immediately
- * without reading any bytes from the stream.
- *
- * @param buf The buffer into which to read the data
- * @param offset The offset into the buffer to start storing data
- * @param len The number of bytes to read into the buffer
- *
- * @exception EOFException If end of file is reached before filling the
- * buffer
- * @exception IOException If any other error occurs
- */
- void readFully(byte[] buf, int offset, int len)
- throws EOFException, IOException;
-
- /**
- * This method skips and discards the specified number of bytes in an
- * input stream. Note that this method may skip less than the requested
- * number of bytes. The actual number of bytes skipped is returned.
- * No bytes are skipped if a negative number is passed to this method.
- *
- * @param numBytes The number of bytes to skip
- *
- * @return The number of bytes actually skipped, which will always be
- * <code>numBytes</code>
- *
- * @exception EOFException If end of file is reached before all bytes can be
- * skipped
- * @exception IOException If any other error occurs
- */
- int skipBytes(int numBytes) throws EOFException, IOException;
-
-} // interface DataInput
Deleted: trunk/core/src/classpath/java/java/io/DataOutput.java
===================================================================
--- trunk/core/src/classpath/java/java/io/DataOutput.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/DataOutput.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,326 +0,0 @@
-/* DataOutput.java -- Interface for writing 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
- * Status: Complete to version 1.1.
- */
-
-/**
- * This interface is implemented by classes that can wrte data to streams
- * from Java primitive types. This data can subsequently be read back
- * by classes implementing the <code>DataInput</code> interface.
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- *
- * @see DataInput
- */
-public interface DataOutput
-{
- /**
- * This method writes a Java boolean value to an output stream. If
- * <code>value</code> is <code>true</code>, a byte with the value of
- * 1 will be written, otherwise a byte with the value of 0 will be
- * written.
- *
- * The value written can be read using the <code>readBoolean</code>
- * method in <code>DataInput</code>.
- *
- * @param value The boolean value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readBoolean
- */
- void writeBoolean(boolean value) throws IOException;
-
- /**
- * This method writes a Java byte value to an output stream. The
- * byte to be written will be in the lowest 8 bits of the
- * <code>int</code> value passed.
- *
- * The value written can be read using the <code>readByte</code> or
- * <code>readUnsignedByte</code> methods in <code>DataInput</code>.
- *
- * @param value The int value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readByte
- * @see DataInput#readUnsignedByte
- */
- void writeByte(int value) throws IOException;
-
- /**
- * This method writes a Java char value to an output stream. The
- * char to be written will be in the lowest 16 bits of the <code>int</code>
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * <p>
- * <code>byte0 = (byte)((value & 0xFF00) >> 8);<br>
- * byte1 = (byte)(value & 0x00FF);</code>
- * <p>
- *
- * The value written can be read using the <code>readChar</code>
- * method in <code>DataInput</code>.
- *
- * @param value The char value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readChar
- */
- void writeChar(int value) throws IOException;
-
- /**
- * This method writes a Java short value to an output stream. The
- * char to be written will be in the lowest 16 bits of the <code>int</code>
- * value passed. These bytes will be written "big endian". That is,
- * with the high byte written first in the following manner:
- * <p>
- * <code>byte0 = (byte)((value & 0xFF00) >> 8);<br>
- * byte1 = (byte)(value & 0x00FF);</code>
- * <p>
- *
- * The value written can be read using the <code>readShort</code> and
- * <code>readUnsignedShort</code> methods in <code>DataInput</code>.
- *
- * @param value The int value to write as a 16-bit value
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readShort
- * @see DataInput#readUnsignedShort
- */
- void writeShort(int value) throws IOException;
-
- /**
- * This method writes a Java int value to an output stream. The 4 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * <p>
- * <code>byte0 = (byte)((value & 0xFF000000) >> 24);<br>
- * byte1 = (byte)((value & 0x00FF0000) >> 16);<br>
- * byte2 = (byte)((value & 0x0000FF00) >> 8);<br>
- * byte3 = (byte)(value & 0x000000FF);</code>
- * <p>
- *
- * The value written can be read using the <code>readInt</code>
- * method in <code>DataInput</code>.
- *
- * @param value The int value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readInt
- */
- void writeInt(int value) throws IOException;
-
- /**
- * This method writes a Java long value to an output stream. The 8 bytes
- * of the passed value will be written "big endian". That is, with
- * the high byte written first in the following manner:
- * <p>
- * <code>byte0 = (byte)((value & 0xFF00000000000000L) >> 56);<br>
- * byte1 = (byte)((value & 0x00FF000000000000L) >> 48);<br>
- * byte2 = (byte)((value & 0x0000FF0000000000L) >> 40);<br>
- * byte3 = (byte)((value & 0x000000FF00000000L) >> 32);<br>
- * byte4 = (byte)((value & 0x00000000FF000000L) >> 24);<br>
- * byte5 = (byte)((value & 0x0000000000FF0000L) >> 16);<br>
- * byte6 = (byte)((value & 0x000000000000FF00L) >> 8);<br>
- * byte7 = (byte)(value & 0x00000000000000FFL);</code>
- * <p>
- *
- * The value written can be read using the <code>readLong</code>
- * method in <code>DataInput</code>.
- *
- * @param value The long value to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readLong
- */
- void writeLong(long value) throws IOException;
-
- /**
- * This method writes a Java <code>float</code> value to the stream. This
- * value is written by first calling the method
- * <code>Float.floatToIntBits</code>
- * to retrieve an <code>int</code> representing the floating point number,
- * then writing this <code>int</code> value to the stream exactly the same
- * as the <code>writeInt()</code> method does.
- *
- * The value written can be read using the <code>readFloat</code>
- * method in <code>DataInput</code>.
- *
- * @param value The float value to write
- *
- * @exception IOException If an error occurs
- *
- * @see #writeInt
- * @see DataInput#readFloat
- * @see Float#floatToIntBits
- */
- void writeFloat(float value) throws IOException;
-
- /**
- * This method writes a Java <code>double</code> value to the stream. This
- * value is written by first calling the method
- * <code>Double.doubleToLongBits</code>
- * to retrieve an <code>long</code> representing the floating point number,
- * then writing this <code>long</code> value to the stream exactly the same
- * as the <code>writeLong()</code> method does.
- *
- * The value written can be read using the <code>readDouble</code>
- * method in <code>DataInput</code>.
- *
- * @param value The double value to write
- *
- * @exception IOException If any other error occurs
- *
- * @see #writeLong
- * @see DataInput#readDouble
- * @see Double#doubleToLongBits
- */
- void writeDouble(double value) throws IOException;
-
- /**
- * This method writes all the bytes in a <code>String</code> out to the
- * stream. One byte is written for each character in the
- * <code>String</code>.
- * The high eight bits of each character are discarded, thus this
- * method is inappropriate for completely representing Unicode characters.
- *
- * @param value The <code>String</code> to write
- *
- * @exception IOException If an error occurs
- */
- void writeBytes(String value) throws IOException;
-
- /**
- * This method writes all the characters of a <code>String</code> to an
- * output stream as an array of <code>char</code>'s. Each character
- * is written using the method specified in the <code>writeChar</code>
- * method.
- *
- * @param value The String to write
- *
- * @exception IOException If an error occurs
- *
- * @see #writeChar(int)
- */
- void writeChars(String value) throws IOException;
-
- /**
- * This method writes a Java <code>String</code> to the stream in a modified
- * UTF-8 format. First, two bytes are written to the stream indicating the
- * number of bytes to follow. This is written in the form of a Java
- * <code>short</code> value in the same manner used by the
- * <code>writeShort</code> method. Note that this is the number of
- * bytes in the
- * encoded <code>String</code> not the <code>String</code> length. Next
- * come the encoded characters. Each character in the <code>String</code>
- * is encoded as either one, two or three bytes. For characters in the
- * range of <code>\u0001</code> to <code>\u007F</code>, one byte is used.
- * The character
- * value goes into bits 0-7 and bit eight is 0. For characters in the range
- * of <code>\u0080</code> to <code>\u007FF</code>, two bytes are used. Bits
- * 6-10 of the character value are encoded bits 0-4 of the first byte, with
- * the high bytes having a value of "110". Bits 0-5 of the character value
- * are stored in bits 0-5 of the second byte, with the high bits set to
- * "10". This type of encoding is also done for the null character
- * <code>\u0000</code>. This eliminates any C style NUL character values
- * in the output. All remaining characters are stored as three bytes.
- * Bits 12-15 of the character value are stored in bits 0-3 of the first
- * byte. The high bits of the first bytes are set to "1110". Bits 6-11
- * of the character value are stored in bits 0-5 of the second byte. The
- * high bits of the second byte are set to "10". And bits 0-5 of the
- * character value are stored in bits 0-5 of byte three, with the high bits
- * of that byte set to "10".
- *
- * The value written can be read using the <code>readUTF</code>
- * method in <code>DataInput</code>.
- *
- * @param value The <code>String</code> to write
- *
- * @exception IOException If an error occurs
- *
- * @see DataInput#readUTF
- */
- void writeUTF(String value) throws IOException;
-
- /**
- * This method writes an 8-bit value (passed into the method as a Java
- * <code>int</code>) to an output stream. The low 8 bits of the
- * passed value are written.
- *
- * @param value The <code>byte</code> to write to the output stream
- *
- * @exception IOException If an error occurs
- */
- void write(int value) throws IOException;
-
- /**
- * This method writes the raw byte array passed in to the output stream.
- *
- * @param buf The byte array to write
- *
- * @exception IOException If an error occurs
- */
- void write(byte[] buf) throws IOException;
-
- /**
- * This method writes raw bytes from the passed array <code>buf</code>
- * starting
- * <code>offset</code> bytes into the buffer. The number of bytes
- * written will be exactly <code>len</code>.
- *
- * @param buf The buffer from which to write the data
- * @param offset The offset into the buffer to start writing data from
- * @param len The number of bytes to write from the buffer to the output
- * stream
- *
- * @exception IOException If any other error occurs
- */
- void write(byte[] buf, int offset, int len) throws IOException;
-
-} // interface DataOutput
-
Deleted: trunk/core/src/classpath/java/java/io/FileFilter.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileFilter.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/FileFilter.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,65 +0,0 @@
-/* FileFilter.java -- Filter a list of pathnames
- Copyright (C) 1998,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 interface has one method which is used for filtering pathnames
- * returned in a pathname listing. It is currently used by the
- * <code>File.listFiles(FileFilter)</code> method.
- * <p>
- * The method in this interface determines if a particular pathname should
- * or should not be included in the pathname listing.
- *
- * @author Aaron M. Renn (ar...@ur...)
- *
- * @see File#listFiles(java.io.FileFilter)
- */
-public interface FileFilter
-{
- /**
- * This method determines whether or not a given pathname should be included
- * in a pathname listing.
- *
- * @param pathname The pathname to test
- *
- * @return <code>true</code> if the path should be included in the list,
- * <code>false</code> otherwise.
- */
- boolean accept(File pathname);
-}
Deleted: trunk/core/src/classpath/java/java/io/FileNotFoundException.java
===================================================================
--- trunk/core/src/classpath/java/java/io/FileNotFoundException.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/FileNotFoundException.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,73 +0,0 @@
-/* FileNotFoundException.java -- the requested file could not be found
- 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 when an attempt is made to access a file that
- * does not exist, or is inaccessible for some other reason (such as writing
- * a read-only file).
- *
- * @author Aaron M. Renn (ar...@ur...)
- * @author Tom Tromey (tr...@cy...)
- * @status updated to 1.4
- */
-public class FileNotFoundException extends IOException
-{
- /**
- * Compatible with JDK 1.0+.
- */
- private static final long serialVersionUID = -897856973823710492L;
-
- /**
- * Create an exception without a descriptive error message.
- */
- public FileNotFoundException()
- {
- }
-
- /**
- * Create an exception with a descriptive error message.
- *
- * @param message the descriptive error message
- */
- public FileNotFoundException(String message)
- {
- super(message);
- }
-} // class FileNotFoundException
Deleted: trunk/core/src/classpath/java/java/io/Flushable.java
===================================================================
--- trunk/core/src/classpath/java/java/io/Flushable.java 2007-08-12 19:02:15 UTC (rev 3394)
+++ trunk/core/src/classpath/java/java/io/Flushable.java 2007-08-13 07:38:53 UTC (rev 3395)
@@ -1,62 +0,0 @@
-/* Flushable.java -- Flushable 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>Flushable</code> class represents a stream of
- * data, for which internally buffered data can be `flushed'.
- * Flushing such a stream causes the buffered data to be
- * written to the stream.
- *
- * @author Tom Tromey (tromey@re...
[truncated message content] |
|
From: <ls...@us...> - 2007-08-12 19:02:22
|
Revision: 3394
http://jnode.svn.sourceforge.net/jnode/?rev=3394&view=rev
Author: lsantha
Date: 2007-08-12 12:02:15 -0700 (Sun, 12 Aug 2007)
Log Message:
-----------
Console improvements by crawley
Modified Paths:
--------------
trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
Added Paths:
-----------
trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java
Added: trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java (rev 0)
+++ trunk/core/src/driver/org/jnode/driver/console/spi/ConsolePrintStream.java 2007-08-12 19:02:15 UTC (rev 3394)
@@ -0,0 +1,17 @@
+package org.jnode.driver.console.spi;
+
+import java.io.PrintStream;
+
+public class ConsolePrintStream extends PrintStream {
+ public ConsolePrintStream(ConsoleOutputStream out) {
+ super(out);
+ }
+
+ public int getFgColor() {
+ return ((ConsoleOutputStream) out).getFgColor();
+ }
+
+ public void setFgColor(int color) {
+ ((ConsoleOutputStream) out).setFgColor(color);
+ }
+}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java 2007-08-11 20:33:38 UTC (rev 3393)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/KeyboardInputStream.java 2007-08-12 19:02:15 UTC (rev 3394)
@@ -223,13 +223,15 @@
// if it's the tab key, we want to trigger command line completion
case '\t':
if (completer != null) {
- CompletionInfo completion = currentLine.complete(currentPrompt);
+ CompletionInfo completion = currentLine.complete();
if (completion.needNewPrompt()) {
currentLine.start(true);
}
refreshCurrentLine();
}
break;
+ // interpret ^D as a soft EOF
+ // FIXME - behavior correct? cf bash's treatment of ^D
case CTRL_D:
currentLine.moveEnd();
refreshCurrentLine();
@@ -237,6 +239,8 @@
eof = true;
breakChar = true;
break;
+ // ^L means kill current line and redraw screen.
+ // FIXME - is this behavior useful?
case CTRL_L:
this.console.clear();
this.console.setCursor(0, 0);
@@ -337,7 +341,7 @@
}
private void refreshCurrentLine() {
- currentLine.refreshCurrentLine(currentPrompt);
+ currentLine.refreshCurrentLine();
}
private boolean fillBuffer() throws IOException {
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2007-08-11 20:33:38 UTC (rev 3393)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/Line.java 2007-08-12 19:02:15 UTC (rev 3394)
@@ -22,12 +22,16 @@
package org.jnode.driver.console.textscreen;
import java.io.PrintStream;
+import java.util.Arrays;
import org.jnode.driver.console.CompletionInfo;
import org.jnode.driver.console.InputCompleter;
import org.jnode.driver.console.TextConsole;
+import org.jnode.driver.console.spi.ConsolePrintStream;
+import com.sun.tools.javac.code.Attribute.Array;
+
/**
* A class that handles the content of the current command line in the shell.
* That can be : - a new command that the user is beeing editing - an existing
@@ -61,14 +65,14 @@
private int oldLength = 0;
private int maxLength = 0;
-
+
private final TextConsole console;
- private PrintStream out;
+ private ConsolePrintStream out;
public Line(TextConsole console) {
this.console = console;
- this.out = console.getOut();
+ this.out = (ConsolePrintStream) console.getOut();
}
public void start() {
@@ -157,20 +161,20 @@
}
}
- public CompletionInfo complete(String currentPrompt) {
+ public CompletionInfo complete() {
CompletionInfo info = null;
InputCompleter completer = console.getCompleter();
if (posOnCurrentLine != currentLine.length()) {
String ending = currentLine.substring(posOnCurrentLine);
info = completer.complete(currentLine.substring(0, posOnCurrentLine));
- printList(info, currentPrompt);
+ printList(info);
if (info.getCompleted() != null) {
setContent(info.getCompleted() + ending);
posOnCurrentLine = currentLine.length() - ending.length();
}
} else {
info = completer.complete(currentLine.toString());
- printList(info, currentPrompt);
+ printList(info);
if (info.getCompleted() != null) {
setContent(info.getCompleted());
posOnCurrentLine = currentLine.length();
@@ -180,11 +184,11 @@
return info;
}
- protected void printList(CompletionInfo info, String currentPrompt) {
+ protected void printList(CompletionInfo info) {
if ((info != null) && info.hasItems()) {
int oldPosOnCurrentLine = posOnCurrentLine;
moveEnd();
- refreshCurrentLine(currentPrompt);
+ refreshCurrentLine();
out.println();
String[] list = info.getItems();
@@ -283,7 +287,19 @@
oldLength = 0;
}
- public void refreshCurrentLine(String currentPrompt) {
+ private volatile char[] mySpaces;
+
+ private char[] getSpaces(int count) {
+ char[] res = mySpaces;
+ if (res == null || res.length < count) {
+ res = new char[count];
+ Arrays.fill(res, ' ');
+ mySpaces = res;
+ }
+ return res;
+ }
+
+ public void refreshCurrentLine() {
try {
int x = consoleX;
int width = console.getWidth();
@@ -292,28 +308,48 @@
if (((x + maxLength) % width) != 0)
nbLines++;
- // if the line has not been shortened (delete, backspace...)
- if (!shortened)
- // scroll up the buffer if necessary, and get the new y
- console.ensureVisible(consoleY + nbLines - 1);
-
- for (int i = 0; i < nbLines; i++) {
- console.clearRow(consoleY + i);
+ // output the input line buffer contents with the screen cursor hidden
+ console.setCursorVisible(false);
+ console.setCursor(consoleX, consoleY);
+ out.print(currentLine);
+
+ // get position of end of line
+ // FIXME ... there's a problem here if some application simultaneously
+ // writes to console output.
+ int newConsoleX = console.getCursorX();
+ int newConsoleY = console.getCursorY();
+
+ // blank to the end of the screen region
+ if (newConsoleX > 0) {
+ int len = width - newConsoleX;
+ console.setChar(newConsoleX, newConsoleY, getSpaces(len),
+ 0, len, out.getFgColor());
+ newConsoleY++;
}
+ for (int i = newConsoleY; i < consoleY + nbLines; i++) {
+ console.clearRow(i);
+ }
- // print the input line
- console.setCursor(0, consoleY);
- out.print(currentPrompt + currentLine);
-
- int posCurX = x + posOnCurrentLine;
- int posCurY = consoleY;
- if (posCurX >= width) {
- posCurY += posCurX / width;
- posCurX = (posCurX % width);
+ // reset the screen cursor and reveal it
+ // FIXME ... there's a problem here if the input buffer contains
+ // characters that do not render as one screen character; e.g. \t or \n.
+ int inputCursorX = x + posOnCurrentLine;
+ int inputCursorY = consoleY;
+ if (inputCursorX >= width) {
+ inputCursorY += inputCursorX / width;
+ inputCursorX = (inputCursorX % width);
}
- console.setCursor(posCurX, posCurY);
+ console.setCursor(inputCursorX, inputCursorY);
+ console.setCursorVisible(true);
+
+ // if the line has not been shortened (delete, backspace...)
+ if (!shortened) {
+ // ensure that the location of the input cursor is included.
+ console.ensureVisible(inputCursorY);
+ }
} catch (Exception e) {
- //todo: why is it ignored?
+ // TODO - why ignore these exceptions? Are they due to the console methods
+ // not being thread-safe???
}
}
Modified: trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java
===================================================================
--- trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-08-11 20:33:38 UTC (rev 3393)
+++ trunk/core/src/driver/org/jnode/driver/console/textscreen/TextScreenConsole.java 2007-08-12 19:02:15 UTC (rev 3394)
@@ -31,6 +31,7 @@
import org.jnode.driver.console.TextConsole;
import org.jnode.driver.console.spi.AbstractConsole;
import org.jnode.driver.console.spi.ConsoleOutputStream;
+import org.jnode.driver.console.spi.ConsolePrintStream;
import org.jnode.driver.textscreen.TextScreen;
import org.jnode.system.event.FocusEvent;
import org.jnode.system.event.FocusListener;
@@ -62,11 +63,9 @@
private InputStream in;
- private final PrintStream out;
+ private final ConsolePrintStream out;
- private final PrintStream err;
-
- private InputStream savedIn;
+ private final ConsolePrintStream err;
private PrintStream savedOut;
@@ -89,9 +88,9 @@
this.screen = screen;
this.scrWidth = screen.getWidth();
this.scrHeight = screen.getHeight();
- this.savedOut = this.out = new PrintStream(new ConsoleOutputStream(
+ this.savedOut = this.out = new ConsolePrintStream(new ConsoleOutputStream(
this, 0x07));
- this.savedErr = this.err = new PrintStream(new ConsoleOutputStream(
+ this.savedErr = this.err = new ConsolePrintStream(new ConsoleOutputStream(
this, 0x04));
this.claimSystemOutErr = ((options & ConsoleManager.CreateOptions.NO_SYSTEM_OUT_ERR) == 0);
this.myIsolate = VmIsolate.currentIsolate();
@@ -141,9 +140,11 @@
}
}
mark = i + 1;
- putChar(c, color);
+ doPutChar(c, color);
}
}
+ screen.ensureVisible(curY);
+ syncScreen();
}
/**
@@ -153,6 +154,12 @@
* @param color
*/
public void putChar(char v, int color) {
+ doPutChar(v, color);
+ screen.ensureVisible(curY);
+ syncScreen();
+ }
+
+ private void doPutChar(char v, int color) {
if (v == '\n') {
// Goto next line
// Clear till eol
@@ -185,9 +192,6 @@
curY--;
clearRow(curY);
}
- screen.ensureVisible(curY);
- syncScreen();
- //setCursor(curX, curY);
}
/**
@@ -315,7 +319,7 @@
}
void setIn(InputStream in) {
- this.savedIn = this.in = in;
+ this.in = in;
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|