|
From: <cr...@us...> - 2009-04-29 15:39:37
|
Revision: 5359
http://jnode.svn.sourceforge.net/jnode/?rev=5359&view=rev
Author: crawley
Date: 2009-04-29 15:39:29 +0000 (Wed, 29 Apr 2009)
Log Message:
-----------
Procletize the System properties. This entails a classlib update ...
Modified Paths:
--------------
trunk/all/lib/classlib-src.jar.bz2
trunk/all/lib/classlib.pack.gz
trunk/core/src/core/org/jnode/vm/VmIOContext.java
trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
Added Paths:
-----------
trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java
Modified: trunk/all/lib/classlib-src.jar.bz2
===================================================================
(Binary files differ)
Modified: trunk/all/lib/classlib.pack.gz
===================================================================
(Binary files differ)
Added: trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java
===================================================================
--- trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java (rev 0)
+++ trunk/core/src/classpath/vm/gnu/classpath/NativeSystemProperties.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -0,0 +1,25 @@
+package gnu.classpath;
+
+import java.util.Properties;
+
+import org.jnode.vm.VmSystem;
+
+/**
+ * @see gnu.classpath.SystemProperties
+ */
+class NativeSystemProperties {
+
+ /**
+ * @see gnu.classpath.SystemProperties#doGetProperties()
+ */
+ private static Properties doGetProperties() {
+ return VmSystem.getIOContext().getProperties();
+ }
+
+ /**
+ * @see gnu.classpath.SystemProperties#doSetProperties(java.util.Properties)
+ */
+ private static void doSetProperties(Properties props) {
+ VmSystem.getIOContext().setProperties(props);
+ }
+}
Modified: trunk/core/src/core/org/jnode/vm/VmIOContext.java
===================================================================
--- trunk/core/src/core/org/jnode/vm/VmIOContext.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/core/src/core/org/jnode/vm/VmIOContext.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -28,9 +28,10 @@
/**
* This is the implementation of the IOContext API that is be used when
* 'proclet' mode is not enabled. It also provides static methods for
- * getting and setting the 'global' versions of the Stream state, and
- * the System properties and environment. (The 'global' state is used
- * in 'proclet' mode when the current thread is not part of a 'proclet'.)
+ * getting and setting the 'global' versions of the Stream state,
+ * the System properties and the System environment. The 'global' state
+ * is used and (in the case of the properties and 'env' map, updated) in
+ * 'proclet' mode when the current thread is not part of a 'proclet'.
*
* @author Levente S\u00e1ntha
* @author cr...@jn...
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/AbstractProxyPrintStream.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -20,8 +20,6 @@
package org.jnode.shell.proclet;
-import gnu.classpath.SystemProperties;
-
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -43,8 +41,6 @@
* 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;
@@ -81,7 +77,7 @@
PrintStream eo = effectiveOutput();
writeChars(eo, str, 0, str.length());
if (println) {
- writeChars(eo, line_separator, 0, line_separator.length);
+ eo.println();
}
flush();
}
@@ -91,7 +87,7 @@
PrintStream eo = effectiveOutput();
writeChars(eo, chars, pos, len);
if (println) {
- writeChars(eo, line_separator, 0, line_separator.length);
+ eo.println();
}
flush();
}
@@ -145,7 +141,7 @@
}
public void println() {
- print(line_separator, 0, line_separator.length, false);
+ effectiveOutput().println();
}
public void println(boolean bool) {
Modified: trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2009-04-29 15:31:45 UTC (rev 5358)
+++ trunk/shell/src/shell/org/jnode/shell/proclet/ProcletIOContext.java 2009-04-29 15:39:29 UTC (rev 5359)
@@ -32,7 +32,15 @@
/**
* The ProcletIOContext is an IOContext implementation that uses Proxy streams to
* direct System.in/out/err traffic to different places depending on the current
- * proclet.
+ * proclet. The System properties and 'env' are also 'procletized' in this
+ * implementation.
+ * <p>
+ * A JNode isolate is switched to 'proclet mode" by calling
+ * {@link VmSystem#switchToExternalIOContext(IOContext)}.
+ * In theory, calling {@link VmSystem#resetIOContext()} will return the isolate
+ * to "normal mode". However, doing this abruptly cause any remaining
+ * proclets' procletized state to abruptly revert to the isolate-global version
+ * of that state.
*
* @author Levente S\u00e1ntha
* @author cr...@jn...
@@ -75,19 +83,39 @@
}
public Map<String, String> getEnv() {
- return Proclet.currentProcletContext().getEnvironment();
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ return proclet.getEnvironment();
+ } else {
+ return VmIOContext.getGlobalEnv();
+ }
}
public Properties getProperties() {
- return Proclet.currentProcletContext().getProperties();
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ return proclet.getProperties();
+ } else {
+ return VmIOContext.getGlobalProperties();
+ }
}
public void setEnv(Map<String, String> env) {
- Proclet.currentProcletContext().setEnvironment(env);
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ proclet.setEnvironment(env);
+ } else {
+ VmIOContext.setGlobalEnv(env);
+ }
}
public void setProperties(Properties props) {
- Proclet.currentProcletContext().setProperties(props);
+ Proclet proclet = Proclet.currentProcletContext();
+ if (proclet != null) {
+ proclet.setProperties(props);
+ } else {
+ VmIOContext.setGlobalProperties(props);
+ }
}
private int getCurrentPid() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|